Logo
New RPC users get 35% off their first monthView the offer
RPC Assistant

Polygon Mainnet RPC: Chain Settings, Endpoint, and Connection Checks

Summary

Polygon Mainnet is the proof-of-stake, EVM-compatible chain identified by chain ID 137. If you searched for "polygon mainnet," you most likely need to connect a wallet, a dApp, or a backend service to it and want the correct chain settings and a working RPC endpoint without guessing.

This page gives you the chain settings first, then a public OnFinality endpoint you can test immediately, then the checks that separate a quick demo from a production-ready connection. It also explains when a public endpoint is enough and when a dedicated node or managed RPC plan makes more sense.

Polygon Mainnet is not the same as Polygon Amoy, the testnet. Keep the two separate in your config: the mainnet chain ID is 137, while Amoy uses 80002. Mixing them up is one of the most common reasons a deployment looks connected but never confirms a transaction.

Key Takeaways

  • Polygon Mainnet uses chain ID 137, native currency POL with 18 decimals, and the explorer at polygonscan.com.
  • A public OnFinality endpoint for Polygon Mainnet is https://polygon.api.onfinality.io/public; it is useful for testing and light reads.
  • Wallet, dApp, and backend configs must all point to chain ID 137, not the Amoy testnet chain ID 80002.
  • Production workloads usually need a managed or dedicated endpoint with clear rate limits, WebSocket support, and monitoring.
  • Most connection failures trace back to wrong chain ID, a stale or rate-limited endpoint, or a method the endpoint does not support.
  • OnFinality offers Polygon RPC API access and dedicated node options; check the network page and pricing page for current details.

Polygon Mainnet settings at a glance

Before you touch any code, confirm the four values that every EVM tool needs: chain ID, currency symbol, decimals, and a working RPC URL. For Polygon Mainnet these are stable and widely used, so a mismatch almost always means a copy-paste error or a leftover testnet value.

The table below is the reference you can paste into a wallet, a Hardhat config, or a viem chain definition. If a tool asks for a network ID as well as a chain ID, use 137 for both on Polygon Mainnet.

CriterionWhat to checkWhy it matters
Chain ID137 (hex 0x89)Wrong chain ID sends transactions to the wrong network or causes wallet rejection.
Native currencyPOL, 18 decimalsGas is paid in POL; older configs that still say MATIC may confuse users but the network is the same.
Public OnFinality RPC URLhttps://polygon.api.onfinality.io/publicA quick endpoint for testing reads and wallet connection.
Block explorerhttps://polygonscan.comUse it to confirm transactions, contract addresses, and block numbers.
TransportHTTP and WebSocketHTTP suits request/response calls; WebSocket is needed for subscriptions.

Quick recommendation: public endpoint or managed plan?

Use the public OnFinality endpoint when you are wiring up a wallet, running a quick script, or checking that your contract address resolves. It is a fast way to confirm chain settings without signing up for anything.

Move to a managed RPC API key or a dedicated node when your app has real users, background jobs, or indexers hitting Polygon Mainnet continuously. Shared public endpoints are not designed to absorb production traffic, and a single noisy client can degrade everyone's experience.

If you are unsure, start public, measure your request volume for a day, then decide. The RPC pricing page and the Polygon network page give you the concrete options to compare.

  • Prototype or wallet setup: public endpoint is fine.
  • Staging with realistic traffic: managed RPC API key.
  • High-volume reads, indexers, or latency-sensitive writes: evaluate dedicated nodes.
  • Need WebSocket subscriptions in production: confirm transport support before committing.

Connect with curl, viem, and a wallet

The fastest sanity check is a single JSON-RPC call. If eth_chainId returns 0x89, you are talking to Polygon Mainnet. If it returns 0x13882, you are on Amoy and need to switch endpoints.

For application code, viem lets you define a chain and point it at any RPC URL. Keep the URL in an environment variable so you can swap between public, managed, and dedicated endpoints without editing source.

  • curl -X POST https://polygon.api.onfinality.io/public -H 'Content-Type: application/json' -d '{"jsonrpc":"2.0","id":1,"method":"eth_chainId","params":[]}'
  • Expect result 0x89 for Polygon Mainnet.
  • In viem, create a chain object with id 137 and rpcUrls.default.http set to your endpoint.
  • In MetaMask, add a network with chain ID 137, symbol POL, and the RPC URL above.

Failure modes and how to debug them

Most Polygon Mainnet connection problems fall into a small set of categories. Match the symptom to the likely cause before you change code, because the fix is usually configuration rather than logic.

If a call works in curl but fails in your app, compare the exact URL, headers, and chain ID the app is using. Environment variables that were copied from a testnet setup are a frequent culprit.

CriterionWhat to checkWhy it matters
Wallet shows wrong networkChain ID is 137, not 80002Amoy is a testnet; transactions there do not affect mainnet balances.
eth_call returns empty or revertsContract address and ABI match mainnet deploymentTestnet addresses often differ from mainnet ones.
Intermittent 429 or timeoutsRequest volume against endpoint limitsPublic endpoints are shared; sustained load needs a managed plan.
WebSocket subscription dropsTransport support and reconnect logicLong-lived subscriptions need a provider that supports ws and a client that reconnects.
eth_getLogs times outBlock range size and filter specificityVery wide log queries are expensive; narrow the range or use an indexer.

Production readiness checklist

Before you point real users at a Polygon Mainnet endpoint, walk through the items below. They are the difference between a demo that works on your laptop and a service that behaves predictably under load.

Keep at least one fallback endpoint configured. Even a well-run provider can have maintenance windows, and a fallback URL in your client config turns a hard outage into a brief degradation.

  • Endpoint URL stored in environment config, not hardcoded.
  • Chain ID asserted at startup so a misconfigured environment fails fast.
  • Fallback RPC URL configured for read paths.
  • Monitoring on error rate, latency, and block height lag.
  • WebSocket reconnect logic if you use subscriptions.
  • Log retention for failed transactions so you can reproduce issues.

When to move from public RPC to OnFinality infrastructure

OnFinality provides RPC API access and dedicated node infrastructure for Polygon Mainnet. The RPC API is the natural next step after the public endpoint: you get a managed URL and a clearer picture of your usage. Dedicated nodes are for teams that need isolated capacity or specific transport requirements.

You do not have to decide all at once. Start with the public endpoint, move to a managed plan when traffic grows, and evaluate dedicated nodes when your workload becomes predictable enough to size. The supported RPC networks page shows what else is available if you run multi-chain infrastructure.

  • Managed RPC API: good default for most production apps.
  • Dedicated node: better fit for high sustained throughput or strict isolation.
  • Multi-chain teams: keep endpoint conventions consistent across networks.
  • Always confirm current transport support and limits on the network page.

Frequently Asked Questions

What is the Polygon Mainnet chain ID?

Polygon Mainnet uses chain ID 137, which is 0x89 in hex. Polygon Amoy, the testnet, uses 80002. Always confirm the chain ID your wallet or app reports before sending transactions.

What is the public OnFinality RPC URL for Polygon Mainnet?

The public endpoint is https://polygon.api.onfinality.io/public. It supports HTTP and WebSocket and is suitable for testing and light usage. For production traffic, use a managed RPC API key or a dedicated node.

Is Polygon Mainnet the same as Polygon PoS?

Polygon Mainnet is commonly referred to as Polygon PoS. It is an EVM-compatible proof-of-stake chain that settles checkpoints to Ethereum. The native gas token is POL, which replaced MATIC in naming.

How do I add Polygon Mainnet to MetaMask?

Open the network settings, add a custom network, and enter chain ID 137, currency symbol POL, the RPC URL from OnFinality, and https://polygonscan.com as the explorer. Save and switch to the network.

Why does my Polygon Mainnet call fail with a rate limit error?

Public endpoints are shared and have limits. If you see 429 responses or timeouts under load, move to a managed RPC plan or a dedicated node so your traffic has its own capacity.

RPC Knowledge Base

Related RPC details

Never Worry about Infrastructure Again

OnFinality takes away the heavy lifting of DevOps so you can build smarter and faster.

Get Started