Giter Site home page Giter Site logo

chainstack / solana-snapshot-finder Goto Github PK

View Code? Open in Web Editor NEW

This project forked from c29r3/solana-snapshot-finder

0.0 1.0 0.0 198 KB

Automatic search and download of snapshots for Solana

License: GNU General Public License v3.0

Python 97.32% Dockerfile 2.68%

solana-snapshot-finder's Introduction

solana-snapshot-finder

Automatic search and download of snapshots for Solana

Navigation

What exactly does the script do:

  1. Finds all available RPCs
  2. Get the number of the current slot
  3. 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
  4. List of RPCs sorted by lowest latency slots_diff = current_slot - snapshot_slot
  5. 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.
  6. Download snapshot
options:
  -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
  --slot SLOT           search for a snapshot with a specific slot number (useful for network restarts)
  --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_download_speed MAX_DOWNLOAD_SPEED
                        Maximum snapshot download speed in megabytes - https://github.com/c29r3/solana-snapshot-finder/issues/11.
                        Example: --max_download_speed 192
  --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
  --sleep SLEEP         Sleep before next retry (seconds)
  --sort_order SORT_ORDER
                        Priority way to sort the found servers. latency or slots_diff
  -b BLACKLIST, --blacklist BLACKLIST
                        If the same corrupted archive is constantly downloaded, you can exclude it. Specify either the number of
                        the slot you want to exclude, or the hash of the archive name. You can specify several, separated by
                        commas. Example: -b 135501350,135501360 or --blacklist 135501350,some_hash
  -v, --verbose         increase output verbosity to DEBUG

alt text

Without docker

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

Run via docker

Mainnet

sudo 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

sudo 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

Update

sudo docker pull c29r3/solana-snapshot-finder:latest

solana-snapshot-finder's People

Contributors

c29r3 avatar meyerbro avatar unordered-set avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.