Summary
Find the official Polygon RPC endpoints for mainnet and Amoy testnet, including HTTPS and WebSocket URLs. Learn how to choose between public, managed, and dedicated RPC providers based on your application's needs, and get configuration examples for wallets and developers.
When you search for a Polygon RPC list, you usually need one of two things: a quick endpoint to paste into a wallet or a reliable RPC provider for a production application. This page gives you both. You'll find the official public endpoints for Polygon mainnet and the Amoy testnet, plus a practical framework for deciding which RPC setup fits your workload.
Quick recommendation: which Polygon RPC should you use?
For local development, testing, or a wallet, the public endpoints listed below are fine. They are rate-limited and shared, so they are not suitable for production dApps or high-traffic services.
For production applications, you need a managed RPC provider that offers higher throughput, WebSocket support, and dedicated node options. OnFinality provides Polygon RPC endpoints with both shared and dedicated infrastructure. You can start with the free tier and scale to a dedicated node when your traffic grows.
Here's a quick decision guide:
- Wallet or simple dApp: Use the public endpoint or a free tier from a managed provider.
- Production dApp with moderate traffic: Use a managed RPC provider with a paid plan that offers higher rate limits and WebSocket support.
- High-throughput or data-intensive application: Consider a dedicated node to avoid rate limits and noisy neighbors.
- Testnet development: Use the Amoy testnet endpoint.
Official Polygon RPC endpoints
The following are the official public RPC endpoints provided by OnFinality for Polygon. These are suitable for testing and low-volume use.
Polygon Mainnet
- Chain ID: 137
- HTTPS:
https://polygon.api.onfinality.io/public - WebSocket:
wss://polygon.api.onfinality.io/public/ws - Explorer: https://polygonscan.com
- Native Currency: POL (formerly MATIC)
Polygon Amoy Testnet
- Chain ID: 80002
- HTTPS:
https://polygon-amoy.api.onfinality.io/public - Explorer: https://amoy.polygonscan.com
- Native Currency: POL
Note: The Amoy testnet does not currently support WebSocket on the public endpoint. If you need WebSocket for testnet, you may need a dedicated node.
Chain settings at a glance
The table below summarizes the key network parameters for Polygon mainnet and Amoy testnet. Use these when configuring a wallet or adding a network to your dApp.
| Parameter | Polygon Mainnet | Polygon Amoy Testnet |
|---|---|---|
| Network Name | Polygon Mainnet | Polygon Amoy |
| Chain ID | 137 | 80002 |
| Native Currency | POL | POL |
| HTTPS RPC URL | https://polygon.api.onfinality.io/public | https://polygon-amoy.api.onfinality.io/public |
| WebSocket RPC URL | wss://polygon.api.onfinality.io/public/ws | Not available on public endpoint |
| Block Explorer | https://polygonscan.com | https://amoy.polygonscan.com |
How to configure your wallet or dApp
Most wallets and dApps allow you to add a custom network. Below is an example of how to configure Polygon mainnet in a JavaScript application using ethers.js.
import { ethers } from "ethers";
const polygonProvider = new ethers.JsonRpcProvider(
"https://polygon.api.onfinality.io/public"
);
const network = await polygonProvider.getNetwork();
console.log("Chain ID:", network.chainId); // 137
For a wallet like MetaMask, you can use the wallet_addEthereumChain RPC method to switch networks programmatically.
await window.ethereum.request({
method: "wallet_addEthereumChain",
params: [{
chainId: "0x89", // 137 in hex
chainName: "Polygon Mainnet",
nativeCurrency: {
name: "POL",
symbol: "POL",
decimals: 18
},
rpcUrls: ["https://polygon.api.onfinality.io/public"],
blockExplorerUrls: ["https://polygonscan.com"]
}]
});
Public vs. managed vs. dedicated RPC
When you see a list of Polygon RPC endpoints, you are likely looking at public URLs. These are free but come with limitations. Here is a breakdown of the three main options:
Public RPC endpoints
- Pros: Free, no sign-up, easy to test.
- Cons: Rate-limited, shared bandwidth, no WebSocket on testnet, not reliable for production.
Managed RPC providers
- Pros: Higher rate limits, WebSocket support, multiple endpoints for failover, technical support, and analytics.
- Cons: Costs money at scale, but many offer free tiers.
Dedicated nodes
- Pros: Guaranteed resources, clear rate limits, full control over the node, access to archive data and debug/trace methods.
- Cons: More expensive, requires more operational knowledge.
For a production dApp, a managed RPC provider is often the sweet spot. OnFinality offers RPC pricing that scales with your usage, and you can choose from a list of supported networks including Polygon.
Common RPC methods and examples
Polygon is an Ethereum-compatible chain, so it supports standard Ethereum JSON-RPC methods. Here are a few common ones you might use.
Get the latest block number
curl https://polygon.api.onfinality.io/public \
-X POST \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}'
Get a transaction receipt
curl https://polygon.api.onfinality.io/public \
-X POST \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","method":"eth_getTransactionReceipt","params":["0x..."],"id":1}'
Subscribe to new pending transactions (WebSocket)
const ws = new WebSocket("wss://polygon.api.onfinality.io/public/ws");
ws.onopen = () => {
ws.send(JSON.stringify({
jsonrpc: "2.0",
method: "eth_subscribe",
params: ["newPendingTransactions"],
id: 1
}));
};
ws.onmessage = (event) => {
console.log(event.data);
};
Troubleshooting common RPC issues
Even with a good RPC list, you may run into issues. Here are some common problems and how to fix them.
Rate limiting
If you see errors like 429 Too Many Requests or rate limit exceeded, you are hitting the public endpoint's limits. Switch to a managed provider or a dedicated node.
WebSocket disconnects
Public WebSocket endpoints may drop connections during high load. For production, use a managed provider that offers stable WebSocket connections.
Incorrect chain ID
Make sure your dApp is using the correct chain ID (137 for mainnet, 80002 for Amoy). A mismatch will cause transactions to fail.
Out-of-sync nodes
If you are running your own node, it may fall out of sync. Check your node's logs and ensure it has enough disk space and bandwidth.
Key Takeaways
- Polygon mainnet uses chain ID 137 and POL as its native currency.
- The Amoy testnet uses chain ID 80002 and is the recommended testnet for Polygon development.
- Public RPC endpoints are fine for testing but not for production.
- Managed RPC providers like OnFinality offer scalable, reliable endpoints with WebSocket support.
- For high-throughput or data-intensive applications, consider a dedicated node.
Frequently Asked Questions
What is the official Polygon RPC URL?
The official public RPC URL for Polygon mainnet is https://polygon.api.onfinality.io/public. For the Amoy testnet, use https://polygon-amoy.api.onfinality.io/public.
What is the Polygon chain ID?
The Polygon mainnet chain ID is 137. The Amoy testnet chain ID is 80002.
Does Polygon support WebSocket?
Yes, Polygon mainnet supports WebSocket at wss://polygon.api.onfinality.io/public/ws. The public Amoy endpoint does not currently support WebSocket.
What is the difference between Polygon and Polygon Amoy?
Polygon is the mainnet, while Polygon Amoy is the testnet used for development and testing. They have different chain IDs and RPC endpoints.
Can I use the public Polygon RPC for production?
Public RPC endpoints are rate-limited and shared, so they are not recommended for production applications. Consider a managed RPC provider or a dedicated node for reliable service.
How do I get POL tokens for the Amoy testnet?
You can obtain test POL from the Amoy faucet. Check the official Polygon documentation for the current faucet URL.
What RPC methods are supported on Polygon?
Polygon supports standard Ethereum JSON-RPC methods, including eth_blockNumber, eth_getBalance, eth_sendRawTransaction, and more. For a full list, see the Ethereum JSON-RPC specification.
How do I choose between a shared and a dedicated RPC node?
If your application has moderate traffic and can tolerate occasional rate limits, a shared managed RPC is sufficient. If you need high throughput, archive data, or custom methods, a dedicated node is better.
Does OnFinality support Polygon?
Yes, OnFinality supports Polygon mainnet and Amoy testnet. You can find more details on the Polygon network page.
How do I get started with OnFinality's Polygon RPC?
Sign up for an account, create an API key, and use the provided endpoints. You can start with the free tier and upgrade as needed. See RPC pricing for details.