Ah right, the Merkle root is calculated based on the stripped
transaction, and therefore AJ’s idea works fine. Nevermind, carry on!
Thanks,
Murch
On 2026-01-14 07:33, Antoine Poinsot wrote:
Thanks everyone for the comments.
Sjors, transactions are serialized in modern blocks as described by Murch.
Murch, for the purpose of computing the Merkle root transactions are serialized
without witness data.
Best,
Antoine
On Wednesday, January 14th, 2026 at 5:23 AM, Sjors Provoost
<[email protected]> wrote:
Hi Murch,
You're referring to the "serialization with witness data" defined in BIP 141.
But that's not how the transaction is serialised in a block, since the witness
is
segregated.
The witness is committed in a tree that is nested into the block's existing
merkle root via the coinbase transaction for the purpose of making this BIP
soft fork compatible. A future hard fork can place this tree in its own branch.
As long as the miner doesn't touch the SegWit OP_RETURN , which also commits
to the coinbase witness, it can safely use the legacy transaction serialisation.
- Sjors
[0]
https://github.com/bitcoin/bips/blob/master/bip-0141.mediawiki#transaction-id
Op 14 jan 2026, om 01:23 heeft Murch [email protected] het volgende geschreven:
Hi Sjors,
On 2026-01-08 00:30, Sjors Provoost wrote:
The approach suggested by Towns [4] of appending a 0-sat OP_RETURN output with
padding so a 4-byte nonce lands in the final 64-byte SHA256 chunk is probably
better, but not because like nLockTime it has a small hashing midstate
benefit. It's easier to implement.
I can’t access Delving right now to read AJ’s comment, but a small nit on the
idea of using an additional output: BIP 141 requires coinbase transaction
inputs to have a 32-byte witness. Since the witness section follows the outputs
in the serialization, the bytes before the `nLocktime` in a coinbase
transaction are the witness of the coinbase input, not the last output script.
-Murch
--
You received this message because you are subscribed to the Google Groups "Bitcoin
Development Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/bitcoindev/1B807731-DC2A-4E59-B462-5C210EF1FB73%40sprovoost.nl.
--
You received this message because you are subscribed to the Google Groups "Bitcoin
Development Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/bitcoindev/1dd74f45-bd0a-4fd7-bf80-56a3b2a44128%40murch.one.