<p>You don't need to modify the bitcoin client at all - you can use <a href="https://en.bitcoin.it/wiki/API_reference_%28JSON-RPC%29" rel="nofollow">JSON-RPC</a> and call <a href="https://en.bitcoin.it/wiki/Original_Bitcoin_client/API_calls_list" rel="nofollow">getblockcount</a>.</p>

CC BY-SA 3.0
2013-05-31T17:57:25.347Z
It's altcoin-dev, I need height to recalculate difficulty after fork.
user1497250
CC BY-SA 3.0
2013-06-02T18:29:50.103Z
I don't understand your problem. There's no variable nHeight in ComputeMinWork.
Nick ODell
CC BY-SA 3.0
2013-06-03T19:05:24.560Z
It's true. It's not possible, because, does not have position on blockchain yet. Thanks.
user1497250
CC BY-SA 3.0
2013-05-31T16:52:55.240Z
2013-05-31T16:52:55.240Z
Nick ODell
<p>If you don't mind using someone else's server you can just use the response from a HTTP call to <a href="http://blockexplorer.com/q/getblockcount" rel="nofollow">http://blockexplorer.com/q/getblockcount</a></p>

CC BY-SA 3.0
2013-06-02T18:22:21.393Z
2013-06-02T18:22:21.393Z
jgm
<p>How do I figure out the current number of blocks?</p>

<json-rpc>
current block height
user1497250
# current block height

(Asked by: username_0 on 2013-05-31)

How do I figure out the current number of blocks?

**Tags:** json-rpc


---

## 2 answers

### Answer by username_1 on 2013-05-31. Score: 2

You don't need to modify the bitcoin client at all - you can use [JSON-RPC](https://en.bitcoin.it/wiki/API_reference_%28JSON-RPC%29) and call [getblockcount](https://en.bitcoin.it/wiki/Original_Bitcoin_client/API_calls_list).

> **Comments:**
> **username_0**: It's altcoin-dev, I need height to recalculate difficulty after fork.  
> **username_1**: I don't understand your problem. There's no variable nHeight in ComputeMinWork.  
> **username_0**: It's true. It's not possible, because, does not have position on blockchain yet. Thanks.  

---

### Answer by username_2 on 2013-06-02. Score: 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>


---

