The online script check program that you are using to evaluate the script has numerous issues. First, there is a known issue of the software calculating the OP_HASH160
incorrectly. For example, the HASH160
of the public key that you have entered (the one starting with 04...) is 7f9b1a7fb68d60c536c2fd8aeaa53a8f3cc025a8
while the program is calculating it as 6DF13DE1F1D824380834E0D42E49E5E451A647CF
. This results in a failed validation when the OP_EQUALVERIFY
opcode runs.
The error derives from mishandling the preimages that are hashedhashing strings as asciiASCII instead of binary. By this I mean that the program is hashing the public key as a string rather than treating the public key as a hexadecimal number and hashing the bytes. Below is a python code of how the hashing should actually be done.
import hashlib
def hash160(payload_in_hex):
payload_in_bytes = bytes.fromhex(payload_in_hex) # note this step
payload_sha256 = hashlib.sha256(payload_in_bytes).digest()
payload_sha256_ripemd160 = hashlib.new('ripemd160', payload_sha256).hexdigest()
return payload_sha256_ripemd160
pub_key = '0484ecc0d46f1918b30928fa0e4ed99f16a0fb4fde0735e7ade8416ab9fe423cc5412336376789d172787ec3457eee41c04f4938de5cc17b4a10fa336a8d752adf'
hash160(pub_key)
>>> '7f9b1a7fb68d60c536c2fd8aeaa53a8f3cc025a8'
SecondSecondly, the signature verification against a public key without knowing what message was signed is simply incorrect. This is resulting in the program accepting any signature for any given public key. For example just try the below script and it will show you that execution was successful.
aecd 0484ecc0d46f1918b30928fa0e4ed99f16a0fb4fde0735e7ade8416ab9fe423cc5412336376789d172787ec3457eee41c04f4938de5cc17b4a10fa336a8d752adf OP_CHECKSIG