As stated in the configuration section simnode allows you to create blocks simply by calling an RPC method:
bashcurl http://127.0.0.1:9933 -d '{"id":29,"jsonrpc":"2.0","method":"engine_createBlock","params":[true, true]}' -H "Content-Type: application/json" {"jsonrpc":"2.0","result":{"hash":"0xbf1120ffcc74ab53811f1c2ca27edcf61dc30546a44b5141c968b43581432278","aux":{"header_only":false,"clear_justification_requests":false,"needs_justification":false,"bad_justification":false,"is_new_best":true}},"id":29}
The parameters of this RPC method are
create_empty
and finalize
. If create_empty
is set to true
, it will create empty blocks that have no transactions, only inherents. If it is set to false
, it will return an error if there are no transactions available to be inserted into the block.bashcurl http://127.0.0.1:9933 -d '{"id":29,"jsonrpc":"2.0","method":"engine_createBlock","params":[false, true]}' -H "Content-Type: application/json" {"jsonrpc":"2.0","error":{"code":12000,"message":"Transaction pool is empty, set create_empty to true, if you want to create empty blocks"},"id":29}
The second argument,
finalize
, simply allows you to mark the newly created block as final. This should always be set to true for parachain runtimes. Otherwise, the newly created block will not be inserted into the database. Simnode also exposes an RPC API for reverting blocks, pass the number of blocks you want to revert as the only parameter:
bash➜ curl http://127.0.0.1:9933 -d '{"id":29,"jsonrpc":"2.0","method":"simnode_revertBlocks","params":[4]}' -H "Content-Type: application/json" {"jsonrpc":"2.0","result":null,"id":29}