2020-07-17 18:07:05 +00:00
<!--
order: 5
-->
# Upgrade Node
Learn how to upgrade your full node to the latest software version {synopsis}
## Software Upgrade
These instructions are for full nodes that have ran on previous versions of and would like to upgrade to the latest testnet.
2020-08-05 15:17:50 +00:00
First, stop your instance of `ethermintd` . Next, upgrade the software:
2020-07-17 18:07:05 +00:00
```bash
cd ethermint
git fetch --all & & git checkout < new_version >
make install
```
::: tip
If you have issues at this step, please check that you have the latest stable version of GO installed.
:::
2020-10-09 15:52:32 +00:00
You will need to ensure that the version installed matches the one needed for th testnet. Check the Ethermint [release page ](https://github.com/cosmos/ethermint/releases ) for details on each release.
2020-07-17 18:07:05 +00:00
## Upgrade Genesis File
:::warning
If the new version you are upgrading to has breaking changes, you will have to restart your chain. If it is **not** breaking, you can skip to [Restart ](#restart-node ).
:::
2020-08-05 15:17:50 +00:00
To upgrade the genesis file, you can either fetch it from a trusted source or export it locally using the `ethermintd export` command.
2020-07-17 18:07:05 +00:00
### Fetch from a Trusted Source
If you are joining an existing testnet, you can fetch the genesis from the appropriate testnet source/repository where the genesis file is hosted.
Save the new genesis as `new_genesis.json` . Then, replace the old `genesis.json` with `new_genesis.json` .
```bash
2020-08-05 15:17:50 +00:00
cd $HOME/.ethermintd/config
2020-07-17 18:07:05 +00:00
cp -f genesis.json new_genesis.json
mv new_genesis.json genesis.json
```
Finally, go to the [reset data ](./run_node.md#reset-data ) section.
### Export State to a new Genesis locally
Ethermint can dump the entire application state to a JSON file. This, besides upgrades, can be
useful for manual analysis of the state at a given height.
Export state with:
```bash
2020-08-05 15:17:50 +00:00
ethermintd export > new_genesis.json
2020-07-17 18:07:05 +00:00
```
You can also export state from a particular height (at the end of processing the block of that height):
```bash
2020-08-05 15:17:50 +00:00
ethermintd export --height [height] > new_genesis.json
2020-07-17 18:07:05 +00:00
```
If you plan to start a new network for 0 height (i.e genesis) from the exported state, export with the `--for-zero-height` flag:
```bash
2020-08-05 15:17:50 +00:00
ethermintd export --height [height] --for-zero-height > new_genesis.json
2020-07-17 18:07:05 +00:00
```
Then, replace the old `genesis.json` with `new_genesis.json` .
```bash
cp -f genesis.json new_genesis.json
mv new_genesis.json genesis.json
```
At this point, you might want to run a script to update the exported genesis into a genesis state that is compatible with your new version.
You can use the `migrate` command to migrate from a given version to the next one (eg: `v0.X.X` to `v1.X.X` ):
```bash
2020-08-05 15:17:50 +00:00
ethermintd migrate [target-version] [/path/to/genesis.json] --chain-id=< new_chain_id > --genesis-time=< yyyy-mm-ddThh:mm:ssZ >
2020-07-17 18:07:05 +00:00
```
## Restart Node
To restart your node once the new genesis has been updated, use the `start` command:
```bash
2020-08-05 15:17:50 +00:00
ethermintd start
2020-07-17 18:07:05 +00:00
```
## Next {hide}
Learn about how to setup a [validator ](./validator-setup.md ) node on Ethermint {hide}