Skip to Content

State

RPC methods for setting code, nonce, storage, and balance on any account.

Each method writes directly to your Stagenet’s chain state, as if the value had been changed in a transaction. Once written, the value behaves like any piece of chain state: subsequent transactions can modify it, and reads return the latest write.

dev_setCode

Write bytecode at an address.

ParameterTypeDescription
addressstringA 0x-prefixed Ethereum address
bytecodestring0x-prefixed hex

Returns { address }.

curl -X POST <YOUR_STAGENET_RPC_URL> \ -H "Content-Type: application/json" \ -d '{ "jsonrpc": "2.0", "id": 1, "method": "dev_setCode", "params": ["0x0000000000000000000000000000000000001234", "0x6042"] }'

dev_setNonce

Set the nonce on an account. Subsequent transaction-driven increments proceed from this value.

ParameterTypeDescription
addressstringA 0x-prefixed Ethereum address
noncestringNon-negative integer (decimal or 0x-hex)

Returns { address, nonce } where nonce is the post-update value as a decimal string.

dev_setStorageAt

Write a 32-byte value into a specific storage slot.

The slot key accepts decimal slot numbers and short 0x hex (left-padded — slot keys are uint256, so this is unambiguous). The value must be an exactly 32-byte hex word (0x + 64 hex chars): uint-style vs bytes-style padding is ambiguous for values, so encode explicitly.

ParameterTypeDescription
addressstringA 0x-prefixed Ethereum address
slotstring | numberStorage slot key — 0x hex (≤32 bytes) or a decimal slot number ("10" / 10 is slot ten, not 0x10)
valuestringValue to write — exactly 32 bytes

Returns { address, slot } (the canonical 32-byte slot key is echoed back).

curl -X POST <YOUR_STAGENET_RPC_URL> \ -H "Content-Type: application/json" \ -d '{ "jsonrpc": "2.0", "id": 1, "method": "dev_setStorageAt", "params": [ "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", "0", "0x000000000000000000000000000000000000000000000000000000000000002a" ] }'

dev_setBalance

Overwrite an account’s native token balance. Amount is in wei.

ParameterTypeDescription
addressstringA 0x-prefixed Ethereum address
amountstringAmount in wei (decimal or 0x-hex)

Returns { address, balance } where balance is the post-update value in wei as a string.

curl -X POST <YOUR_STAGENET_RPC_URL> \ -H "Content-Type: application/json" \ -d '{ "jsonrpc": "2.0", "id": 1, "method": "dev_setBalance", "params": ["0x1111111111111111111111111111111111111111", "1000000000000000000"] }'

dev_resyncAccount

Discard every local override on a contract that exists on the replicated chain — its code, account record and written storage — so it reads live again. The inverse of dev_setCode and dev_setStorageAt for a contract with a real counterpart on the replicated chain. A no-op on an account with no overrides.

ParameterTypeDescription
addressstringA 0x-prefixed contract address

Returns { address, slotsCleared }.

State reset

Three methods back State Reset and contract.dev stagenet reset.

MethodParametersReturns
mock_wipeLocalState[{ routers?: string[] }] — spenders whose Permit2 allowances are keptA summary of the reset
mock_setWipeSchedule[{ intervalMs?: number | null, onStartup?: boolean, routers?: string[] }] — intervalMs: null stops the scheduleThe schedule
mock_getWipeSchedulenone{ intervalMs, routers, onStartup, lastWipeAt }
Last updated on