| title | extra | ||||
|---|---|---|---|---|---|
Custom EVM RPC Methods Index |
|
see https://sambacha.github.io/custom-rpc-methods/
Special non-standard methods that aren’t included within the original RPC specification:
evm_snapshot: Snapshot the state of the blockchain at the current block. Takes no parameters. Returns the integer id of the snapshot created. A snapshot can only be used once. After a successfulevm_revert, the same snapshot id cannot be used again. Consider creating a new snapshot after eachevm_revertif you need to revert to the same point multiple times.
curl -H "Content-Type: application/json" -X POST --data \
'{"id":1337,"jsonrpc":"2.0","method":"evm_snapshot","params":[]}' \
http://localhost:8545{ "id": 1337, "jsonrpc": "2.0", "result": "0x1" }evm_revert: Revert the state of the blockchain to a previous snapshot. Takes a single parameter, which is the snapshot ID to revert to. This deletes the given snapshot, as well as any snapshots taken after (Ex: reverting to id0x1will delete snapshots with IDs0x1,0x2,etc... If no snapshot ID is passed it will revert to the latest snapshot. Returnstrue.
curl -H "Content-Type: application/json" -X POST --data \
'{"id":1337,"jsonrpc":"2.0","method":"evm_revert","params":["0x1"]}' \
http://localhost:8545{ "id": 1337, "jsonrpc": "2.0", "result": true }evm_increaseTime: Jump forward in time. Takes one parameter, which is the amount of time to increase in seconds. Returns the total time adjustment, in seconds.
curl -H "Content-Type: application/json" -X POST --data \
'{"id":1337,"jsonrpc":"2.0","method":"evm_increaseTime","params":[60]}' \
http://localhost:8545{ "id": 1337, "jsonrpc": "2.0", "result": "060" }evm_mine: Force a block to be mined. Takes one optional parameter, which is the timestamp a block should set up as the mining time. Mines a block independent of whether mining is started or stopped.
curl -H "Content-Type: application/json" -X POST --data \
'{"id":1337,"jsonrpc":"2.0","method":"evm_mine","params":[1231006505000]}' \
http://localhost:8545{ "id": 1337, "jsonrpc": "2.0", "result": "0x0" }2BSD