TriportRPC

eth_chainId

Polygon / https://triport.io/polygon

Minimum tier: Free

Polygon method guide

Last updated:

eth_chainId returns the chain ID of the connected network as a hex-encoded integer. On Polygon mainnet this is the constant 0x89 (137 decimal). It is the cheapest possible call against the Polygon RPC surface — one request resolves to a single immutable constant — which makes it a common liveness ping.

Its primary purpose is EIP-155 replay protection: the chain ID is mixed into the transaction signature so that a transaction signed for Polygon cannot be replayed on another EVM chain. Wallets and signing libraries call it once before constructing a transaction. Because the value never changes for a given network, clients should fetch it once per connection and cache it indefinitely (TTL = ∞).

This method belongs to the free polygon_read_rpc category, so it is available on every tier starting at Free. It takes no parameters. If you are targeting the Polygon Amoy testnet instead of mainnet, the returned value is 0x13882 (80002 decimal).

Note: net_version returns the same chain identity as a decimal string ("137") rather than a hex quantity. Prefer eth_chainId for EIP-155 and modern signing flows; net_version exists mainly for legacy Web3.js (< 4.x) chain detection.

Parameters

This method takes no parameters.

Returns

eth_chainId return value
FieldType
resultobject

Examples

curl https://triport.io/polygon \
  -X POST -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer <api-key>' \
  -d '{"jsonrpc":"2.0","id":1,"method":"eth_chainId","params":[]}'
const res = await fetch("https://triport.io/polygon", {
  method: "POST",
  headers: { "Content-Type": "application/json", Authorization: "Bearer <api-key>" },
  body: JSON.stringify({
  "jsonrpc": "2.0",
  "id": 1,
  "method": "eth_chainId",
  "params": []
}),
});
const data = await res.json();
import requests
resp = requests.post(
    "https://triport.io/polygon",
    headers={"Authorization": "Bearer <api-key>"},
    json={"jsonrpc":"2.0","id":1,"method":"eth_chainId","params":[]},
)
print(resp.json())

Usage

  1. Transport: HTTP (JSON-RPC).
  2. Chain: Polygon.
  3. Clusters: mainnet.
  4. Credit cost: 1 per call.

FAQ

What does eth_chainId do?
Returns the Polygon network's EIP-155 chain ID as a hex string — 0x89 (137) on mainnet.
How many credits does eth_chainId cost?
eth_chainId costs 1 credit(s) per call on Triport by default.
Is eth_chainId available over WebSocket?
eth_chainId is an HTTP JSON-RPC method.