Author

Topic: Segwit address generation (Read 159 times)

copper member
Activity: 112
Merit: 0
newbie
Activity: 19
Merit: 2
December 15, 2017, 06:03:48 PM
#1
Hi,

I'm trying to figure out how to create a Segwit address. I already managed to create an original bitcoin address.

Let's assume the following Public Key:
publicKey = 03fac6879502c4c939cfaadc45999c7ed7366203ad523ab83ad5502c71621a85bb
*ripemd160(sha256(publicKey)) = 7646c030f7e75b80f0a31cdcab731e6f424f22b2 - hash
*Add version to hash = 00147646c030f7e75b80f0a31cdcab731e6f424f22b2 - redeemScript
*ripemd160(sha256(redeemScript)) = 188ba16284702258959d8bb63bb9a5d979b57875 - hash
*sha256(sha256(redeemScript)) = 55c304447c41caee29f1d7c9779a3a8e9dd00ea7905e286e733049d12e1b479f - hash-for-checksum

--so far so good (I assume)--

*4 byte checksum = 55c30444 - checksum
*'05' + hash + checksum = 05188ba16284702258959d8bb63bb9a5d979b5787555c30444 - this is the part I get wrong I think
*base58 of it = 33voQqbNAYyig272KjcX8GkucWn2uJk5WT - this is the address that I get, while I should be getting 33voQqbNAYyig272KjcX8GkucWn2x25WEg.

How is possible that only the last 6 characters are incorrect? Does that imply that the checksum is incorrect? Or when it comes to segwit, is the base58 function different?
Jump to: