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

<p><a href="http://tbtc.blockr.io/api/v1/coin/info" rel="nofollow">http://tbtc.blockr.io/api/v1/coin/info</a></p>

<p>You have to get the "last_block" element.</p>

<p>(For mainnet: <a href="http://btc.blockr.io/api/v1/coin/info" rel="nofollow">http://btc.blockr.io/api/v1/coin/info</a>)</p>

CC BY-SA 3.0
2016-06-27T07:18:08.830Z
2016-06-27T07:18:08.830Z
knocte
<p>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.</p>

<pre><code>wget -O - http://blockexplorer.com/testnet/q/getblockcount 2&gt; /dev/null
</code></pre>

<p>or shorter</p>

<pre><code>curl http://blockexplorer.com/testnet/q/getblockcount
</code></pre>

CC BY-SA 3.0
2016-06-27T07:13:57.497Z
this doesn't work anymore :( gives a 502...
knocte
CC BY-SA 3.0
2013-06-17T16:00:48.823Z
2013-06-17T16:00:48.823Z
cdecker
<p>Like I would do <code>wget -O - http://blockchain.info/q/getblockcount 2&gt;/dev/null</code> for the main net.</p>

<blockchain><testnet><height>
How do I get testnet block height?
o0'.
# How do I get testnet block height?

(Asked by: username_0 on 2013-06-17)

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

**Tags:** blockchain, testnet, height


---

## 2 answers

### Answer by username_2 on 2013-06-17. Score: 4 | Accepted answer

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

```

> **Comments:**
> **username_1**: this doesn't work anymore :( gives a 502...  

---

### Answer by username_1 on 2016-06-27. Score: 0

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

<http://tbtc.blockr.io/api/v1/coin/info>

You have to get the "last\_block" element.

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


---

