Skip to content

State import and export

Daodst can dump the entire application state into a JSON file. In addition to upgrade, this is useful for manually analyzing the status at a specified height.

export status

Export status:

stcd export > new_genesis.json

You can also export state from a specific height (at the end of the block that handles that height):

stcd export --height [height] > new_genesis.json

If you plan to start a new network with height 0 (i.e. genesis) from the exported state, export with the --for-zero-height flag:

stcd export --height [height] --for-zero-height > new_genesis.json

Manually migrate state

If you want to migrate state manually, e.g. for local testing purposes. Note that for regular chain upgrades, no manual state migration is required.

After exporting state to json file, you can replace old genesis.json with new_genesis.json

cp -f genesis.json new_genesis.json
mv new_genesis.json genesis.json

At this point, you may want to run a script to update the exported genesis to a genesis state compatible with your new version.

You can migrate from a given version to the next version (eg: v0.X.X to v1.X.X) using the migrate command:

stcd migrate TARGET_VERSION GENESIS_FILE --chain-id=<new_chain_id> --genesis-time=<yyyy-mm-ddThh:mm:ssZ>