Comprehensive documentation for LucyNode Premium Solana RPC Services & gRPC Streams.
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.
All LucyNode services are available for purchase directly through our user-friendly dashboard.
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.
All essential connection details pertinent to your purchased services will be readily accessible within your LucyNode dashboard.
Your unique RPC endpoint URL will adhere to the following format:
lb-<<load_balancer_id>>.lucynode.com
<<load_balancer_id>>: This placeholder represents a unique, randomly generated integer specific to your service instance. This randomization is implemented to enhance security and mitigate spam.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).
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.
@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();
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()
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.
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.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.
Our dedicated expert support team is available 24/7 to assist you with any questions or issues you may encounter.
Explore more about LucyNode and manage your services: