How to Export Chain State for a Network Upgrade
A step-by-step guide for node operators on how to safely export the Maroo chain state using the marood export command in preparation for a coordinated network upgrade.
Prerequisites
- A fully synced Maroo node (`marood`)
- Familiarity with the command line
1. Determine the Upgrade Height
First, the upgrade height must be agreed upon by the network validators through a governance proposal. Once the proposal passes, all node operators must perform the export at this exact height. For this example, let's assume the upgrade height is
1,000,000.2. Stop the Node at the Correct Height
It is crucial to stop your
marood process precisely at the upgrade height to ensure a consistent state export across all validators. You can configure your node to halt automatically at a specific height.# In your app.toml configuration file for the node:
halt-height = 1000000
# Then, restart your marood process. It will run normally and stop
# automatically once it reaches block 1,000,000. 3. Run the Export Command
Once the node has halted, you can safely run the export command. This command reads the application state from your node's database and prints the resulting JSON to standard output. It's recommended to redirect this output to a file.
# This command will export the state of the chain at the last block (1,000,000)
# and save it to a file named `maroo_export.json`
marood export > maroo_export.json Warning: The export process can be memory-intensive and take several minutes for a chain with a large state. Ensure your machine has sufficient resources.
4. Verify the Exported State (Optional but Recommended)
After the export is complete, you should verify the integrity of the
maroo_export.json file. A common practice is to calculate a SHA256 hash of the file and compare it with the hashes generated by other validators or trusted parties. This ensures everyone is starting the new chain from the exact same state.sha256sum maroo_export.json