Note: Currently only predefined smart contracts available (see below).
In addition to transaction fee per byte a gas consumption has to be paid when a smart contract is called.
Transaction fee and gas charged when calling the following for smart contracts:
Maximum transaction fee
maxFee parameter must cover a sum of
GasCost is calculated as a total amount of gas consumed by the smart contract operations multiplied to the current
You can use estimation methods to get an expected amount of gas that will be consumed by the smart contract:
maxFee parameter can be omitted when calling estimation methods.
GasPrice is calculated automatically by the protocol. The minimum
bcn_feePerGas method should be called to get the current
In order to deploy a new Idena smart contract stake must be locked. The
amount parameter has to be specified to lock the stake when
DeployTx transaction is called. If the specified amount is less than a minimum stake then error message will be returned.
Minimum smart contract stake is calculated as
50% of the stake will be refunded to its creator once the smart contract is terminated.
Termination of the smart contract removes all smart contract data from the state. 50% of the stake is burnt. Another 50% of the stake transferred to the creator of the smart contract.
The contract might be terminated according to its internal rules.
OracleVoting smart contract can be terminated after a termination delay once the public voting is finished. Termination delay is proportional to the amount of coins blocked at the smart contract stake. Termination delay, days =
round( (NetworkSize * Stake) ^ 1/3 )
Currently only predefined smart contracts available to deploy. You can find the code of the smart contracts here.
CodeHash represents the algorithm of a predefined smart contract:
0x02: OracleVoting (integrated into Idena app)
DeployTx: Create smart contract
CallTx: Call method of the smart contract
TerminateTx: Delete smart contract and refund 50% of the locked stake
TxReceipt indicates result of mined smart contract transaction
Contract: address of the smart contract
Method: called method of the smart contract
Success: whether transaction changed the state or not
gasUsed: amount of gas used
txHash: smart contract transaction hash
Error: error text
gasCost: gas cost, iDNA
txFee: transaction fee, iDNA
You can calculate the address of the smart contract before it will be deployed as following:
addr: sender address
epoch: epoch when the smart contract will be deployed
nonce: nonce of the deploy transaction