I need single integer converted from public BTC address. Is it enough to Base58Check decode the address and I will get hex/binary format of that integer or do I need to do something more?

What will be the format of Base58Check decoded data? Will there be any checksums, additional bytes?

I can write a script in Bash/Perl/Python if I would have instructions.

1 Answer 1


NOTE: This applies only to LEGACY ADDRESSES that start with a "1". Addresses starting with "3" have 0x0014 appended to the beginning and are Base58Check encoded, while addresses starting with "bc1q" have 0x0014 appended to the beginning but are encoded with Bech32 Encoding.

You will get Hex/binary after decoding from Base58Check. There should be 20 bytes after decoding the Address to get the public key's hash. If whatever process or function you're using to Base58Check decode doesn't remove the version byte and checksum, you will have 25 bytes instead: The first byte will be 0x00 (the version), and the last 4 bytes (the chscksum) will be the first 4 bytes of the double SHA256 hash of the other 21 bytes.

What you'd be converting to a large integer is the HASH160 of the Public Key; aka, the result of taking the public key in compressed format (33 bytes) and running it through SHA256 then running that hash through RIPEMD-160.

More information about legacy addresses can be found here. Additionally, I've written a breakdown on how addresses are created here.

Your Answer

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

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