<p>At the time of asking, this functionality wasn't supported in Namecoin. I've written a patch that adds this and a few other properties to Namecoin's getblock RPC call.</p>

<p><a href="https://github.com/namecoin/namecoin/issues/87" rel="nofollow">https://github.com/namecoin/namecoin/issues/87</a>
<a href="https://gist.github.com/ryancdotorg/5e610e9ee546beed367d" rel="nofollow">https://gist.github.com/ryancdotorg/5e610e9ee546beed367d</a></p>

CC BY-SA 3.0
2014-05-28T03:04:56.227Z
2014-05-28T03:04:56.227Z
ryanc
<p>Is it possible to use namecoind to determine the block number from a block hash?
Going from height to hash is easy:</p>

<p>namecoind getblockhash </p>

<p>But going from hash to height appears to be impossible...</p>

<p>Height is not an attribute on each block and no method appears to return it.</p>

<p>The closest two are:</p>

<pre><code>namecoind help getblockcount
"Returns the number of blocks in the longest block chain."

namecoind help getblocknumber
"Returns the block number of the latest block in the longest block chain."
</code></pre>

<p>This is close, but I don't want the single, largest height value, I'm looking for a way to look up any block's height via its hash.</p>

<p>So there are two methods which do the same thing (return greatest height) and no methods that take a block's hash and return that block's height.  Block height is also not a block attribute.</p>

<p>Is there something I'm missing here?  Other coins do not appear to lack this basic functionality.</p>

<altcoin><namecoin><hash><height>
Namecoin - How to Find Block Height via Block Hash?
CoinHeavy
# Namecoin - How to Find Block Height via Block Hash?

(Asked by: username_0 on 2014-05-27)

Is it possible to use namecoind to determine the block number from a block hash?
Going from height to hash is easy:

namecoind getblockhash

But going from hash to height appears to be impossible...

Height is not an attribute on each block and no method appears to return it.

The closest two are:

```
namecoind help getblockcount
"Returns the number of blocks in the longest block chain."

namecoind help getblocknumber
"Returns the block number of the latest block in the longest block chain."

```

This is close, but I don't want the single, largest height value, I'm looking for a way to look up any block's height via its hash.

So there are two methods which do the same thing (return greatest height) and no methods that take a block's hash and return that block's height. Block height is also not a block attribute.

Is there something I'm missing here?  Other coins do not appear to lack this basic functionality.

**Tags:** altcoin, namecoin, hash, height


---

## 1 answers

### Answer by username_1 on 2014-05-28. Score: 2 | Accepted answer

At the time of asking, this functionality wasn't supported in Namecoin. I've written a patch that adds this and a few other properties to Namecoin's getblock RPC call.

<https://github.com/namecoin/namecoin/issues/87>
<https://gist.github.com/ryancdotorg/5e610e9ee546beed367d>


---

