6

I understand that non-segwit nodes interpret segwit txes as Anyone-Can-Spend txes, and they cannot validate txes that spend segwit outputs.

But when an old style miner receives a segwit tx to mine he consideres it invalid, right? (That's because it appears to them as a strange transaction with no input and 1 output.) So, does it follow that segwit txes can only be mined in a block by upgraded miners?

Murch
  • 71,155
  • 33
  • 180
  • 600

1 Answers1

5

An old style miner would only receive a stripped transaction, i.e. a transaction from which the witness has been removed. They will consider a segwit transaction to be valid but non-standard because one element remains on the stack when resolving the redeem script.

If a miner included this transaction in their block, the block would appear valid to segwit-incapable nodes, but invalid to any segwit-capable nodes as any segwit input would be missing the required witness and thus would not be properly signed. This would lead to the block being rejected by 98% of the nodes on the network, and thus the segwit-incapable miner to lose their block reward as it would not become part of the heaviest blockchain. Segwit-incapable miners can however contribute blocks that only include non-segwit transactions that build on top of the chain that includes segwit-blocks.

This means that only a miner collecting transactions with a segwit-capable node is able to create a valid block that includes segwit transactions.

Murch
  • 71,155
  • 33
  • 180
  • 600
  • So, old miners can't create a block with segwit txs but can reiceve this block from new miners (stripped), right? Thank you for your explaination –  Oct 12 '17 at 02:01
  • 1
    Exactly. And not only can't they produce SegWit blocks, they also won't, as SegWit transactions are non-standard. – Pieter Wuille Oct 12 '17 at 04:48
  • they won't receive the block from other (upgrade) miner? so old miner refuse them? –  Oct 12 '17 at 15:09
  • The old nodes can redistribute the stripped block amongst each other, or any new nodes will create the stripped block when it is requested from any old node. – Murch Oct 12 '17 at 22:24
  • yes this is clear, my last question was about what pieter said ("they also won't"), because I understand that old miners don't want segwit txs, but they accept segwit blocks (stripped) –  Oct 13 '17 at 00:39
  • @Zaitsev: Segwit-incapable miners can not validate segwit-transactions completely, nor use them in their blocks. Since the outputs and inputs are part of the stripped blocks, they can however follow segwit blocks correctly and arrive at the same UTXO set as other nodes. – Murch Oct 13 '17 at 01:00
  • 1
    I meant that non-SegWit miners won't try to include SegWit txn, as they are non-standard to them, so they won't accept or relay them. They will however accept (stripped) SegWit txn if they occur in a block miner by a SegWit miner. – Pieter Wuille Dec 09 '17 at 17:58