跳到主要内容

RPC 响应类型

所有 RPC 响应对象的详细 JSON 结构。

BlockResponse(区块响应)

chain_getBlockchain_getBlockByNumberchain_getBlockByHashchain_getLatestBlock 返回。

{
"hash": "0a1b2c...",
"height": 42,
"timestamp": 1710000000,
"parent_hash": "ff0011...",
"state_root": "abc123...",
"tx_root": "def456...",
"proposer": "aabbcc...",
"version": 1,
"transaction_count": 15
}
字段类型描述
hashstring区块哈希(十六进制,128 字符 = 64 字节 SHA-512)
heightu64区块编号
timestampu64Unix 时间戳(秒)
parent_hashstring父区块哈希(十六进制)
state_rootstring状态根哈希(十六进制,64 字符)
tx_rootstring交易根哈希(十六进制,64 字符)
proposerstring提案者公钥(十六进制,64 字符)
versionu32区块格式版本
transaction_countu64区块中的交易数量

AccountResponse(账户响应)

account_getAccountaccount_getBalanceaccount_getNonce 返回。

{
"address": "aabbcc...",
"balance": "1000000000000000000",
"nonce": 5
}
字段类型描述
addressstring账户地址(十六进制,64 字符 = 32 字节 ed25519 公钥)
balancestring最小单位余额(u128 以十进制字符串表示,18 位精度)
nonceu64当前交易 nonce

TransactionResponse(交易响应)

tx_getTransaction 返回。

{
"hash": "aabbcc...",
"from": "112233...",
"to": "445566...",
"amount": 1000,
"nonce": 1,
"fee": 1000000000000000,
"timestamp": 1710000000,
"block_height": 42
}
字段类型描述
hashstring交易哈希(十六进制)
fromstring发送方地址(十六进制)
tostring接收方地址(十六进制)
amountu64转账金额
nonceu64提交时发送方的 nonce
feeu128?交易手续费(可选)
timestampu64?已确认时的区块时间戳
block_heightu64?已确认时的区块高度

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_scoreu16?本节点的 PoU 分数(0-1000)
leaderstring?当前 leader 的节点 ID
leader_scoreu16?Leader 的 PoU 分数
epochu64?当前 epoch 编号
local_is_leaderbool本节点是否为当前 leader
election_readybool是否可以进行选举

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
}