Skip to main content

State Export/Import

The full application state can be dumped to a JSON file by Humans.ai. This can be helpful for manual investigation of the status at a specific height in addition to upgrades.

Export State

Export state with:

humansd export > new_genesis.json

Additionally, you can export state from a specific height (after processing the block of that height):

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

Export the state using the --for-zero-height flag if you intend to create a new network with 0 height (i.e. genesis):

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

Manually Migrate State

if you wish to manually migrate the state, perhaps for local testing. It should be noted that a manual state transfer is not necessary for routine chain upgrades.

You can replace the current "genesis.json" file with the new new_genesis.json file after exporting your state to a json file.

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

You might wish to execute a script at this point to convert the exported genesis into a genesis state compatible with your new version.

When moving from one version to the next (for example, v0.X.X to v1.X.X), you can do so by using the migrate command:

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