-
Notifications
You must be signed in to change notification settings - Fork 226
Starting Node from Global State Backup DB
We will be automating the backup practice for tip only global state DB of TestNet and MainNet. Documentation will update as this is completed.
- Setup a node normally for the environment.
- Get trusted hash and setup keys.
- Start with empty DB.
You should see the node link up and get into "CatchUp" mode with casper-node-util watch. This validates that all on the node should be good and you are syncing historical blocks from the network. This will work, but since syncing is not prioritized over operation, the process will take some time.
Stop the node sudo casper-node-util stop.
Insure that zstandard package is installed: sudo apt install zstd
Links to versions of the global-state archive will be stored in: [https://genesis.casper.network/network name]/backup/versions
We can use the follow to get the latest version with no new line for downloading: curl -s https://genesis.casper.network/[network name]/backup/versions | head -n 1 | tr -d '\n\r'
Process to pull down TestNet DB tip archive:
# Make sure you are in this directory before deleting everything below
cd /var/lib/casper/casper-node/casper-test
rm -rf *
# Download and decompress the global-state DB
DOWNLOAD_URL=$(curl -s https://genesis.casper.network/casper-test/backup/versions | head -n 1 | tr -d '\n\r')
# Print out the location to verify it was pulled correctly if the next step fails.
echo "Downloading from $DOWNLOAD_URL"
# Download and decompress DB, this will take some time
curl -s --output - "$DOWNLOAD_URL" | zstd -d --long=31 | sudo -u casper tar -xv
Process to pull down MainNet DB tip archive:
cd /var/lib/casper/casper-node/casper
rm -rf *
# Download and decompress the global-state DB
DOWNLOAD_URL=$(curl -s https://genesis.casper.network/casper/backup/versions | head -n 1 | tr -d '\n\r')
# Print out the location to verify it was pulled correctly if the next step fails.
echo "Downloading from $DOWNLOAD_URL"
# Download and decompress DB, this will take some time
curl -s --output - "$DOWNLOAD_URL" | zstd -d --long=31 | sudo -u casper tar -xv
Update your trusted_hash to have current one before starting.
When you start the node and pull up watch: casper-node-util watch, you will see it move into CatchUp mode and see the block the db archive was captured at:
Reactor State: CatchUp
Available Block Range - Low: 5427143 High: 5427143
You will not sync all blocks back to this, just catch up global-state and the TTL window if using default settings.
You can see the sync of data tries with metrics:
# HELP trie_or_chunk_fetch_total number of trie_or_chunk all fetch requests made
# TYPE trie_or_chunk_fetch_total counter
trie_or_chunk_fetch_total 10831
Rerunning this command should so more totals fetched.
After some time getting the missing global state and needed block data at the tip, your node will switch to KeepUp. This makes it ready to follow the network and add a bid if you wish this node to be a validator.