-
Notifications
You must be signed in to change notification settings - Fork 0
Solana Validator Ledger
- Snapshots explanation
- RocksDB
- Historical Data
Snapshot is a compressed tar archive (.tar.bz2, .tar.gz, .tar.xz or .tar.zst file) containing the following data:
- A dump of Solana accounts (pubkey, owner, SOL balance, data, etc) in the AppendVec file format. This is the same format that the accounts database uses.
- The bank state: Metadata about the implicit state of the chain when the snapshot was taken (network stakes, etc)
Each snapshot targets a specific slot number and uses a cryptographic hash value that uniquely identifies the data stored within the snapshot. Full vs incremental snapshots
There are further two types of snapshots that differ in the amount of data they store:
- Full snapshots contain all accounts at a specific slot, example:
snapshot-100-D17vR2iksG5RoLMfTX7i5NwSsr4VpbybuX1eqzesQfu2.tar.zst - Incremental snapshots contain accounts that were changed between specific slots. Example:
incremental-snapshot-100-200-AvFf9oS8A8U78HdjT9YG2sTTThLHJZmhaMn2g8vkWYnr.tar.zst
Solana nodes load snapshots on startup to start syncing at a recent block height instead of having to execute the entire blockchain history from genesis.
Currently validators delete their accounts database and start from a snapshot even if their account data is recent. Naturally nodes automatically generate full and incremental snapshots while they are running to ensure they can start up again.
When a new node joins the network for the first time, it loads a snapshot from a trusted provider (e.g. another node you operate or a slot where the accounts hash has been agreed on by stake supermajority).
Additionally, snapshots are useful for analytics purposes to quickly load a collection of accounts.
- Increase swap file.
- Increase the memory mapped files limit.
-
Install and configure Solana to install the
solana-ledger-tool.
- Find the appropriate Validator. Consider using the Solana instances.
- Find the selected Validator IP address and port:
solana gossip | grep <validator address> - Download Full snapshot:
wget --continue --trust-server-names http://<ip:port>/snapshot.tar.bz2- Mainnet:
wget --continue --trust-server-names http://145.40.93.177:80/snapshot.tar.bz2 - Devnet:
wget --continue --trust-server-names http://147.75.55.147:8899/snapshot.tar.bz2
- Mainnet:
- Download incremental snapshot: reuse the same command but add
-incrementalto the archive name. Example:incremental-snapshot.tar.bz2.
- The Avorio Validator:
wget --trust-server-names https://snapshots.avorio.network/mainnet-beta/snapshot.tar.bz2; \ wget --trust-server-names https://snapshots.avorio.network/mainnet-beta/incremental-snapshot.tar.bz2` - Solana Snapshot Finder
- Use the same validator servers as for the manual snapshot download.
- Mainnet:
wget --continue --trust-server-names http://145.40.93.177:8899/genesis.tar.bz2 - Devnet:
wget --continue --trust-server-names http://147.75.55.147:8899/genesis.tar.bz2
- Mainnet:
- Download a snapshot
- Run solana-ledger-tool command with the following params. It will build the ledger state from full snapshot. If there are incremental snapshots in the
snapshotsdirectory, the tool will process account updates from them as well.solana-ledger-tool verify \ --disable-accounts-disk-index \ --skip-verification \ --no-os-memory-stats-reporting \ --force-update-to-open \ --ledger <ledger directory> \ --snapshot-archive-path <snapshots directory> \ --use-snapshot-archives-at-startup always
- Optional for now: Obtain an access to the Solana Bigtable.
- Access the Solana Bigtable bucket.
- Use the current slot from Solana Explorer to search for the most recent epoch archive containing rocksdb.tzr.zst.
- Download the
rocksdb.tar.zst. Examplenohup curl -C - -O https://storage.googleapis.com/mainnet-beta-ledger-us-ny5/278201635/rocksdb.tar.zst & - Extract the
rocksdb.tar.zstarchive in the Ledger'sledgerdirectory. Examplenohup tar --use-compress-program=unzstd -xvf rocksdb.tar.zst -C /mnt/ledger &. - Download the first
snapshot-xxx.tar.zsthourly snapshot archive that is within the slot range outlined in thebounds.txtfile. Example:curl -O https://storage.googleapis.com/mainnet-beta-ledger-us-ny5/261781166/hourly/snapshot-261835693-EdoRtXVBzbtMszs2vwcmTzFmQ1ACYj5oYPqDifFr7QE3.tar.zst - Place the downloaded snapshot in the Ledger's
snapshotsdirectory. - Run the slt_replay.sh script. It will restore Ledger's bank from the downloaded snapshot and replay shreds from the extracted rocksdb archive files residing in the
ledgerdirectory.
- Current Ledger information:
solana-ledger-tool bounds --ledger <ledger direcotry> - Check the specific slot:
solana-ledger-tool -l /mnt/validator/ledger/ slot <slot> - Accounts:
- Check the account balance:
solana balance <ACCOUNT_ADDRESS>
- Check the account balance: