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.


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

| improve this answer | |

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