DEV Community

OnFinality
OnFinality

Posted on Originally published at onfinality.io

Polygon Node Hosting: Build vs Buy for Production Apps

Polygon node hosting is the practice of running the Polygon PoS client stack on infrastructure you do not physically own — either as a managed RPC endpoint or as a dedicated node instance — so your application can read and write to the chain without your team babysitting servers. The question most teams actually face is not whether they can run a node, but whether they should keep doing it once the workload grows.

Build-versus-buy tradeoffs for Polygon

Running your own Polygon node gives you full control over the client version, the data directory, and the network path. It also means you own the disk growth, the sync time, the client upgrades, and the pager rotation when Heimdall falls behind. For a small team, that is a real engineering tax.

Hosting shifts that operational load to a provider. You get an endpoint, a dashboard, and someone else's on-call rotation. The tradeoff is less control over the exact client build and a dependency on the provider's network path.

Factor Self-hosted Polygon node Managed Polygon node hosting
Setup effort Days to weeks (sync, disk, monitoring) Minutes to hours
Ongoing ops Client upgrades, disk, restarts Provider handles it
Data control Full Shared or dedicated depending on plan
Archive access You provision the disk Provider-dependent; confirm before committing
Cost shape Fixed infra + engineer time Usage-based or flat instance fee
Scaling reads You add nodes Provider scales or you add dedicated instances
Failure blast radius Your team Provider's SLA and your failover config

If your team is small and the workload is read-heavy, hosting usually wins on total cost of ownership. If you have a compliance reason to keep data in-house, or you need a custom client patch, self-hosting still makes sense.

Chain settings at a glance

Before you point anything at a hosted endpoint, get the network parameters right. Polygon mainnet uses chain ID 137 and the native gas token POL (18 decimals). The canonical block explorer is polygonscan.com.

Setting Polygon mainnet value
Chain ID 137
Chain name Polygon Mainnet
Native currency POL (18 decimals)
Block explorer https://polygonscan.com
Transport HTTP and WebSocket

A wallet or dApp network config for Polygon looks like this:

{
  "chainId": "0x89",
  "chainName": "Polygon Mainnet",
  "nativeCurrency": { "name": "POL", "symbol": "POL", "decimals": 18 },
  "rpcUrls": ["https://polygon.api.onfinality.io/public"],
  "blockExplorerUrls": ["https://polygonscan.com"]
}
Enter fullscreen mode Exit fullscreen mode

Note that 0x89 is the hex form of 137. If your wallet shows the wrong chain, that mismatch is usually the cause.

What a hosted Polygon endpoint actually gives you

A managed endpoint is more than a URL. When you evaluate hosting, check what sits behind it:

  • HTTP and WebSocket transport. Polygon supports both. WebSocket matters for subscriptions (eth_subscribe) and for apps that need push updates instead of polling.
  • Archive depth. If you query historical state or run analytics, you need archive data. Confirm the retention window before you build on it.
  • Trace and debug methods. debug_traceTransaction and trace_* calls are expensive and not always enabled. Ask explicitly.
  • eth_getLogs limits. Log queries over wide block ranges are the most common source of 4xx errors. Providers cap the range differently.
  • Rate and concurrency limits. Understand the request-per-second ceiling and whether bursts are allowed.

OnFinality provides Polygon RPC through its API service and offers dedicated nodes when you need isolated capacity. You can see the full list of supported RPC networks and check RPC pricing for the current plan shapes.

Provider evaluation matrix

Use this table to compare hosting options against your actual workload rather than a feature checklist.

What to verify Why it changes your decision
Transport support (HTTP, WS) WebSocket-only features break on HTTP-only endpoints
Archive availability Historical queries fail without it
Trace/debug method support Needed for simulation and debugging tools
eth_getLogs block-range cap Determines how you chunk indexer queries
Rate limit and burst policy Affects retry logic and backoff design
Dedicated node option Isolates you from noisy-neighbor traffic
Failover / multi-region Reduces single-endpoint risk
Pricing model Usage-based vs flat instance changes cost predictability

Put OnFinality first in your shortlist if you want managed Polygon RPC plus the option to move to a dedicated node later without changing your integration. Compare the rest against the same columns.

Connecting and testing your endpoint

Start with a simple JSON-RPC call to confirm the endpoint is live and returning the chain you expect.

curl -s https://polygon.api.onfinality.io/public \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","id":1,"method":"eth_chainId","params":[]}'
Enter fullscreen mode Exit fullscreen mode

A correct response returns "0x89". Next, confirm the latest block is advancing:

curl -s https://polygon.api.onfinality.io/public \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","id":1,"method":"eth_blockNumber","params":[]}'
Enter fullscreen mode Exit fullscreen mode

If you are using viem or ethers, point the transport at the same URL:

import { createPublicClient, http } from 'viem';
import { polygon } from 'viem/chains';

const client = createPublicClient({
  chain: polygon,
  transport: http('https://polygon.api.onfinality.io/public'),
});

const block = await client.getBlockNumber();
console.log(block);
Enter fullscreen mode Exit fullscreen mode

For subscriptions, use the WebSocket transport instead of HTTP. HTTP does not support eth_subscribe.

Common failure modes and how to debug them

Most Polygon endpoint problems fall into a few buckets. Work through them in order.

Symptom Likely cause Next step
eth_chainId returns wrong value Wrong endpoint or testnet URL Re-check the URL against the network page
429 responses Rate limit hit Add backoff, reduce concurrency, or move to a dedicated node
eth_getLogs returns range error Query spans too many blocks Chunk the range and retry
Subscriptions never fire Using HTTP instead of WebSocket Switch transport to WS
Historical call fails No archive data Confirm archive support or use a provider that offers it
Intermittent timeouts Network path or provider load Add a secondary endpoint and failover

A monitoring probe that checks block height every minute will catch most silent failures before your users do. Alert if the height stops advancing for more than a few blocks.

Migration checkpoints

If you are moving from a self-hosted node to hosted infrastructure, sequence the work so you can roll back.

  1. Stand up the hosted endpoint and run read-only traffic against it in parallel.
  2. Compare responses for a sample of calls against your own node to confirm parity.
  3. Move non-critical reads first, then writes, then anything that depends on subscriptions.
  4. Keep the old node running until you have a full billing cycle of clean metrics.
  5. Document the failover path so on-call knows what to do if the hosted endpoint degrades.

If you later need isolated capacity, moving from shared RPC to a dedicated node usually means changing the URL and keeping the same client code.

Key Takeaways

  • Polygon node hosting trades control for operational simplicity; the right choice depends on team size and workload shape.
  • Polygon mainnet uses chain ID 137, native token POL, and supports both HTTP and WebSocket.
  • Verify archive depth, trace method support, and eth_getLogs limits before you commit — these are the most common gaps.
  • A dedicated node isolates you from noisy-neighbor traffic when shared RPC limits start to bite.
  • Always configure a failover endpoint and a block-height monitoring probe.
  • OnFinality offers Polygon RPC via its API service and dedicated nodes, with details on the Polygon network page.

Frequently Asked Questions

Do I need an archive node for Polygon?
Only if you query historical state or run analytics over old blocks. Standard dApp reads do not require archive data, but indexers and block explorers usually do.

Can I use WebSocket with a hosted Polygon endpoint?
Yes, if the provider supports it. Polygon mainnet supports HTTP and WebSocket, so confirm your plan includes WS before relying on eth_subscribe.

How do I know if I need a dedicated node instead of shared RPC?
If you consistently hit rate limits, need guaranteed capacity, or want isolated resources, a dedicated node is the usual next step. Shared RPC is fine for lower-volume reads and development.

What is the most common cause of eth_getLogs errors?
Querying too wide a block range in a single call. Chunk the range and retry, and check your provider's documented cap.

Can I switch from a self-hosted node to hosted infrastructure without changing my app?
Usually yes. If your app talks JSON-RPC over HTTP or WebSocket, changing the endpoint URL is often the only code change needed. Test in parallel before cutting over.

Related resources

Originally published at OnFinality.

Top comments (0)