Bitcoin Forum
December 11, 2024, 10:29:24 PM *
News: Latest Bitcoin Core release: 28.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Namecoin - Determine Block Height from Block Hash  (Read 508 times)
CoinHeavy (OP)
Full Member
***
Offline Offline

Activity: 221
Merit: 100


View Profile
May 27, 2014, 10:59:15 PM
Last edit: May 27, 2014, 11:09:31 PM by CoinHeavy
 #1

Is it possible to use namecoind to determine the block number from a block hash?
going the other way is easy:

Code:
namecoind getblockhash <index>

but getting the height from the hash appears to be impossible...

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

The closest two are:

Code:
namecoind getblockcount
which:
"Returns the number of blocks in the longest block chain."
 and
namecoind getblocknumber
which:
"Returns the block number of the latest block in the longest block chain."

So there are two methods which do the same thing and no methods that take a block hash and return that block's height, nor is block height a block attribute.

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

Activity: 105
Merit: 59


View Profile WWW
May 28, 2014, 03:04:03 AM
 #2

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
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!