Skip to content

Lite-RPC

As discussed in the v2 optimization guide, Lite-RPC lets you send txs directly to leaders.

Setup

This guide is for Linux (Ubuntu/Debian) only. If you’re on Windows, you can use WSL.

Make sure you have rust and git installed, then run:

Terminal window
sudo apt update
sudo apt install build-essential libssl-dev libudev-dev pkg-config zlib1g-dev llvm clang cmake make libprotobuf-dev protobuf-compiler -y
git clone https://github.com/blockworks-foundation/lite-rpc
cd lite-rpc
cargo b -r

Start script

Create a startup script, and modify your settings accordingly: (if you’re looking for actual performance, please replace these with your actual, private connections!)

start.sh
#!/bin/bash
export RPC_ADDR="http://api.mainnet-beta.solana.com/"
export WS_ADDR="wss://api.mainnet-beta.solana.com/"
export USE_GRPC=false
export GRPC_ADDR="set_usegrpc_to_true_and_put_your_grpc_here_else_this_will_be_ignored"
export GRPC_X_TOKEN="you_probably_dont_need_this_but_if_you_do_set_it"
cargo r -r

More options can be found at the Lite-RPC repo.

Save it in a file called start.sh, and run it with:

Terminal window
bash start.sh