Tendermint RPC API文档

在线工具推荐: Three.js AI纹理开发包 - YOLO合成数据生成器 - GLTF/GLB在线编辑 - 3D模型格式在线转换 - 可编程3D场景编辑器

Status - 查询Tendermint状态

Status接口用来查询Tendermint的状态,包括节点信息、公钥、 最新区块哈希、因公哈希、区块高度和时间。

API请求

GET /status

API响应

返回JSON对象,结构如下:

  • jsonrpc:JSONRPC版本,固定为"2.0"
  • id:API请求的ID编号
  • error:错误描述信息
  • result:结果对象,结构如下:
    • node_info:节点信息
    • sync_info:同步信息
    • validator_info:验证节点信息

示例代码

使用curl调用Status接口,查询当前状态:

~$ curl 'localhost:26657/status'

响应结果:

{
"jsonrpc": "2.0",
"id": "",
"result": {
    "node_info": {
            "protocol_version": {
                "p2p": "4",
                "block": "7",
                "app": "0"
            },
            "id": "53729852020041b956e86685e24394e0bee4373f",
            "listen_addr": "10.0.2.15:26656",
            "network": "test-chain-Y1OHx6",
            "version": "0.24.0-2ce1abc2",
            "channels": "4020212223303800",
            "moniker": "ubuntu-xenial",
            "other": {
                "tx_index": "on",
                "rpc_addr": "tcp://0.0.0.0:26657"
            }
        },
        "sync_info": {
            "latest_block_hash": "F51538DA498299F4C57AC8162AAFA0254CE08286",
            "latest_app_hash": "0000000000000000",
            "latest_block_height": "18",
            "latest_block_time": "2018-09-17T11:42:19.149920551Z",
            "catching_up": false
        },
        "validator_info": {
            "address": "D9F56456D7C5793815D0E9AF07C3A355D0FC64FD",
            "pub_key": {
                "type": "tendermint/PubKeyEd25519",
                "value": "wVxKNtEsJmR4vvh651LrVoRguPs+6yJJ9Bz174gw9DM="
            },
            "voting_power": "10"
        }
    }
}