code.vegaprotocol.io/vega@v0.79.0/core/docs/chain-replay.md (about) 1 # Chain Replay 2 3 This is a guide to replay a chain using the backup of an existing chain (e.g. Testnet) 4 5 ## How it works 6 7 A Tendermint Core and Vega Core node store their configuration and data to disk by default at `$HOME/.cometbft` and `$HOME/.vega`. When you start new instances of those nodes using a copy of these directories as their home, Tendermint re-submits (replays) historical blocks/transactions from the genesis height to Vega Core. 8 9 ## Prerequisites 10 11 - [Google Cloud SDK ][gcloud] 12 - Vega Core Node 13 - Vega Wallet 14 - [Tendermint][tendermint] 15 16 ## Chain backups 17 18 Note you need to first authenticate `gcloud`. 19 20 You can find backups for the Vega networks stored in Google Cloud Storage, e.g. For Testnet Node 01 21 22 ``` 23 $ gsutil ls gs://vega-chaindata-n01-testnet/chain_stores 24 ``` 25 26 ## Steps 27 28 - Copy backups locally to `<path>` 29 30 - Overwrite Vega node wallet with your own development [node wallet][wallet]. 31 32 ``` 33 $ cp -rp ~/.vega/node_wallets_dev <path>/.vega 34 $ cp ~/.vega/nodewalletstore <path>/.vega 35 ``` 36 37 - Update Vega node configuration 38 39 ``` 40 $ sed -i 's/\/home\/vega/<path>' <path>/.vega/config.toml 41 ``` 42 43 - Start Vega and Tendermint using backups 44 45 ``` 46 $ vega node --root-path=<path>/.vega --stores-enabled=false 47 $ tendermint node --home=<path>/.tendermint 48 ``` 49 50 51 ## Tips 52 53 The Vega nodes adheres to the Tendermint ABCI contract, therefore breakpoints in the following methods are useful: 54 55 ``` 56 blockchain/abci/abci.go#BeginBlock 57 ``` 58 59 ## Alternatives 60 61 Instead of a backup, which effectively replays the full chain from genesis, you can also use a snapshot of the chain at a given height to bootstrap the Tendermint node. Which only replays blocks/transactions from the given height. This however requires extra tooling. 62 63 ## References 64 65 - https://github.com/cometbft/cometbft/blob/master/docs/introduction/quick-start.md 66 - https://docs.tendermint.com/master/spec/abci/apps.html 67 - https://github.com/tendermint/spec/blob/master/spec/abci/README.md 68 - https://docs.tendermint.com/master/spec/abci/apps.html#state-sync 69 70 [wallet]: https://github.com/vegaprotocol/vega#configuration 71 [gcloud]: https://cloud.google.com/sdk/docs/install 72 [tendermint]: https://github.com/cometbft/cometbft/blob/master/docs/introduction/install.md