How do I figure out the current number of blocks?


You don't need to modify the bitcoin client at all - you can use JSON-RPC and call getblockcount.

  • It's altcoin-dev, I need height to recalculate difficulty after fork. – user1497250 May 31 '13 at 17:57
  • I don't understand your problem. There's no variable nHeight in ComputeMinWork. – Nick ODell Jun 2 '13 at 18:29
  • It's true. It's not possible, because, does not have position on blockchain yet. Thanks. – user1497250 Jun 3 '13 at 19:05

If you don't mind using someone else's server you can just use the response from a HTTP call to http://blockexplorer.com/q/getblockcount

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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