Gas is NDSR’s instruction fuel (about one unit per bytecode operator; structural operators such as block and end are
free) plus fixed costs for host calls. Every executed function call also costs 12 gas for the injected
stack-limit check.
Host function
Cost
console.log
100 + 1 per byte
hive.emit
500 + 2 per byte (name + data)
crypto.hash
200 + 1 per byte
storage.get
1,000 + 1 per byte of key + 1 per byte of value returned
storage.set
5,000 + 10 per byte of key + value
storage.del
2,000 + 1 per byte of key
hive.call
10,000 + 1 per byte (address + function + input) + instantiation (16 per initial memory page, 1 per table element, 1 per data-segment byte) + compilation on the first call to a module (4 per code byte) + the callee’s gas + 1 per byte of output
Costs above are those of execution revision 2, live today. Revision 3 adds rows and reprices crypto.hash:
see below.
gas_used on success or trap = what was consumed. Out of gas charges the full limit and fails the
call. A module rejected by validation uses 0.
hive.call hands all remaining gas to the callee and charges what it used on every path.
One execution may load at most 8 distinct modules through hive.call (the calling module itself and
repeat calls to a module already loaded do not count). Calling a 9th distinct module traps the caller.
Gas is checked at function entries, loop headers and host calls. A call may therefore finish a short
loop-free stretch slightly past its limit and report gas_used = gas_limit. This is deterministic, so it
does not affect agreement.
500 + 2 per byte (name + data + topics) + 1,000 per topic
crypto.hash (repriced)
4,300 + 15 per byte (revision 2: 200 + 1 per byte)
Signed call, charged once before the module starts
ed25519 240,000; eip191 790,000; plus 6,000 for the nonce (not for read-only calls)
crypto.hash repricing. Measured against the same reference as the new functions, the revision 2
price of crypto.hash was about 20× too low in base cost and 15× per byte. Under revision 3 it costs
4,300 + 15 per byte, so gas_used, and therefore the receipt, of any execution that calls crypto.hash
changes once revision 3 is active. Its output is unchanged. Use crypto.keccak256 (2,500 + 15 per byte, raw
32 bytes, no hex encoding) in new code. Every other existing cost is unchanged.
Signed calls pay their verification up front: an eip191 call with a nonce costs 796,000 gas before
the first instruction runs, an ed25519 call 246,000. Set gas_limit to at least that plus what the
function needs; a lower limit is rejected with 400 before execution. A nonce mismatch fails with
gas_used equal to this charge. Signed calls
Pricing basis: 3 gas per nanosecond of native work (the fastest wasm throughput measured on the
reference host) with a 25 % margin, measured on the slowest validator class (Linux x86-64), so a module cannot make a validator do more work per gas with the
crypto functions than with plain code. Compared with verification in module code, ed25519 drops from
about 2.5 M to 235,000 gas and secp256k1 recovery from about 9.6 M to 780,000 (both about 11–12× cheaper).
ctx.random, ctx.beacon and eip712 signed calls are deferred to a later revision and have no price.
For committee tasks, each verified vote earns max(1, ceil(gas_used / gas_per_unit))compute units,
with gas_per_unit = 1,000,000 on the testnet. A task that uses 89k gas earns 1 unit per correct miner;
one that uses 9.6M gas earns 10. See Reward epochs.