Published in · 3 min read · Apr 17, 2024
--
TL;DR — Running a Solana RPC Node
- Prepare machine with proper CPU, RAM, disk, network specs. Use Ubuntu 20.04.
- Partition and mount disks for ledger, accounts, and OS.
- Create a new user for the node.
- Install Solana binaries and create a keypair.
- Run system tuner and create a startup script.
- Set up a system service for the node.
- Start the node and verify it’s running.
- Enable account indices for better performance.
Need a Shared / Dedicated Private Solana RPC Node and don’t want to set it up / manage it yourself?
Visit https://www.solanatracker.io/solana-rpc , Starting at $197 per month
So, you want to become a part of the Solana network? There are two ways to do that:
1. Spin up a Validator
2. Spin up an RPC Node
Validator vs. RPC Node
Validators are the backbone of the network. They maintain the chain’s state, validate transactions, and produce blocks. Essentially, they participate in the consensus process and get rewarded for it based on the amount of tokens staked.
An RPC Node, on the other hand, runs the same software as a Validator but does not participate in consensus. Instead, it allows developers and applications to access and interact with the chain.
How to Run an RPC Node
Prerequisites
Before getting started, ensure you have the following:
- CPU: At least 24 Cores, 3GHZ +
- RAM: 512GB+ (1,5TB+ for account indices)
- Disk: 2x 1TB NVMe SSD (one for accounts, one for ledger), 1x 256GB NVMe SSD (for OS)
- Network: 1 Gbit/s+ (10 Gbit/s+ preferred)
- OS: Ubuntu 20.04
Step 1: Prepare the Disks
SSH into your machine and run lsblk to view the disk information. You should have:
- nvme0n1 for the OS
- nvme1n1 for ledger data
- nvme2n1 for accounts data
Create partitions if needed using parted. Format nvme1n1p1 and nvme2n1p1 with XFS or EXT4.
Don’t forget to run apt update -y && apt upgrade -y!
Step 2: Mount the Disks
Create the data directories and mount the disks:
mkdir /var/solana
mkdir /var/solana/data /var/solana/accounts
mount /dev/nvme1n1p1 /var/solana/data
mount /dev/nvme2n1p1 /var/solana/accounts
You can also edit /etc/fstab to automatically mount on startup.
Step 3: Create a User
Create a new user to run the node:
adduser solana
chown solana:solana /var/solana/data
chown solana:solana /var/solana/accounts
Step 4: Install Solana
Switch to the solana user and install the Solana binaries:
su — solana
sh -c “$(curl -sSfL https://release.solana.com/stable/install)"
Add this to .profile:
export PATH=”/home/solana/.local/share/solana/install/active_release/bin:$PATH”
Verify with solana — version.
Step 5: Create Keypair
Create a keypair for your node:
solana-keygen new -o /var/solana/data/config/validator-keypair.json
Step 6: Run System Tuner
Run the automatic system tuner:
sudo $(command -v solana-sys-tuner) — user solana > sys-tuner.log 2>&1
Step 7: Create Startup Script
Create a validator.sh script in /home/solana/bin:
#!/bin/bash
set -e
set -u
export RUST_LOG=error
solana-validator \
— ledger /var/solana/data/ledger \
— accounts /var/solana/accounts \
— identity /var/solana/data/config/validator-keypair.json \
— known-validator 7Np41oeYqPefeNQEHSv1UDhYrehxin3NStELsSKCT4K2 \
— known-validator GdnSyH3YtwcxFvQrVVJMm1JhTS4QVX7MFsX56uJLUfiZ \
— known-validator DE1bawNcRJB9rVm3buyMVfr8mBEoyyu73NBovf2oXJsJ \
— known-validator CakcnaRDHka2gXyfbEd2d3xsvkJkqsLw2akB3zsN1D2S \
— expected-genesis-hash 5eykt4UsFv8P8NJdTREpY1vzqKqZKvdpKuc147dw2N9d \
— entrypoint entrypoint.mainnet-beta.solana.com:8001 \
— entrypoint entrypoint2.mainnet-beta.solana.com:8001 \
— entrypoint entrypoint3.mainnet-beta.solana.com:8001 \
— entrypoint entrypoint4.mainnet-beta.solana.com:8001 \
— entrypoint entrypoint5.mainnet-beta.solana.com:8001 \
— rpc-port 8899 \
— dynamic-port-range 8000–8020 \
— wal-recovery-mode skip_any_corrupted_record \
— init-complete-file /var/solana/data/init-completed \
— limit-ledger-size 50000000 \
— log — \
— only-known-rpc \
— full-rpc-api \
— no-voting \
— enable-rpc-transaction-history \
— enable-cpi-and-log-storage
Don’t forget to chmod +x validator.sh.
Step 8: Create a System Service
Create /etc/systemd/system/solana-validator.service:
[Unit]
Description=Solana RPC Node
After=network.target
[Service]
Type=simple
Restart=always
RestartSec=1
User=solana
LimitNOFILE=1000000
LogRateLimitIntervalSec=0
Environment=PATH=/bin:/usr/bin:/home/solana/.local/share/solana/install/active_release/bin
ExecStart=/home/solana/bin/validator.sh
[Install]
WantedBy=multi-user.target
Step 9: Start the Node
First test with ./validator.sh, then start the service:
sudo systemctl daemon-reload
sudo systemctl enable solana-validator
sudo systemctl start solana-validator
Step 10: Verify It’s Running
Check service status:
sudo systemctl status solana-validator
Check gossip:
solana-keygen pubkey /var/data/data/config/validator-keypair.json
solana gossip | grep <pubkey>
Check catchup progress:
solana catchup <pubkey>
Step 11: Enable Account Indices
To speed up account-data RPC requests, enable in-memory indices with — account-index <type>:
- program-id
- spl-token-mint
- spl-token-owner
Note: Enabling all 3 requires a very large amount of RAM.