Fix BIP142: Example script needs PUSH length byte #275

pull afk11 wants to merge 3 commits into bitcoin:master from afk11:bip-142-typo-script changing 1 files +7 −2
  1. afk11 commented at 12:17 AM on January 10, 2016: contributor

    Following the segwit BIP 141 #265, a version 0 program: OP_0 <a push of the script>

    BIP142: #267 mentions the following script:

      <0x0076A914{20-byte-hash-value}88AC>
    

    which would be: OP_0 DUP HASH160 [hash] EQUALVERIFY CHECKSIG

    Notice the witness program isn't pushed like pay-to-script-hash. The push is missing the length marker, 0x19. I think it should be:

     OP_0 PUSHDATA|length [hash]
     script: OP_0 76a914010966776006953d5567439e5e39f86a0d273bee88ac
     scriptPubKey: 001976a914010966776006953d5567439e5e39f86a0d273bee88ac
     Address: BGMZdnvTr2wXTjkSs5TmrCGRN33MWpzdoK 
    
  2. Bug: example script needs PUSH length byte cdd82167c7
  3. afk11 renamed this:
    BIP142: Example script needs PUSH length byte
    Fix BIP142: Example script needs PUSH length byte
    on Jan 10, 2016
  4. afk11 cross-referenced this on Jan 10, 2016 from issue Replace raw byte in pushed script by op name by NicolasDorier
  5. Clarify p2pkh-segwit-scriptpubkey form, and replace an incorrect address with the correct one 6665f1b67e
  6. remove whitespace 5eccf879dd
  7. in bip-0142.mediawiki:None in cdd82167c7 outdated
     124 | @@ -120,7 +125,7 @@ And the corresponding version 1 Bitcoin address is
     125 |  When the same script is encoded as a version 0 witness program, the scriptPubKey becomes: 
     126 |      OP_0 <0x76A914010966776006953D5567439E5E39F86A0D273BEE88AC>
     127 |  Using 0x19 as the address version, the equivalent witness program address is:
     128 | -    B4YZZ3nMBETWVF9ZSfotSwTxVnqhdkTi7r
     129 | +    BGMZdnvTr2wXTjkSs5TmrCGRN33MWpzdoK
    


    jl2012 commented at 3:00 PM on January 11, 2016:

    The address B4YZZ3nMBETWVF9ZSfotSwTxVnqhdkTi7r is correct. Please double check


    afk11 commented at 4:05 PM on January 11, 2016:

    Duly noted, I used the wrong hash to derive this.

  8. in bip-0142.mediawiki:None in cdd82167c7 outdated
      19 | @@ -20,7 +20,12 @@ To define standard payment addresses for native segwit transactions to promote e
      20 |  === P2PKH segwit address ===
      21 |  
      22 |  The first new Bitcoin address format defined is specific to pay-to-public-key-hash segwit transaction. The scriptPubKey is a single push of version-0 witness program in this form,
      23 | -  <0x0076A914{20-byte-hash-value}88AC>
      24 | +  0x001976A914{20-byte-hash-value}88AC
      25 | +
    


    jl2012 commented at 3:01 PM on January 11, 2016:

    Thanks. I forgot to change this when the spec of BIP141 changed


    afk11 commented at 3:53 PM on January 11, 2016:

    Further nit: "The scriptPubKey is a single push of version-0 witness program in this form"

    Why does it say the scriptPubKey is a single push? It's two pushes?


    jl2012 commented at 3:55 PM on January 11, 2016:

    That was the old BIP141 spec that I forgot to change

  9. jl2012 commented at 7:26 PM on January 11, 2016: contributor

    I have fixed together with other updates: #277

  10. luke-jr commented at 1:09 PM on January 12, 2016: member

    #277 is merged. Let me know if this needs to be reopened.

  11. luke-jr closed this on Jan 12, 2016


github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bips. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-14 15:10 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me