# JSON-RPC

> 原文地址: https://docs.blockvectra.com/zh/api/json-rpc/

## 概述

所有请求按 **计算单位（CU）** 计量，并按 key 进行限流。

* **入口**：`POST /v1/{chain}/{api_key}`（key 放在路径中）或 `POST /v1/{chain}`（key 放在请求头中）。Robinhood Chain 的 `{chain}` 是 `robinhood_mainnet`：`https://api.blockvectra.com/v1/robinhood_mainnet`。同一个 [API key](https://docs.blockvectra.com/zh/quickstart/#1-获取-api-key) 可用于所有已支持的链
* **协议**：HTTP `POST`，单个调用或批量
* **计量**：请求到达时，其全部 CU 开销立即计入该 key 的突发容量；每个被受理并得到应答的调用按该方法公布的 CU 权重计费，不计费的情况见[错误参考](https://docs.blockvectra.com/zh/errors/)。按小时账期结算扣费（向下取整为整单位，余数结转下一期，账期结束约 15 分钟后执行）
* **以太坊**：有自己的方法清单，状态窗口以 `state_window_blocks` 为准，见[支持的链 → 以太坊](https://docs.blockvectra.com/zh/chains/#以太坊)。

关于全部方法的完整参数 schema、方法签名与交互式测试，请参阅[完整参考](https://docs.blockvectra.com/zh/api/json-rpc/reference/)。关于路径版本、向后兼容规则与对接建议，请参阅 [API 版本与兼容性](https://docs.blockvectra.com/zh/api/versioning/)。

获取 API key 与发出第一个请求见[快速上手](https://docs.blockvectra.com/zh/quickstart/)，其中也说明了 key 的传递方式与批量请求。

## 常用调用示例

常用调用的完整示例。

### 日志查询（`eth_getLogs`）

按合约地址和 topic 过滤最近一段区块的日志——这里以 ERC-20 的 `Transfer` 事件（topic 为 `0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef`）为例。`eth_getLogs` 的当前 CU 权重见下方[CU 计量规则](#cu-计量规则)表；区块跨度超过该链 `max_logs_block_range`（取自 `GET /v1/chains`）的请求会被拒绝并返回 `-32602`。

**cURL**

```bash
export BLOCKVECTRA_API_KEY=rgw_your_api_key

curl -X POST "https://api.blockvectra.com/v1/robinhood_mainnet" \
  -H 'Content-Type: application/json' \
  -H "x-api-key: $BLOCKVECTRA_API_KEY" \
  -d '{
    "jsonrpc": "2.0",
    "method": "eth_getLogs",
    "params": [{
      "fromBlock": "0x45a2409",
      "toBlock": "0x45a2609",
      "address": "0x1111111111111111111111111111111111111111",
      "topics": ["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"]
    }],
    "id": 1
  }'
```


  **TypeScript**

```ts
// 运行：npx tsx example.mts
import { createPublicClient, http } from 'viem'

const apiKey = process.env.BLOCKVECTRA_API_KEY!
const client = createPublicClient({
  transport: http('https://api.blockvectra.com/v1/robinhood_mainnet', { fetchOptions: { headers: { 'x-api-key': apiKey } } }),
})

const TRANSFER_TOPIC = '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef'
const latest = await client.getBlockNumber()

const logs = await client.getLogs({
  address: '0x1111111111111111111111111111111111111111',
  topics: [TRANSFER_TOPIC],
  fromBlock: latest > 100n ? latest - 100n : 0n,
  toBlock: latest,
})
console.log(logs.length)
```


  **Python**

```python
# 运行：uv run --with web3 python example.py
import os
from web3 import Web3

api_key = os.environ["BLOCKVECTRA_API_KEY"]
w3 = Web3(
    Web3.HTTPProvider(
        "https://api.blockvectra.com/v1/robinhood_mainnet",
        request_kwargs={"headers": {"Content-Type": "application/json", "x-api-key": api_key}},
    )
)

TRANSFER_TOPIC = "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"
latest = w3.eth.block_number

logs = w3.eth.get_logs(
    {
        "address": "0x1111111111111111111111111111111111111111",
        "topics": [TRANSFER_TOPIC],
        "fromBlock": max(latest - 100, 0),
        "toBlock": latest,
    }
)
print(len(logs))
```


  **Go**

```go
// 运行：go mod init example && go get github.com/ethereum/go-ethereum && go mod tidy && go run .
package main

import (
	"context"
	"fmt"
	"log"
	"math/big"
	"os"

	"github.com/ethereum/go-ethereum"
	"github.com/ethereum/go-ethereum/common"
	"github.com/ethereum/go-ethereum/ethclient"
	"github.com/ethereum/go-ethereum/rpc"
)

var transferTopic = common.HexToHash(
	"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
)

func main() {
	apiKey := os.Getenv("BLOCKVECTRA_API_KEY")
	ctx := context.Background()

	rpcClient, err := rpc.DialOptions(ctx, "https://api.blockvectra.com/v1/robinhood_mainnet", rpc.WithHeader("x-api-key", apiKey))
	if err != nil {
		log.Fatal(err)
	}
	client := ethclient.NewClient(rpcClient)

	latest, err := client.BlockNumber(ctx)
	if err != nil {
		log.Fatal(err)
	}
	from := uint64(0)
	if latest > 100 {
		from = latest - 100
	}

	address := common.HexToAddress("0x1111111111111111111111111111111111111111")
	logs, err := client.FilterLogs(ctx, ethereum.FilterQuery{
		FromBlock: new(big.Int).SetUint64(from),
		ToBlock:   new(big.Int).SetUint64(latest),
		Addresses: []common.Address{address},
		Topics:    [][]common.Hash{{transferTopic}},
	})
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(len(logs))
}
```


  **Rust**

添加到 `Cargo.toml`：

```toml
[dependencies]
alloy = { version = "1", features = ["provider-http", "rpc-types"] }
tokio = { version = "1", features = ["full"] }
eyre = "0.6"
reqwest = { version = "0.13", default-features = false }
```

```rust
// 运行：cargo run
use alloy::primitives::{address, b256};
use alloy::providers::{Provider, ProviderBuilder};
use alloy::rpc::types::Filter;

const TRANSFER_TOPIC: alloy::primitives::B256 =
    b256!("ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef");

#[tokio::main]
async fn main() -> eyre::Result<()> {
    let api_key = std::env::var("BLOCKVECTRA_API_KEY").unwrap_or_default();
    let rpc_url: reqwest::Url = "https://api.blockvectra.com/v1/robinhood_mainnet".parse()?;

    let mut headers = reqwest::header::HeaderMap::new();
    headers.insert("x-api-key", api_key.parse()?);
    let http_client = reqwest::Client::builder().default_headers(headers).build()?;

    let provider = ProviderBuilder::new().connect_reqwest(http_client, rpc_url);

    let latest = provider.get_block_number().await?;
    let from = latest.saturating_sub(100);

    let filter = Filter::new()
        .address(address!("1111111111111111111111111111111111111111"))
        .event_signature(TRANSFER_TOPIC)
        .from_block(from)
        .to_block(latest);

    let logs = provider.get_logs(&filter).await?;
    println!("{}", logs.len());

    Ok(())
}
```


### 交易 Trace（`debug_traceTransaction`）

用 `callTracer` 追踪一笔交易的内部调用。`debug_traceTransaction` 的当前 CU 权重见下方[CU 计量规则](#cu-计量规则)表。和其他读状态的方法一样，目标区块若超出该链的近期状态窗口就会被拒绝（`-32011`）。窗口大小为该链的 `state_window_blocks`（取自 `GET /v1/chains`）。在提供 trace 的链上，历史 trace 请使用 [Data API](https://docs.blockvectra.com/zh/api/data/)。

**cURL**

```bash
export BLOCKVECTRA_API_KEY=rgw_your_api_key

curl -X POST "https://api.blockvectra.com/v1/robinhood_mainnet" \
  -H 'Content-Type: application/json' \
  -H "x-api-key: $BLOCKVECTRA_API_KEY" \
  -d '{
    "jsonrpc": "2.0",
    "method": "debug_traceTransaction",
    "params": ["0xYOUR_TRANSACTION_HASH", {"tracer": "callTracer"}],
    "id": 1
  }'
```


  **TypeScript**

```ts
// 运行：npx tsx example.mts
import { createPublicClient, http } from 'viem'

const apiKey = process.env.BLOCKVECTRA_API_KEY!
const client = createPublicClient({
  transport: http('https://api.blockvectra.com/v1/robinhood_mainnet', { fetchOptions: { headers: { 'x-api-key': apiKey } } }),
})

const txHash = '0xYOUR_TRANSACTION_HASH'
const trace = await client.request({
  method: 'debug_traceTransaction' as any,
  params: [txHash, { tracer: 'callTracer' }] as any,
})
console.log(trace)
```


  **Python**

```python
# 运行：uv run --with web3 python example.py
import os
from web3 import Web3

api_key = os.environ["BLOCKVECTRA_API_KEY"]
w3 = Web3(
    Web3.HTTPProvider(
        "https://api.blockvectra.com/v1/robinhood_mainnet",
        request_kwargs={"headers": {"Content-Type": "application/json", "x-api-key": api_key}},
    )
)

tx_hash = "0xYOUR_TRANSACTION_HASH"
trace = w3.manager.request_blocking(
    "debug_traceTransaction", [tx_hash, {"tracer": "callTracer"}]
)
print(trace)
```


  **Go**

```go
// 运行：go mod init example && go get github.com/ethereum/go-ethereum && go mod tidy && go run .
package main

import (
	"context"
	"encoding/json"
	"fmt"
	"log"
	"os"

	"github.com/ethereum/go-ethereum/rpc"
)

func main() {
	apiKey := os.Getenv("BLOCKVECTRA_API_KEY")
	ctx := context.Background()

	client, err := rpc.DialOptions(ctx, "https://api.blockvectra.com/v1/robinhood_mainnet", rpc.WithHeader("x-api-key", apiKey))
	if err != nil {
		log.Fatal(err)
	}

	txHash := "0xYOUR_TRANSACTION_HASH"
	var trace json.RawMessage
	err = client.CallContext(ctx, &trace, "debug_traceTransaction", txHash, map[string]string{
		"tracer": "callTracer",
	})
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(string(trace))
}
```


  **Rust**

添加到 `Cargo.toml`：

```toml
[dependencies]
alloy = { version = "1", features = ["provider-http", "rpc-types"] }
tokio = { version = "1", features = ["full"] }
eyre = "0.6"
reqwest = { version = "0.13", default-features = false }
serde_json = "1"
```

```rust
// 运行：cargo run
use alloy::providers::{Provider, ProviderBuilder};
use serde_json::json;

#[tokio::main]
async fn main() -> eyre::Result<()> {
    let api_key = std::env::var("BLOCKVECTRA_API_KEY").unwrap_or_default();
    let rpc_url: reqwest::Url = "https://api.blockvectra.com/v1/robinhood_mainnet".parse()?;

    let mut headers = reqwest::header::HeaderMap::new();
    headers.insert("x-api-key", api_key.parse()?);
    let http_client = reqwest::Client::builder().default_headers(headers).build()?;

    let provider = ProviderBuilder::new().connect_reqwest(http_client, rpc_url);

    let tx_hash = "0xYOUR_TRANSACTION_HASH";
    let trace: serde_json::Value = provider
        .client()
        .request("debug_traceTransaction", (tx_hash, json!({ "tracer": "callTracer" })))
        .await?;
    println!("{trace}");

    Ok(())
}
```


## CU 计量规则

各 JSON-RPC 方法的计算单位（CU）权重。

| 方法名 | 权重（CU） |
| --- | --- |
| `eth_blockNumber` | 1 |
| `eth_chainId` | 1 |
| `eth_getBlockByNumber` | 5 |
| `eth_blobBaseFee` | 10 |
| `eth_feeHistory` | 10 |
| `eth_gasPrice` | 10 |
| `eth_getBalance` | 10 |
| `eth_getBlockByHash` | 10 |
| `eth_getBlockReceipts` | 10 |
| `eth_getBlockTransactionCountByHash` | 10 |
| `eth_getBlockTransactionCountByNumber` | 10 |
| `eth_getCode` | 10 |
| `eth_getHeaderByHash` | 10 |
| `eth_getHeaderByNumber` | 10 |
| `eth_getProof` | 10 |
| `eth_getRawTransactionByBlockHashAndIndex` | 10 |
| `eth_getRawTransactionByBlockNumberAndIndex` | 10 |
| `eth_getRawTransactionByHash` | 10 |
| `eth_getStorageAt` | 10 |
| `eth_getTransactionByBlockHashAndIndex` | 10 |
| `eth_getTransactionByBlockNumberAndIndex` | 10 |
| `eth_getTransactionByHash` | 10 |
| `eth_getTransactionCount` | 10 |
| `eth_getTransactionReceipt` | 10 |
| `eth_getUncleByBlockHashAndIndex` | 10 |
| `eth_getUncleByBlockNumberAndIndex` | 10 |
| `eth_getUncleCountByBlockHash` | 10 |
| `eth_getUncleCountByBlockNumber` | 10 |
| `eth_maxPriorityFeePerGas` | 10 |
| `eth_syncing` | 10 |
| `net_version` | 10 |
| `web3_clientVersion` | 10 |
| `web3_sha3` | 10 |
| `eth_call` | 15 |
| `eth_createAccessList` | 20 |
| `eth_estimateGas` | 20 |
| `eth_simulateV1` | 20 |
| `eth_getLogs` | 30 |
| `eth_sendRawTransaction` | 30 |
| `debug_traceBlockByHash` | 100 |
| `debug_traceBlockByNumber` | 100 |
| `debug_traceCall` | 100 |
| `debug_traceTransaction` | 100 |
| `trace_block` | 100 |
| `trace_call` | 100 |
| `trace_get` | 100 |
| `trace_replayTransaction` | 100 |
| `trace_transaction` | 100 |

## 方法策略

可用方法因链而异，下面按链分别列出，其他说明见[支持的链](https://docs.blockvectra.com/zh/chains/)。只有匹配允许的方法名或模式的方法才可调用，其他方法返回 `-32601 method not available`。

**以下各链均允许:**

- `eth_blockNumber`
- `eth_call`
- `eth_chainId`
- `eth_estimateGas`
- `eth_gasPrice`
- `eth_getBalance`
- `eth_getBlockByHash`
- `eth_getBlockByNumber`
- `eth_getBlockTransactionCountByHash`
- `eth_getBlockTransactionCountByNumber`
- `eth_getCode`
- `eth_getLogs`
- `eth_getStorageAt`
- `eth_getTransactionByBlockHashAndIndex`
- `eth_getTransactionByBlockNumberAndIndex`
- `eth_getTransactionByHash`
- `eth_getTransactionCount`
- `eth_getTransactionReceipt`
- `eth_sendRawTransaction`
- `eth_syncing`
- `net_version`
- `web3_clientVersion`

### Arbitrum One

eth_getLogs 单次最大块跨度 1,000 个区块；状态窗口 5,000 个区块

**另外允许:**

- `debug_traceBlockByHash`
- `debug_traceBlockByNumber`
- `debug_traceCall`
- `debug_traceTransaction`
- `eth_blobBaseFee`
- `eth_createAccessList`
- `eth_feeHistory`
- `eth_getBlockReceipts`
- `eth_getHeaderByHash`
- `eth_getHeaderByNumber`
- `eth_getProof`
- `eth_getRawTransactionByBlockHashAndIndex`
- `eth_getRawTransactionByBlockNumberAndIndex`
- `eth_getRawTransactionByHash`
- `eth_getUncleByBlockHashAndIndex`
- `eth_getUncleByBlockNumberAndIndex`
- `eth_getUncleCountByBlockHash`
- `eth_getUncleCountByBlockNumber`
- `eth_maxPriorityFeePerGas`
- `eth_simulateV1`
- `web3_sha3`

### Arc

eth_getLogs 单次最大块跨度 1,000 个区块；状态窗口：—

**另外允许:**

- `eth_blobBaseFee`
- `eth_createAccessList`
- `eth_feeHistory`
- `eth_getBlockReceipts`
- `eth_getHeaderByHash`
- `eth_getHeaderByNumber`
- `eth_getProof`
- `eth_getRawTransactionByBlockHashAndIndex`
- `eth_getRawTransactionByBlockNumberAndIndex`
- `eth_getRawTransactionByHash`
- `eth_getUncleByBlockHashAndIndex`
- `eth_getUncleByBlockNumberAndIndex`
- `eth_getUncleCountByBlockHash`
- `eth_getUncleCountByBlockNumber`
- `eth_maxPriorityFeePerGas`
- `eth_simulateV1`
- `web3_sha3`

### Avalanche C-Chain

eth_getLogs 单次最大块跨度 1,000 个区块；状态窗口 128 个区块

**另外允许:**

- `debug_traceBlockByHash`
- `debug_traceBlockByNumber`
- `debug_traceCall`
- `debug_traceTransaction`
- `eth_createAccessList`
- `eth_feeHistory`
- `eth_getBlockReceipts`
- `eth_getHeaderByHash`
- `eth_getHeaderByNumber`
- `eth_getProof`
- `eth_getRawTransactionByBlockHashAndIndex`
- `eth_getRawTransactionByBlockNumberAndIndex`
- `eth_getRawTransactionByHash`
- `eth_getUncleByBlockHashAndIndex`
- `eth_getUncleByBlockNumberAndIndex`
- `eth_getUncleCountByBlockHash`
- `eth_getUncleCountByBlockNumber`
- `eth_maxPriorityFeePerGas`
- `web3_sha3`

### Base

eth_getLogs 单次最大块跨度 1,000 个区块；状态窗口 10,000 个区块

**另外允许:**

- `eth_maxPriorityFeePerGas`
- `eth_blobBaseFee`
- `eth_feeHistory`
- `eth_createAccessList`
- `eth_getProof`
- `eth_simulateV1`
- `eth_getBlockReceipts`
- `eth_getRawTransactionByHash`
- `eth_getRawTransactionByBlockHashAndIndex`
- `eth_getRawTransactionByBlockNumberAndIndex`
- `eth_getUncleCountByBlockNumber`
- `eth_getUncleCountByBlockHash`
- `eth_getUncleByBlockNumberAndIndex`
- `eth_getUncleByBlockHashAndIndex`
- `eth_getHeaderByNumber`
- `eth_getHeaderByHash`
- `web3_sha3`

### Berachain

eth_getLogs 单次最大块跨度 1,000 个区块；状态窗口 9,000 个区块

**另外允许:**

- `eth_blobBaseFee`
- `eth_createAccessList`
- `eth_feeHistory`
- `eth_getBlockReceipts`
- `eth_getHeaderByHash`
- `eth_getHeaderByNumber`
- `eth_getProof`
- `eth_getRawTransactionByBlockHashAndIndex`
- `eth_getRawTransactionByBlockNumberAndIndex`
- `eth_getRawTransactionByHash`
- `eth_getUncleByBlockHashAndIndex`
- `eth_getUncleByBlockNumberAndIndex`
- `eth_getUncleCountByBlockHash`
- `eth_getUncleCountByBlockNumber`
- `eth_maxPriorityFeePerGas`
- `eth_simulateV1`
- `web3_sha3`

### Boba

eth_getLogs 单次最大块跨度 1,000 个区块；状态窗口 80,000 个区块

**另外允许:**

- `eth_blobBaseFee`
- `eth_createAccessList`
- `eth_feeHistory`
- `eth_getBlockReceipts`
- `eth_getHeaderByHash`
- `eth_getHeaderByNumber`
- `eth_getProof`
- `eth_getRawTransactionByBlockHashAndIndex`
- `eth_getRawTransactionByBlockNumberAndIndex`
- `eth_getRawTransactionByHash`
- `eth_getUncleByBlockHashAndIndex`
- `eth_getUncleByBlockNumberAndIndex`
- `eth_getUncleCountByBlockHash`
- `eth_getUncleCountByBlockNumber`
- `eth_maxPriorityFeePerGas`
- `eth_simulateV1`
- `web3_sha3`

### BNB Smart Chain

eth_getLogs 单次最大块跨度 1,000 个区块；状态窗口 100 个区块

**另外允许:**

- `eth_feeHistory`
- `eth_getBlockReceipts`
- `eth_maxPriorityFeePerGas`

### Celo

eth_getLogs 单次最大块跨度 1,000 个区块；状态窗口 864,000 个区块

**另外允许:**

- `eth_blobBaseFee`
- `eth_createAccessList`
- `eth_feeHistory`
- `eth_getBlockReceipts`
- `eth_getHeaderByHash`
- `eth_getHeaderByNumber`
- `eth_getProof`
- `eth_getRawTransactionByBlockHashAndIndex`
- `eth_getRawTransactionByBlockNumberAndIndex`
- `eth_getRawTransactionByHash`
- `eth_getUncleByBlockHashAndIndex`
- `eth_getUncleByBlockNumberAndIndex`
- `eth_getUncleCountByBlockHash`
- `eth_getUncleCountByBlockNumber`
- `eth_maxPriorityFeePerGas`
- `eth_simulateV1`
- `web3_sha3`

### 以太坊

eth_getLogs 单次最大块跨度 1,000 个区块；状态窗口 250,000 个区块

**另外允许:**

- `debug_traceBlockByHash`
- `debug_traceBlockByNumber`
- `debug_traceCall`
- `debug_traceTransaction`
- `eth_blobBaseFee`
- `eth_createAccessList`
- `eth_feeHistory`
- `eth_getBlockReceipts`
- `eth_getProof`
- `eth_maxPriorityFeePerGas`
- `trace_block`
- `trace_call`
- `trace_get`
- `trace_replayTransaction`
- `trace_transaction`
- `web3_sha3`

### Ethereum Sepolia

eth_getLogs 单次最大块跨度 1,000 个区块；状态窗口：—

**另外允许:**

- `eth_blobBaseFee`
- `eth_createAccessList`
- `eth_feeHistory`
- `eth_getBlockReceipts`
- `eth_getProof`
- `eth_maxPriorityFeePerGas`
- `web3_sha3`

### Fraxtal

eth_getLogs 单次最大块跨度 1,000 个区块；状态窗口 10,000 个区块

**另外允许:**

- `eth_blobBaseFee`
- `eth_createAccessList`
- `eth_feeHistory`
- `eth_getBlockReceipts`
- `eth_getHeaderByHash`
- `eth_getHeaderByNumber`
- `eth_getProof`
- `eth_getRawTransactionByBlockHashAndIndex`
- `eth_getRawTransactionByBlockNumberAndIndex`
- `eth_getRawTransactionByHash`
- `eth_getUncleByBlockHashAndIndex`
- `eth_getUncleByBlockNumberAndIndex`
- `eth_getUncleCountByBlockHash`
- `eth_getUncleCountByBlockNumber`
- `eth_maxPriorityFeePerGas`
- `eth_simulateV1`
- `web3_sha3`

### Gnosis

eth_getLogs 单次最大块跨度 1,000 个区块；状态窗口 262,000 个区块

**另外允许:**

- `eth_blobBaseFee`
- `eth_createAccessList`
- `eth_feeHistory`
- `eth_getBlockReceipts`
- `eth_getHeaderByHash`
- `eth_getHeaderByNumber`
- `eth_getProof`
- `eth_getRawTransactionByBlockHashAndIndex`
- `eth_getRawTransactionByBlockNumberAndIndex`
- `eth_getRawTransactionByHash`
- `eth_getUncleByBlockHashAndIndex`
- `eth_getUncleByBlockNumberAndIndex`
- `eth_getUncleCountByBlockHash`
- `eth_getUncleCountByBlockNumber`
- `eth_maxPriorityFeePerGas`
- `eth_simulateV1`
- `web3_sha3`

### HyperEVM

eth_getLogs 单次最大块跨度 1,000 个区块；状态窗口：—

**另外允许:**

- `eth_feeHistory`
- `eth_getBlockReceipts`
- `eth_maxPriorityFeePerGas`

### Ink

eth_getLogs 单次最大块跨度 1,000 个区块；状态窗口 9,000 个区块

**另外允许:**

- `eth_blobBaseFee`
- `eth_createAccessList`
- `eth_feeHistory`
- `eth_getBlockReceipts`
- `eth_getHeaderByHash`
- `eth_getHeaderByNumber`
- `eth_getProof`
- `eth_getRawTransactionByBlockHashAndIndex`
- `eth_getRawTransactionByBlockNumberAndIndex`
- `eth_getRawTransactionByHash`
- `eth_getUncleByBlockHashAndIndex`
- `eth_getUncleByBlockNumberAndIndex`
- `eth_getUncleCountByBlockHash`
- `eth_getUncleCountByBlockNumber`
- `eth_maxPriorityFeePerGas`
- `eth_simulateV1`
- `web3_sha3`

### Katana

eth_getLogs 单次最大块跨度 1,000 个区块；状态窗口 86,400 个区块

**另外允许:**

- `eth_blobBaseFee`
- `eth_createAccessList`
- `eth_feeHistory`
- `eth_getBlockReceipts`
- `eth_getHeaderByHash`
- `eth_getHeaderByNumber`
- `eth_getProof`
- `eth_getRawTransactionByBlockHashAndIndex`
- `eth_getRawTransactionByBlockNumberAndIndex`
- `eth_getRawTransactionByHash`
- `eth_getUncleByBlockHashAndIndex`
- `eth_getUncleByBlockNumberAndIndex`
- `eth_getUncleCountByBlockHash`
- `eth_getUncleCountByBlockNumber`
- `eth_maxPriorityFeePerGas`
- `eth_simulateV1`
- `web3_sha3`

### Linea

eth_getLogs 单次最大块跨度 1,000 个区块；状态窗口 128 个区块

**另外允许:**

- `eth_blobBaseFee`
- `eth_createAccessList`
- `eth_feeHistory`
- `eth_getBlockReceipts`
- `eth_getHeaderByHash`
- `eth_getHeaderByNumber`
- `eth_getProof`
- `eth_getRawTransactionByBlockHashAndIndex`
- `eth_getRawTransactionByBlockNumberAndIndex`
- `eth_getRawTransactionByHash`
- `eth_getUncleByBlockHashAndIndex`
- `eth_getUncleByBlockNumberAndIndex`
- `eth_getUncleCountByBlockHash`
- `eth_getUncleCountByBlockNumber`
- `eth_maxPriorityFeePerGas`
- `eth_simulateV1`
- `web3_sha3`

### Metal L2

eth_getLogs 单次最大块跨度 1,000 个区块；状态窗口 10,000 个区块

**另外允许:**

- `eth_blobBaseFee`
- `eth_createAccessList`
- `eth_feeHistory`
- `eth_getBlockReceipts`
- `eth_getHeaderByHash`
- `eth_getHeaderByNumber`
- `eth_getProof`
- `eth_getRawTransactionByBlockHashAndIndex`
- `eth_getRawTransactionByBlockNumberAndIndex`
- `eth_getRawTransactionByHash`
- `eth_getUncleByBlockHashAndIndex`
- `eth_getUncleByBlockNumberAndIndex`
- `eth_getUncleCountByBlockHash`
- `eth_getUncleCountByBlockNumber`
- `eth_maxPriorityFeePerGas`
- `eth_simulateV1`
- `web3_sha3`

### Mode

eth_getLogs 单次最大块跨度 1,000 个区块；状态窗口 10,000 个区块

**另外允许:**

- `eth_blobBaseFee`
- `eth_createAccessList`
- `eth_feeHistory`
- `eth_getBlockReceipts`
- `eth_getHeaderByHash`
- `eth_getHeaderByNumber`
- `eth_getProof`
- `eth_getRawTransactionByBlockHashAndIndex`
- `eth_getRawTransactionByBlockNumberAndIndex`
- `eth_getRawTransactionByHash`
- `eth_getUncleByBlockHashAndIndex`
- `eth_getUncleByBlockNumberAndIndex`
- `eth_getUncleCountByBlockHash`
- `eth_getUncleCountByBlockNumber`
- `eth_maxPriorityFeePerGas`
- `eth_simulateV1`
- `web3_sha3`

### OP Mainnet

eth_getLogs 单次最大块跨度 1,000 个区块；状态窗口 1,296,000 个区块

**另外允许:**

- `eth_blobBaseFee`
- `eth_createAccessList`
- `eth_feeHistory`
- `eth_getBlockReceipts`
- `eth_getHeaderByHash`
- `eth_getHeaderByNumber`
- `eth_getProof`
- `eth_getRawTransactionByBlockHashAndIndex`
- `eth_getRawTransactionByBlockNumberAndIndex`
- `eth_getRawTransactionByHash`
- `eth_getUncleByBlockHashAndIndex`
- `eth_getUncleByBlockNumberAndIndex`
- `eth_getUncleCountByBlockHash`
- `eth_getUncleCountByBlockNumber`
- `eth_maxPriorityFeePerGas`
- `eth_simulateV1`
- `web3_sha3`

### Polygon

eth_getLogs 单次最大块跨度 1,000 个区块；状态窗口 126 个区块

**另外允许:**

- `debug_traceBlockByHash`
- `debug_traceBlockByNumber`
- `debug_traceCall`
- `debug_traceTransaction`
- `eth_blobBaseFee`
- `eth_createAccessList`
- `eth_feeHistory`
- `eth_getBlockReceipts`
- `eth_getHeaderByHash`
- `eth_getHeaderByNumber`
- `eth_getProof`
- `eth_getRawTransactionByBlockHashAndIndex`
- `eth_getRawTransactionByBlockNumberAndIndex`
- `eth_getRawTransactionByHash`
- `eth_getUncleByBlockHashAndIndex`
- `eth_getUncleByBlockNumberAndIndex`
- `eth_getUncleCountByBlockHash`
- `eth_getUncleCountByBlockNumber`
- `eth_maxPriorityFeePerGas`
- `eth_simulateV1`
- `web3_sha3`

### Robinhood Chain

eth_getLogs 单次最大块跨度 1,000 个区块；状态窗口 900 个区块

**另外允许:**

- `eth_maxPriorityFeePerGas`
- `eth_blobBaseFee`
- `eth_feeHistory`
- `eth_createAccessList`
- `eth_getProof`
- `eth_simulateV1`
- `eth_getBlockReceipts`
- `eth_getRawTransactionByHash`
- `eth_getRawTransactionByBlockHashAndIndex`
- `eth_getRawTransactionByBlockNumberAndIndex`
- `eth_getUncleCountByBlockNumber`
- `eth_getUncleCountByBlockHash`
- `eth_getUncleByBlockNumberAndIndex`
- `eth_getUncleByBlockHashAndIndex`
- `eth_getHeaderByNumber`
- `eth_getHeaderByHash`
- `web3_sha3`
- `debug_traceTransaction`
- `debug_traceCall`
- `debug_traceBlockByNumber`
- `debug_traceBlockByHash`

### Robinhood Chain Testnet

eth_getLogs 单次最大块跨度 1,000 个区块；状态窗口 1,023 个区块

**另外允许:**

- `debug_traceBlockByHash`
- `debug_traceBlockByNumber`
- `debug_traceCall`
- `debug_traceTransaction`
- `eth_blobBaseFee`
- `eth_createAccessList`
- `eth_feeHistory`
- `eth_getBlockReceipts`
- `eth_getHeaderByHash`
- `eth_getHeaderByNumber`
- `eth_getProof`
- `eth_getRawTransactionByBlockHashAndIndex`
- `eth_getRawTransactionByBlockNumberAndIndex`
- `eth_getRawTransactionByHash`
- `eth_getUncleByBlockHashAndIndex`
- `eth_getUncleByBlockNumberAndIndex`
- `eth_getUncleCountByBlockHash`
- `eth_getUncleCountByBlockNumber`
- `eth_maxPriorityFeePerGas`
- `eth_simulateV1`
- `web3_sha3`

### Rootstock

eth_getLogs 单次最大块跨度 1,000 个区块；状态窗口 6,000 个区块

**另外允许:**

- `eth_getUncleByBlockHashAndIndex`
- `eth_getUncleByBlockNumberAndIndex`
- `eth_getUncleCountByBlockHash`
- `eth_getUncleCountByBlockNumber`
- `web3_sha3`

### Soneium

eth_getLogs 单次最大块跨度 1,000 个区块；状态窗口 9,000 个区块

**另外允许:**

- `eth_blobBaseFee`
- `eth_createAccessList`
- `eth_feeHistory`
- `eth_getBlockReceipts`
- `eth_getHeaderByHash`
- `eth_getHeaderByNumber`
- `eth_getProof`
- `eth_getRawTransactionByBlockHashAndIndex`
- `eth_getRawTransactionByBlockNumberAndIndex`
- `eth_getRawTransactionByHash`
- `eth_getUncleByBlockHashAndIndex`
- `eth_getUncleByBlockNumberAndIndex`
- `eth_getUncleCountByBlockHash`
- `eth_getUncleCountByBlockNumber`
- `eth_maxPriorityFeePerGas`
- `eth_simulateV1`
- `web3_sha3`

### Sonic

eth_getLogs 单次最大块跨度 1,000 个区块；状态窗口 11,000 个区块

**另外允许:**

- `debug_traceBlockByHash`
- `debug_traceBlockByNumber`
- `debug_traceCall`
- `debug_traceTransaction`
- `eth_blobBaseFee`
- `eth_createAccessList`
- `eth_feeHistory`
- `eth_getBlockReceipts`
- `eth_getHeaderByHash`
- `eth_getHeaderByNumber`
- `eth_getProof`
- `eth_getRawTransactionByBlockHashAndIndex`
- `eth_getRawTransactionByBlockNumberAndIndex`
- `eth_getRawTransactionByHash`
- `eth_getUncleByBlockHashAndIndex`
- `eth_getUncleByBlockNumberAndIndex`
- `eth_getUncleCountByBlockHash`
- `eth_getUncleCountByBlockNumber`
- `eth_maxPriorityFeePerGas`
- `eth_simulateV1`
- `web3_sha3`

### Unichain

eth_getLogs 单次最大块跨度 1,000 个区块；状态窗口 85,500 个区块

**另外允许:**

- `eth_blobBaseFee`
- `eth_createAccessList`
- `eth_feeHistory`
- `eth_getBlockReceipts`
- `eth_getHeaderByHash`
- `eth_getHeaderByNumber`
- `eth_getProof`
- `eth_getRawTransactionByBlockHashAndIndex`
- `eth_getRawTransactionByBlockNumberAndIndex`
- `eth_getRawTransactionByHash`
- `eth_getUncleByBlockHashAndIndex`
- `eth_getUncleByBlockNumberAndIndex`
- `eth_getUncleCountByBlockHash`
- `eth_getUncleCountByBlockNumber`
- `eth_maxPriorityFeePerGas`
- `eth_simulateV1`
- `web3_sha3`

### World Chain

eth_getLogs 单次最大块跨度 1,000 个区块；状态窗口 30,000 个区块

**另外允许:**

- `eth_blobBaseFee`
- `eth_createAccessList`
- `eth_feeHistory`
- `eth_getBlockReceipts`
- `eth_getHeaderByHash`
- `eth_getHeaderByNumber`
- `eth_getProof`
- `eth_getRawTransactionByBlockHashAndIndex`
- `eth_getRawTransactionByBlockNumberAndIndex`
- `eth_getRawTransactionByHash`
- `eth_getUncleByBlockHashAndIndex`
- `eth_getUncleByBlockNumberAndIndex`
- `eth_getUncleCountByBlockHash`
- `eth_getUncleCountByBlockNumber`
- `eth_maxPriorityFeePerGas`
- `eth_simulateV1`
- `web3_sha3`

### X Layer

eth_getLogs 单次最大块跨度 1,000 个区块；状态窗口 250,000 个区块

**另外允许:**

- `debug_traceBlockByHash`
- `debug_traceBlockByNumber`
- `debug_traceCall`
- `debug_traceTransaction`
- `eth_blobBaseFee`
- `eth_createAccessList`
- `eth_feeHistory`
- `eth_getBlockReceipts`
- `eth_getHeaderByHash`
- `eth_getHeaderByNumber`
- `eth_getProof`
- `eth_getRawTransactionByBlockHashAndIndex`
- `eth_getRawTransactionByBlockNumberAndIndex`
- `eth_getRawTransactionByHash`
- `eth_getUncleByBlockHashAndIndex`
- `eth_getUncleByBlockNumberAndIndex`
- `eth_getUncleCountByBlockHash`
- `eth_getUncleCountByBlockNumber`
- `eth_maxPriorityFeePerGas`
- `eth_simulateV1`
- `web3_sha3`

### Zora

eth_getLogs 单次最大块跨度 1,000 个区块；状态窗口 10,000 个区块

**另外允许:**

- `eth_blobBaseFee`
- `eth_createAccessList`
- `eth_feeHistory`
- `eth_getBlockReceipts`
- `eth_getHeaderByHash`
- `eth_getHeaderByNumber`
- `eth_getProof`
- `eth_getRawTransactionByBlockHashAndIndex`
- `eth_getRawTransactionByBlockNumberAndIndex`
- `eth_getRawTransactionByHash`
- `eth_getUncleByBlockHashAndIndex`
- `eth_getUncleByBlockNumberAndIndex`
- `eth_getUncleCountByBlockHash`
- `eth_getUncleCountByBlockNumber`
- `eth_maxPriorityFeePerGas`
- `eth_simulateV1`
- `web3_sha3`

**限制**：

* **批量**：每个请求最多 100 个调用；同时受该 key 的 CU 突发容量限制，见下文。
* **请求体**：最大 2 MiB（见[完整 OpenAPI 参考](https://docs.blockvectra.com/zh/api/json-rpc/reference/)中的“10. Limits at a glance”）
* **CU 突发**：每个 API key 均有 CU 令牌桶（`cu_per_sec` 补充速率、`burst_cu` 突发容量——默认 100 CU/s、突发 400 CU；付费充值后每个 key 至少 2,000 CU/s、突发 10,000 CU，更高的自定义限额保持不变；在控制台 Keys 表按 key 显示）。单个请求（包括整批 JSON-RPC 批量调用）的 CU 总开销若超过该 key 的突发容量，会被拒绝并返回 `-32022 request_exceeds_burst`（`request cost <N> CU exceeds burst capacity <M> CU`）；请拆分为更小的批次。

## 错误码表

全部错误码、是否计费与处理方式见[错误参考](https://docs.blockvectra.com/zh/errors/)。

## 完整 OpenAPI 参考

完整的机器可读规范（含所有方法签名、请求与响应 schema 及交互式参数详情）见[完整 OpenAPI 参考](https://docs.blockvectra.com/zh/api/json-rpc/reference/)。
