Like I would do wget -O - http://blockchain.info/q/getblockcount 2>/dev/null for the main net.


2 Answers 2


Blockchain.info does not track the testnet, but blockexplorer.com does. In fact the API you're using was originally from blockexplorer.com, and blockchain.info simply adopted it.

wget -O - http://blockexplorer.com/testnet/q/getblockcount 2> /dev/null

or shorter

curl http://blockexplorer.com/testnet/q/getblockcount
  • 1
    this doesn't work anymore :( gives a 502...
    – knocte
    Commented Jun 27, 2016 at 7:13

BlockExplorer doesn't work anymore for me (redirecting to testnet.blockexplorer.com which throws a 502) so I found a new alternative:


You have to get the "last_block" element.

(For mainnet: http://btc.blockr.io/api/v1/coin/info)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.