From 49e8b5653347b21ca9d2bf34384a5e0a21b5fa3e Mon Sep 17 00:00:00 2001 From: "Andreas M. Antonopoulos" Date: Sat, 18 Feb 2017 11:09:12 +0700 Subject: [PATCH] corrected P2SH(P2WPKH) and P2SH(P2WSH) HASH160 and addresses Resolve issue: https://github.com/bitcoinbook/bitcoinbook/issues/228 --- appdx-future-segwit.asciidoc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/appdx-future-segwit.asciidoc b/appdx-future-segwit.asciidoc index c6403cef..fb145d1e 100644 --- a/appdx-future-segwit.asciidoc +++ b/appdx-future-segwit.asciidoc @@ -221,20 +221,20 @@ Bob's wallet then hashes the above witness program, first with SHA256, then with .HASH160 of the P2WPKH witness program ---- -660a5ab01c8468ac2e3cd58e9b17f8ba637867a4 +3e0547268b3b19288b3adef9719ec8659f4b2b0b ---- The hash of the witness program is then embedded in a P2SH script: .P2SH script containing the hash of a P2WPKH witness program ---- -HASH160 660a5ab01c8468ac2e3cd58e9b17f8ba637867a4 EQUAL +HASH160 3e0547268b3b19288b3adef9719ec8659f4b2b0b EQUAL ---- Finally, the P2SH script is converted to a P2SH bitcoin address: .P2SH address ---- -3AzZFY4WJJZbVr2A6qBTbdkYRpMLbdg6gD +37Lx99uaGn5avKBxiW26HjedQE3LrDCZru ---- Now, Bob can display this address for customers to pay for their coffee. Alice's wallet can make a payment to +3deadbeef+, just as it would to any other bitcoin address. Even though Alice's wallet has no support for segwit, the payment it creates can be spent by Bob with a segwit transaction. @@ -256,20 +256,20 @@ Then, the witness program itself is hashed with SHA256 and RIPEMD160, producing .The HASH160 of the P2WSH witness program ---- -e3cca368764d7b32ed27a15b2e8d7d45d4edd2c6 +86762607e8fe87c0c37740cddee880988b9455b2 ---- Next, Mohammed's wallet puts the hash into a P2SH script .P2SH script containing the hash of a P2WSH witness program ---- -HASH160 e3cca368764d7b32ed27a15b2e8d7d45d4edd2c6 EQUAL +HASH160 86762607e8fe87c0c37740cddee880988b9455b2 EQUAL ---- Finally, the wallet constructs a bitcoin address from this script: .P2SH bitcoin address ---- -3NTWTcFE88p26GTPoxcWef9Q5ncKt6CY2E +3Dwz1MXhM6EfFoJChHCxh1jWHb8GQqRenG ---- Now, Mohammed's clients can make payments to this address without any need to support segwit. Mohammed's company can then construct segwit transactions to spend these payments, taking advantage of segwit features including lower transaction fees.