3
This data is taken from: http://bcoin.io/guides/segwit.html
Examples:
For the P2WPKH address: "bc1qw508d6qejxtdg4y5r3zarvary0c5xw7kv8f3t4"
OP_0 , 0x14 , HASH160(PubKey) -- looks like (in hex):
00 14 751e76e8199196d454941c45d1b3a323f1433bd6
For the P2WSH address: "bc1qrp33g0q5c5txsp9arysrx4k6zdkfs4nce4xj0gdcccefvpysxf3qccfmv3"
OP_0 , 0x20 , SHA256(script) -- looks like (in hex):
00 20 1863143c14c5166804bd19203356da136c985678cd4d27a1b8c6329604903262
Examples taken from http://bitcoin.sipa.be/bech32/demo/demo.html and https://github.com/sipa/bech32/blob/master/ref/c%2B%2B/tests.cpp
Not MD5 (lol), it's SHA256. – Pieter Wuille – 2018-12-13T23:38:11.703
Ah, thanks! I thought md5 sounded wrong myself! – kawthuldrok – 2018-12-13T23:39:09.497
Are you asking about the differences between P2WPKH/P2WSH in general, or about the differences between their corresponding address formats? – Pieter Wuille – 2018-12-13T23:21:17.933
In short, both. As you can see, I've added some of the research I've done over the past month or so. I'm programming a bech32 encoder/decoder in perl, but also trying to understand bech32, segwit, P2WPKH, and P2WSH beyond simply porting the code from the node/c++ code in bip173. – kawthuldrok – 2018-12-13T23:34:17.280
Also, there were few simple and concise answers that I could find with a google search that correspond to bech32 validation and how bech32 relates to SegWit, so I wanted to share the conclusions I came to. – kawthuldrok – 2018-12-13T23:38:19.157