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) + the callee’s gas + 1 per byte of output |
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.
- 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.
| Module |
Call |
Gas |
| Rust |
addNumbers |
10,570 |
| Rust |
counter increment (storage + event) |
18,671 |
| AssemblyScript |
counter increment |
12,305 |
| Go (TinyGo) |
addNumbers |
91,204 |
| Go |
ledger.record (hive.call + storage + event) |
488,464 |
| Rust |
oracle aggregate, 4 reports |
69,709 |
| Rust |
EIP-191 signature recovery (attestation example) |
9,630,772 |
| JavaScript engine |
counter increment |
2,557,020 |
| Python |
counter get |
3,559,178 |
| Where |
Default gas_limit |
Maximum |
ndsr run |
1,000,000 |
10^10 (node --max-gas) |
hivec run (Rust, Go) |
1,000,000 |
|
hivec run (JavaScript, Python SDKs) |
1,000,000,000 |
|
POST /v1/execute |
1,000,000 |
50,000,000 |
| Committee tasks |
the project’s max_gas_limit |
10^10 |
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.
All nodes on a network enforce the same limits (they are consensus parameters).
| Limit |
Value |
.hbc file |
16 MiB |
module.wasm |
12 MiB |
manifest.json |
64 KiB |
| Linear memory per instance |
64 MiB (memory.grow beyond returns −1) |
| Table elements |
100,000 |
| Input / output per call |
1 MiB / 1 MiB (output must be valid UTF-8) |
| Events per call |
64 |
| Event name / data |
64 bytes / 16 KiB |
| Storage key / value |
256 bytes / 64 KiB |
| State written per top-level call (keys + values) |
1 MiB |
console.log per message |
4 KiB |
hive.call depth |
8 |
| Logical stack |
65,536 units per instance |
/v1/execute request body |
256 KiB |
Task input (/v1/projects/{id}/tasks) |
1 MiB |