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

Anthony
  • 151
  • 1
  • 11
  • 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 00: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 00:58

1 Answers1

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.

morsecoder
  • 14,168
  • 2
  • 42
  • 94
  • 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 01:06
  • I'm not an expert on Blockchain's API, but their documentation is here: https://blockchain.info/api/blockchain_api. For the latest block, it looks like you can use: https://blockchain.info/latestblock. – morsecoder Apr 16 '16 at 01:09
  • Whoops, I meant to say use getblock to access this via the Bitcoin API, typo. – Anthony Apr 16 '16 at 01:14
  • You mean the Bitcoin Core RPC command getblock? Yes, it reports those values. – Pieter Wuille Apr 17 '16 at 08:32