0

I went to https://siminchen.github.io/bitcoinIDE/build/editor.html to try some bitcoin scripting and I wrote this script:

<1PUzZ61FSVTn12CafJC85Vy1ts3BoFcXdU> OP_HASH160 <E105E01B92119CC55D753248CE3A32C82A9BB308> OP_EQUAL

Screenshot:

see screenshot

My script fails even though both the hashes are same. Why?

  • why are you trying to calculate the hash160 of a Bitcoin address? That is not common. Also looks like the tool thinks the address is a hex value (0x prefix) which would obviously been invalid. – JBaczuk Jun 25 at 17:10
1

Because they aren't the same. It appears that this script IDE interprets things inside of angle brackets (< and >) as strings, not as hex values. However a hash is not a string, it is a sequence of bytes which may be represented using hexadecimal values.

So what your script is actually doing is putting the string 1PUzZ61FSVTn12CafJC85Vy1ts3BoFcXdU on the stack and then hashing it and putting the byte value E105E01B92119CC55D753248CE3A32C82A9BB308. But then you push the string E105E01B92119CC55D753248CE3A32C82A9BB308 onto the stack except this has a byte value of 45313035453031423932313139434335354437353332343843453341333243383241394242333038. The OP_EQUAL is then comparing the two byte values E105E01B92119CC55D753248CE3A32C82A9BB308 and 45313035453031423932313139434335354437353332343843453341333243383241394242333038 which are obviously not equal to each other and thus the script fails.

Instead you need to tell this program that you want to push the byte values E105E01B92119CC55D753248CE3A32C82A9BB308 to the stack, not the string representation of these hex characters. To do that, just don't surround it with angle brackets. This works for me:

<1PUzZ61FSVTn12CafJC85Vy1ts3BoFcXdU> OP_HASH160 E105E01B92119CC55D753248CE3A32C82A9BB308 OP_EQUAL

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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