Tendermint RPC API文档

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

DumpConsensusState - 导出共识状态

DumpConsensusState调用可以导出共识状态。该API目前还不稳定。

API请求

GET /dump_consensus_state

API响应

返回JSON对象,结构如下:

  • jsonrpc:JSONRPC版本,固定为"2.0"
  • id:API请求的ID编号
  • error:错误描述信息
  • result:结果对象
    • round_state:轮次状态
      • height
      • round
      • start_time
      • commit_time
      • validators:验证节点集
      • proposal:提议
      • proposal_block:提议区块
      • proposal_block_parts:
      • locked_round
      • locked_block
      • locked_block_parts
      • valid_round
      • valid_block
      • valid_block_parts
      • votes
      • commit_round
      • last_commit
      • last_validators
    • peers:对等节点集

示例代码

使用curl调用DumpConsensusState接口,导出当前共识状态:

~$ curl 'localhost:26657/dump_consensus_state'

响应结果:

{
    "jsonrpc": "2.0",
    "id": "",
    "result": {
      "round_state": {
        "height": "7185",
        "round": "0",
        "step": "1",
        "start_time": "2018-05-12T13:57:28.440293621-07:00",
        "commit_time": "2018-05-12T13:57:27.440293621-07:00",
        "validators": {
          "validators": [
            {
              "address": "B5B3D40BE53982AD294EF99FF5A34C0C3E5A3244",
              "pub_key": {
                "type": "tendermint/PubKeyEd25519",
                "value": "SBctdhRBcXtBgdI/8a/alTsUhGXqGs9k5ylV1u5iKHg="
              },
              "voting_power": "10",
              "accum": "0"
            }
          ],
          "proposer": {
            "address": "B5B3D40BE53982AD294EF99FF5A34C0C3E5A3244",
            "pub_key": {
              "type": "tendermint/PubKeyEd25519",
              "value": "SBctdhRBcXtBgdI/8a/alTsUhGXqGs9k5ylV1u5iKHg="
            },
            "voting_power": "10",
            "accum": "0"
          }
        },
        "proposal": null,
        "proposal_block": null,
        "proposal_block_parts": null,
        "locked_round": "0",
        "locked_block": null,
        "locked_block_parts": null,
        "valid_round": "0",
        "valid_block": null,
        "valid_block_parts": null,
        "votes": [
          {
            "round": "0",
            "prevotes": "_",
            "precommits": "_"
          }
        ],
        "commit_round": "-1",
        "last_commit": {
          "votes": [
            "Vote{0:B5B3D40BE539 7184/00/2(Precommit) 14F946FA7EF0 /702B1B1A602A.../ @ 2018-05-12T20:57:27.342Z}"
          ],
          "votes_bit_array": "x",
          "peer_maj_23s": {}
        },
        "last_validators": {
          "validators": [
            {
              "address": "B5B3D40BE53982AD294EF99FF5A34C0C3E5A3244",
              "pub_key": {
                "type": "tendermint/PubKeyEd25519",
                "value": "SBctdhRBcXtBgdI/8a/alTsUhGXqGs9k5ylV1u5iKHg="
              },
              "voting_power": "10",
              "accum": "0"
            }
          ],
          "proposer": {
            "address": "B5B3D40BE53982AD294EF99FF5A34C0C3E5A3244",
            "pub_key": {
              "type": "tendermint/PubKeyEd25519",
              "value": "SBctdhRBcXtBgdI/8a/alTsUhGXqGs9k5ylV1u5iKHg="
            },
            "voting_power": "10",
            "accum": "0"
          }
        }
      },
      "peers": [
        {
          "node_address": "30ad1854af22506383c3f0e57fb3c7f90984c5e8@172.16.63.221:26656",
          "peer_state": {
            "round_state": {
              "height": "7185",
              "round": "0",
              "step": "1",
              "start_time": "2018-05-12T13:57:27.438039872-07:00",
              "proposal": false,
              "proposal_block_parts_header": {
                "total": "0",
                "hash": ""
              },
              "proposal_block_parts": null,
              "proposal_pol_round": "-1",
              "proposal_pol": "_",
              "prevotes": "_",
              "precommits": "_",
              "last_commit_round": "0",
              "last_commit": "x",
              "catchup_commit_round": "-1",
              "catchup_commit": "_"
            },
            "stats": {
              "last_vote_height": "7184",
              "votes": "255",
              "last_block_part_height": "7184",
              "block_parts": "255"
            }
          }
        }
      ]
    }
}