Author

Topic: bitcoin address calculation deep dive, does not add up (Read 491 times)

full member
Activity: 394
Merit: 101
THANKS for both of you guys Smiley !! now it adds up! why do i always mess up between nibbles and bytes!!  Grin
legendary
Activity: 3472
Merit: 4801
BitcoinAddress=base58encode( 2 bytes version + 20 bytes output from RIPEMD160(SHA256(pubkey)) + 4 bytes checksum)

Are you sure about that?  I thought:

BitcoinAddress=base58encode( 1 bytes version + 20 bytes output from RIPEMD160(SHA256(pubkey)) + 4 bytes checksum)

1 + 20 + 4 = 25 bytes

Since 1 byte = 8 bits...

25 * 8 = 200 bits
base58encode(25 bytes) = base58encode(200 bits)

200 bits / [ log(58) / log(2) ] = 200 bits / 5.85798... = 34.14 base58 digits
legendary
Activity: 4536
Merit: 3188
Vile Vixen and Miss Bitcointalk 2021-2023
base58encode(26 bytes)=base58encode(104 bits)
I think you'll find 26 bytes is actually 208 bits. Wink
full member
Activity: 394
Merit: 101
Looking through mastering bitcoin book's chapters, I get the following formula for bitcoin address generation:
BitcoinAddress=base58encode( 2 bytes version + 20 bytes output from RIPEMD160(SHA256(pubkey)) + 4 bytes checksum)
= base58encode(26 bytes)=base58encode(104 bits) however this is generating base58 digit size of
104bits / ((log(58)/log(2)) = 104bits/5.8579...=17.75 base58 digits.


Why 104bits / (log(58)/log(2))?
Suppose 256-bits address and how many hexes are there if represented by hex? 256 / ((log 16) / log(2)) = 256/4 = 64 hex digits.

But when I check several bitcoin wallet address the base58encoded address they are showing is 34 base58 digits. Definitely not adding up or I am missing something here.
Jump to: