Chuyển đến nội dung chính

Endpoint RPC miễn phí của BNB Smart Chain và Chain ID

BNB Smart Chain có Chain ID 56; endpoint RPC công khai không cần khóa là https://api.blockvectra.com/v1/bsc_mainnet/public (3 yêu cầu mỗi giây cho mỗi IP), còn eth_getLogs cần khóa API.

Nhà phát triển và AI Agent có thể kết nối ví và xây dựng ứng dụng bằng API HTTP.

Điểm cuối RPC và thông số mạng

Mạng chính

https://api.blockvectra.com/v1/bsc_mainnet/public

Thử RPC không cần khóa API

curl -sS 'https://api.blockvectra.com/v1/bsc_mainnet/public' \
  -H 'Content-Type: application/json' \
  -d '{"jsonrpc":"2.0","id":1,"method":"eth_chainId","params":[]}'

Thêm mạng vào ví

Sao chép các giá trị này vào biểu mẫu mạng tùy chỉnh của ví.

{
  "networkName": "BNB Smart Chain",
  "rpcUrl": "https://api.blockvectra.com/v1/bsc_mainnet/public",
  "chainId": 56,
  "currencySymbol": "BNB",
  "blockExplorerUrl": "https://bscscan.com"
}
bscscan.com

Webhook thông báo chuyển tiền đến

Nhận hoạt động địa chỉ tại điểm cuối HTTPS. Theo hướng dẫn để tạo đăng ký, xác minh chữ ký và loại bỏ thông báo trùng lặp.

BNB Smart Chain

Webhook thông báo chuyển tiền đến

Hướng dẫn tích hợp

Endpoint

Không cần API key. Chỉ hỗ trợ phương thức ví, giới hạn tốc độ theo IP. Xem phương thức và giới hạn hiện tại tại GET /v1/chains.

Điểm cuối RPC công khai miễn phí
https://api.blockvectra.com/v1/bsc_mainnet/public
curl -X POST 'https://api.blockvectra.com/v1/bsc_mainnet/public' -H 'Content-Type: application/json' -d '{"jsonrpc":"2.0","id":1,"method":"eth_blockNumber","params":[]}'
Giới hạn tốc độ: 3 yêu cầu/giây mỗi IP, burst 20, lô tối đa 10
Giới hạn gửi giao dịch: 1 yêu cầu/giây mỗi IP, burst 3
Phương thức công khai
  • eth_chainId
  • net_version
  • eth_blockNumber
  • eth_getBalance
  • eth_getTransactionCount
  • eth_getCode
  • eth_getStorageAt
  • eth_call
  • eth_estimateGas
  • eth_gasPrice
  • eth_maxPriorityFeePerGas
  • eth_feeHistory
  • eth_getBlockByNumber
  • eth_getBlockByHash
  • eth_getTransactionByHash
  • eth_getTransactionReceipt
  • eth_syncing
  • web3_clientVersion
  • eth_sendRawTransaction
Tất cả điểm cuối RPC công khai miễn phí
Lịch sử công khai: 100 khối gần nhất. Đăng ký miễn phí để dùng tín dụng API miễn phí cho các phương thức được chuỗi này hỗ trợ.
JSON-RPC (Khóa trên đường dẫn)
https://api.blockvectra.com/v1/bsc_mainnet/{api_key}
JSON-RPC (header: x-api-key)
https://api.blockvectra.com/v1/bsc_mainnet
x-api-key: {api_key}
Data API
https://api.blockvectra.com/v1/data/bsc_mainnet
x-api-key: {api_key}

WebSocket

WebSocket (Khóa trên đường dẫn)
wss://api.blockvectra.com/v1/bsc_mainnet/{api_key}
WebSocket (header: x-api-key hoặc Authorization)
wss://api.blockvectra.com/v1/bsc_mainnet
x-api-key: {api_key}
Authorization: Bearer {api_key}
Các loại subscription được hỗ trợ
  • newHeads
  • logs (bộ lọc phải bao gồm address hoặc topic0)

Thông số mạng

Chain ID56
Điểm cuối RPC công khai miễn phíhttps://api.blockvectra.com/v1/bsc_mainnet/public
Số phương thức dùng khóa API25
Data APIĐược hỗ trợ
Hỗ trợ WebSocketĐược hỗ trợ
Thông báo WebhookĐược hỗ trợ · Số xác nhận 1–2 (mặc định 1)
Hướng dẫn thông báo Webhook
Gửi giao dịchĐược hỗ trợ
Gửi giao dịch (endpoint công khai không cần key)Được hỗ trợ
Cửa sổ lịch sử trạng tháiTrạng thái lịch sử cho 100 khối gần đây nhất
Khoảng khối tối đa của eth_getLogs1,000 khối
Tập dữ liệu Data APIKhối, Giao dịch, Giao dịch địa chỉ, Chuyển token, Siêu dữ liệu token, Độ mới dữ liệu
Các loại subscription được hỗ trợnewHeads, logs
Mạng thử nghiệm liên quanKhông xác định
Hướng dẫn liên quanKhông xác định

Ví dụ nhanh

curl -X POST https://api.blockvectra.com/v1/bsc_mainnet \
  -H "Content-Type: application/json" \
  -H "x-api-key: {api_key}" \
  -d '{"jsonrpc":"2.0","id":1,"method":"eth_blockNumber","params":[]}'

Giới hạn

Cửa sổ lịch sử trạng tháiTrạng thái lịch sử cho 100 khối gần đây nhất
Khoảng khối tối đa của eth_getLogs1,000 khối
Chính sách phương thức
Cho phép: 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_sendRawTransaction, eth_syncing, net_version, web3_clientVersion

Data API

Kiểm tra độ mới dữ liệu chuỗi

curl -s "https://api.blockvectra.com/v1/data/bsc_mainnet/status/freshness" -H "x-api-key: {api_key}"

Xem hướng dẫn tập dữ liệu →

Xem tài liệu Data API →

Chọn tác vụ

Giải pháp cho tác vụ onchain

Bước tiếp theo với khóa API

eth_getLogs

set -eu
: "${BLOCKVECTRA_API_KEY:?BLOCKVECTRA_API_KEY is required}"
validate_response='import json,re,sys
response=json.load(sys.stdin)
if not (type(response) is dict and response.get("jsonrpc")=="2.0" and type(response.get("id")) is int and response["id"]==1 and "error" not in response and "result" in response):
    sys.exit("Invalid JSON-RPC response")
result=response["result"]
if sys.argv[1]=="head":
    if not (type(result) is str and re.fullmatch(r"0x(?:0|[1-9a-fA-F][0-9a-fA-F]*)",result)):
        sys.exit("Invalid block quantity")
    print(result)
else:
    if not (type(result) is list and all(type(log) is dict for log in result)):
        sys.exit("Invalid logs result")
    print(json.dumps(response,indent=2))'
head_response=$(curl -fsS 'https://api.blockvectra.com/v1/bsc_mainnet' -H "x-api-key: $BLOCKVECTRA_API_KEY" -H 'Content-Type: application/json' -d '{"jsonrpc":"2.0","id":1,"method":"eth_blockNumber","params":[]}')
head=$(printf '%s' "$head_response" | python3 -c "$validate_response" head)
logs_response=$(curl -fsS 'https://api.blockvectra.com/v1/bsc_mainnet' -H "x-api-key: $BLOCKVECTRA_API_KEY" -H 'Content-Type: application/json' \
  -d "{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"eth_getLogs\",\"params\":[{\"fromBlock\":\"$head\",\"toBlock\":\"$head\"}]}")
printf '%s' "$logs_response" | python3 -c "$validate_response" logs
eth_getLogs

Data API

curl -fsS 'https://api.blockvectra.com/v1/data/bsc_mainnet/status/freshness' -H "x-api-key: $BLOCKVECTRA_API_KEY"
Data API

WebSocket

echo '{"jsonrpc":"2.0","id":1,"method":"eth_subscribe","params":["newHeads"]}' | websocat --no-close -H="x-api-key: $BLOCKVECTRA_API_KEY" 'wss://api.blockvectra.com/v1/bsc_mainnet'
WebSocket

Câu hỏi thường gặp

Điểm cuối RPC và Chain ID của BNB Smart Chain là gì?

BNB Smart Chain có Chain ID 56; endpoint RPC công khai không cần khóa là https://api.blockvectra.com/v1/bsc_mainnet/public (3 yêu cầu mỗi giây cho mỗi IP), còn eth_getLogs cần khóa API.

Có thể thử RPC BNB Smart Chain mà không cần khóa API không?

Có. Gọi eth_chainId tại các điểm cuối công khai ở trên mà không cần khóa. GET /v1/chains liệt kê phương thức và giới hạn theo IP hiện tại.

BNB Smart Chain RPC có hỗ trợ WebSocket không?

BNB Smart Chain RPC hỗ trợ kết nối WebSocket. Các loại subscription được hỗ trợ: newHeads, logs.

BNB Smart Chain RPC có hỗ trợ các phương thức trace hoặc debug không?

Các phương thức trace và debug không được hỗ trợ cho BNB Smart Chain RPC.

Tôi có thể phát giao dịch qua RPC của BNB Smart Chain không?

BNB Smart Chain: Được hỗ trợ.

Tôi có thể truy vấn trạng thái lịch sử trong phạm vi nào trên BNB Smart Chain?

BNB Smart Chain: Trạng thái lịch sử cho 100 khối gần đây nhất.

Giới hạn phạm vi khối của eth_getLogs trên BNB Smart Chain là bao nhiêu?

BNB Smart Chain: 1,000 khối, còn eth_getLogs cần khóa API.

Những tập dữ liệu Data API nào có trên BNB Smart Chain?

BNB Smart Chain: Khối, Giao dịch, Giao dịch địa chỉ, Chuyển token, Siêu dữ liệu token, Độ mới dữ liệu.

Giá cả

Nhận 30,000,000 CU khi đăng ký, nạp lại sau mỗi 30 ngày (số dư và giới hạn tốc độ được gộp chung giữa các chuỗi; không cần thẻ tín dụng); tính giá cho mỗi triệu lệnh gọi: eth_blockNumber $0.10, eth_call $1.50, eth_getLogs $3.00.

Xem các gói giá →