Automatic search and download of snapshots for Solana
- Finds all available RPCs
- Get the number of the current slot
- In multi-threaded mode, checks the slot numbers of all snapshots on all RPCs
*Starting from version 0.1.3, only the first 10 RPCs speed are tested in a loop. See details here - List of RPCs sorted by lowest latency
slots_diff = current_slot - snapshot_slot
- Checks the download speed from RPC with the most recent snapshot. If
download_speed <min_download_speed
, then it checks the speed at the next node. - Download snapshot
usage: snapshot-finder.py [-h] [-t THREADS_COUNT] [-r RPC_ADDRESS] [--max_snapshot_age MAX_SNAPSHOT_AGE] [--min_download_speed MIN_DOWNLOAD_SPEED] [--max_latency MAX_LATENCY] [--with_private_rpc] [--measurement_time MEASUREMENT_TIME]
[--snapshot_path SNAPSHOT_PATH] [--num_of_retries NUM_OF_RETRIES]
Solana snapshot finder
optional arguments:
-h, --help show this help message and exit
-t THREADS_COUNT, --threads-count THREADS_COUNT
the number of concurrently running threads that check snapshots for rpc nodes
-r RPC_ADDRESS, --rpc_address RPC_ADDRESS
RPC address of the node from which the current slot number will be taken https://api.mainnet-beta.solana.com
--max_snapshot_age MAX_SNAPSHOT_AGE
How many slots ago the snapshot was created (in slots)
--min_download_speed MIN_DOWNLOAD_SPEED
Minimum average snapshot download speed in megabytes
--max_latency MAX_LATENCY
The maximum value of latency (milliseconds). If latency > max_latency --> skip
--with_private_rpc Enable adding and checking RPCs with the --private-rpc option.This slow down checking and searching but potentially increases the number of RPCs from which snapshots can be downloaded.
--measurement_time MEASUREMENT_TIME
Time in seconds during which the script will measure the download speed
--snapshot_path SNAPSHOT_PATH
The location where the snapshot will be downloaded (absolute path). Example: /home/ubuntu/solana/validator-ledger
--num_of_retries NUM_OF_RETRIES
The number of retries if a suitable server for downloading the snapshot was not found
Install requirements
sudo apt-get update \
&& sudo apt-get install python3-venv git -y \
&& git clone https://github.com/c29r3/solana-snapshot-finder.git \
&& cd solana-snapshot-finder \
&& python3 -m venv venv \
&& source ./venv/bin/activate \
&& pip3 install -r requirements.txt
Start script
Mainnet
python3 snapshot-finder.py --snapshot_path $HOME/solana/validator-ledger
$HOME/solana/validator-ledger/
- path to your validator-ledger
TdS
python3 snapshot-finder.py --snapshot_path $HOME/solana/validator-ledger -r http://api.testnet.solana.com
Mainnet
docker pull c29r3/solana-snapshot-finder:latest; \
sudo docker run -it --rm \
-v ~/solana/validator-ledger:/solana/snapshot \
--user $(id -u):$(id -g) \
c29r3/solana-snapshot-finder:latest \
--snapshot_path /solana/snapshot
~/solana/validator-ledger
- path to validator-ledger, where snapshots stored
TdS
docker pull c29r3/solana-snapshot-finder:latest; \
sudo docker run -it --rm \
-v ~/solana/validator-ledger:/solana/snapshot \
--user $(id -u):$(id -g) \
c29r3/solana-snapshot-finder:latest \
--snapshot_path /solana/snapshot \
-r http://api.testnet.solana.com
docker pull c29r3/solana-snapshot-finder:latest