Bitcoin full node and query server

Dec 10, 2018

View in context in the libbitcoin Slack #general mirror.

M
Mlmikael02:07
Guys, BIP 143 has a funny detail, what do you think of it? https://github.com/bitcoin/bips/blob/master/bip-0143.mediawiki When you make an endorsement for a segwit input witness to spend a P2WPKH output, the signtext part for the pubkey script of the output to be consumed is this: "The item 5: For P2WPKH witness program, the scriptCode is 0x1976a914{20-byte-pubkey-hash}88ac." I.e. the P2*PKH* pubkeyscript template (DUP HASH160 hash EQUALVERIFY CHECKSIG). What sense do you make of this choice? At least on first sight it looks a bit assymetrical to me. Gmaxwell provided the following clarifications which I feel didn't clarify at all also: "it is the implied pubkey. Because that is the actual public key in use. in the sense that that is the script that the network is actually validating. In general, it's advistable that signatures actually commit to their conditions, so they can't be rebound. Otherwise, I could potentially trick an application into signing for X when it's really signing for Y. (like if a user reused a key in different applications, foolishly) you can just think of it as the stored spk being compressed. the txout effectively is storing a compressed representation of the actual script. The actual script is OP_DUP OP_HASH160 x OP_EQUALVERIFY OP_CHECKSIG. but it wastes some blockchain space to encode all that, so instead only a version and x gets stored. The P2WPKH is just a compact encoding for the witness script I pasted above. You sign the actual script, rather than the compact encoding." Thoughts?