1

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.

Oroffe
  • 185
  • 5

1 Answers1

3

"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.

jtgrassie
  • 19,601
  • 4
  • 17
  • 54