0

https://bitcoin.stackexchange.com/a/13347/27951

Based upon the answer here, it seems there's values per block with each Prev_Hash and also Tx_Root

There doesn't seem to be much documentation for how to access these. How can I find the Prev_Hash and the Tx_Root of the most recent block for example?

Thanks

2
  • Do you want to access the values from code? Or just see them? You can see the values on a block explorer, but to decode the values from a raw block you'd need to understand the message protocol format. – morsecoder Apr 16 '16 at 0:50
  • I'd like to see them for now but additionally access them by code eventually. I've found the getblock method which can be used to display the merkle tree, but how do I find the blockHash parameter to pass to that method, for say the last block or last 10 blocks? Not sure where I can find those blockHashes – Anthony Apr 16 '16 at 0:58
1

Look at a block on a block explorer.

enter image description here

Here the Prev_Hash is called 'Previous Block' and the Tx_Root is called 'Merkle Root'.

For more technical info, take a look at the Protocol Documentation.

4
  • Awesome, thanks. Can I use getblock to access this via the Blockchain API? And also how can I find the hash of the latest block? Thanks! – Anthony Apr 16 '16 at 1:06
  • I'm not an expert on Blockchain's API, but their documentation is here: blockchain.info/api/blockchain_api. For the latest block, it looks like you can use: blockchain.info/latestblock. – morsecoder Apr 16 '16 at 1:09
  • Whoops, I meant to say use getblock to access this via the Bitcoin API, typo. – Anthony Apr 16 '16 at 1:14
  • You mean the Bitcoin Core RPC command getblock? Yes, it reports those values. – Pieter Wuille Apr 17 '16 at 8:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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