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!