Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix BIP142: Example script needs PUSH length byte #275

Closed
wants to merge 3 commits into from

Conversation

afk11
Copy link
Contributor

@afk11 afk11 commented Jan 10, 2016

Following the segwit BIP 141 #265, a version 0 program: OP_0

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 

@afk11 afk11 changed the title BIP142: Example script needs PUSH length byte Fix BIP142: Example script needs PUSH length byte Jan 10, 2016
@@ -120,7 +125,7 @@ And the corresponding version 1 Bitcoin address is
When the same script is encoded as a version 0 witness program, the scriptPubKey becomes:
OP_0 <0x76A914010966776006953D5567439E5E39F86A0D273BEE88AC>
Using 0x19 as the address version, the equivalent witness program address is:
B4YZZ3nMBETWVF9ZSfotSwTxVnqhdkTi7r
BGMZdnvTr2wXTjkSs5TmrCGRN33MWpzdoK
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The address B4YZZ3nMBETWVF9ZSfotSwTxVnqhdkTi7r is correct. Please double check

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@jl2012
Copy link
Contributor

jl2012 commented Jan 11, 2016

I have fixed together with other updates: #277

@luke-jr
Copy link
Member

luke-jr commented Jan 12, 2016

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

@luke-jr luke-jr closed this Jan 12, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants