I have been learning about how P2PKH addresses are generated so I thought I would try and work through one myself manually. I start with the following public key hash:


Which I know should come out to address:


I append the 00 prefix to my hash getting:


I then go to calculate the checksum by converting this to binary:


And then running this through SHA256 twice which gets me:


I take the first 4 bytes a66d4caa and put them onto the end of my prefix+hash:


And I wind up with:


Can someone help me out with where I am going wrong?

EDIT: Forgot to convert it to binary first. But it still doesn't work.

1 Answer 1


You accidentally converted to binary the original public key hash, not the result of prepending 00 (you can tell because it should start with 00000000). You also might not need to convert to binary at all, many hashing tools will be perfectly happy to accept a hexadecimal input.

The hash you should get after this step is:

  • You are correct I don't need to convert to binary first but I was doomed from the start regardless. I was using an online SHA256 hashing tool and didn't realise it defaulted to treating the input as text not hex. Once I changed it to hex it worked. Feb 3 at 8:05

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.