1

I am trying to learn more about how bitcoin addresses are created. I am following along with the tutorial at https://en.bitcoin.it/wiki/Wallet_import_format

I undertsand how they do the first six steps however I do not understand how to go from step 6 to step 7

they have 800C28FCA386C7A227600B2FE50B7CAE11EC86D3BF1FBE471BE89827E19D72AA1D507A5B8D and they get the private key of 5HueCGU8rMjxEXxiPuD5BDku4MkFqeZyd4dZ1jvhTVqvbTLvyTJ

I have read from here that I need to do put the version byte in front which is 00 so I have

00800C28FCA386C7A227600B2FE50B7CAE11EC86D3BF1FBE471BE89827E19D72AA1D507A5B8D

then I need to do sha256(sha256(result)) = 74944C34 (first 4 bytes) then I have

00800C28FCA386C7A227600B2FE50B7CAE11EC86D3BF1FBE471BE89827E19D72AA1D507A5B8D74944C34

then I am running it through this test vb.net code (I will put it in a loop once I get it working)

Dim number As BigInteger = System.Numerics.BigInteger.Parse("00800C28FCA386C7A227600B2FE50B7CAE11EC86D3BF1FBE471BE89827E19D72AA1D507A5B8D74944C34", NumberStyles.HexNumber)


Dim count As BigInteger = number / 58
    Dim remainder As Integer = number Mod 58
    MessageBox.Show(count.ToString())
    MessageBox.Show(remainder.ToString())
    count = count / 58
    remainder = count Mod 58
    MessageBox.Show(count.ToString())
    MessageBox.Show(remainder.ToString())
    count = count / 58
    remainder = count Mod 58
    MessageBox.Show(count.ToString())
    MessageBox.Show(remainder.ToString())

for some reason the numbers are 48,37,3 but this does not line up with the chart on the second link and the answer which is 5HueCGU8rMjxEXxiPuD5BDku4MkFqeZyd4dZ1jvhTVqvbTLvyTJ

can someone please show me what I am doing wrong and help me understand the base58encode?

thanks

1 Answer 1

1

Version byte 0 is for addresses, for an uncompressed private key you want 128.

https://en.bitcoin.it/wiki/Base58Check_encoding#Version_bytes

4
  • I thought I did add that. that is what the 80 is in the front of the hexadecimal Aug 30, 2015 at 17:13
  • 0x00 or 0x80, not both. Your example has 0x0080.
    – Claris
    Aug 30, 2015 at 17:19
  • I used convertxy.com/index.php/numberbases to try and convert it but it still does not give anything near that 5Hue. I also used the vb.net code and it does not work either? Aug 30, 2015 at 21:37
  • See this great webapp Sep 3, 2015 at 3:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.