Crates.io | solana-block-cacher |
lib.rs | solana-block-cacher |
version | 1.0.10 |
source | src |
created_at | 2024-01-04 15:58:58.95657 |
updated_at | 2024-01-13 13:59:02.035955 |
description | Solana Block Cacher is a high-performance, command-line interface (CLI) tool built in Rust. It is designed to efficiently pull blocks from the Solana blockchain, respecting the specified rate limits. This tool intelligently measures the user's connection speed and the rate limit to calculate the optimum number of threads for fetching blocks. |
homepage | https://github.com/Jamesmallon1/solana-block-cacher |
repository | https://github.com/Jamesmallon1/solana-block-cacher |
max_upload_size | |
id | 1088779 |
size | 218,835 |
Solana Block Cacher is a high-performance, command-line interface (CLI) tool built in Rust. It is designed to efficiently pull blocks from the Solana blockchain, respecting the specified rate limits. This tool intelligently measures the user's connection speed and the rate limit to calculate the optimum number of threads for fetching blocks. The blocks are processed in batches of 50 and written to a JSON file in an efficient manner.
Before installing Solana Block Cacher, ensure you have Cargo installed on your system. If not, you can install it following the instructions on the official Cargo website.
To install Solana Block Cacher, use the following command:
cargo install solana-block-cacher
To use Solana Block Cacher, run the command with the desired arguments. Below are the available options:
solana-block-cacher [OPTIONS]
You can get a Solana RPC Url through QuickNode. I personally use the QuickNode Pro solution which allows me to retrieve millions of blocks a month for back testing.
-v, --verbose
: Enables verbose logging (default: false).-l, --log_output_file <LOG_OUTPUT_FILE>
: Path to the logging output file (default: "output.log").-f, --from_slot <FROM_SLOT>
: The Solana slot number to start caching blocks from.-t, --to_slot <TO_SLOT>
: The Solana slot number to cache blocks until.-r, --rpc_url <RPC_URL>
: The HTTP RPC URL for connecting to Solana MainNet.-o, --output_file <OUTPUT_FILE>
: The file to write the blocks to (default: "blocks.json").--rate_limit <RATE_LIMIT>
: The rate limit for the cacher (default: 50 (QuickNode Pro Default)).-w, --window <WINDOW>
: The time window for the rate limit in seconds (default: 1 (QuickNode Pro Default)).solana-block-cacher --from_slot 12345 --to_slot 54321 --rpc_url https://crimson-chaotic-bird.solana-mainnet.quiknode.pro/*** --output_file my_blocks.json
Given the following inputs:
The Optimum Number of Threads ($O_n$) can be calculated using the formula:
$$ O_n = \frac{R_l}{\min\left(\frac{W}{T}, R_l\right)} $$
Where:
Contributions are welcome! Please feel free to submit pull requests or open issues for improvements and suggestions.
Prior to contributing please ensure you read CONTRIBUTING.md.
This project is open source and available under MIT.