1

I'm trying to understand Pay-to-Pubkey-Hash transactions. I picked a random P2PKH transaction in a blockchain explorer: ab3f542ad5add941f8ba4282cebab0cca81266a83cab6b98ebb8ae730477a570

As far as I understand 0312437e326ef7bef6ea13209720f308548d2d205a4bf94e73bf8233ea7e6bb769 in the scriptSig is the public key and 3b10b087f293aecbb3af71e26d17f4e0ff4ea5f7 in the scriptPubKey is the OP_HASH160 of the public key of the receiver. So I did the following:

  1. SHA256(0312437e326ef7bef6ea13209720f308548d2d205a4bf94e73bf8233ea7e6bb769) = 7205ec1e595ce779b4d8b68fd909e00ef97eb0fdb8274951c7f923e2c82a898f
  2. RIPEMD160(7205ec1e595ce779b4d8b68fd909e00ef97eb0fdb8274951c7f923e2c82a898f) = 73e440177e6b5e27eabef63905bb2e2c1616dc9d

I was expecting the second step to result in 3b10b087f293aecbb3af71e26d17f4e0ff4ea5f7.

What am I doing wrong?

1 Answer 1

1

It appears the tool you're using to generate the hashes interprets the input as ASCII or UTF-8 characters, even though it should be interpreted as a hexadecimal number.

SHA256(0312437e326ef7bef6ea13209720f308548d2d205a4bf94e73bf8233ea7e6bb769) is actually e39ddbed20e2baba5b24f0ee4532249853d22b5d76c48a7a70ec2c373f895c01.

1
  • Thanks, that's it. Now everything checks out.
    – user138015
    Nov 20, 2022 at 22:28

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.