2

How do I figure out the current number of blocks?

2 Answers 2

2

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

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

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 and acknowledge you have read our privacy policy.

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