0

I'm trying to find out how exactly transactions are confirmed in a block. I understand that to confirm a transaction, you hash it with its associated transaction and then the associated hashes until you get the Merkle root, and if the Merkle root is the same as that which is in the block, the transaction is legitimate.

But how would someone know which associated transaction is required to hash with your transaction to confirm its validity? And where would you get it from?

Also, i'm a little confused about Segregated Witness. As I understand it, the signatures are separated from the transactions and the signatures are hashed in the same manner as transactions. This final signature hashed is either hashed with the final transaction hash to form a Merkle root, or it is contained as another Merkle root in a separate field in the block. But if the Merkle root is always the same size (I assume) how does this save space? If the Merkle root is always 256 bits, why does it matter if the signatures are hashed with the transactions or hashed separately?

I can't find clear answers to my questions so any help will be appreciated.

1 Answer 1

2

But how would someone know which associated transaction is required to hash with your transaction to confirm its validity? And where would you get it from?

Your question is a little vague, it sounds like you are asking how a lite client confirms that a transaction they care about is indeed in a block. The party trying to convince them the transaction is included can give them the required information.

Full nodes already have all the data and don't need to have it provided.

Also, i'm a little confused about Segregated Witness. As I understand it, the signatures are separated from the transactions and the signatures are hashed in the same manner as transactions. This final signature hashed is either hashed with the final transaction hash to form a Merkle root, or it is contained as another Merkle root in a separate field in the block. But if the Merkle root is always the same size (I assume) how does this save space? If the Merkle root is always 256 bits,

The segwit commitment is down lower in the tree not at the top. This doesn't make any real functional difference but it answers your question about the root always being the same size.

why does it matter if the signatures are hashed with the transactions or hashed separately?

Because when transactions specify which coins they are spending they refer to it by the txid. If the signature data is part of the txid then changes to the signature (like third party malleation or resigning) invalidate subsequent transactions. If the signatures are excluded from those txids this problem does not happen.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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