JSON-RPC

JSON-RPC

Các phương thức JSON-RPC được hỗ trợ, trọng số CU và mã lỗi. Thiết lập điểm cuối, chọn chuỗi và kiểm tra tính khả dụng của phương thức, định giá cùng quy tắc thanh toán.

Tổng quan

Tất cả các yêu cầu được tính bằng Compute Units (CU) và được giới hạn tốc độ theo từng key.

  • Điểm cuối: POST /v1/{chain}/{api_key} (key nằm trong đường dẫn) hoặc POST /v1/{chain} (key trong header). Đối với Robinhood Chain, {chain} là robinhood_mainnet: https://api.blockvectra.com/v1/robinhood_mainnet. Cùng một API key hoạt động trên mọi chuỗi được hỗ trợ
  • Giao thức: HTTP POST, lệnh gọi đơn lẻ hoặc theo lô (batch)
  • Đo lường: Tổng chi phí CU của một yêu cầu được tính vào dung lượng burst của key ngay khi yêu cầu đến. Mọi lệnh gọi được chấp nhận và nhận được phản hồi đều bị tính phí theo trọng số CU đã công bố của phương thức; Tài liệu tham khảo lỗi liệt kê các trường hợp không bị tính phí. Phí được quyết toán theo giờ (làm tròn xuống số nguyên, phần dư chuyển sang chu kỳ tiếp theo, thực hiện ~15 phút sau khi kết thúc chu kỳ)
  • Ethereum: có danh sách phương thức riêng và cửa sổ trạng thái được xác định bởi state_window_blocks — xem Chuỗi được hỗ trợ → Ethereum.

Để xem lược đồ tham số đầy đủ, chữ ký phương thức và thử nghiệm yêu cầu tương tác trên tất cả các phương thức, xem Tài liệu tham khảo đầy đủ. Về phiên bản đường dẫn, quy tắc tương thích ngược và khuyến nghị SDK, xem Phiên bản và tính tương thích của API.

Để tạo API key và gửi yêu cầu đầu tiên, xem Khởi động nhanh; tài liệu này cũng hướng dẫn cách truyền key và gửi yêu cầu theo lô.

Các lệnh gọi phổ biến

Ví dụ thực hành cho các lệnh gọi phổ biến.

Truy vấn log (eth_getLogs)

Lọc log của hợp đồng trong phạm vi các khối gần đây — ở đây là sự kiện ERC-20 Transfer (topic 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef). Xem bảng Quy tắc đo lường CU bên dưới để biết trọng số CU hiện tại của eth_getLogs; phạm vi rộng hơn max_logs_block_range của chuỗi (từ GET /v1/chains) sẽ bị từ chối với mã lỗi -32602.

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
  }'

Truy vết giao dịch (debug_traceTransaction)

Truy vết các lệnh gọi nội bộ của giao dịch bằng callTracer. Xem bảng Quy tắc đo lường CU bên dưới để biết trọng số CU hiện tại của debug_traceTransaction. Giống như các phương thức đọc trạng thái khác, yêu cầu sẽ bị từ chối khi khối mục tiêu nằm ngoài cửa sổ trạng thái gần đây của chuỗi (-32011). Kích thước cửa sổ là state_window_blocks của chuỗi (từ GET /v1/chains). Trên các chuỗi cung cấp trace, hãy sử dụng Data API để truy vấn trace lịch sử.

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
  }'

Quy tắc đo lường CU

Trọng số Compute Unit (CU) cho mỗi phương thức JSON-RPC.

Phương thứcTrọng số (CU)
eth_blockNumber1
eth_chainId1
eth_getBlockByNumber5
eth_blobBaseFee10
eth_feeHistory10
eth_gasPrice10
eth_getBalance10
eth_getBlockByHash10
eth_getBlockReceipts10
eth_getBlockTransactionCountByHash10
eth_getBlockTransactionCountByNumber10
eth_getCode10
eth_getHeaderByHash10
eth_getHeaderByNumber10
eth_getProof10
eth_getRawTransactionByBlockHashAndIndex10
eth_getRawTransactionByBlockNumberAndIndex10
eth_getRawTransactionByHash10
eth_getStorageAt10
eth_getTransactionByBlockHashAndIndex10
eth_getTransactionByBlockNumberAndIndex10
eth_getTransactionByHash10
eth_getTransactionCount10
eth_getTransactionReceipt10
eth_getUncleByBlockHashAndIndex10
eth_getUncleByBlockNumberAndIndex10
eth_getUncleCountByBlockHash10
eth_getUncleCountByBlockNumber10
eth_maxPriorityFeePerGas10
eth_syncing10
net_version10
web3_clientVersion10
web3_sha310
eth_call15
eth_createAccessList20
eth_estimateGas20
eth_simulateV120
eth_getLogs30
eth_sendRawTransaction30
debug_traceBlockByHash100
debug_traceBlockByNumber100
debug_traceCall100
debug_traceTransaction100
trace_block100
trace_call100
trace_get100
trace_replayTransaction100
trace_transaction100

Chính sách phương thức

Các phương thức khả dụng khác nhau tùy theo chuỗi; danh sách của từng chuỗi được hiển thị bên dưới, và Chuỗi được hỗ trợ trình bày các nội dung còn lại. Chỉ các phương thức khớp với tên hoặc mẫu được phép mới có thể gọi được; bất kỳ phương thức nào khác sẽ trả về -32601 method not available.

Được cho phép trên tất cả các chuỗi dưới đây

  • eth_blockNumber
  • eth_call
  • eth_chainId
  • eth_estimateGas
  • eth_feeHistory
  • eth_gasPrice
  • eth_getBalance
  • eth_getBlockByHash
  • eth_getBlockByNumber
  • eth_getBlockReceipts
  • eth_getBlockTransactionCountByHash
  • eth_getBlockTransactionCountByNumber
  • eth_getCode
  • eth_getLogs
  • eth_getStorageAt
  • eth_getTransactionByBlockHashAndIndex
  • eth_getTransactionByBlockNumberAndIndex
  • eth_getTransactionByHash
  • eth_getTransactionCount
  • eth_getTransactionReceipt
  • eth_maxPriorityFeePerGas
  • eth_syncing
  • net_version
  • web3_clientVersion

Arbitrum One

Phạm vi khối tối đa của eth_getLogs: 1,000 khối; Cửa sổ trạng thái: 6,000 khối

Được cho phép bổ sung

  • debug_traceBlockByHash
  • debug_traceBlockByNumber
  • debug_traceCall
  • debug_traceTransaction
  • eth_blobBaseFee
  • eth_createAccessList
  • eth_getHeaderByHash
  • eth_getHeaderByNumber
  • eth_getProof
  • eth_getRawTransactionByBlockHashAndIndex
  • eth_getRawTransactionByBlockNumberAndIndex
  • eth_getRawTransactionByHash
  • eth_getUncleByBlockHashAndIndex
  • eth_getUncleByBlockNumberAndIndex
  • eth_getUncleCountByBlockHash
  • eth_getUncleCountByBlockNumber
  • eth_sendRawTransaction
  • eth_simulateV1
  • web3_sha3

Base

Phạm vi khối tối đa của eth_getLogs: 1,000 khối; Cửa sổ trạng thái: 10,000 khối

Được cho phép bổ sung

  • eth_blobBaseFee
  • eth_createAccessList
  • eth_getProof
  • eth_simulateV1
  • eth_getRawTransactionByHash
  • eth_getRawTransactionByBlockHashAndIndex
  • eth_getRawTransactionByBlockNumberAndIndex
  • eth_getUncleCountByBlockNumber
  • eth_getUncleCountByBlockHash
  • eth_getUncleByBlockNumberAndIndex
  • eth_getUncleByBlockHashAndIndex
  • eth_getHeaderByNumber
  • eth_getHeaderByHash
  • eth_sendRawTransaction
  • web3_sha3

BNB Smart Chain

Phạm vi khối tối đa của eth_getLogs: 1,000 khối; Cửa sổ trạng thái: 100 khối

Được cho phép bổ sung

  • eth_sendRawTransaction

Ethereum

Phạm vi khối tối đa của eth_getLogs: 1,000 khối; Cửa sổ trạng thái: 250,000 khối

Được cho phép bổ sung

  • debug_traceBlockByHash
  • debug_traceBlockByNumber
  • debug_traceCall
  • debug_traceTransaction
  • eth_blobBaseFee
  • eth_createAccessList
  • eth_getProof
  • eth_sendRawTransaction
  • trace_block
  • trace_call
  • trace_get
  • trace_replayTransaction
  • trace_transaction
  • web3_sha3

Ethereum Sepolia

Phạm vi khối tối đa của eth_getLogs: 1,000 khối; Cửa sổ trạng thái: —

Được cho phép bổ sung

  • eth_blobBaseFee
  • eth_createAccessList
  • eth_getProof
  • eth_sendRawTransaction
  • web3_sha3

HyperEVM

Chuỗi này hiện chưa hỗ trợ gửi giao dịch (eth_sendRawTransaction trả về -32601 method_not_allowed); các phương thức đọc hoạt động bình thường.

Phạm vi khối tối đa của eth_getLogs: 1,000 khối; Cửa sổ trạng thái: —

Polygon

Phạm vi khối tối đa của eth_getLogs: 1,000 khối; Cửa sổ trạng thái: 126 khối

Được cho phép bổ sung

  • debug_traceBlockByHash
  • debug_traceBlockByNumber
  • debug_traceCall
  • debug_traceTransaction
  • eth_blobBaseFee
  • eth_createAccessList
  • eth_getHeaderByHash
  • eth_getHeaderByNumber
  • eth_getProof
  • eth_getRawTransactionByBlockHashAndIndex
  • eth_getRawTransactionByBlockNumberAndIndex
  • eth_getRawTransactionByHash
  • eth_getUncleByBlockHashAndIndex
  • eth_getUncleByBlockNumberAndIndex
  • eth_getUncleCountByBlockHash
  • eth_getUncleCountByBlockNumber
  • eth_sendRawTransaction
  • eth_simulateV1
  • web3_sha3

Robinhood Chain

Phạm vi khối tối đa của eth_getLogs: 1,000 khối; Cửa sổ trạng thái: 900 khối

Được cho phép bổ sung

  • eth_blobBaseFee
  • eth_createAccessList
  • eth_getProof
  • eth_simulateV1
  • eth_getRawTransactionByHash
  • eth_getRawTransactionByBlockHashAndIndex
  • eth_getRawTransactionByBlockNumberAndIndex
  • eth_getUncleCountByBlockNumber
  • eth_getUncleCountByBlockHash
  • eth_getUncleByBlockNumberAndIndex
  • eth_getUncleByBlockHashAndIndex
  • eth_getHeaderByNumber
  • eth_getHeaderByHash
  • eth_sendRawTransaction
  • web3_sha3
  • debug_traceTransaction
  • debug_traceCall
  • debug_traceBlockByNumber
  • debug_traceBlockByHash

Robinhood Chain Testnet

Phạm vi khối tối đa của eth_getLogs: 1,000 khối; Cửa sổ trạng thái: 1,023 khối

Được cho phép bổ sung

  • debug_traceBlockByHash
  • debug_traceBlockByNumber
  • debug_traceCall
  • debug_traceTransaction
  • eth_blobBaseFee
  • eth_createAccessList
  • eth_getHeaderByHash
  • eth_getHeaderByNumber
  • eth_getProof
  • eth_getRawTransactionByBlockHashAndIndex
  • eth_getRawTransactionByBlockNumberAndIndex
  • eth_getRawTransactionByHash
  • eth_getUncleByBlockHashAndIndex
  • eth_getUncleByBlockNumberAndIndex
  • eth_getUncleCountByBlockHash
  • eth_getUncleCountByBlockNumber
  • eth_sendRawTransaction
  • eth_simulateV1
  • web3_sha3

Giới hạn:

  • Theo lô (Batch): tối đa 100 lệnh gọi mỗi yêu cầu; cũng bị giới hạn bởi CU burst của key, xem bên dưới.
  • Thân yêu cầu (Request body): tối đa 2 MiB
  • CU burst: mỗi API key có một bucket CU (tốc độ nạp cu_per_sec, dung lượng burst_cu — mặc định là 400 CU/s và burst 1,600 CU; hiển thị theo từng key trong bảng Keys trên console). Một yêu cầu đơn lẻ — bao gồm toàn bộ lô JSON-RPC — có tổng số CU vượt quá dung lượng burst của key sẽ bị từ chối với mã lỗi -32022 request_exceeds_burst (request cost <N> CU exceeds burst capacity <M> CU); hãy chia nhỏ thành các lô nhỏ hơn.

Mã lỗi

Xem Tài liệu tham khảo lỗi để biết mọi mã lỗi, việc lỗi có bị tính phí hay không và cách xử lý.

Tham khảo OpenAPI đầy đủ

Xem Tài liệu tham khảo OpenAPI đầy đủ để xem đặc tả hoàn chỉnh mà máy có thể đọc được cùng tất cả chữ ký phương thức, lược đồ yêu cầu và phản hồi cũng như chi tiết tham số được kết xuất có tính tương tác.

Cập nhật lần cuối:

Trên trang này