4

Let's say a miner mines a block.

  1. In this block some transactions will be non-segwit and some will be segwit?

  2. The block contains two parts:

    • The part with transactions
    • The segregated part with signatures of segwit transactions?
  3. To old nodes non-segwit transactions look normal, and segwit transactions look like no-signature-needed valid transactions? These nodes don't see the segregated part containing signatures?

  4. To new nodes non-segwit transactions look normal, and they recognize segwit transactions and check the segregated part to validate the signatures?

2

There aren't two part to a block like you describe. The word segregated in segwit means that the witness data isn't included in the TXID computation similar to how it always wasn't included in the signature hash computation. It's still included in transactions and blocks.

With segwit, the signatures are in each transaction in a witness field that is included before the nlocktime field.

When a node relays a segwit using block to a peer that doesn't understand segwit, it strips the witness fields out of all the transactions that have them. Since they don't have any rules pertaining to segwit data they're perfectly fine with this.

If you were to hand a stripped block to a non-outdated node, it would just drop it and ban you for giving it invalid data-- it knows about the segwit rules and attempts to validate the additional data.

0

In this block some transactions will be non-segwit and some will be segwit?

Yes. Both types of transactions can be included in the same block. Segwit transactions generally consume all types of UTXOs; while non-segwit transactions exclusively consume P2SH/P2PKH/P2PK type UTXOs.

The block contains two parts

No. Its mostly the same, segwit only has to do with how the transaction identifier (i.e. txid) is computed, which is pretty much just the hash of everything in a transaction excluding its signature. And similarly, the block simply contains all the transactions.

To old nodes non-segwit transactions look normal, and segwit transactions look like no-signature-needed valid transactions? These nodes don't see the segregated part containing signatures?

EDIT #1: As per Pieter Wuille pointed out -- no, old nodes will not see the same. New nodes will it simply remove the witness before sending. Post-reivision, I noticed this is because the scriptSig field for P2WSH and P2WPKH native inputs will be zero as described in BIP141.

To new nodes non-segwit transactions look normal, and they recognize segwit transactions and check the segregated part to validate the signatures?

Yes. New nodes have to do signature validation as per the convention of old nodes. Again, just to re-iterate, there is no segregated part for signatures.

  • No, old nodes will not see the same. When a segwit-compatible node sends a block to an old nodes, it simply removes the witness before sending. – Pieter Wuille Nov 11 '18 at 17:58
  • @PieterWuille, thanks for the correction. – renlord Nov 15 '18 at 15:33

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.