Installation of solana cli

Installing and configuring a Solana RPC node involves several steps. Here’s a guide based on Solana’s official documentation and general best practices.

Step 1: Prerequisites

Hardware Requirements

  • CPU: Minimum 4 cores, 8 cores recommended.

  • Memory: Minimum 16 GB RAM, 32 GB recommended.

  • Storage: At least 500 GB SSD (NVMe recommended for mainnet).

Software Requirements

  • Operating System: Linux (Ubuntu 20.04 or later recommended) or macOS.

  • Dependencies: curl, git, build-essential, libssl-dev, pkg-config

Step 2: Install Dependencies

For Ubuntu, run:

sudo apt update
sudo apt install -y curl git build-essential libssl-dev pkg-config

Step 3: Install Rust

Solana is written in Rust, so you need the Rust programming language.

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source $HOME/.cargo/env

Step 4: Install Solana Tool Suite

Download and install the latest Solana release:

sh -c "$(curl -sSfL https://release.solana.com/v1.16.14/install)"

Replace v1.16.14 with the latest version from Solana's release page.

Step 5: Configure Solana CLI

After installation, verify and configure:

solana --version

Now configure helius devnet

To set the Solana CLI to use your Helius Devnet, you need to update the CLI configuration to point to your Helius RPC endpoint. Here’s a step-by-step guide to configuring the Solana CLI for Helius Devnet:

Prerequisites

  1. Solana CLI: Ensure that you have the Solana CLI installed. You can download it from the official Solana documentation.

  2. Helius RPC Endpoint: Obtain your Helius Devnet RPC endpoint. If you don't have it, you can sign up and get one from the Helius website.

Steps to Set Solana CLI to Helius Devnet

  1. Open Your Terminal: Start by opening a terminal or command prompt.

  2. Set the Helius Devnet URL: Update the Solana CLI configuration to use the Helius Devnet RPC endpoint. Replace YOUR_HELIUS_DEVNET_RPC_ENDPOINT with your actual Helius RPC URL.

     solana config set --url YOUR_HELIUS_DEVNET_RPC_ENDPOINT
    

    For example, if your Helius endpoint is https://devnet.helius.rpc/xyz, the command would be:

     solana config set --url https://devnet.helius.rpc/xyz
    
  3. Verify the Configuration: Check if the Solana CLI is now pointing to your Helius Devnet endpoint by running:

     solana config get
    

    You should see your Helius RPC URL listed under RPC URL.

  4. (Optional) Set the Commitment Level: You can also set the commitment level for the network if needed. The commitment level determines the confirmation level of transactions and queries. The available levels are processed, confirmed, or finalized.

     solana config set --commitment confirmed
    

Test the Configuration: Ensure everything is working by running a basic command, such as checking your balance or querying the block height.

solana balance

Configure Nginx

To configure Nginx as a reverse proxy for the Solana RPC server, you need to set up Nginx to forward requests to your Helius Devnet RPC endpoint. This can help in load balancing, logging, security, and managing traffic.

Here’s how you can configure Nginx to work with your Helius Devnet RPC server:

Prerequisites

  • Nginx: Ensure Nginx is installed on your server. You can install it using your package manager. For example, on Ubuntu:

      sudo apt update
      sudo apt install nginx
    
  • Helius RPC Endpoint: Ensure you have your Helius Devnet RPC endpoint URL.

Steps to Configure Nginx

  1. Create an Nginx Configuration File: Create a configuration file in the Nginx sites-available directory. For example, solana-proxy.conf.

     sudo nano /etc/nginx/sites-available/solana-proxy.conf
    
  2. Add Reverse Proxy Configuration: Add the following configuration to the file. Replace YOUR_HELIUS_DEVNET_RPC_ENDPOINT with your Helius RPC URL.

     server {
         listen 80;
    
         server_name 52.221.234.80; # Replace with your domain or IP
    
         location / {
             proxy_pass https://devnet.helius-rpc.com/?api-key=ea625763-3344-4bab-98f5-385a5f8d9f3d; #replace it with rpc helius 
             proxy_http_version 1.1;
             proxy_set_header Upgrade $http_upgrade;
             proxy_set_header Connection 'upgrade';
             proxy_set_header Host $host;
             proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
             proxy_set_header X-Forwarded-Proto $scheme;
             proxy_cache_bypass $http_upgrade;
    
             # Optional settings
             proxy_read_timeout 90;
             proxy_connect_timeout 90;
             proxy_send_timeout 90;
             send_timeout 90;
    
             access_log /var/log/nginx/solana-access.log main;
             error_log /var/log/nginx/solana-error.log;
         }
    
  3. /etc/nginx/nginx.conf

     http {
         ...
         log_format main '$remote_addr - $remote_user [$time_local] "$request" '
                         '$status $body_bytes_sent "$http_referer" '
                         '"$http_user_agent" "$http_x_forwarded_for"';
    
         include /etc/nginx/sites-enabled/*;
         ...
     }
    
  4. Enable the Configuration: Create a symbolic link to the sites-enabled directory to enable the configuration.

     sudo ln -s /etc/nginx/sites-available/solana-proxy.conf /etc/nginx/sites-enabled/
    
  5. Test the Configuration: Test your Nginx configuration for syntax errors.

     sudo nginx -t
    

    If the test is successful, you should see a message indicating that the configuration file syntax is ok and the test is successful.

  6. Reload Nginx: Reload Nginx to apply the new configuration.

     sudo systemctl reload nginx