Get Block Chain Info

The getblockchaininfo RPC provides information about the current state of the block chain.

Parameters: none

Result—A JSON object providing information about the block chain

Name Type Presence Description
result object Required
(exactly 1)
Information about the current state of the local block chain

chain
string Required
(exactly 1)
The name of the block chain. One of main for mainnet, test for testnet, or regtest for regtest

blocks
number(int) Required
(exactly 1)
The number of validated blocks in the local best block chain. For a new node with just the hardcoded genesis block, this will be 0

headers
number(int) Required
(exactly 1)
The number of validated headers in the local best headers chain. For a new node with just the hardcoded genesis block, this will be zero. This number may be higher than the number of blocks

bestblockhash
string(hex) Required
(exactly 1)
The hash of the header of the highest validated block in the best block chain, encoded as hex in RPC byte order. This is identical to the string returned by the getbestblockhash RPC

difficulty
number(real) Required
(exactly 1)
The difficulty of the highest-height block in the best block chain

mediantime
number(int) Required
(exactly 1)
The median time of the 11 blocks before the most recent block on the blockchain. Used for validating transaction locktime under BIP113

verificationprogress
number(real) Required
(exactly 1)
Estimate of what percentage of the block chain transactions have been verified so far, starting at 0.0 and increasing to 1.0 for fully verified. May slightly exceed 1.0 when fully synced to account for transactions in the memory pool which have been verified before being included in a block

chainwork
string(hex) Required
(exactly 1)
The estimated number of block header hashes checked from the genesis block to this block, encoded as big-endian hex

pruned
bool Required
(exactly 1)
Indicates if the blocks are subject to pruning

pruneheight
number(int) Optional
(0 or 1)
The lowest-height complete block stored if prunning is activated

softforks
array Required
(exactly 1)
An array of objects each describing a current or previous soft fork
→ →
Softfork
object Required
(3 or more)
A specific softfork
→ → →
id
string Required
(exactly 1)
The name of the softfork
→ → →
version
numeric
(int)
Required
(exactly 1)
The block version used for the softfork
→ → →
enforce
string = object Optional
(0 or 1)
The progress toward enforcing the softfork rules for new-version blocks
→ → → →
status
bool Required
(exactly 1)
Indicates if the threshold was reached
→ → → →
found
numeric
(int)
Optional
(0 or 1)
Number of blocks that support the softfork
→ → → →
required
numeric
(int)
Optional
(0 or 1)
Number of blocks that are required to reach the threshold
→ → → →
window
numeric
(int)
Optional
(0 or 1)
The maximum size of examined window of recent blocks
→ → →
reject
object Optional
(0 or 1)
The progress toward enforcing the softfork rules for new-version blocks
→ → → →
status
bool Optional
(0 or 1)
Indicates if the threshold was reached
→ → → →
found
numeric
(int)
Optional
(0 or 1)
Number of blocks that support the softfork
→ → → →
required
numeric
(int)
Optional
(0 or 1)
Number of blocks that are required to reach the threshold
→ → → →
window
numeric
(int)
Optional
(0 or 1)
The maximum size of examined window of recent blocks

bip9_softforks
object Required
(exactly 1)
The status of BIP9 softforks in progress
→ →
Name
string : object Required
(2 or more)
A specific BIP9 softfork
→ → →
status
string Required
(exactly 1)
Set to one of the following reasons=
defined if voting hasn’t started yet
started if the voting has started
locked_in if the voting was successful but the softfort hasn’t been activated yet
active if the softfork was activated
failed if the softfork has not receieved enough votes
→ → →
bit
numeric
(int)
Optional
(0 or 1)
The bit (0-28) in the block version field used to signal this softfork. Field is only shown when status is started
→ → →
startTime
numeric
(int)
Required
(exactly 1)
The Unix epoch time when the softfork voting begins
→ → →
timeout
numeric
(int)
Required
(exactly 1)
The Unix epoch time at which the deployment is considered failed if not yet locked in
→ → →
since
numeric
(int)
Required
(exactly 1)
The height of the first block to which the status applies

Example

pai-cli getblockchaininfo

Result:

{
  "chain": "main",
  "blocks": 464562,
  "headers": 464562,
  "bestblockhash": "00000000000000000085bd56990c579a36bade6ea427646612f13476edb30ceb",
  "difficulty": 521974519553.6282,
  "mediantime": 1493758169,
  "verificationprogress": 0.999989733170878,
  "chainwork": "00000000000000000000000000000000000000000052c26f32ffa22706efd28c",
  "pruned": false,
  "softforks": [
    {
      "id": "bip34",
      "version": 2,
      "reject": {
        "status": true
      }
    },
    {
      "id": "bip66",
      "version": 3,
      "reject": {
        "status": true
      }
    },
    {
      "id": "bip65",
      "version": 4,
      "reject": {
        "status": true
      }
    }
  ],
  "bip9_softforks": {
    "csv": {
      "status": "active",
      "startTime": 1462060800,
      "timeout": 1493596800,
      "since": 419328
    },
    "segwit": {
      "status": "started",
      "bit": 1,
      "startTime": 1479168000,
      "timeout": 1510704000,
      "since": 439488
    }
  }
}

See also

  • GetMiningInfo: returns various mining-related information.
  • GetNetworkInfo: returns information about the node’s connection to the network.
  • GetWalletInfo: provides information about the wallet.