Commit - 查询提交数据
Commit
调用返回指定高度时的提交数据。如果未指定高度参数,则该
调用将返回最新区块的提交数据。
API请求
GET /commit
查询参数:
- height:区块高度
API响应
返回JSON对象,结构如下:
- jsonrpc:JSONRPC版本,固定为"2.0"
- id:API请求的ID编号
- error:错误描述信息
- result:结果对象
- canonical;是否权威结果
- commit:提交对象,结构如下
- precommits:预提交数组
- blockID:区块ID
- header:区块头
示例代码
使用curl调用Commit接口,获取高度11的提交数据:
~$curl 'localhost:26657/commit?height=11'
响应结果:
{
"error": "",
"result": {
"canonical": true,
"commit": {
"precommits": [
{
"signature": {
"data": "00970429FEC652E9E21D106A90AE8C5413759A7488775CEF4A3F44DC46C7F9D941070E4FBE9ED54DF247FA3983359A0C3A238D61DE55C75C9116D72ABC9CF50F",
"type": "ed25519"
},
"block_id": {
"parts": {
"hash": "9E37CBF266BC044A779E09D81C456E653B89E006",
"total": "1"
},
"hash": "CC6E861E31CA4334E9888381B4A9137D1458AB6A"
},
"type": "2",
"round": "0",
"height": "11",
"validator_index": "0",
"validator_address": "E89A51D60F68385E09E716D353373B11F8FACD62"
}
],
"blockID": {
"parts": {
"hash": "9E37CBF266BC044A779E09D81C456E653B89E006",
"total": "1"
},
"hash": "CC6E861E31CA4334E9888381B4A9137D1458AB6A"
}
},
"header": {
"app_hash": "",
"chain_id": "test-chain-6UTNIN",
"height": "11",
"time": "2017-05-29T15:05:54.893Z",
"num_txs": "0",
"last_block_id": {
"parts": {
"hash": "277A4DBEF91483A18B85F2F5677ABF9694DFA40F",
"total": "1"
},
"hash": "96B1D2F2D201BA4BC383EB8224139DB1294944E5"
},
"last_commit_hash": "3CE0C9727CE524BA9CB7C91E28F08E2B94001087",
"data_hash": "",
"validators_hash": "9365FC80F234C967BD233F5A3E2AB2F1E4B0E5AA"
}
},
"id": "",
"jsonrpc": "2.0"
}