How to Setup a Solana RPC Node: Step-by-Step Guide

Interested in learning more about Solana blockchain development? Your first step is to set up a Solana RPC node or choose an RPC provider!

Setting up a Solana RPC node, a tool that helps you connect to the network and access its data, requires deep technical knowledge. No worries, though—this article will guide you through the process, from installing the necessary software to running the node.

Let’s begin!

P.S. If you just want to focus on building instead of setting up infrastructure, just use dRPC’s Solana RPC to get 99,99% uptime,  fast response times and amazing UX.


Create an account and get started with our freemium plan.

Install Solana Binaries

Download Solana Binaries

Solana Website

To install Solana on a Linux operating system, you need sudo permissions. Run the following commands:

  1. Run the following command to install Solana:
    sh -c “$(curl -sSfL https://release.solana.com/v1.9.5/install)”
    (Replace v1.9.5 with the latest version if needed.)
  2. After installation, verify it with:
    solana –version
  3. Update the configuration to target your desired cluster (e.g., testnet) with:
    solana config set –url https://api.testnet.solana.com

Create Validator Keypair

  1. Generate a keypair for the validator using the Solana CLI:
    solana-keygen new -o validator-keypair.json
  2. To view the public key of the keypair, use:
    solana-keygen pubkey validator-keypair.json

This keypair is essential for validator authentication and network participation.

System Requirements and Optimization 

Ensure that you have at least 2TB of SSD disk space available for Solana operations. Additionally, adjust system parameters, such as file descriptor limits, to optimize validator performance.

Create Startup Script and Systemd Service

To manage your validator node efficiently, automate its startup by creating a script and setting up a systemd service.
Below is an example systemd service configuration:

[Unit]
Description=Solana Validator
After=network.target

[Service]
User=solana
ExecStart=/home/solana/.local/share/solana/install/solana-validator –identity /home/solana/validator-keypair.json –vote-account /home/solana/vote-account-keypair.json [other parameters]
Restart=always
LimitNOFILE=1000000

[Install]
WantedBy=multi-user.target

This configuration ensures that the validator starts automatically on boot.

Monitor Node Operation

Regularly check the logs for errors and confirm the validator’s network participation using its public key in the gossip output. This helps ensure smooth operation.

Improve RPC Node Performance

To enhance RPC node performance, enable in-memory indices with the --rpc-pubsub-enable-memory-cache flag. This speeds up account-data RPC requests.

Create a User for Solana RPC Node

Create a dedicated user with sudo permissions for managing the Solana RPC Node. Use keypairs such as validator-keypair.json and vote-account-keypair.json for secure access. Transfer these keypairs securely from your personal computer to the validator server.

Set Up Nginx to run Solana RPC node

NGINX is an open-source web server that acts as a reverse proxy, load balancer, and caching solution. For RPC activities, it helps distribute incoming requests across multiple nodes, reducing latency and improving performance. It also supports HTTPS and ensures high availability, making it ideal for managing RPC traffic efficiently.

Install Nginx

Set Up Nginx for Solana RPC Node

To install Nginx on the server for the Solana RPC node, you can follow these steps:

  1.  Mount separate disks to store Solana data. Ensure accounts and ledger data are stored on different volumes as recommended by Solana.
  2. Create a user for the Solana instance and install Solana binaries to set up the necessary tools.
  3. Create a run script and a service for the Solana instance to ensure it runs smoothly.
  4. Create an identity keypair for the node. Each validator or RPC node requires a unique keypair for network identification.
  5. Once the node is running, you can install Nginx to provide secure access to the RPC endpoint. Follow specific configuration steps for this.
  6. Lastly, obtain an SSL certificate to enable secure connections between you and the RPC node for data protection.

Configure Nginx

To set up Nginx as a reverse proxy for a Solana RPC Node, follow these steps:

  1. Mount Disks: Mount disks to store Solana data in separate directories for ledger and accounts to optimize storage and performance.
  2. Create Startup Scripts and Systemd Service: Develop a startup script and set up a systemd service to automate the startup and management of the RPC node.
  3. Tune System Parameters: Adjust system parameters (e.g., file descriptors, network settings) to ensure optimal performance and stability.
  4. Verify Node Operation: Check the logs and network status to ensure the RPC node is running correctly.
  5. Monitor Disk Space: Regularly monitor disk space to meet storage requirements and prevent service interruptions.
  6. Configure Nginx: Set up Nginx as a reverse proxy to manage and secure access to the Solana RPC endpoint.
  7. Enable In-Memory Indices: Activate in-memory indices (e.g., program-id, spl-token-mint, spl-token-owner) for efficient handling of account-data RPC requests.
  8. Network Interaction: Ensure the RPC node can effectively interact with the Solana network, validators, and stakeholders.
  9. Optimize for Development: Ensure the RPC node configuration supports fast and reliable access to blockchain data for Solana blockchain development services.

Enabling Account Indices

Enabling account indices on a Solana RPC node is important as it enhances the performance of account-related requests. Activating in-memory indices, such as program-id, spl-token-mint, or spl-token-owner, makes the node more responsive to these specific queries.

Handling requests likegetProgramAccounts and getTokenAccountsByOwner can be done using the --account-index parameter. However, enabling all three indices simultaneously can consume significant RAM, potentially affecting overall performance.

As a node operator, you should choose indices carefully based on available resources and the expected request load. Adjustments to startup scripts, configuration flags, and system settings might be necessary to manage increased memory and processing requirements.

Mount Disks for Solana Node Setup

To mount disks for a Solana RPC Node:

  • Create appropriate data directories and mount the disks.
  • Format the disks if needed.
  • Mount them at specific locations like /var/solana/data for ledger data and /var/solana/accounts for accounts data.

By following these steps, you ensure the RPC Node has enough storage to work well.

Other steps for better performance can be taken, such as:

  • Checking hardware requirements.
  • Making sure to have at least 2TB disk space on the Ubuntu computer.
  • Formatting and mounting disks correctly, with separate directories for ledger and accounts data.
  • Doing system tuning by optimizing sysctl knobs and increasing systemd and session file limits.
  • Setting up a systemd service to run a startup script that initializes the Solana Validator and checks its operation via log output.

Configure System Tuner for Solana RPC Node

To ensure your Solana RPC node performs at its best, proper system tuning is essential. Adjusting system parameters, such as sysctl settings, improves performance, while increasing file and session limits helps your node manage high transaction loads efficiently.

Key Actions for Configuration:

  1. Enhancing sysctl settings: Tuning kernel parameters via sysctl can significantly boost system performance. These changes help your node handle increased network activity and data throughput.
  2. Increasing File Limits: To avoid hitting file descriptor limits, update the systemd configuration. Add LimitNOFILE=infinity to your Solana service file or in /etc/systemd/system.conf under the [Manager] section. This prevents file limit issues during high traffic.
  3. Disk Space and Mounting: Ensure sufficient disk space and proper disk mounting to handle the large amounts of data Solana nodes process. Use fast storage options like SSDs to avoid bottlenecks.
  4. Memory Optimization: Allocate enough RAM to handle the demands of the Solana network, especially during peak times. Monitor resource usage to prevent system crashes due to memory constraints.
  5. Creating a Startup Script: Automate the node startup process with a custom script to ensure all configurations and optimizations are applied correctly every time the node restarts.

Log Monitoring: Continuously monitor logs for errors or warnings. Quick identification and resolution of issues will help maintain the node’s stability and prevent disruptions in RPC requests.

Set Up Startup Script for Solana RPC Node

To set up a startup script for a Solana RPC Node:

  1. Creating the Startup Script:
  • Navigate to the Solana home directory and create a new folder named bin.
  • Inside the bin folder, create a script file: validator.sh.
  • Make the script executable with: chmod +x validator.sh
  1. Configuring the Validator:
  • Edit validator.sh to include the following flags necessary for configuring the Solana validator:
    • –known-validator – Identifies a trusted validator.
    • –rpc-port [port] – Assigns a port for RPC connections.
    • –limit-ledger-size – Restricts the ledger’s size to manage disk space.
    • –full-rpc-api – Provides full access to the RPC API.
    • –no-voting – Disables voting functionality, suitable for non-validator nodes.
    • Add any other relevant flags to customize the node’s behavior.
  1. Establishing a System Service:
  • Modify the systemd service file or system.conf to enhance performance:
    • Set LimitNOFILE=infinity under the [Service] section to avoid file descriptor limitations.
    • Ensure proper session and file limit settings are configured to handle increased loads.
  1. Optimizing System Settings:
  • Adjust sysctl settings for optimal node operation:
    • Increase memory-mapped file limits.
    • Boost UDP buffer sizes.
    • Fine-tune other kernel parameters to enhance system performance and stability.

By following these steps, your Solana RPC Node will be properly set up and optimized for blockchain interactions.

Create System Service for Solana RPC Node

A system service is a background process managed by the operating system, running automatically on boot and restarting if needed. For an RPC node, it ensures it remains active to consistently handle client requests and provide data access.

Setting up a node involves:

  • Creating a startup script
  • Ensuring optimal system tuning
  • Verifying the validator’s operation

The script should be run with essential flags like `–no-voting` to prioritize RPC functionality. Additional values can be added to optimize system performance.

Running the script as a system service ensures continuous operation in the background, providing a consistent endpoint for users. By following these steps, users can ensure smooth RPC node functionality in the Solana network.

Add Sysctl Additional Values for Solana RPC Node

Enhancing the performance of a Solana RPC Node can be achieved by fine-tuning the sysctl configuration. By adjusting key parameters such as memory mapped files limit and UDP buffer size, operators can significantly improve the node’s efficiency and responsiveness.

These optimizations are crucial for ensuring swift and effective handling of requests by the RPC Node. By customizing the sysctl settings, operators can tailor the node’s performance to meet the specific demands of blockchain development services on the Solana network.

Run Script to Start Your Node

Before starting the Solana RPC node script:

  • Install all required Solana binaries on your system.
  • Configure and authenticate the user for the RPC node.
  • Format and mount disks for data storage.
  • Optimize system settings for better performance.

When initiating the RPC node:

  • Create a startup script with flags like –no-voting and –full-rpc-api.
  • Ensure the script differs from a validator node.
  • After running the script, check logs for errors.
  • Verify node registration on the Solana network using the gossip command.

Ongoing steps:

  • Monitor node performance.
  • Troubleshoot any operational issues promptly.

Phew! Feeling a Bit Overwhelmed? There’s an Easier Way!

Did that technical walkthrough make your head spin? Don’t worry, you’re not alone! 

Setting up a Solana RPC node is complex, but here’s the good news: you don’t have to do it yourself. Enter RPC node providers like dRPC.

Why Use an RPC Node Provider?

For blockchain developers and entrepreneurs, time is precious. Instead of wrestling with node setup and maintenance, you could be focusing on your core business and innovation.

By choosing an RPC node provider, you get:

  • High-performance nodes with 99.99% uptime
  • Scalable, cost-efficient solutions
  • Expert support without the infrastructure hassle

The Quick Solution: dRPC’s Solana RPC Service

Remember that little note at the beginning? Let’s circle back to it. If you’d rather build amazing dApps than become a system admin overnight, dRPC’s got your back:

  • 99.99% Uptime: Less downtime, more dApp time
  • Lightning-Fast Responses: Keep your users happy and engaged
  • User-Friendly Experience: No computer science degree required
  • Freemium Plan: Start building without breaking the bank

Getting started is a breeze:

  1. Create a dRPC account
  2. Pick your plan
  3. Grab your API key
  4. Start building!q

Ready to skip the technical obstacle course and get straight to building? For more information, visit dRPC!


Let’s keep in touch!

Stay informed about the latest developments in RPC infrastructure by signing up for the dRPC blog.

Scheduling a demo?

For a deeper dive into how decentralized or hybrid RPC solutions can benefit your projects, consider booking a meeting with a dRPC.org on this link to explore tailored offerings that meet your specific needs.

Premium gift cards and conference tickets?

Follow us at (https://x.com/drpcorg) and access free Premium credit and conference ticket raffles. Follow now!