> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polynode.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Polygon RPC

> Authenticated Polygon RPC with priority transaction routing

## Endpoint

```
https://rpc.polynode.dev
```

Standard Ethereum JSON-RPC over HTTPS for Polygon reads and priority transaction submission. Change your HTTP RPC URL and add your API key. WebSocket subscriptions and privileged node methods are intentionally outside this endpoint's current scope.

## Authentication

Every request requires a valid polynode API key. Pass it as a header:

```
x-api-key: YOUR_API_KEY
```

Or as a Bearer token:

```
Authorization: Bearer YOUR_API_KEY
```

Requests without a valid key receive a `-32000` error.

## Rate Limit

Active Growth and Enterprise accounts are rate-limited to **50 requests per second** per account. Exceeding this returns a `-32005` error.

Batch requests count as one HTTP request and may contain up to **1,000 JSON-RPC calls**. Calls within a batch are processed sequentially.

## Transport

The production endpoint is HTTP/HTTPS only. It does not currently accept WebSocket upgrades, so `eth_subscribe`, `eth_unsubscribe`, and `newHeads` are not available at `rpc.polynode.dev` yet.

## Supported Methods

| Method                      | Source               | Description                               |
| --------------------------- | -------------------- | ----------------------------------------- |
| `eth_sendRawTransaction`    | **Priority routing** | P2P delivery to block-producing validator |
| `eth_chainId`               | Local                | Returns `0x89` (137)                      |
| `eth_blockNumber`           | Local cache          | Latest cached reference/P2P chain tip     |
| `eth_gasPrice`              | Local                | Calibrated for optimal block positioning  |
| `net_version`               | Local                | Returns `137`                             |
| `net_peerCount`             | Local                | Connected P2P peer count                  |
| `web3_clientVersion`        | Local                | Returns `PolyNode/1.0.0`                  |
| `eth_call`                  | Polygon upstream     | Contract read calls                       |
| `eth_getBalance`            | Polygon upstream     | Account balance queries                   |
| `eth_getTransactionCount`   | Polygon upstream     | Nonce queries                             |
| `eth_estimateGas`           | Polygon upstream     | Gas estimation                            |
| `eth_getBlockByNumber`      | Polygon upstream     | Block data                                |
| `eth_getTransactionReceipt` | Polygon upstream     | Transaction receipts                      |
| `eth_getLogs`               | Polygon upstream     | Log queries                               |

<Warning>
  **Historical availability follows the configured Polygon upstream.** Current production can answer historical block and state queries, but PolyNode does not operate an independent archive behind this endpoint and does not guarantee every historical height. Use `latest` or recent blocks when archival completeness matters.
</Warning>

## Common Queries

### Check a wallet's MATIC balance

```bash theme={null}
curl -X POST https://rpc.polynode.dev \
  -H "Content-Type: application/json" \
  -H "x-api-key: YOUR_API_KEY" \
  -d '{
    "jsonrpc": "2.0",
    "method": "eth_getBalance",
    "params": ["0xYOUR_WALLET_ADDRESS", "latest"],
    "id": 1
  }'
```

The result is the balance in wei (hex). Divide by 10^18 for MATIC.

### Check a wallet's USDC balance

Use `eth_call` with the ERC-20 `balanceOf(address)` function:

```bash theme={null}
curl -X POST https://rpc.polynode.dev \
  -H "Content-Type: application/json" \
  -H "x-api-key: YOUR_API_KEY" \
  -d '{
    "jsonrpc": "2.0",
    "method": "eth_call",
    "params": [{
      "to": "0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359",
      "data": "0x70a08231000000000000000000000000YOUR_WALLET_ADDRESS_WITHOUT_0x"
    }, "latest"],
    "id": 1
  }'
```

Replace `YOUR_WALLET_ADDRESS_WITHOUT_0x` with the 40-character address (no `0x` prefix), zero-padded to 64 characters. The result is the balance in the token's smallest unit (hex). USDC has 6 decimals.

**Common Polygon token contracts:**

| Token            | Address                                      |
| ---------------- | -------------------------------------------- |
| USDC             | `0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359` |
| USDC.e (bridged) | `0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174` |
| USDT             | `0xc2132D05D31c914a87C6611C10748AEb04B58e8F` |
| WMATIC           | `0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270` |
| WETH             | `0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619` |

### Read any contract function

The `data` field for `eth_call` is the function selector (first 4 bytes of the keccak256 hash) followed by ABI-encoded arguments.

Common selectors:

| Function                     | Selector     | Arguments                             |
| ---------------------------- | ------------ | ------------------------------------- |
| `balanceOf(address)`         | `0x70a08231` | address (32 bytes, left-padded)       |
| `totalSupply()`              | `0x18160ddd` | none                                  |
| `decimals()`                 | `0x313ce567` | none                                  |
| `symbol()`                   | `0x95d89b41` | none                                  |
| `name()`                     | `0x06fdde03` | none                                  |
| `allowance(address,address)` | `0xdd62ed3e` | owner (32 bytes) + spender (32 bytes) |

### Get the current block number

```bash theme={null}
curl -X POST https://rpc.polynode.dev \
  -H "Content-Type: application/json" \
  -H "x-api-key: YOUR_API_KEY" \
  -d '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}'
```

### Get a transaction receipt

```bash theme={null}
curl -X POST https://rpc.polynode.dev \
  -H "Content-Type: application/json" \
  -H "x-api-key: YOUR_API_KEY" \
  -d '{
    "jsonrpc": "2.0",
    "method": "eth_getTransactionReceipt",
    "params": ["0xYOUR_TX_HASH"],
    "id": 1
  }'
```

## Batch Requests

Send multiple calls in a single HTTP request:

```bash theme={null}
curl -X POST https://rpc.polynode.dev \
  -H "Content-Type: application/json" \
  -H "x-api-key: YOUR_API_KEY" \
  -d '[
    {"jsonrpc":"2.0","method":"eth_chainId","params":[],"id":1},
    {"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":2},
    {"jsonrpc":"2.0","method":"eth_gasPrice","params":[],"id":3}
  ]'
```

Batch requests count as a single HTTP request against the rate limit and are capped at 1,000 calls.

## Error Codes

| Code     | Meaning                                       |
| -------- | --------------------------------------------- |
| `-32000` | Missing or invalid API key                    |
| `-32005` | Rate limit exceeded (max 50 requests/second)  |
| `-32600` | Invalid request, including an oversized batch |
| `-32601` | Method not available                          |
| `-32602` | Invalid parameters                            |
| `-32603` | Upstream error                                |
