getblockchaininfo | Bitcoin

The getblockchaininfo method returns an object containing various state info regarding blockchain processing.

👍

Get you own node endpoint today

Start for free and get your app to production levels immediately. No credit card required.

You can sign up with your GitHub, X, Google, or Microsoft account.

Parameters

  • none

Response

  • result — an object containing various state info with the following fields:
    • chain — current network name (main, test, regtest)
    • blocks — the height of the most-work fully-validated chain. The genesis block has height 0
    • headers — the current number of headers we have validated
    • bestblockhash — the hash of the currently best block
    • difficulty — the current difficulty
    • mediantime — median time for the current best block
    • verificationprogress — estimate of verification progress [0..1]
    • initialblockdownload — (debug information) estimate of whether this node is in Initial Block Download mode
    • chainwork — total amount of work in active chain, in hexadecimal
    • size_on_disk — the estimated size of the block and undo files on disk
    • pruned — if the blocks are subject to pruning
    • pruneheight — lowest-height complete block stored (only present if pruning is enabled)
    • automatic_pruning — whether automatic pruning is enabled (only present if pruning is enabled)
    • prune_target_size — the target size used by pruning (only present if automatic pruning is enabled)
    • softforks — status of softforks
    • bip9_softforks — status of BIP9 softforks in progress
    • warnings — any network and blockchain warnings
  • error — an object containing an error message if an error occurred, otherwise null
  • id — an integer representing the ID of the request, used to match requests with responses

Use case

The getblockchaininfo method is useful for retrieving various state information about the blockchain. This information can be used for monitoring the health and progress of the blockchain, as well as for making decisions in blockchain-based applications. For example, a mining pool might use the difficulty field to adjust the pool's target share difficulty.

Try the getblockchaininfo RPC method yourself

Language
Click Try It! to start a request and see the response here!