Is it possible to acquire the merkleroot per block with rpc command or core command?

Why is the merkleroot not included in the block header in the cns003.txt?

I see the transaction hashes are included in some rpc responses so must I calculate merkleroot manually?


The merkle root hash is used when creating the block hash. This is in the block_header as returned from the daemon RPC method get_block.

| improve this answer | |
  • I thought the block hash was the block identifier: – Satoshi Nakamonero Oct 7 '18 at 10:00
  • 5. Calculation of Block Identifier The identifier of a block is the result of hashing the following data with Keccak: - size of [block_header, Merkle root hash, and the number of transactions] in bytes (varint) - block_header, - Merkle root hash, - number of transactions (varint). The goal of the Merkle root hash is to "attach" the transactions referred to in the list to the block header: once the Merkle root hash is fixed, the transactions cannot be modified. – Satoshi Nakamonero Oct 7 '18 at 10:00
  • For block with height of 912345 and block hash e22cf75f39ae720e8b71b3d120a5ac03f0db50bba6379e2850975b4859190bc6 I see only a coinbase transaction with hash c7da3965f25c19b8eb7dd8db48dcd4e7c885e2491db77e289f0609bf8e08ec30. In bitcoin if there is only a coinbase transaction then the coinbase transaction is used as merkleroot but this does not seem to be the case for Monero? When I take the Monero 912345 coinbase hash byteswap it, concatenate it with itself decode from hex, double hash it with sha256 and encode to hex doesn't result in the block hash? – Satoshi Nakamonero Oct 7 '18 at 10:08
  • Block hash is the block ID which also is derived from merkle root hash. – jtgrassie Oct 7 '18 at 13:15
  • Your example of trying to recreate block hash is flawed in a couple of ways. The merkle root hash is just the tx hash if there is only 1 tx, but to get to the block hash you need to follow the steps in the paper you linked. There is no mention of sha256 for starters. You need to use Keccak. – jtgrassie Oct 7 '18 at 13: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.