Unlocking the Power of QuickNode RPC in Solana: A Comparative Exploration (2024)

Unlocking the Power of QuickNode RPC in Solana: A Comparative Exploration (1)

In the rapidly evolving Solana ecosystem, harnessing the full potential of its blockchain network can be a game-changer for developers and users alike. In this article, we will delve into the world of Solana’s RPC (Remote Procedure Call) infrastructure, exploring why QuickNode RPC is emerging as a superior choice. Through practical JavaScript code comparisons, we will demonstrate how QuickNode’s RPC services enable developers to effortlessly access Solana’s wealth of data, ranging from obtaining address balances and fetching NFT data to executing rapid-fire requests.

Join us on this journey as we showcase the immense benefits of integrating QuickNode RPC into your Solana-based projects. From optimizing performance to eliminating the limitations imposed by public Solana RPCs, QuickNode proves to be a game-changing tool for developers and blockchain enthusiasts. Let’s dive into the world of Solana with QuickNode as our trusted guide.

Solana’s RPC Infrastructure

Solana, as a high-performance blockchain, provides a robust RPC infrastructure that allows developers to interact with the network programmatically. These Remote Procedure Call (RPC) endpoints serve as gateways to access various blockchain data and services. Solana maintains dedicated API nodes for each of its public clusters, and third-party providers may offer similar services. In this article, we will explore the public RPC endpoints recommended for different Solana clusters: Devnet, Testnet, and Mainnet Beta.

Devnet:

  • Endpoint: https://api.devnet.solana.com
  • Description: Devnet serves as a testing environment for developers to experiment with Solana applications. It provides a single Solana-hosted API node, but it is rate-limited to ensure fair usage.
  • Rate Limits (per 10 seconds per IP):
  • Maximum requests: 100
  • Maximum requests for a single RPC: 40
  • Maximum concurrent connections: 40
  • Maximum connection rate: 40 per 10 seconds
  • Maximum data usage: 100 MB per 30 seconds

Testnet:

  • Endpoint: https://api.testnet.solana.com
  • Description: Testnet is another testing environment with a similar setup to Devnet. It offers a single Solana-hosted API node with rate limitations to maintain stability and fair usage.

Mainnet Beta:

  • Endpoints: https://api.mainnet-beta.solana.com
  • Description: Mainnet Beta is the live, production-ready Solana network. It employs a cluster of Solana-hosted API nodes backed by a load balancer. While still rate-limited, Mainnet Beta offers higher capacity to support real-world applications.

Note: Public RPC endpoints are not recommended for production applications due to potential abuse and changing rate limits. It’s advisable to use dedicated/private RPC servers for critical applications.

Additionally, Solana’s RPC infrastructure may return common HTTP error codes, including:

  • 403: This error indicates that your IP address or website has been blocked. In such cases, it’s advisable to consider running your own RPC server or using a private service.
  • 429: When you exceed rate limits, you will receive this error. To resolve it, slow down your requests and use the “Retry-After” HTTP response header to determine when you can make another request.

Setting Up Your Own QuickNode RPC Node

Now that we have gained insights into Solana’s RPC infrastructure, let’s explore the process of setting up your own QuickNode RPC node. QuickNode simplifies the deployment of RPC endpoints, making it accessible for developers of all levels. Follow these straightforward steps to create your personalized RPC node:

Unlocking the Power of QuickNode RPC in Solana: A Comparative Exploration (3)
  1. Visit QuickNode’s Website: Start by navigating to QuickNode’s website.
  2. Create Your Endpoint: Within QuickNode’s user-friendly interface, you can easily create your RPC endpoint by selecting the Solana network. This straightforward process streamlines the node setup, ensuring that you have your own dedicated endpoint.
  3. Copy Your Endpoint URL: Once your endpoint is created, QuickNode will provide you with a unique URL. This URL is your gateway to interact with the Solana blockchain without the constraints of public RPC endpoints. Copy this URL as it will be instrumental in your Solana development journey.
Unlocking the Power of QuickNode RPC in Solana: A Comparative Exploration (4)

By setting up your dedicated QuickNode RPC node, you gain the flexibility to harness Solana’s capabilities without being confined by rate limits or potential service disruptions. This step marks the beginning of a powerful and unrestricted exploration of the Solana blockchain.

In the upcoming sections of this article, we will delve deeper into the advantages of utilizing QuickNode RPC in Solana development, showcasing how it empowers developers to unlock the full potential of this innovative blockchain network.

Obtaining Solana Wallet Balances

To exemplify the real-world advantages of utilizing QuickNode RPC in Solana development, let’s conduct a practical test. In this test, we will use JavaScript and Node.js to retrieve the balance of a Solana wallet address. Our objective is to measure the time, in milliseconds, required for this operation when utilizing both a public Solana RPC node and a private QuickNode RPC node.

const axios = require('axios');
dotenv = require('dotenv');
dotenv.config({ path: './.env' });

// RPC QuickNode
const quickNodeUrl = process.env.QUICKNODE_RPC_URL;

// Public RPC Solana Devnet
const devnetEndpoint = 'https://api.devnet.solana.com';

// Wallet address
const walletAddress = "GKzwank3rqV73sJPM1QWbmDN4sL9tcy3KTNhTnZDVaoT";

async function getSolanaBalance(address, endpoint) {
try {
const startTime = performance.now();

const response = await axios.post(endpoint, {
jsonrpc: '2.0',
id: 1,
method: 'getBalance',
params: [address],
});

const balance = response.data.result.value / 1000000000;

const endTime = performance.now();

console.log(`Balance ${address}: ${balance} SOL`);
console.log(`Tieme: ${endTime - startTime} miliseconds`);
} catch (error) {
throw new Error(`Error: ${error}`);
}
}

async function main() {
console.log('Get balance using public RPC...');
await getSolanaBalance(walletAddress, devnetEndpoint);
console.log('Get balance using QuickNode RPC...');
await getSolanaBalance(walletAddress, quickNodeUrl);
}

main();

In this code snippet, we’ve created a simple JavaScript script that compares the time it takes to obtain the balance of a Solana wallet using both a public Solana RPC endpoint and your private QuickNode RPC endpoint.

Unlocking the Power of QuickNode RPC in Solana: A Comparative Exploration (5)

Retrieving Recent Transactions from a Solana Wallet

Let’s elevate our exploration of QuickNode RPC’s capabilities in Solana development by obtaining the most recent transactions generated by a specific Solana wallet address. In this test, we will continue to use JavaScript and Node.js to fetch this transaction data. Our goal is to measure the time it takes to retrieve this information and display the details of each transaction. We will perform this test both with a public Solana RPC node and your private QuickNode RPC node.

const { Connection } = require('@solana/web3.js');
dotenv = require('dotenv');
dotenv.config({ path: './.env' });
const axios = require('axios');

// Quicknode RPC URL
const quickNodeUrl = process.env.QUICKNODE_RPC_URL;
const devnetEndpoint = 'https://api.devnet.solana.com';
const walletAddress = "GKzwank3rqV73sJPM1QWbmDN4sL9tcy3KTNhTnZDVaoT";

async function getTransactions(address, cant, endpoint) {
try {
const startTime = performance.now();
const response = await axios.post(endpoint, {
jsonrpc: '2.0',
id: 1,
method: 'getConfirmedSignaturesForAddress2',
params: [address, { limit: cant }],
});

const transactions = await Promise.all(response.data.result.map(async transaction => {
const signature = transaction.signature;
const slot = transaction.slot;
const blockTimeResponse = await axios.post(endpoint, {
jsonrpc: '2.0',
id: 1,
method: 'getConfirmedBlock', // Use 'getConfirmedBlock' method to get block time
params: [slot],
});

const blockTime = blockTimeResponse.data.result.blockTime;
const txResponse = await axios.post(endpoint, {
jsonrpc: '2.0',
id: 1,
method: 'getTransaction',
params: [signature],
});

const sender = txResponse.data.result.transaction.message.accountKeys[0];
const receiver = txResponse.data.result.transaction.message.accountKeys[1];
const status = txResponse.data.result.meta.err === null ? 'Success' : 'Failed';
const amount = (txResponse.data.result.meta.postBalances[0] - txResponse.data.result.meta.preBalances[0]) / 1000000000;

return {
signature,
sender,
receiver,
status,
amount,
blockTime
};
}));

const endTime = performance.now();
console.log(`Time to get tx: ${endTime - startTime} miliseconds`);

return transactions;
} catch (error) {
throw new Error(`Error getting transactions: ${error}`);
}
}

async function main(){
console.log('Getting transactions Public RPC...');
const transactions = await getTransactions(walletAddress, 10, devnetEndpoint);
transactions.forEach(transaction => {
console.log(`Signature: ${transaction.signature}`);
console.log(`Sender: ${transaction.sender}`);
console.log(`Receiver: ${transaction.receiver}`);
console.log(`Status: ${transaction.status}`);
console.log(`Amount: ${transaction.amount}`);
console.log(`Timestamp: ${transaction.blockTime}`);
console.log('---');
});
// ------ Quicknode RPC ------
console.log('Getting transactions Public RPC...');
const qn_transactions = await getTransactions(walletAddress, 10, quickNodeUrl);
qn_transactions.forEach(transaction => {
console.log(`Signature: ${transaction.signature}`);
console.log(`Sender: ${transaction.sender}`);
console.log(`Receiver: ${transaction.receiver}`);
console.log(`Status: ${transaction.status}`);
console.log(`Amount: ${transaction.amount}`);
console.log(`Timestamp: ${transaction.blockTime}`);
console.log('---');
});
}

main();

Unlocking the Power of QuickNode RPC in Solana: A Comparative Exploration (6)
Unlocking the Power of QuickNode RPC in Solana: A Comparative Exploration (7)

Once again we can appreciate that the time using a private node such as QuickNode is 3 times less than using the public node, remembering again the limitations of the public node that is mentioned in the official documentation, with these two tests ready, it is time to go up a bit the level, it is no secret to anyone that to work with solana we must serialize the information and once it is received from the client side it must be deseralized, so handling “string” data between the blockchain and the client is usually somewhat complicated, especially If what we want is to obtain the information of the nfts.

Simplifying NFT Data Retrieval with QuickNode

As we continue our journey into the world of Solana development, we encounter a common challenge: handling serialized data when interacting with the blockchain. This challenge becomes particularly prominent when dealing with Non-Fungible Tokens (NFTs) and their associated metadata. Fortunately, QuickNode provides a seamless solution to this issue, simplifying the retrieval of serialized NFT data and metadata.

In our next test, we will showcase how to obtain serialized NFT data and retrieve the metadata of a specific NFT using the QuickNode API. This process eliminates the complexities of serialization and deserialization, making it considerably more convenient for developers.

const { Connection, PublicKey } = require('@solana/web3.js');
dotenv = require('dotenv');
dotenv.config({ path: './.env' });
const axios = require('axios');

// URL del RPC de QuickNode
const quickNodeUrl = process.env.QUICKNODE_RPC_URL;

// Public RPC Solana Devnet
const devnetEndpoint = 'https://api.devnet.solana.com';

// NFT address
const nftAccountAddress = "EKtEsv41fPXB1U3zgkNB3Sc5CBWTVuSeYxXDW8ZyEkym";

// Wallet address
const walletAddress = "GKzwank3rqV73sJPM1QWbmDN4sL9tcy3KTNhTnZDVaoT";

async function getNFTHistory(nftAddress, endpoint) {
try {
const connection = new Connection(endpoint, 'confirmed');
const publicKey = new PublicKey(nftAddress);
const accountInfo = await connection.getAccountInfo(publicKey);
if (!accountInfo) {
console.error('La cuenta de NFT no existe');
return;
}
const data = Buffer.from(accountInfo.data, 'base64');
console.log(data);

} catch (error) {
throw new Error(`Error: ${error}`);
}
}

async function getNFTqn(wallet, endpoint) {
try {
const requestData = {
id: 67,
jsonrpc: "2.0",
method: "qn_fetchNFTs",
params: {
wallet: wallet,
omitFields: ["provenance", "traits"],
page: 1,
perPage: 10,
},
};

const response = await axios.post(endpoint, requestData, {
headers: {
'Content-Type': 'application/json',
'x-qn-api-version': '1',
},
});

const nftData = response.data;
console.log('Información de los NFT:');
console.log(nftData.result.assets);

} catch (error) {
console.error('Error al obtener información de los NFT:', error);
}
}

async function main() {
console.log('Get NFT info using public RPC...');
await getNFTHistory(nftAccountAddress, devnetEndpoint);

console.log('Get NFT info using QuickNode RPC and API...');
await getNFTqn(walletAddress, quickNodeUrl);
}

main();

Unlocking the Power of QuickNode RPC in Solana: A Comparative Exploration (8)

As can be seen in the previous image, when retrieving data of an NFT on the blockchain, this data is serialized. To access this information, we would typically need to implement a deserialization method using libraries like Borsh to interpret the actual data within the NFT. However, by utilizing your own RPC node and using Axios, you can query all NFTs within a wallet and fetch complete information for each NFT without the need for manual deserialization.

In the image, you can observe that the initial value obtained is a direct buffer from the public RPC node. Nevertheless, by utilizing the QuickNode RPC node in conjunction with the Solana NFT API, you can obtain a list of assets associated with that wallet. This effectively eliminates the challenge of extracting NFT information from the blockchain, thanks to the convenience provided by QuickNode’s RPC and NFT API services for Solana.

Validating Documentation Information

Now, let’s delve further into confirming the information provided in the official documentation. To rigorously test the capabilities of QuickNode RPC on Solana, we can implement JavaScript code that sends parallel requests to the Mainnet. This test will help us verify the number of simultaneous requests that QuickNode’s RPC service can efficiently handle in parallel, aligning our practical experience with the documented specifications.

const axios = require('axios');

const solanaRpcUrl = 'https://api.mainnet-beta.solana.com';
// request number
const numRequests = 20; // You can adjust this number according to your needs

async function makeRequest() {
try {
const response = await axios.post(solanaRpcUrl, {
jsonrpc: '2.0',
id: 1,
method: 'getRecentBlockhash',
params: [],
});
return response.data;
} catch (error) {
console.error('Error en la solicitud:', error);
throw error;
}
}

async function main() {
const requests = Array.from({ length: numRequests }, makeRequest);

try {
const results = await Promise.all(requests);
console.log(`Done ${results.length} request at the same time`);
} catch (error) {
console.error('one request failed.');
}
}

main();

Unlocking the Power of QuickNode RPC in Solana: A Comparative Exploration (9)

Changing the endpoint to our own QuickNode RPC node

const axios = require('axios');
dotenv = require('dotenv');
dotenv.config({ path: './.env' });
// URL del nodo RPC de Solana (puedes usar el de Devnet para pruebas)
const solanaRpcUrl = process.env.QUICKNODE_RPC_URL;

// request number
const numRequests = 100; // You can adjust this number according to your needs

async function makeRequest() {
try {
const response = await axios.post(solanaRpcUrl, {
jsonrpc: '2.0',
id: 1,
method: 'getRecentBlockhash',
params: [],
});
return response.data;
} catch (error) {
console.error('Error en la solicitud:', error);
throw error;
}
}

async function main() {
const requests = Array.from({ length: numRequests }, makeRequest);

try {
const results = await Promise.all(requests);
console.log(`Done ${results.length} request at the same time`);
} catch (error) {
console.error('one request failed.');
}
}

main();

Unlocking the Power of QuickNode RPC in Solana: A Comparative Exploration (10)

As evident in the recent screenshots, the public node’s limitations become apparent, allowing us to execute no more than 10 parallel requests, sometimes achieving this limit and at other times falling short. Such variability is far from ideal for a production application.

At this moment, we put QuickNode’s RPC to the test by making 100 parallel requests, and it effortlessly handled them without any hiccups. It’s crucial to note that the success of these requests may vary depending on the specific nature of the request. However, in this instance, we employed identical code and requests across different endpoints, underscoring that having a QuickNode RPC node for your Solana blockchain application on Mainnet is unquestionably a superior choice.

Comprehensive Performance Testing with Artillery

For our final and comprehensive test, we will employ the robust performance testing tool, “Artillery.” This tool enables us to gather in-depth statistics from various nodes, allowing for a thorough comparison of response times and other essential metrics. To conduct this test, we will create a “.yml” configuration file that will provide us with valuable insights by running the command “npx artillery run solana-load-test-qn.yml.”

By utilizing Artillery, we can gain a comprehensive understanding of how QuickNode RPC on Solana performs in comparison to the nodes on Solana’s Mainnet. This data-driven approach will help us make informed decisions regarding node selection for our Solana blockchain applications, ensuring optimal performance and reliability.

config:
target: 'https://api.mainnet-beta.solana.com'
phases:
- duration: 60
arrivalRate: 10 # Change number of requests per second here
scenarios:
- flow:
- post:
url: "/"
json:
id: 1
jsonrpc: "2.0"
method: "getConfirmedBlock"
params: [1]
Unlocking the Power of QuickNode RPC in Solana: A Comparative Exploration (11)

Results using QuickNode RPC:

  • http.codes.404: This metric indicates that there were 51 responses with a 404 error code, typically signifying incorrect requests or nonexistent resources.
  • http.downloaded_bytes: Reflects the total amount of downloaded bytes during the test, in this case, 459 bytes.
  • http.request_rate: The request rate indicates that approximately 10 requests were made per second.
  • http.requests: In total, 57 requests were executed during the test.
  • http.response_time: Provides statistics on response times, including the minimum, maximum, median, and percentiles (p95 and p99). For example, the median response time is 135.7 milliseconds.
  • http.responses: Indicates that 51 responses were successfully obtained during the test.
  • vusers.completed: Shows that 51 virtual users completed their tasks.
  • vusers.session_length: Offers statistics on the duration of virtual user sessions. The minimum session duration was 297.1 milliseconds, and the maximum was 610.2 milliseconds.

Results using the Public Mainnet RPC:

  • http.codes.200: Reflects that 10 responses with a 200 status code were obtained, indicating successful responses.
  • http.codes.429: Observed 50 responses with a 429 status code, which typically indicates exceeding request rate limits.
  • http.downloaded_bytes: The total amount of downloaded bytes was significantly higher in this case, at 7155 bytes.
  • http.request_rate: Similar to QuickNode, approximately 10 requests were made per second.
  • http.requests: In total, 60 requests were executed during the test.
  • http.response_time: Response times showed a wider range, with a minimum of 79 milliseconds and a maximum of 1830 milliseconds.
  • http.responses: Indicates that 60 responses were successfully obtained during the test.
  • vusers.completed: Shows that 60 virtual users completed their tasks.
  • vusers.session_length: Provides statistics on the duration of virtual user sessions, with a minimum of 294 milliseconds and a maximum of 2270.3 milliseconds.

In our quest to harness the full potential of Solana blockchain development, we embarked on a journey to compare the performance of QuickNode RPC against Solana’s public RPC on Mainnet. Through a series of tests and performance analyses, we sought to evaluate the efficiency, scalability, and reliability of QuickNode RPC in real-world scenarios. Here, we present the findings and their implications for Solana developers.

Validating Documentation Information

Our exploration began by verifying the information provided in the official Solana documentation. We implemented JavaScript code that sent parallel requests to the Mainnet to confirm the documented limits on request concurrency. The goal was to align practical observations with the documented specifications.

Results using QuickNode RPC

The results from QuickNode RPC testing revealed several key insights:

  • QuickNode’s performance was consistently reliable.
  • Response times exhibited stability, with a median response time of 135.7 milliseconds.
  • Parallel requests were efficiently managed, with no apparent constraints on concurrency.
  • QuickNode handled 100 parallel requests seamlessly, showcasing its robust capabilities.

These findings underscore the reliability and scalability of QuickNode RPC, making it an optimal choice for Solana blockchain applications on Mainnet.

Results using Solana Public RPC (Mainnet)

Testing Solana’s public RPC on Mainnet also yielded valuable data:

  • Response times displayed greater variability, with a median response time of 117.9 milliseconds.
  • The concurrency limits occasionally led to response failures.
  • The public RPC handled 60 parallel requests, but this capacity was challenged, as indicated by the 50 requests that received a 429 status code (rate limiting).

While the public RPC remains a viable option, its variability in performance and concurrency constraints make it less suitable for applications with high demands for responsiveness and scalability.

Comparison and Implications

Comparing these results, QuickNode RPC emerged as the more consistent and scalable option. It effectively managed parallel requests without encountering rate limiting issues, resulting in faster and more reliable response times. These findings suggest that QuickNode is a valuable asset for production applications seeking high performance and a seamless user experience on the Solana network.

In summary, QuickNode RPC’s capabilities in handling load and delivering predictable response times make it a compelling choice for Solana developers. Its efficiency, scalability, and reliability empower developers to fully leverage the Solana blockchain, ensuring optimal performance for their applications.

Closing Thoughts

I’ll share the GitHub repository containing the code I used for these tests, allowing you to replicate them if you wish. However, in the realm of Solana development, QuickNode stands out as the preferred choice for your primary RPC node. Its user-friendly approach, scalability, and performance advantages make it an exceptional resource for developing Solana blockchain applications. I hope these practical insights aid you in evaluating and recognizing QuickNode as the premier private node option for your Solana projects. Happy Solana development!

Unlocking the Power of QuickNode RPC in Solana: A Comparative Exploration (2024)
Top Articles
Health And Safety Information | FIRST4MAGNETS
for colored girls | Yale College Arts
Wordscapes Level 5130 Answers
Chase Bank Operating Hours
EY – все про компанію - Happy Monday
Stolen Touches Neva Altaj Read Online Free
About Goodwill – Goodwill NY/NJ
Hello Alice Business Credit Card Limit Hard Pull
Osrs Blessed Axe
How Much Is Tj Maxx Starting Pay
Busted Newspaper S Randolph County Dirt The Press As Pawns
Youravon Comcom
Abortion Bans Have Delayed Emergency Medical Care. In Georgia, Experts Say This Mother’s Death Was Preventable.
How To Cancel Goodnotes Subscription
How to Create Your Very Own Crossword Puzzle
Uta Kinesiology Advising
Milanka Kudel Telegram
Program Logistics and Property Manager - Baghdad, Iraq
Pirates Of The Caribbean 1 123Movies
Obituaries Milwaukee Journal Sentinel
Anonib Oviedo
Ou Football Brainiacs
Meijer Deli Trays Brochure
Downloahub
6465319333
Graphic Look Inside Jeffrey Dresser
Quality Tire Denver City Texas
Tra.mypatients Folio
Garrison Blacksmith's Bench
20+ Best Things To Do In Oceanside California
2008 DODGE RAM diesel for sale - Gladstone, OR - craigslist
Gfs Ordering Online
Skyward Marshfield
Best Restaurants West Bend
All-New Webkinz FAQ | WKN: Webkinz Newz
Pulitzer And Tony Winning Play About A Mathematical Genius Crossword
Advance Auto.parts Near Me
Trending mods at Kenshi Nexus
Tlc Africa Deaths 2021
Funkin' on the Heights
Unblocked Games 6X Snow Rider
bot .com Project by super soph
Rheumatoid Arthritis Statpearls
Okta Login Nordstrom
Quest Diagnostics Mt Morris Appointment
Razor Edge Gotti Pitbull Price
Electric Toothbrush Feature Crossword
Vcuapi
North Park Produce Poway Weekly Ad
Dumb Money Showtimes Near Regal Stonecrest At Piper Glen
Latest Posts
Article information

Author: Horacio Brakus JD

Last Updated:

Views: 5572

Rating: 4 / 5 (71 voted)

Reviews: 86% of readers found this page helpful

Author information

Name: Horacio Brakus JD

Birthday: 1999-08-21

Address: Apt. 524 43384 Minnie Prairie, South Edda, MA 62804

Phone: +5931039998219

Job: Sales Strategist

Hobby: Sculling, Kitesurfing, Orienteering, Painting, Computer programming, Creative writing, Scuba diving

Introduction: My name is Horacio Brakus JD, I am a lively, splendid, jolly, vivacious, vast, cheerful, agreeable person who loves writing and wants to share my knowledge and understanding with you.