# Gas & limits

> NeuroWASM limits and fuel prices — per-call fuel budget, bytecode size, call depth, storage growth and how fuel turns into transaction gas.

Source: https://docs.nro.world/neurowasm/gas-limits

Two separate meters apply to a contract call:

- **Fuel** inside the VM — every WASM instruction and host function burns fuel; the call has a budget.
- **Gas** at the transaction level — what the sender pays, in uNRO. See [Gas & fees](/learn/gas).

After the call, the fuel burned becomes gas units: `ceil(fuel / NEUROCHAIN_FUEL_PER_GAS_UNIT)`, at least 1, with the rate defaulting to 20 000 fuel per gas unit. The 50 units prepaid for a contract call (`GAS_CONTRACT_CALL`) are then refunded or topped up to match.

## Limits

| Constant | Value | What happens at the limit |
|----------|-------|---------------------------|
| `MAX_CONTRACT_GAS` | 1 000 000 fuel per top-level call | Out of fuel → the call traps, everything rolls back, fee and nonce are consumed |
| `MAX_BYTECODE_SIZE` | 512 KiB | Deploy refused |
| `MAX_CALL_DEPTH` | 8 nested `call_contract` | `call_contract` returns `-1` |
| `MAX_STATE_GROWTH_BYTES_PER_TX` | 64 KiB of new storage per call | `set_storage` writes nothing |
| `allocate` single request | 1 MiB | Request is clamped |

## Fuel prices of host functions

| Host function | Fuel | Constant |
|---------------|------|----------|
| `get_storage` | 800 + 5 × value length | `FUEL_STORAGE_READ_BASE`, `FUEL_STORAGE_READ_PER_BYTE` |
| `set_storage` | 5 000 + 50 × (key + value length) | `FUEL_STORAGE_WRITE_BASE`, `FUEL_STORAGE_WRITE_PER_BYTE` |

Other host functions and plain WASM instructions are metered by the interpreter's default fuel costs. Planned AI host functions will each get a named fuel price.

These are protocol constants; contracts and clients should not depend on their exact values staying the same.
