Logo
RPC Assistant

Polygon RPC Nodes: Endpoint Settings, Providers, and How to Choose

摘要

Polygon RPC nodes are remote endpoints that let your dApp communicate with the Polygon blockchain. This article covers chain configuration details (chain ID, RPC/WebSocket URLs), a comparison of free public nodes versus paid providers, and a decision checklist to help you pick the right infrastructure for development, testing, or production use.

Polygon RPC Node Decision Checklist

Before integrating a Polygon RPC node, ask yourself these questions:

CriterionWhat to checkWhy it matters
Workload typeLight reads or heavy archive queries?Public nodes work for low volume; archive and high throughput need dedicated nodes.
Rate limitsWhat are the request-per-second (RPS) and daily caps?Exceeding limits causes errors; production apps need predictable performance.
WebSocket supportDoes the provider offer wss:// endpoints?Required for real-time subscriptions (e.g., pending transactions, logs).
Network coverageMainnet only, or also testnet (Amoy)?You need testnet for development and staging.
Reliability SLAIs there an uptime guarantee?production apps should avoid free public endpoints with no commitment.
Trace and archive methodsAre debug_trace*, eth_getLogs with block range limits?Debugging and data analytics often require archive nodes.
Geographic distributionAre there multiple regions?Low latency for global users improves dApp experience.
Cost modelPay-as-you-go, monthly subscription, or free?Aligns with budget and scaling needs.

Polygon Network Chain Configuration

Polygon (formerly Matic) operates as a sidechain to Ethereum. Here are the essential parameters for connecting:

PropertyMainnetTestnet (Amoy)
Chain ID137 (0x89)80002
Gas tokenPOLPOL
RPC endpointhttps://polygon-rpc.com (public) or provider-specifichttps://rpc-amoy.polygon.technology
WebSocket endpointwss://polygon-rpc.com or provider-specificwss://rpc-amoy.polygon.technology
Explorerpolygonscan.comamoy.polygonscan.com

These values are common across most providers. When you use a service like OnFinality or others, you will receive a unique URL, but the chain ID and network remain the same.


Connecting to Polygon: Basic RPC Calls

Once you have an endpoint, test it with a simple JSON-RPC request. Here is a curl example to get the latest block number:

curl https://polygon.api.onfinality.io/public \
  -X POST \
  -H "Content-Type: application/json" \
  --data '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}'

Expected response (hex block number):

{"jsonrpc":"2.0","id":1,"result":"0x55d9a3e"}

For a WebSocket subscription using JavaScript:

const WebSocket = require('ws');
const ws = new WebSocket('wss://polygon.api.onfinality.io/public-ws');

ws.on('open', () => {
  ws.send(JSON.stringify({
    jsonrpc: '2.0',
    id: 1,
    method: 'eth_subscribe',
    params: ['newHeads']
  }));
});

ws.on('message', (data) => {
  console.log(JSON.parse(data));
});

Always check your provider's documentation for the exact WebSocket URL and any authentication requirements.


Free vs Paid Polygon RPC Nodes

Public (Free) Endpoints

Free endpoints are great for prototyping, hackathons, and low-traffic applications. However, they come with trade-offs:

  • Rate limited – typically 10–100 requests per second.
  • No SLA – uptime not guaranteed.
  • Limited method support – archive and trace methods are often disabled.
  • No dedicated throughput – your traffic shares capacity with others.

Examples of public Polygon RPC endpoints:

ProviderEndpoint
OnFinalityhttps://polygon.api.onfinality.io/public
dRPChttps://polygon.drpc.org
PublicNodehttps://polygon-bor-rpc.publicnode.com
Allnodeshttps://polygon.publicnode.com
Tatumhttps://polygon-mainnet.gateway.tatum.io/

Paid services, including shared API plans and dedicated nodes, offer:

  • Higher or clear rate limits.
  • SLAs with uptime guarantees.
  • Access to archive data and Trace API.
  • Dedicated compute for consistent latency.
  • WebSocket support with higher concurrency.

Leading paid providers for Polygon include Alchemy, Infura, Chainstack, QuickNode, and OnFinality. OnFinality offers both shared RPC API access with transparent pricing and dedicated nodes for high-throughput workloads. You can compare plans on our RPC pricing page and see the full list of supported networks on our networks page.


How to Choose the Right Polygon RPC Node

  1. Assess your volume. If your dApp makes fewer than 100,000 requests per day, a public endpoint may suffice. For anything larger, consider a paid shared or dedicated plan.
  2. Check method needs. If you require eth_getLogs with large block ranges or debug_traceTransaction, you need an archive node. Some providers offer archive as an add-on.
  3. Evaluate latency. Run a simple ping test from your server location to the endpoint. Many providers have points of presence in multiple regions; choose one geographically close to your users or backend.
  4. Test WebSocket reliability. Subscribe to new blocks and measure reconnection time. Dropped connections can break real-time features.
  5. Review the provider's support. For production, you need a way to escalate issues quickly.
  6. Plan for scaling. Start with a shared plan, but ensure the provider offers a clear migration path to dedicated nodes without changing your integration code.

Common Pitfalls When Using Polygon RPC Nodes

  • Using public nodes in production: Public nodes are often rate-limited and may throttle or block excessive usage. Your app can become unavailable during peak times.
  • Ignoring WS limitations: Not all public endpoints support WebSocket. Even if they do, they may limit the number of concurrent subscriptions.
  • Forgetting chain ID validation: Some providers serve multiple chains; always verify that the eth_chainId response returns 137 for mainnet.
  • Overlooking testnet differences: Amoy testnet (chain ID 80002) uses a different RPC endpoint. Ensure your deployment scripts and environments are configured correctly for each network.
  • Not handling rate limits gracefully: Implement exponential backoff and retry logic, even when using paid endpoints, to handle occasional spikes.

Troubleshooting Polygon RPC Issues

ProblemPossible CauseSolution
429 Too Many RequestsRate limit exceededSwitch to a paid plan or add backoff/retry.
-32000: out of requestsDaily quota exhaustedUpgrade to a higher tier or wait for reset.
eth_blockNumber returns stale valueNode not syncedUse a provider that maintains fully synced nodes.
WebSocket disconnects frequentlyProvider limits or network issueCheck provider's WS documentation and consider a dedicated node.
Transaction not mined after hoursNonce mismatch or low gasVerify nonce and gas price; use eth_sendRawTransaction carefully.

If you encounter persistent problems, test with a different endpoint. OnFinality provides both public and private endpoints; you can sign up for free to get a dedicated API key and higher limits.


Key Takeaways

  • Polygon mainnet uses chain ID 137 and token POL; testnet Amoy uses chain ID 80002.
  • Public RPC nodes are suitable for development and low-traffic apps, but production apps need paid services with SLAs.
  • Evaluate providers based on throughput, archive data availability, WebSocket support, and geographic coverage.
  • Always test your integration on testnet first and handle rate limits in your code.
  • OnFinality offers both shared and dedicated Polygon RPC nodes with flexible pricing. See our RPC pricing and supported networks.

Frequently Asked Questions

What is a Polygon RPC node? A Polygon RPC node is a server that processes remote procedure calls, allowing external applications to interact with the Polygon blockchain. It exposes an endpoint that accepts standard JSON-RPC requests.

Can I run my own Polygon node? Yes. You can run your own Polygon node using the official client (bor + heimdall). However, maintaining sync, storage, and uptime requires operational effort. Many teams prefer managed services.

What is the difference between a full node and an archive node? A full node stores only recent state and can recreate historical data up to a configurable prune limit. An archive node stores all historical data, enabling queries like eth_getBalance at any past block. Archive nodes require more storage.

How do I add Polygon to MetaMask? MetaMask often auto-detects Polygon; if not, go to Settings > Networks > Add Network and enter:

  • Network Name: Polygon
  • RPC URL: (your provider's endpoint)
  • Chain ID: 137
  • Symbol: POL
  • Explorer: https://polygonscan.com

Does OnFinality support Polygon testnet? Yes. OnFinality provides endpoints for Polygon Amoy testnet. Check our networks page for current availability and URLs.

RPC 知识库

相关 RPC 内容

Network Rpc

什么是SORA区块链以及如何连接它?

# 什么是SORA区块链以及如何连接它? SORA是一个旨在创建去中心化货币体系和经济基础设施的区块链平台。它基于Hyperledger Iroha v3构建,采用单一逻辑账本、确定性最终性和基于通道的扩展,以支持支付、DeFi、CBDC和企业应用。该网络通过民主机制进行治理,旨在为全球市场提供统一...

Network Rpc

什么是 TON RPC,如何使用它?

# 什么是 TON RPC,如何使用它? TON(The Open Network)是一个为高可扩展性和与 Telegram 深度集成而设计的 layer-1 区块链。与 EVM 链不同,TON 采用独特的分片和异步智能合约架构。要从 Web 应用程序与 TON 交互,需要一个 RPC(远程过程调用...

Testnet Rpc

什么是 Sui 测试网 RPC,如何使用?

# Sui 测试网 RPC:开发者指南 Sui 测试网 RPC 端点允许开发者在不运行自己节点的情况下与 Sui 区块链测试网交互。本指南涵盖可用的端点、连接方式以及测试 dApp 的最佳实践。无论您是首次在 Sui 上构建,还是从主网迁移,使用像 OnFinality 这样可靠的测试网 RPC 提...

Network Rpc

关于 Scroll RPC 端点,我需要了解什么?

# 关于 Scroll RPC 端点,我需要了解什么? Scroll RPC 端点至关重要,因为 Web3 应用程序依赖于稳定的端点访问来实现读取、交易、仪表盘和后端工作流。正确的设置应匹配您的工作负载,支持您所需的网络和测试网,使限制可见,并在共享 RPC 不再足够时为您提供扩展路径。 对于 Sc...

Blockchain Infrastructure

区块链节点托管:面向开发者和基础设施采购者的实用指南

# 区块链节点托管:面向开发者和基础设施采购者的实用指南 区块链节点托管是指在专用或云基础设施上运行和维护区块链节点——全节点、归档节点或验证者节点。无论您是构建去中心化应用、运行验证者节点,还是执行分析管道,选择自行托管还是使用托管节点提供商,都会直接影响应用的可靠性、延迟和运营开销。本指南涵盖了...

Network Rpc

Avalanche RPC:端点、链ID与提供商选择

本指南涵盖C链、P链和X链的Avalanche RPC端点,包括主网和Fuji测试网的URL、链ID,以及如何选择可靠的RPC提供商。其中包含决策清单、评估标准和代码示例,帮助开发者将Avalanche RPC集成到他们的dApp中。...

永远不用担心基础设施

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

开始