PublicNode is a free RPC service that provides public endpoints for several blockchain networks, including Solana. Developers often search for the exact endpoint URL, how to configure their wallet or dApp, and what limitations come with a free service.
This article gives you the practical details: how to connect to the PublicNode Solana RPC endpoint, what to expect in terms of rate limits and reliability, and when you should consider a managed RPC provider like OnFinality for production workloads.
Quick Decision: When to Use PublicNode vs. a Managed Provider
Before diving into the endpoint details, here's a quick framework to help you decide which RPC route fits your stage:
- Prototyping and hackathons: PublicNode's free endpoint is fine for quick experiments, small scripts, and learning Solana development. You can get started without creating an account.
- Building a production dApp: If your app serves real users, you need consistent performance, higher rate limits, and support. A managed RPC provider like OnFinality offers dedicated nodes and scalable API access.
- Running a validator or high-frequency bot: You likely need a dedicated node with low latency and no shared rate limits. PublicNode's free tier is not designed for that.
If you are still evaluating, check the Solana RPC providers comparison for a broader view.
What Is PublicNode?
PublicNode is a community-driven RPC provider that offers free public endpoints for multiple networks. It is often used by developers who want a no-cost way to interact with blockchains without running their own node.
For Solana, PublicNode provides an HTTP endpoint and a WebSocket endpoint. These are shared across all users, which means they come with rate limits and no uptime guarantees.
PublicNode Solana RPC Endpoint Details
PublicNode's Solana RPC endpoint is:
https://rpc.publicnode.com
This is the base URL for JSON-RPC requests. You can use it with any Solana RPC client, such as @solana/web3.js.
Here is an example of a simple getVersion request using curl:
curl https://rpc.publicnode.com \
-X POST \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","id":1,"method":"getVersion"}'
Expected response:
{"jsonrpc":"2.0","result":{"feature-set":2891141728,"solana-core":"1.18.22"},"id":1}
Note that PublicNode may change its endpoint URL or add authentication requirements over time. Always check the official PublicNode documentation for the latest endpoint.
Connecting a Solana dApp to PublicNode
If you are using @solana/web3.js, you can create a Connection object with the PublicNode endpoint:
import { Connection } from '@solana/web3.js';
const connection = new Connection('https://rpc.publicnode.com', 'confirmed');
// Example: get the latest blockhash
const blockhash = await connection.getLatestBlockhash();
console.log(blockhash);
For WebSocket subscriptions (e.g., account changes), you would need the WebSocket URL, which PublicNode also provides. However, free endpoints often restrict WebSocket usage or require a separate connection.
Rate Limits and Reliability: What to Expect
PublicNode is a free service, so it has limitations:
- Rate limits: PublicNode imposes rate limits to prevent abuse. The exact limits are not always published and may change. If you exceed them, you may receive HTTP 429 errors.
- Uptime: There is no SLA. The service may be down for maintenance or experience outages.
-
Data retention: PublicNode may not provide full archive data. Solana's
getTransactionand similar methods may only return recent data. - No support: If you have issues, you rely on community forums or Discord.
These limitations make PublicNode suitable for development and testing, but risky for production apps where downtime or rate limiting directly impacts users.
When to Move to a Managed RPC Provider
As your project grows, you will likely need:
- Higher rate limits: Managed providers offer tiered plans with higher request per second (RPS) allowances.
- Dedicated nodes: For consistent performance, you can get a dedicated Solana node that is not shared with other users.
- Archive data: If your app needs historical transaction data, you need an archive node. PublicNode may not provide that.
- WebSocket support: For real-time updates, a reliable WebSocket connection is essential.
- Support and SLAs: Managed providers offer support and uptime guarantees.
OnFinality provides managed Solana RPC endpoints with both HTTP and WebSocket support. You can start with a free tier and scale to dedicated nodes as needed. See RPC pricing for details.
Comparing PublicNode and OnFinality for Solana
The table below summarizes the key differences:
| Feature | PublicNode | OnFinality |
|---|---|---|
| Cost | Free | Free tier and paid plans |
| Rate limits | Shared, limited | Configurable, higher limits |
| Uptime SLA | None | Available on paid plans |
| Archive data | Not guaranteed | Available on request |
| WebSocket | Yes, but limited | Yes, dedicated WebSocket URL |
| Support | Community | Dedicated support |
| Dedicated nodes | No | Yes |
OnFinality also offers a Solana Devnet endpoint for testing, which is useful for development.
Troubleshooting Common Issues with PublicNode Solana
If you encounter problems with the PublicNode endpoint, here are common issues and fixes:
- HTTP 429 Too Many Requests: You are rate limited. Reduce your request frequency or switch to a paid provider.
- Connection timeouts: The free endpoint may be overloaded. Retry with exponential backoff.
- Missing data: If you need historical transactions, use an archive provider.
- WebSocket disconnects: Free WebSocket endpoints may drop connections. Implement reconnection logic.
Here is a simple retry logic example in JavaScript:
async function rpcCall(method, params) {
const response = await fetch('https://rpc.publicnode.com', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ jsonrpc: '2.0', id: 1, method, params })
});
if (response.status === 429) {
await new Promise(resolve => setTimeout(resolve, 1000));
return rpcCall(method, params);
}
return response.json();
}
Key Takeaways
- PublicNode offers a free Solana RPC endpoint at
https://rpc.publicnode.com. - It is suitable for development and testing, but not for production due to rate limits and lack of SLA.
- For production apps, consider a managed RPC provider like OnFinality which offers scalable and reliable infrastructure.
- Always check the latest endpoint and limits on the official PublicNode documentation.
Frequently Asked Questions
Is PublicNode Solana RPC free?
Yes, PublicNode provides free public RPC endpoints for Solana and other networks.
What are the rate limits for PublicNode Solana?
PublicNode does not publish exact rate limits. They are subject to change and are shared across all users.
Can I use PublicNode for a production dApp?
It is not recommended due to lack of SLA, rate limits, and potential downtime. A managed provider like OnFinality is better suited for production.
Does PublicNode support WebSocket?
Yes, PublicNode offers WebSocket endpoints, but they may have additional restrictions.
How do I get a dedicated Solana RPC endpoint?
You can get a dedicated Solana node from OnFinality. Visit the Solana network page for more information.
Related resources
Originally published at OnFinality.
Top comments (0)