比特币 RPC 命令 getblockchaininfo解析

root@local:~# bitcoin-cli getblockchaininfo
{
  "chain": "main",
  "blocks": 39,
  "headers": 39,
  "bestblockhash": "0000000027d14f1ed98ba38ab41718b9de106410ec867edf7a0da0af0366fbb9",
  "difficulty": 1,
  "mediantime": 1540616741,
  "verificationprogress": 1.143294162804354e-07,
  "initialblockdownload": false,
  "chainwork": "0000000000000000000000000000000000000000000000000000002800280028",
  "size_on_disk": 11041,
  "pruned": false,
  "softforks": [
    {
      "id": "bip34",
      "version": 2,
      "reject": {
        "status": false
      }
    },
    {
      "id": "bip66",
      "version": 3,
      "reject": {
        "status": false
      }
    },
    {
      "id": "bip65",
      "version": 4,
      "reject": {
        "status": false
      }
    }
  ],
  "bip9_softforks": {
    "csv": {
      "status": "defined",
      "startTime": 1462060800,
      "timeout": 1493596800,
      "since": 0
    },
    "segwit": {
      "status": "defined",
      "startTime": 1479168000,
      "timeout": 1510704000,
      "since": 0
    }
  },
  "warnings": "This is a pre-release test build - use at your own risk - do not use for mining or merchant applications"
}

也可以用curl命令查看:

root@local:~# curl --user root --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getblockchaininfo", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:8332/
Enter host password for user 'root':
{"result":{"chain":"main","blocks":769,"headers":769,"bestblockhash":"0000000099872365ec021c3707945b620f592bab34403be30193f891347263cb","difficulty":1,"mediantime":1542004440,"verificationprogress":2.180065870095701e-06,"initialblockdownload":false,"chainwork":"0000000000000000000000000000000000000000000000000000030203020302","size_on_disk":213163,"pruned":false,"softforks":[{"id":"bip34","version":2,"reject":{"status":false}},{"id":"bip66","version":3,"reject":{"status":false}},{"id":"bip65","version":4,"reject":{"status":false}}],"bip9_softforks":{"csv":{"status":"defined","startTime":1462060800,"timeout":1493596800,"since":0},"segwit":{"status":"defined","startTime":1479168000,"timeout":1510704000,"since":0}},"warnings":"This is a pre-release test build - use at your own risk - do not use for mining or merchant applications"},"error":null,"id":"curltest"}

参考:
比特币 RPC 命令剖析 “getblockchaininfo”

你可能感兴趣的:(区块链)