Comprehensive documentation for LucyNode Premium Solana RPC Services & gRPC Streams.

Welcome to LucyNode Documentation

LucyNode provides cutting-edge, high-performance Solana RPC services and real-time gRPC data streams. Our infrastructure is designed by traders, for traders, ensuring you have the fastest and most reliable access to the Solana blockchain without breaking the bank.

This documentation will guide you through purchasing services, managing your subscriptions, and connecting to our robust network.

Getting Started

Purchasing Services

All LucyNode services are available for purchase directly through our user-friendly dashboard.

Resource Allocation

Upon successful purchase, your dedicated resources will be provisioned. This process typically takes a short while. You will receive a notification directly within your LucyNode dashboard as soon as your resources are fully allocated and ready for use.

Subscription and Billing

Connecting to LucyNode

All essential connection details pertinent to your purchased services will be readily accessible within your LucyNode dashboard.

RPC Connection URL

Your unique RPC endpoint URL will adhere to the following format:

lb-<<load_balancer_id>>.lucynode.com

Connecting to Solana RPC

To interact with the Solana blockchain via RPC, you will typically leverage a Solana Software Development Kit (SDK) in your preferred programming language. Below are examples using JavaScript (web3.js) and Python (solana_web3).

// Additional Note About Bandwidth Usage

LucyNode RPC services are designed to be efficient, but since we work with a shared node basis, please be aware that excessive bandwidth usage may incur throttling. Currently we offer 15TB/mo (~500GB/day) bandwidth on the starter plan with, 30TB/mo (~1TB/day) on Professional and 75TB/mo (~2.5TB/day) on Enterprise plans. If you require more bandwidth, please contact our support team for custom solutions.

JavaScript Example (using @solana/web3.js)

First, ensure you have the @solana/web3.js library installed:

npm install @solana/web3.js

Then, you can connect and make calls:

const solanaWeb3 = require('@solana/web3.js');

// IMPORTANT: Replace with your actual LucyNode RPC URL from your dashboard
const lucyNodeRpcUrl = "https://lb-YOUR_LOAD_BALANCER_ID.lucynode.com"; 

// Establish a connection to the Solana cluster via LucyNode
const connection = new solanaWeb3.Connection(lucyNodeRpcUrl, 'confirmed');

/**
 * Fetches and logs account information for a given public key.
 * @param {string} publicKeyString The public key of the Solana account as a string.
 */
async function getAccountInfo(publicKeyString) {
    try {
        const publicKey = new solanaWeb3.PublicKey(publicKeyString);
        const accountInfo = await connection.getAccountInfo(publicKey);
        if (accountInfo) {
            console.log("Account Info:", accountInfo);
            console.log("Account Lamports:", accountInfo.lamports);
            console.log("Account Owner Program:", accountInfo.owner.toBase58());
        } else {
            console.log(`Account ${publicKeyString} not found.`);
        }
    } catch (error) {
        console.error("Error fetching account info:", error);
    }
}

// Example usage: Replace "YOUR_SOLANA_PUBLIC_KEY_HERE" with a valid Solana public key
getAccountInfo("YOUR_SOLANA_PUBLIC_KEY_HERE");

// Example: Fetching the latest blockhash
async function getLatestBlockhash() {
    try {
        const { blockhash } = await connection.getLatestBlockhash();
        console.log("Latest Blockhash:", blockhash);
    } catch (error) {
        console.error("Error fetching latest blockhash:", error);
    }
}

getLatestBlockhash();

Python Example (using solana.rpc.api)

Ensure you have the solana library installed:

pip install solana

Then, you can connect and make calls:

from solana.rpc.api import Client, PublicKey
from solana.exceptions import SolanaRpcException

# IMPORTANT: Replace with your actual LucyNode RPC URL from your dashboard
LUCY_NODE_RPC_URL = "https://lb-YOUR_LOAD_BALANCER_ID.lucynode.com"

# Establish a client connection to LucyNode's RPC endpoint
client = Client(LUCY_NODE_RPC_URL)

def get_balance(public_key_str: str):
    """
    Fetches and prints the SOL balance for a given public key.
    """
    try:
        public_key = PublicKey(public_key_str)
        response = client.get_balance(public_key)
        # The result is nested under 'result' and 'value'
        balance_lamports = response['result']['value']
        print(f"Balance for {public_key_str}: {balance_lamports / 1e9} SOL ({balance_lamports} lamports)")
    except SolanaRpcException as e:
        print(f"Solana RPC Error fetching balance: {e}")
    except Exception as e:
        print(f"An unexpected error occurred: {e}")

# Example usage: Replace "YOUR_SOLANA_PUBLIC_KEY_HERE" with a valid Solana public key
get_balance("YOUR_SOLANA_PUBLIC_KEY_HERE")

def get_latest_block_commitment():
    """
    Fetches and prints the latest block commitment.
    """
    try:
        response = client.get_latest_blockhash()
        blockhash = response['result']['value']['blockhash']
        print(f"Latest Blockhash: {blockhash}")
    except SolanaRpcException as e:
        print(f"Solana RPC Error fetching latest blockhash: {e}")
    except Exception as e:
        print(f"An unexpected error occurred: {e}")

get_latest_block_commitment()

Connecting to gRPC Streams

LucyNode offers real-time blockchain data streaming powered by Triton's Dragonmouth plugin, leveraging the high-performance gRPC framework. gRPC allows for efficient, low-latency communication for receiving continuous data streams.

General Steps for gRPC Connection

  1. Obtain Solana's Proto Files: Solana's gRPC services are defined using Protocol Buffers (`.proto` files). You will need to obtain these official Solana proto definitions.
  2. Generate Client Code: Use the Protocol Buffer Compiler (protoc) to generate client-side code in your desired programming language from these `.proto` files. This generated code provides the necessary classes and stubs to interact with the gRPC service.
  3. Connect to the gRPC Endpoint: Establish a connection to your LucyNode gRPC stream URL (which will be provided in your dashboard, including the specific port) using your generated client code.
  4. Subscribe to Streams: Utilize the generated client methods to subscribe to the real-time data streams you require (e.g., transaction updates, account changes, slot updates).

Conceptual Python gRPC Example (using grpcio)

This is a conceptual example. Actual implementation requires Solana's official `.proto` files and generating corresponding Python stubs. You would typically install grpcio and grpcio-tools:

pip install grpcio grpcio-tools

Then, compile your `.proto` files (e.g., `solana.proto`):

python -m grpc_tools.protoc -I. --python_out=. --grpc_python_out=. solana.proto

Your Python client code would then look something like this:

import grpc
# Assuming you have generated these files from Solana's .proto definitions
# import solana_pb2 
# import solana_pb2_grpc 

# IMPORTANT: Replace with your actual LucyNode gRPC URL and port from your dashboard
LUCY_NODE_GRPC_URL = "lb-YOUR_LOAD_BALANCER_ID.lucynode.com:YOUR_GRPC_PORT" 

def subscribe_to_solana_stream():
    """
    Conceptual function to subscribe to a Solana gRPC stream.
    """
    try:
        # For production environments, use a secure channel with TLS/SSL.
        # For testing or if explicitly instructed, an insecure channel can be used.
        with grpc.insecure_channel(LUCY_NODE_GRPC_URL) as channel:
            # Replace 'SolanaStreamServiceStub' and 'SubscribeTransactions'
            # with the actual service and method names generated from Solana's .proto files.
            # stub = solana_pb2_grpc.SolanaStreamServiceStub(channel) 
            
            print(f"Attempting to connect to gRPC at: {LUCY_NODE_GRPC_URL}")
            print("Please refer to Solana's official documentation for exact gRPC .proto definitions and specific subscription methods.")
            
            # Example: Conceptual subscription call (replace with actual method and request object)
            # for response in stub.SubscribeTransactions(solana_pb2.SubscribeTransactionsRequest()):
            #     print("Received stream update:", response)

    except grpc.RpcError as e:
        print(f"gRPC Error: {e.code()} - {e.details()}")
    except Exception as e:
        print(f"An unexpected error occurred: {e}")

if __name__ == "__main__":
    subscribe_to_solana_stream()

For the most accurate and up-to-date information on Solana's gRPC services, including the necessary `.proto` files and detailed usage examples, please refer to the official Solana Documentation on gRPC.

Support

Our dedicated expert support team is available 24/7 to assist you with any questions or issues you may encounter.

Additional Resources

Explore more about LucyNode and manage your services: