I want to create a address bitcoin.

I have a payload with version like this:


where 00 in my version prefix, and 50d512c984b1656ef47c145c8fd5d5262d3904b1 is my payload.

Now I Want to add checksum, with sha256 twice, the result is


where the first 4 bytes is checksum 4550e204

Now I can convert to base58


And I Get the right address.

I can read that

These four bytes serve as the error-checking code, or checksum. The checksum is concatenated (appended) to the end.

How Can I check if my checksum (4550e204) is correct before base58 ?

  • Sorry I don't understand your question. You have described the derivation for the checksum given version&payload. Given a base58 address, you decode the address for the version+payload+checksum. From that you can verify the version+payload. What other scenario do you mean?
    – James C.
    Jan 22, 2019 at 12:33

1 Answer 1


One way to check is to use a tool like https://github.com/keis/base58 that implements base58check (-c) encoding and decoding (-d) with checksum verification to try to decode the final address:

$ printf "0050d512c984b1656ef47c145c8fd5d5262d3904b14550e204" | xxd -r -p | base58
$ printf "18NQJwokxLGA7KsHJdQWh6ANB46K6nP7Hm" | base58 -c -d | xxd -p

Now, change the checksum and see if it is able to decode:

$ printf "0050d512c984b1656ef47c145c8fd5d5262d3904b14550e203" | xxd -r -p | base58
Jordans-MacBook-Pro:~ Jbaczuk$ printf "18NQJwokxLGA7KsHJdQWh6ANB46K6nP7Hk" | base58 -c -d | xxd -p
Invalid checksum
  • thanks, for do checksum the operation is decode base58 -and reply printf 0050d512c984b1656ef47c145c8fd5d5262d3904b1 |xxd -r -p | sha256sum -b | xxd -r -p | sha256sum -b | head -c 8and Check the output with last 4 bytes ?
    – monkeyUser
    Jan 22, 2019 at 15:46
  • 1
    Yes, the first four bytes of the HASH256 is the checksum, which is appended to the end of the value to encode.
    – JBaczuk
    Jan 22, 2019 at 15:50

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.