Skip to main content

Snapshot

Last update: Fri 04 Oct

ChainDatabaseFormatBlockheightSnapshotFull
direct linkksmcc3paritydbpruned25191138508G528G
direct linkpolkadotparitydbpruned22812603441G460G

snapsize

info

Snapshots are compressed backups of the database directory of a polkadot or kusama node. If you start a node for the first time it will start building the database from scratch, which will take a few days, depending on network speed. If you download an up to date database snapshot your node will be up and running quicker; under an hour or a few hours, depending on network speed.

Recently the warp sync option is becoming more developed and popular. If you start the node with an empty database and the option --sync warp the node will first download the finality proofs after which it will be ready to validate and in the background download the remaining blocks.

With the "beefy" update warp sync got temporarily disabled so for the time being the snapshot service is re-enabled.

For now the snapshots are available for kusama --chain ksmcc3 and polkadot --chain polkadot in the paritydb --database paritydb database format and the rocksdb --database rocksdb format. They are pruned with --state-pruning 256 (default), which is sufficient for a validator node.

Automatic install

The following script can restore a snapshot for a quickstart. If you want you can first review it on github. You can choose "snapinstall" for a snapshot restore or "nodeinstall" to install a complete node. The script will ask some questions and create an install or restore script which you can review before executing.

The script is for ubuntu/debian flavoured servers.

curl -o- -L https://raw.githubusercontent.com/stakeworld/stakeworld-scripts/master/node-install.sh | bash

Manual install

Setup a validator node

Setting up a validator node is covered here. The default apt install creates an user polkadot with a home directory /home/polkadot and a default service script /usr/lib/systemd/system/polkadot.service.

Install the database

Database location: By default the polkadot binary runs as user polkadot and creates .local/share/polkadot in the users homedirectory. So for user polkadot (the default when installing from apt) that is /home/polkadot/.local/share/polkadot.

This can be changed with --base-path so for example --base-path /home/polkadot or --base-path /home/polkadot/myvalidator or whatever you prefer.

To delete the old database, restore a new kusama paritydb database snapshot for your node with a default install:

su - polkadot -s /bin/bash
rm -fr /home/polkadot/.local/share/polkadot/chains/ksmcc3
mkdir -p /home/polkadot/.local/share/polkadot/chains/ksmcc3
curl -o - -L http://snapshot.stakeworld.io/paritydb-ksmcc3.lz4 | lz4 -c -d - | tar -x -C /home/polkadot/.local/share/polkadot/chains/ksmcc3

You can check the startup by running the binary as user polkadot and see if it accepts the database or throws any errors:

su - polkadot -s /bin/bash
polkadot --chain kusama --database paritydb

Edit the systemctl startup script

Edit the default service script and add for example --database paritydb --chain kusama:

su -
vi /usr/lib/systemd/system/polkadot.service"
systemctl daemon-reload
systemctl retart polkadot
systemctl enable polkadot

Or create a new script by copying the default service script:

su -
cp /usr/lib/systemd/system/polkadot.service /etc/systemd/system/validator.service
vi /etc/systemd/system/validator.service

You can edit settings at wish, changing ports and settings at will.

[Service]
ExecStart=/usr/bin/polkadot --chain kusama --name validator --validator --prometheus-external --base-path /home/polkadot --database paritydb --telemetry-url 'wss://telemetry.polkadot.io/submit/ 1'
systemctl daemon-reload
systemctl start validator
systemctl enable validator
caution

If you installed as root you will get an error "failed to create a test file: Permission denied". You can solve this by running chown -R polkadot:polkadot DBDIR

Restore:

Best run the commands as user polkadot (su - polkadot -s /bin/bash) or when running as root do a chown polkadot:polkadot <dbdir>). Of course change the part after -C to your location.

Generic command

curl -o - -L http://snapshot.stakeworld.io/<link> | lz4 -c -d - | tar -x -C <location>

For example paritydb kusama

curl -o - -L http://snapshot.stakeworld.io/paritydb-ksmcc3.lz4 | lz4 -c -d - | tar -x -C /home/polkadot/.local/share/polkadot/chains/ksmcc3

For example rocksdb polkadot

curl -o - -L http://snapshot.stakeworld.io/rocksdb-polkadot.lz4 | lz4 -c -d - | tar -x -C /home/polkadot/.local/share/polkadot/chains/polkadot