RPC 响应类型
所有 RPC 响应对象的详细 JSON 结构。
BlockResponse(区块响应)
由 chain_getBlock、chain_getBlockByNumber、chain_getBlockByHash、chain_getLatestBlock 返回。
{
"hash": "0a1b2c...",
"height": 42,
"timestamp": 1710000000,
"parent_hash": "ff0011...",
"state_root": "abc123...",
"tx_root": "def456...",
"proposer": "aabbcc...",
"version": 1,
"transaction_count": 15
}
| 字段 | 类型 | 描述 |
|---|---|---|
hash | string | 区块哈希(十六进制,128 字符 = 64 字节 SHA-512) |
height | u64 | 区块编号 |
timestamp | u64 | Unix 时间戳(秒) |
parent_hash | string | 父区块哈希(十六进制) |
state_root | string | 状态根哈希(十六进制,64 字符) |
tx_root | string | 交易根哈希(十六进制,64 字符) |
proposer | string | 提案者公钥(十六进制,64 字符) |
version | u32 | 区块格式版本 |
transaction_count | u64 | 区块中的交易数量 |
AccountResponse(账户响应)
由 account_getAccount、account_getBalance、account_getNonce 返回。
{
"address": "aabbcc...",
"balance": "1000000000000000000",
"nonce": 5
}
| 字段 | 类型 | 描述 |
|---|---|---|
address | string | 账户地址(十六进制,64 字符 = 32 字节 ed25519 公钥) |
balance | string | 最小单位余额(u128 以十进制字符串表示,18 位精度) |
nonce | u64 | 当前交易 nonce |
TransactionResponse(交易响应)
由 tx_getTransaction 返回。
{
"hash": "aabbcc...",
"from": "112233...",
"to": "445566...",
"amount": 1000,
"nonce": 1,
"fee": 1000000000000000,
"timestamp": 1710000000,
"block_height": 42
}
| 字段 | 类型 | 描述 |
|---|---|---|
hash | string | 交易哈希(十六进制) |
from | string | 发送方地址(十六进制) |
to | string | 接收方地址(十六进制) |
amount | u64 | 转账金额 |
nonce | u64 | 提交时发送方的 nonce |
fee | u128? | 交易手续费(可选) |
timestamp | u64? | 已确认时的区块时间戳 |
block_height | u64? | 已确认时的区块高度 |
TransactionReceiptResponse(交易收据响应)
由 tx_getTransactionReceipt 返回。
{
"hash": "aabbcc...",
"from": "112233...",
"to": "445566...",
"amount": 1000,
"fee": 1000000000000000,
"block_height": 42,
"block_hash": "ff0011...",
"timestamp": 1710000000,
"status": "confirmed"
}
状态值:"confirmed"(已确认)、"pending"(待处理)、"not_found"(未找到)。
HealthResponse(健康检查响应)
由 savitri_health 返回。
{
"status": "ok",
"service": "savitri-rpc",
"mode": "lightnode"
}
模式值:"lightnode"(轻节点)、"masternode"(主节点)、"unknown"(未知)。
PouLocalResponse(本地 PoU 响应)
由 pou_getConsensusState / savitri_pouLocal 返回。
{
"local_score": 750,
"leader": "12Dxyz...",
"leader_score": 920,
"epoch": 15,
"local_is_leader": false,
"election_ready": true
}
| 字段 | 类型 | 描述 |
|---|---|---|
local_score | u16? | 本节点的 PoU 分数(0-1000) |
leader | string? | 当前 leader 的节点 ID |
leader_score | u16? | Leader 的 PoU 分数 |
epoch | u64? | 当前 epoch 编号 |
local_is_leader | bool | 本节点是否为当前 leader |
election_ready | bool | 是否可以进行选举 |
PouPeersResponse(节点 PoU 响应)
由 savitri_pouPeers 返回。
{
"peers": {
"12D3KooW...abc": 750,
"12D3KooW...def": 820
}
}
NodeInfoResponse(节点信息响应)
由 net_nodeInfo 返回。
{
"node_id": "12D3KooW...",
"protocol_version": "1.0.0",
"network": "savitri-testnet",
"listening": true,
"peer_count": 14,
"block_height": 42,
"syncing": false,
"mode": "lightnode"
}
MempoolSizeResponse(内存池大小响应)
由 mempool_getSize 返回。
{
"pending": 150,
"queued": 30
}
TokenInfoResponse(代币信息响应)
由 token_getTokenInfo 返回。
{
"token_id": "savt",
"name": "Savitri Test Token",
"symbol": "TEST",
"decimals": 18,
"total_supply": "100000000000000000000000000"
}
FaucetClaimResponse(水龙头领取响应)
由 savitri_faucetClaim 返回。
{
"tx_hash": "0xabc...",
"amount": "5000000000000000000"
}
金额为 5 SAVT(5 * 10^18 最小单位)。
SyncingResponse(同步状态响应)
由 savitri_syncing 返回。
{
"syncing": true,
"current_block": 100,
"highest_block": 500
}
MonolithInfoResponse(Monolith 信息响应)
由 savitri_getMonolithHead 返回。
{
"exec_height": 1000,
"window_start": 900,
"epoch_id": 5,
"block_count": 100,
"size_bytes": 524288,
"monolith_id": "mono_1000",
"produced_at_ms": 1710000000000,
"cosignature_count": 3
}