Logo
新用户订阅 RPC,首月享 6.5 折优惠查看优惠
RPC Assistant

Solana Clusters and Public RPC Endpoints: Which One Should Your App Connect To?

摘要

Solana runs several distinct clusters — mainnet-beta, testnet, and devnet — and each one exposes its own RPC endpoints, genesis hash, and faucet. Picking the wrong cluster is one of the most common reasons a wallet, dApp, or indexer silently fails, so the first step is always to confirm which cluster your code is actually pointed at. This reference walks through the cluster settings, endpoint options, and debugging steps for each environment, and explains when a public endpoint is enough versus when a managed or dedicated RPC service such as OnFinality is the better fit.

Solana is not one network but a set of independent clusters, each with its own ledger, RPC endpoints, and purpose. If you are wiring up a wallet, a dApp, or a backend indexer, the cluster you connect to determines which accounts, programs, and tokens you can actually see. This page covers the cluster settings you need, the public endpoints that are available, and how to decide when a public endpoint stops being the right tool.

Which Solana cluster should you connect to?

The choice comes down to three questions: are you moving real value, are you testing program logic, or are you validating validator/client changes? The table below maps each cluster to its typical use and the practical implications.

ClusterTypical useReal value?FaucetNotes
mainnet-betaProduction apps, wallets, DeFi, NFTsYes (real SOL and tokens)NoThe canonical Solana network users interact with
devnetApplication development, testing, demosNoYesAirdrop SOL freely; resets are possible
testnetValidator and client testing, protocol changesNoYes (limited)Not intended for application development

If your app handles real funds, you belong on mainnet-beta. If you are iterating on program logic or UI flows, devnet is the right sandbox. Testnet is primarily for validator operators and core protocol testing — using it for app development usually leads to confusion because tooling and data assumptions differ from mainnet.

A frequent source of bugs is a mismatch between the cluster your frontend thinks it is using and the cluster your backend or wallet is actually connected to. Always log the genesis hash at startup and compare it against the expected value for the cluster.

Cluster settings at a glance

Each cluster is identified by a genesis hash. Checking this hash is the fastest way to confirm you are on the right network.

Settingmainnet-betadevnettestnet
Genesis hash5eykt4UsFv8P8NJdTREpY1vzqKqZKvdpKuc147dw2N9dEtWTRABZaYq6iMfeYKouRu166VU2xqa14uhcVJyU9pJkvQyS88uRDiswHXSCkY3z
Native tokenSOLSOL (no value)SOL (no value)
FaucetNot availableAvailable via CLI or webLimited
Explorerexplorer.solana.comexplorer.solana.com (devnet)explorer.solana.com (testnet)

You can verify the genesis hash of any endpoint with a single RPC call:

curl -s https://solana.api.onfinality.io/public -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","id":1,"method":"getGenesisHash"}'

The response should match the table above for the cluster you intend to use. If it does not, you are pointed at the wrong environment.

Public RPC endpoints: what they are and when they are enough

A public RPC endpoint is a shared, unauthenticated URL that anyone can call. Solana's official documentation lists public endpoints for each cluster, and many infrastructure providers — including OnFinality — also expose public endpoints for Solana mainnet and devnet. These are convenient for quick tests, tutorials, and low-volume scripts.

Public endpoints typically come with tradeoffs you should plan around:

  • Shared capacity: your requests compete with everyone else's, so latency and throughput can vary.
  • Rate limits: most public endpoints apply some form of request throttling, though the exact policy varies.
  • No SLA: there is usually no commitment to availability or support.
  • Limited method access: some heavy or specialized methods may be restricted.

For a hackathon demo or a local script, a public endpoint is fine. For a production app with real users, you will quickly hit the limits of what a shared public endpoint can offer.

OnFinality provides a public Solana mainnet endpoint at https://solana.api.onfinality.io/public and a matching WebSocket endpoint at wss://solana.api.onfinality.io/public-ws. These are useful for development and light usage; for production workloads you can move to a managed or dedicated plan through RPC pricing.

Connecting a wallet or dApp to a Solana cluster

Most Solana tooling lets you specify the cluster or RPC endpoint directly. In JavaScript, the @solana/web3.js library takes a connection endpoint:

import { Connection, clusterApiUrl } from '@solana/web3.js';

// Public devnet endpoint (for testing)
const devnetConnection = new Connection(clusterApiUrl('devnet'), 'confirmed');

// OnFinality public mainnet endpoint (for light production use)
const mainnetConnection = new Connection('https://solana.api.onfinality.io/public', 'confirmed');

// Always confirm the cluster before sending transactions
const genesisHash = await mainnetConnection.getGenesisHash();
console.log('Connected to genesis hash:', genesisHash);

For wallets that support custom RPC configuration, the settings usually ask for an RPC URL and sometimes a WebSocket URL. Use the mainnet endpoint above for mainnet-beta, and the devnet endpoint from the Solana docs for devnet. Keep the WebSocket URL separate if your app subscribes to account or program changes.

A common pitfall is hardcoding a devnet endpoint in a build that later ships to production. Use environment variables and assert the genesis hash at startup so this fails loudly rather than silently.

Requesting an airdrop on devnet or testnet

Devnet and testnet provide faucets so you can obtain SOL for testing. On devnet, you can request an airdrop via the CLI:

solana airdrop 2 --url https://api.devnet.solana.com

Or programmatically:

const signature = await devnetConnection.requestAirdrop(publicKey, 1_000_000_000); // 1 SOL
await devnetConnection.confirmTransaction(signature);

Faucet limits apply, and devnet may reset, wiping test state. Do not rely on devnet for anything you need to persist. If you need a stable, isolated environment for integration tests, a dedicated node or a managed RPC plan with a private endpoint can give you more predictable behavior than a shared public faucet-backed cluster.

Production readiness checklist

Before you point real users at a Solana endpoint, work through these checks:

  • Cluster confirmed: genesis hash matches the intended cluster at startup and in health checks.
  • Endpoint capacity: the endpoint can handle your expected request rate, including bursts during popular mints or market events.
  • WebSocket support: if you use subscriptions, confirm the endpoint supports wss and that your client reconnects cleanly.
  • Failover: you have at least one backup endpoint and a strategy for switching when the primary degrades.
  • Observability: you log request latency, error rates, and rate-limit responses so you can detect problems before users do.
  • Method coverage: the methods you rely on (for example getProgramAccounts, getSignaturesForAddress, or simulateTransaction) are available and perform acceptably.

If several of these are uncertain on a public endpoint, that is a signal to evaluate a managed or dedicated RPC service. OnFinality offers Solana RPC through its API service and dedicated node options, with endpoints you can test before committing. See the Solana network page for current endpoint details.

Debugging cluster and endpoint problems

When something breaks, the symptom often points to a specific cause. The table below maps common symptoms to likely fixes.

SymptomLikely causeWhat to check
Transactions fail with "blockhash not found"Wrong cluster or stale blockhashConfirm genesis hash; fetch a fresh blockhash before signing
Account data is empty or unexpectedConnected to devnet/testnet instead of mainnet-betaLog the RPC URL and genesis hash at runtime
Airdrop request failsFaucet rate limit or mainnet endpointEnsure you are on devnet/testnet and within faucet limits
WebSocket subscriptions stop firingEndpoint dropped the connection or does not support wssVerify the WebSocket URL and implement reconnect logic
Intermittent 429 responsesPublic endpoint rate limitingReduce request rate, batch calls, or move to a managed endpoint
Slow getProgramAccounts callsLarge account set on a shared endpointUse filters, paginate, or use a dedicated/archive-capable endpoint

A useful first debugging step is to run getGenesisHash and getHealth against the endpoint your app is using. If those succeed but your application still fails, the issue is likely in how the client is configured rather than the endpoint itself.

Moving from a public endpoint to managed or dedicated RPC

Public endpoints are a starting point, not a production strategy. As your app grows, you will want more predictable throughput, clearer limits, and support when something goes wrong. Managed RPC services provide authenticated endpoints with defined capacity, while dedicated nodes give you isolated infrastructure for workloads that need consistent performance or access to heavier methods.

OnFinality provides both managed RPC API access and dedicated node infrastructure across a range of networks, including Solana. You can review supported RPC networks to see what is available, and compare plans on the RPC pricing page. If you are still deciding between providers, the guide on how to choose an RPC provider covers the evaluation criteria in more detail.

When migrating, keep the old endpoint configured as a fallback until you have verified the new one under real traffic. Test WebSocket subscriptions, heavy read methods, and error handling before cutting over.

Key Takeaways

  • Solana has three main clusters: mainnet-beta (production), devnet (app development), and testnet (validator/protocol testing).
  • Each cluster has its own genesis hash; checking it is the fastest way to confirm you are on the right network.
  • Public RPC endpoints are convenient for development and light use but are shared, often rate-limited, and not designed for production traffic.
  • Devnet and testnet provide faucets; mainnet-beta does not.
  • For production apps, evaluate managed or dedicated RPC services such as OnFinality for more predictable capacity and support.
  • Always implement failover, logging, and genesis-hash checks before going live.

Frequently Asked Questions

What is the difference between a Solana cluster and an RPC endpoint?

A cluster is the network itself — a set of validators maintaining a shared ledger (mainnet-beta, devnet, or testnet). An RPC endpoint is the HTTP or WebSocket URL your application uses to talk to a node in that cluster. One cluster can have many endpoints.

Can I use a public RPC endpoint for a production Solana app?

You can start with one, but public endpoints are shared and often rate-limited. For production traffic, a managed or dedicated RPC service gives you more predictable performance and a clearer support path.

How do I know which cluster my app is connected to?

Call getGenesisHash on your endpoint and compare the result to the known genesis hash for mainnet-beta, devnet, or testnet. Log this at startup so mismatches are caught early.

Does OnFinality provide a public Solana RPC endpoint?

Yes. OnFinality exposes a public Solana mainnet endpoint at https://solana.api.onfinality.io/public and a WebSocket endpoint at wss://solana.api.onfinality.io/public-ws. For production workloads, managed and dedicated options are available.

What should I do if my Solana transactions fail with "blockhash not found"?

This usually means you are on the wrong cluster or using a stale blockhash. Confirm your genesis hash, fetch a fresh blockhash immediately before signing, and retry.

Where can I find Solana devnet and testnet endpoints?

Solana's official documentation lists public endpoints for devnet and testnet. OnFinality also offers a Solana Devnet endpoint for development and testing.

RPC 知识库

相关 RPC 内容

RPC 提供商选择Solana

面向可扩展企业应用的 Solana 专用节点

Solana 的高吞吐量设计给 RPC 基础设施带来了不寻常的压力:共享端点可能在突发工作负载下受到限制,而企业应用通常需要可预测的容量、归档访问和 WebSocket 可靠性。专用节点让单个团队拥有自己的节点资源,而不是在共享池中竞争。本文解释了何时适合使用专用 Solana 基础设施、如何评估提...

网络 RPCBittensor

Bittensor 子网 123:它是什么以及如何连接?

Bittensor 子网 123 是运行在 Bittensor 网络之上的编号激励子网之一。每个子网都有自己的任务、矿工和验证者激励设计,以及自己的链上注册和质押记账,因此“子网 123”最好理解为特定子网的 netuid,而不是固定的产品名称。如果你正在其上构建,实际问题通常是:如何读取其状态以及...

网络 RPCBNB Chain

如何使用类似 Chainlist 的目录来查找支持的 RPC 网络和端点?

类似 Chainlist 的目录的存在是为了解决一个问题:将链 ID 映射到可用的 RPC 端点,以便钱包和 dApp 无需猜测即可连接。本文解释了这些目录的结构、如何读取它们公开的网络元数据,以及如何在你将其部署到生产环境之前验证端点。 它还涵盖了公共目录端点在哪些情况下不再足够、当列出的端点失败...

网络 RPCAsset Hub

什么是 Asset Hub,如何连接它?

Asset Hub 是 Polkadot 和 Kusama 上的一个系统平行链,用于承载同质化代币、NFT 和其他数字资产。它提供了一个专门的环境,用于以低费用和高吞吐量创建、管理和转移资产。本文解释了什么是 Asset Hub,如何将您的 dApp 连接到它,以及如何为您的用例选择合适的 RPC ...

网络 RPCxx network

关于xx网络,我需要了解什么?

# 关于xx网络,我需要了解什么? xx网络是一个抗量子计算的Layer 1区块链,集成了去中心化混合网络(cMix)用于私密通信。由密码学先驱David Chaum创立,采用提名权益证明(NPoS)共识机制,为dApp和消息传递提供低费用、可扩展的基础设施。对于开发者而言,可靠的RPC端点和专用节...

网络 RPCEfinity

Solana 开发者应关注哪些专用节点访问功能?

专用 Solana RPC 节点为您的 dApp 提供对单个节点实例的独占访问,避免共享端点的“吵闹邻居”效应。需要评估的关键功能包括专用计算和带宽、可配置的速率限制、WebSocket 支持、归档访问和故障转移选项。本文解释了这些功能在实践中的含义,以及如何为生产工作负载选择正确的设置。...

永远不用担心基础设施

OnFinality 消除了 DevOps 的繁重工作,让您能够更聪明、更快地构建。

开始