import { Aside } from ‘@astrojs/starlight/components’;
Ethereum Beacon Chain API 通过标准 REST 端点提供共识层访问能力。与 EVM JSON-RPC 不同,Beacon API 使用 RESTful HTTP 请求(GET/POST),并返回 JSON 响应。
| 协议 | URL |
|---|
| HTTPS(公开) | https://eth-beacon.blockreq.com/v1/rpc/public |
| HTTPS(私有) | https://eth-beacon.blockreq.com/v1/rpc/{API_KEY} |
Beacon API 端点路径会追加在基础 URL 后:
https://eth-beacon.blockreq.com/v1/rpc/public/{beacon_path}
例如,获取节点版本:
https://eth-beacon.blockreq.com/v1/rpc/public/eth/v1/node/version
curl https://eth-beacon.blockreq.com/v1/rpc/public/eth/v1/node/version
"version": "Prysm/v5.x.x ..."
curl https://eth-beacon.blockreq.com/v1/rpc/public/eth/v1/beacon/headers
curl https://eth-beacon.blockreq.com/v1/rpc/public/eth/v1/beacon/states/head/finality_checkpoints
const BASE_URL = "https://eth-beacon.blockreq.com/v1/rpc/public";
const res = await fetch(`${BASE_URL}/eth/v1/node/syncing`);
const data = await res.json();
console.log("Syncing:", data.data);
const genesis = await fetch(`${BASE_URL}/eth/v1/beacon/genesis`);
const genesisData = await genesis.json();
console.log("Genesis time:", genesisData.data.genesis_time);
| 方法 | 端点 | 说明 |
|---|
| GET | /eth/v1/node/version | 节点软件版本 |
| GET | /eth/v1/node/syncing | 同步状态 |
| GET | /eth/v1/node/health | 节点健康检查 |
| GET | /eth/v1/node/identity | 节点网络身份 |
| GET | /eth/v1/node/peers | 已连接 peers |
| GET | /eth/v1/node/peer_count | peer 数量 |
| 方法 | 端点 | 说明 |
|---|
| GET | /eth/v1/beacon/genesis | 创世信息 |
| GET | /eth/v1/beacon/headers | 区块头列表 |
| GET | /eth/v1/beacon/headers/{block_id} | 指定区块头 |
| GET | /eth/v2/beacon/blocks/{block_id} | 按 slot/root 查询区块 |
| GET | /eth/v1/beacon/blocks/{block_id}/root | 区块根 |
| GET | /eth/v1/beacon/blocks/{block_id}/attestations | 区块证明 |
| GET | /eth/v1/beacon/blob_sidecars/{block_id} | Blob sidecars(EIP-4844) |
| GET | /eth/v1/beacon/deposit_snapshot | 存款快照 |
| 方法 | 端点 | 说明 |
|---|
| GET | /eth/v1/beacon/states/{state_id}/root | 状态根 |
| GET | /eth/v1/beacon/states/{state_id}/fork | 分叉信息 |
| GET | /eth/v1/beacon/states/{state_id}/finality_checkpoints | Finality 检查点 |
| GET | /eth/v1/beacon/states/{state_id}/validators | 全部验证者 |
| GET | /eth/v1/beacon/states/{state_id}/validators/{validator_id} | 单个验证者 |
| GET | /eth/v1/beacon/states/{state_id}/validator_balances | 验证者余额 |
| GET | /eth/v1/beacon/states/{state_id}/committees | Epoch 委员会 |
| GET | /eth/v1/beacon/states/{state_id}/sync_committees | 同步委员会 |
| GET | /eth/v1/beacon/states/{state_id}/randao | RANDAO 值 |
| 方法 | 端点 | 说明 |
|---|
| GET | /eth/v1/config/spec | 链规范参数 |
| GET | /eth/v1/config/fork_schedule | 分叉计划 |
| GET | /eth/v1/config/deposit_contract | 存款合约地址 |
| 方法 | 端点 | 说明 |
|---|
| GET | /eth/v1/validator/duties/attester/{epoch} | Attester 职责 |
| GET | /eth/v1/validator/duties/proposer/{epoch} | Proposer 职责 |
| POST | /eth/v1/validator/duties/sync/{epoch} | 同步委员会职责 |
| GET | /eth/v1/validator/attestation_data | 证明数据 |
| GET | /eth/v1/validator/aggregate_attestation | 聚合证明 |
| GET | /eth/v1/validator/sync_committee_contribution | 同步委员会贡献 |
| GET | /eth/v3/validator/blocks/{slot} | 生产区块 |
| 方法 | 端点 | 说明 |
|---|
| GET | /eth/v1/beacon/pool/attestations | 证明池 |
| GET | /eth/v1/beacon/pool/attester_slashings | Attester slashings |
| GET | /eth/v1/beacon/pool/proposer_slashings | Proposer slashings |
| GET | /eth/v1/beacon/pool/voluntary_exits | 自愿退出 |
| GET | /eth/v1/beacon/pool/sync_committees | 同步委员会消息 |
| GET | /eth/v1/beacon/pool/bls_to_execution_changes | BLS 到执行层变更 |
| 方法 | 端点 | 说明 |
|---|
| GET | /eth/v2/debug/beacon/states/{state_id} | 完整 Beacon 状态 |
| GET | /eth/v2/debug/beacon/heads | Fork choice heads |
| GET | /eth/v1/debug/fork_choice | 完整 fork choice 信息 |
| 方法 | 端点 | 说明 |
|---|
| GET | /eth/v1/events | Server-Sent Events 流 |
| EVM JSON-RPC | Beacon API |
|---|
| 协议 | JSON-RPC 2.0 | REST(HTTP GET/POST) |
| 请求格式 | {"jsonrpc":"2.0","method":"...","params":[...]} | URL 路径 + query 参数 |
| 响应格式 | {"result": ...} | {"data": ...} |
| WebSocket | ✅ | ❌(使用 SSE) |
| 调试方式 | 交互式 playground | curl / fetch 示例 |