1

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:

e049ccc9e524a9302c2187bf02c4d78741d9b039

Which I know should come out to address:

1MSvmgVJvYkdtCsopFqsT2g3FNNhpcoeBG

I append the 00 prefix to my hash getting:

00e049ccc9e524a9302c2187bf02c4d78741d9b039

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

1110000001001001110011001100100111100101001001001010100100110000001011000010000110000111101111110000001011000100110101111000011101000001110110011011000000111001

And then running this through SHA256 twice which gets me:

a66d4caa10c1b665d6bca3f06788db9fbea6e9912a9fcf8101eb5992f9e8ab78

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

00e049ccc9e524a9302c2187bf02c4d78741d9b039a66d4caa

And I wind up with:

1MSvmgVJvYkdtCsopFqsT2g3FNNhsp8jXo

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

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:

296b64c7d7e8cf61a327d3e351b9e92e4451af50dff18227550167fe7a13bee2
1
  • 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.