From segwit part of reading bitcoinbook, there is an example for upgrading P2PKH to P2WPKH:
Alice created a transaction to pay Bob for a cup of coffee. That transaction created a P2PKH output with a value of 0.015 BTC that was spendable by Bob. The output’s script looks like this: Example P2PKH output script
DUP HASH160 ab68025513c3dbd2f7b92a94e0581f5d50f654e7 EQUALVERIFY CHECKSIG
With Segregated Witness, Alice would create a Pay-to-Witness-Public-Key-Hash (P2WPKH) script, which looks like this: Example P2WPKH output script
Inputs for them are like below:
For traditional P2PKH:
[...] “Vin” : [ "txid": "0627052b6f28912f2703066a912ea577f2ce4da4caa5a5fbd8a57286c345c2f2", "vout": 0, "scriptSig": “<Bob’s scriptSig>”, ] [...]
[...] “Vin” : [ "txid": "0627052b6f28912f2703066a912ea577f2ce4da4caa5a5fbd8a57286c345c2f2", "vout": 0, "scriptSig": “”, ] [...] “witness”: “<Bob’s witness data>” [...]
So what if a full-node has not upgraded to new version with support to segwit? It seems that client without support for segwit will always validate the second input as true. Because in the book, it is said:
As you can see, a Segregated Witness output’s locking script is much simpler than a traditional output. It consists of two values that are pushed on to the script evaluation stack. To an old (nonsegwit-aware) bitcoin client, the two pushes would look like an output that anyone can spend and does not require a signature (or rather, can be spent with an empty signature).
ab68025513c3dbd2f7b92a94e0581f5d50f654e7 in stack-based bitcoin script does not return true.
Why the the "two pushes in segwit output looks like anyone can spend and does not require a signature" to old client?
What is the
<Bob's witness data>? It looks like that
<Bob's witness data> is different from
<Bob's scriptSig>. Can anyone provides an example?