I want to know how to generate different blockhashing_blobs using blocktemplate_blob, returned by the RPC get_block_template method, with different extra fields. To do this, I need to manually recalculate the transaction merkle tree, and for this, I need to get new base transaction hash. In this answer, I found that the transaction hash is calculated using RingCTBase and RingCTPrunable, but I don't find anything about this in the base transaction structure description. Can anyone please tell me how to get this data from blocktemplate_blob?

edited: My question is how, having the body of a base transaction, change one of its fields (extra) and calculate the new hash (identifier) of this base transaction. I can't understand where I get the RingCTBase and RingCTPrunable values. In the description of the structure of the base transaction there is nothing about it.

  • 1
    Whilst the question is slightly different to the one I marked as a duplicate, the answer covers this question too.
    – jtgrassie
    Commented May 25, 2019 at 18:57
  • I didn’t find anything about calculating the hash of the base transaction from raw blob data on this link. Could you please indicate the part that answers my question more precisely? I tried to write it more clearly.
    – Oroffe
    Commented May 25, 2019 at 19:51
  • 1
    The answer explicitly explains how the blockhashing_blob is constructed (and more).
    – jtgrassie
    Commented May 25, 2019 at 21:35
  • 1
    And the base transaction is the same format as any other transaction. And to get its hash, the same as any tx. source.
    – jtgrassie
    Commented May 25, 2019 at 21:58
  • 2
    @Oroffe - I marked the question as duplicate. Any questions can still be asked in the comments though.
    – dEBRUYNE
    Commented May 26, 2019 at 10:43

1 Answer 1


"prefix", "base" and "prunable" just refer to parts in the transaction.

Given the transaction hash is:

H(H(prefix) || H(base) || H(prunable))

"prefix" refers to these fields.

"base" refers to the signatures that follow the prefix.

"prunable" refers to any prunable parts of a transaction.

Here is the source that calculates transaction hashes in Monero.

Important to note that "base" referenced above and "RingCTBase" as referenced in your linked answer, do not mean the coinbase/miner transaction. They just refer to a specific part in a transaction.

Now, to edit the miner transaction returned in get_block_template, you would need to deserialize the blocktemplate_blob to a block structure, edit the transaction in question, serialize back to a template blob and construct a new hashing blob.

  • I experimented a bit with the testnet and found that the RingCTBase in the base transaction always consists of one byte 0x00. Also, when calculating the hash of prunable part, this branch is always selected. Do I understand correctly that if I want to calculate the hash of the base tx with the modified extra, I need to recalculate only the hash of the prefix and the final hash of the transaction, while the two remaining ones will always be the same?
    – Oroffe
    Commented May 26, 2019 at 10:35
  • 1
    A coinbase transaction doesn't have signatures or prunable data so yes, only the prefix part changes.
    – jtgrassie
    Commented May 26, 2019 at 12:11

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