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

# Polygon RPC 节点

> OrbitFlare 的 Polygon PoS RPC 与 WebSocket 端点：25 至 1000 RPS 的套餐，每档均包含 gRPC 与归档数据，另提供专用实例。

## 概述

OrbitFlare 为 DeFi 协议、游戏和生产级应用提供 Polygon PoS RPC 基础设施。端点按区域绑定，使用与你其他 OrbitFlare 服务相同的许可证密钥进行认证。所有套餐均包含 RPC、WebSocket、gRPC 访问和归档数据。

Polygon 兼容 EVM，因此其 JSON-RPC 接口即标准的 `eth_*` API。

## 端点

| 区域    | 区域代码  | 端点                                                     |
| ----- | ----- | ------------------------------------------------------ |
| 阿姆斯特丹 | `ams` | `https://ams.poly.orbitflare.com?api_key=YOUR_API_KEY` |

通用格式与平台其他部分一致：

```
https://{region}.poly.orbitflare.com?api_key=YOUR_API_KEY
```

<Note>
  Polygon 端点与[身份验证与限制](/cn/authentication)中记录的 Solana 端点相互独立。Solana 使用 `{region}.rpc.orbitflare.com`，Polygon 使用 `{region}.poly.orbitflare.com`。
</Note>

## 身份验证

与 Solana RPC 端点完全一致，将许可证密钥作为查询参数附加：

```bash theme={null}
curl -X POST "https://ams.poly.orbitflare.com?api_key=YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "eth_blockNumber"
  }'
```

<Tip>
  你的许可证密钥位于 [OrbitFlare 控制台](https://orbitflare.com/dashboard)的**许可证**部分。
</Tip>

## 发起 RPC 调用

Polygon 使用与 Ethereum 相同的 JSON-RPC 2.0 格式。请在 POST 请求体中传入 `Content-Type: application/json`：

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST "https://ams.poly.orbitflare.com?api_key=YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "jsonrpc": "2.0",
      "method": "eth_blockNumber",
      "params": [],
      "id": 1
    }'
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch(
    "https://ams.poly.orbitflare.com?api_key=YOUR_API_KEY",
    {
      method: "POST",
      headers: { "Content-Type": "application/json" },
      body: JSON.stringify({
        jsonrpc: "2.0",
        method: "eth_blockNumber",
        params: [],
        id: 1,
      }),
    }
  );
  const data = await response.json();
  console.log("Latest block:", parseInt(data.result, 16));
  ```

  ```python Python theme={null}
  import requests

  response = requests.post(
      "https://ams.poly.orbitflare.com?api_key=YOUR_API_KEY",
      headers={"Content-Type": "application/json"},
      json={
          "jsonrpc": "2.0",
          "method": "eth_blockNumber",
          "params": [],
          "id": 1,
      },
  )
  data = response.json()
  print("Latest block:", int(data["result"], 16))
  ```
</CodeGroup>

## WebSocket 订阅

实时订阅使用 `wss://` 协议，主机与 `api_key` 参数保持一致：

```javascript theme={null}
const ws = new WebSocket(
  "wss://ams.poly.orbitflare.com?api_key=YOUR_API_KEY"
);

ws.on("open", () => {
  ws.send(JSON.stringify({
    jsonrpc: "2.0",
    id: 1,
    method: "eth_subscribe",
    params: ["newHeads"],
  }));
});

ws.on("message", (data) => {
  const msg = JSON.parse(data);
  console.log("New block header:", msg.params?.result);
});
```

## 套餐

吞吐量随套餐提升。RPC、WebSocket、gRPC 访问和归档数据在每一档中均已包含，且无月度额度或请求上限。

| 套餐          | 价格      | 每秒请求数 |
| ----------- | ------- | :---: |
| Free        | \$0/月   |   25  |
| Starter     | \$49/月  |  100  |
| Growth      | \$149/月 |  300  |
| Pro         | \$299/月 |  600  |
| Performance | \$499/月 | 1,000 |

<AccordionGroup>
  <Accordion title="超出速率限制会怎样？">
    超过套餐 RPS 限制的请求将收到 HTTP `429 Too Many Requests` 响应。请在客户端实现指数退避以妥善处理。
  </Accordion>

  <Accordion title="是否有月度额度上限？">
    没有。只要不超过套餐的每秒速率，你可以发送不限总量的请求。
  </Accordion>
</AccordionGroup>

## 专用实例

面向隔离的高吞吐负载，OrbitFlare 同时提供专用 Polygon 节点：

| 功能      | 详情                 |
| ------- | ------------------ |
| **吞吐量** | 自定义，不计量            |
| **硬件**  | 100% 专用资源，隔离环境     |
| **配置**  | 自定义节点配置与参数         |
| **SLA** | 自定义正常运行时间与响应条款     |
| **支持**  | 优先工程支持             |
| **定价**  | 依据吞吐量、区域与 SLA 定制报价 |

<Note>
  专用 Polygon 基础设施按部署报价。请[联系销售](mailto:sales@orbitflare.com)沟通吞吐量、区域与 SLA 需求。
</Note>

## 支持的方法

Polygon 端点提供标准 EVM JSON-RPC API，包括：

| 类别            | 方法                                                                              |
| ------------- | ------------------------------------------------------------------------------- |
| **区块**        | `eth_blockNumber`、`eth_getBlockByHash`、`eth_getBlockByNumber`                   |
| **交易**        | `eth_sendRawTransaction`、`eth_getTransactionByHash`、`eth_getTransactionReceipt` |
| **账户**        | `eth_getBalance`、`eth_getCode`、`eth_getStorageAt`、`eth_getTransactionCount`     |
| **合约**        | `eth_call`、`eth_estimateGas`、`eth_getLogs`                                      |
| **网络**        | `net_version`、`eth_chainId`、`eth_gasPrice`、`eth_feeHistory`                     |
| **WebSocket** | `eth_subscribe`（newHeads、logs、newPendingTransactions）                           |

<Note>
  Polygon PoS 主网使用 `chainId: 137`，Amoy 测试网使用 `chainId: 80002`。
</Note>

## 开始使用

<CardGroup cols={2}>
  <Card title="身份验证与限制" icon="key" href="/cn/authentication">
    了解 API 密钥的工作方式、端点格式、速率限制与错误语义。
  </Card>

  <Card title="联系销售" icon="envelope" href="mailto:sales@orbitflare.com">
    就专用 Polygon 实例与企业条款与 OrbitFlare 团队沟通。
  </Card>
</CardGroup>
