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ặcPOST /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ức | Trọng số (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 |
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_blockNumbereth_calleth_chainIdeth_estimateGaseth_feeHistoryeth_gasPriceeth_getBalanceeth_getBlockByHasheth_getBlockByNumbereth_getBlockReceiptseth_getBlockTransactionCountByHasheth_getBlockTransactionCountByNumbereth_getCodeeth_getLogseth_getStorageAteth_getTransactionByBlockHashAndIndexeth_getTransactionByBlockNumberAndIndexeth_getTransactionByHasheth_getTransactionCounteth_getTransactionReceipteth_maxPriorityFeePerGaseth_sendRawTransactioneth_syncingnet_versionweb3_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: 5,000 khối
Được cho phép bổ sung
debug_traceBlockByHashdebug_traceBlockByNumberdebug_traceCalldebug_traceTransactioneth_blobBaseFeeeth_createAccessListeth_getHeaderByHasheth_getHeaderByNumbereth_getProofeth_getRawTransactionByBlockHashAndIndexeth_getRawTransactionByBlockNumberAndIndexeth_getRawTransactionByHasheth_getUncleByBlockHashAndIndexeth_getUncleByBlockNumberAndIndexeth_getUncleCountByBlockHasheth_getUncleCountByBlockNumbereth_simulateV1web3_sha3
Arc
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_blobBaseFeeeth_createAccessListeth_getHeaderByHasheth_getHeaderByNumbereth_getProofeth_getRawTransactionByBlockHashAndIndexeth_getRawTransactionByBlockNumberAndIndexeth_getRawTransactionByHasheth_getUncleByBlockHashAndIndexeth_getUncleByBlockNumberAndIndexeth_getUncleCountByBlockHasheth_getUncleCountByBlockNumbereth_simulateV1web3_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_blobBaseFeeeth_createAccessListeth_getProofeth_simulateV1eth_getRawTransactionByHasheth_getRawTransactionByBlockHashAndIndexeth_getRawTransactionByBlockNumberAndIndexeth_getUncleCountByBlockNumbereth_getUncleCountByBlockHasheth_getUncleByBlockNumberAndIndexeth_getUncleByBlockHashAndIndexeth_getHeaderByNumbereth_getHeaderByHashweb3_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
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_traceBlockByHashdebug_traceBlockByNumberdebug_traceCalldebug_traceTransactioneth_blobBaseFeeeth_createAccessListeth_getProoftrace_blocktrace_calltrace_gettrace_replayTransactiontrace_transactionweb3_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_blobBaseFeeeth_createAccessListeth_getProofweb3_sha3
Fraxtal
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_blobBaseFeeeth_createAccessListeth_getHeaderByHasheth_getHeaderByNumbereth_getProofeth_getRawTransactionByBlockHashAndIndexeth_getRawTransactionByBlockNumberAndIndexeth_getRawTransactionByHasheth_getUncleByBlockHashAndIndexeth_getUncleByBlockNumberAndIndexeth_getUncleCountByBlockHasheth_getUncleCountByBlockNumbereth_simulateV1web3_sha3
HyperEVM
Phạm vi khối tối đa của eth_getLogs: 1,000 khối; Cửa sổ trạng thái: —
Ink
Phạm vi khối tối đa của eth_getLogs: 1,000 khối; Cửa sổ trạng thái: 60,000 khối
Được cho phép bổ sung
eth_blobBaseFeeeth_createAccessListeth_getHeaderByHasheth_getHeaderByNumbereth_getProofeth_getRawTransactionByBlockHashAndIndexeth_getRawTransactionByBlockNumberAndIndexeth_getRawTransactionByHasheth_getUncleByBlockHashAndIndexeth_getUncleByBlockNumberAndIndexeth_getUncleCountByBlockHasheth_getUncleCountByBlockNumbereth_simulateV1web3_sha3
Katana
Phạm vi khối tối đa của eth_getLogs: 1,000 khối; Cửa sổ trạng thái: 86,400 khối
Được cho phép bổ sung
eth_blobBaseFeeeth_createAccessListeth_getHeaderByHasheth_getHeaderByNumbereth_getProofeth_getRawTransactionByBlockHashAndIndexeth_getRawTransactionByBlockNumberAndIndexeth_getRawTransactionByHasheth_getUncleByBlockHashAndIndexeth_getUncleByBlockNumberAndIndexeth_getUncleCountByBlockHasheth_getUncleCountByBlockNumbereth_simulateV1web3_sha3
Metal L2
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_blobBaseFeeeth_createAccessListeth_getHeaderByHasheth_getHeaderByNumbereth_getProofeth_getRawTransactionByBlockHashAndIndexeth_getRawTransactionByBlockNumberAndIndexeth_getRawTransactionByHasheth_getUncleByBlockHashAndIndexeth_getUncleByBlockNumberAndIndexeth_getUncleCountByBlockHasheth_getUncleCountByBlockNumbereth_simulateV1web3_sha3
Mode
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_blobBaseFeeeth_createAccessListeth_getHeaderByHasheth_getHeaderByNumbereth_getProofeth_getRawTransactionByBlockHashAndIndexeth_getRawTransactionByBlockNumberAndIndexeth_getRawTransactionByHasheth_getUncleByBlockHashAndIndexeth_getUncleByBlockNumberAndIndexeth_getUncleCountByBlockHasheth_getUncleCountByBlockNumbereth_simulateV1web3_sha3
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_traceBlockByHashdebug_traceBlockByNumberdebug_traceCalldebug_traceTransactioneth_blobBaseFeeeth_createAccessListeth_getHeaderByHasheth_getHeaderByNumbereth_getProofeth_getRawTransactionByBlockHashAndIndexeth_getRawTransactionByBlockNumberAndIndexeth_getRawTransactionByHasheth_getUncleByBlockHashAndIndexeth_getUncleByBlockNumberAndIndexeth_getUncleCountByBlockHasheth_getUncleCountByBlockNumbereth_simulateV1web3_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_blobBaseFeeeth_createAccessListeth_getProofeth_simulateV1eth_getRawTransactionByHasheth_getRawTransactionByBlockHashAndIndexeth_getRawTransactionByBlockNumberAndIndexeth_getUncleCountByBlockNumbereth_getUncleCountByBlockHasheth_getUncleByBlockNumberAndIndexeth_getUncleByBlockHashAndIndexeth_getHeaderByNumbereth_getHeaderByHashweb3_sha3debug_traceTransactiondebug_traceCalldebug_traceBlockByNumberdebug_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_traceBlockByHashdebug_traceBlockByNumberdebug_traceCalldebug_traceTransactioneth_blobBaseFeeeth_createAccessListeth_getHeaderByHasheth_getHeaderByNumbereth_getProofeth_getRawTransactionByBlockHashAndIndexeth_getRawTransactionByBlockNumberAndIndexeth_getRawTransactionByHasheth_getUncleByBlockHashAndIndexeth_getUncleByBlockNumberAndIndexeth_getUncleCountByBlockHasheth_getUncleCountByBlockNumbereth_simulateV1web3_sha3
Unichain
Phạm vi khối tối đa của eth_getLogs: 1,000 khối; Cửa sổ trạng thái: 85,500 khối
Được cho phép bổ sung
eth_blobBaseFeeeth_createAccessListeth_getHeaderByHasheth_getHeaderByNumbereth_getProofeth_getRawTransactionByBlockHashAndIndexeth_getRawTransactionByBlockNumberAndIndexeth_getRawTransactionByHasheth_getUncleByBlockHashAndIndexeth_getUncleByBlockNumberAndIndexeth_getUncleCountByBlockHasheth_getUncleCountByBlockNumbereth_simulateV1web3_sha3
Zora
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_blobBaseFeeeth_createAccessListeth_getHeaderByHasheth_getHeaderByNumbereth_getProofeth_getRawTransactionByBlockHashAndIndexeth_getRawTransactionByBlockNumberAndIndexeth_getRawTransactionByHasheth_getUncleByBlockHashAndIndexeth_getUncleByBlockNumberAndIndexeth_getUncleCountByBlockHasheth_getUncleCountByBlockNumbereth_simulateV1web3_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 (xem “10. Limits at a glance” trong tài liệu tham khảo OpenAPI đầy đủ)
- CU burst: mỗi API key có một bucket CU (tốc độ nạp
cu_per_sec, dung lượngburst_cu— mặc định là 100 CU/s và burst 400 CU; sau khi nạp tiền trả phí, mỗi khóa có tối thiểu 2,000 CU/giây và burst 10,000 CU, các giới hạn tùy chỉnh cao hơn được giữ nguyên; 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:
Data API
Tài liệu tham khảo yêu cầu Blockchain Data API: các endpoint REST, xác thực API key, tham số, schema phản hồi, lỗi và trọng số CU cho dữ liệu chuỗi đã lập chỉ mục.
Tài liệu tham khảo đầy đủ
Đặc tả API JSON-RPC 2.0 đầy đủ và danh mục endpoint. Duyệt qua tất cả các phương thức được hỗ trợ, cấu trúc yêu cầu và phản hồi, kiểu schema và mã lỗi.