Th testnet TxID 8d897ca91774a7fafa086a3275e679248d6bffee015d3b2efefd5dab00df152d has the following scriptPubKey:

scriptPubKey: "OP_DUP OP_HASH160 5f1426c2ce4a8e1abaa9dbe819b6303eb8a25a26 OP_EQUALVERIFY OP_CHECKSIGVERIFY OP_IF OP_DUP OP_HASH160 6c7ceafe76c56843c9d2868f616fdc9370355eb9 OP_EQUALVERIFY OP_CHECKSIG OP_ELSE OP_HASH256 644d79d87e0907833e888e272e5d7b925deb261a8499a65cbc0bf26797a15e8e OP_EQUAL OP_ENDIF"

Looking at the script of the redeeming Tx (TxID: 2d0daa01da8294a54178f8111eb2a02010c425fd15957d8baee8717edcfbe105) we see:

7e 10 3ceb50edd0282cd99dc59351f513dcdf 00 der sig

So I can see essentially that because sha256(sha256(3ceb50edd0282cd99dc59351f513dcdf)) = 644d79d87e0907833e888e272e5d7b925deb261a8499a65cbc0bf26797a15e8e the script is validated as True.

I'm attempting to understand how this is working but am consistently getting an error code 26 (OP_EQUALVERIFY failure) for this attempt at sendrawtransaction:


Where exactly is this problem occurring?

Also, in general, if one needs to push data onto the stack before the der signature, how is it done? Is the data added to the scriptSig field then signed, or signed, then added to the scriptSig? (I'm having trouble visualising the stack even with this interactive scenario at webbtc)

1 Answer 1


The first redeeming transaction has a scriptSig in the form:

<value to be double hashed> 0 <signature> <public key>

That 7e is a red herring - it's the size of the scriptSig. Similarly, the 10 is the size of the data to be hashed.

The second transaction appears to be attempting to spend a standard output. It appears to be trying to spend this using a key that doesn't hash to the right value.

You can see this by pasting the following script into Bitcoin Script IDE:

042daa93315eebbe2cb9b5c3505df4c6fb6caca8b756786098567550d4820c09db988fe9997d049d687292f815ccd6e7fb5c1b1a91137999818d17c73d0f80aef9 OP_DUP OP_HASH160 e900510876cb689f1db6fa982376c301362b740c OP_EQUALVERIFY OP_CHECKSIG
  • re: Bitcoin Script IDE: I have been looking for something like this EVERYWHERE. Mar 18, 2015 at 11:36
  • Is the virtual asm fully tested? I'm getting inconsistent OP_HASH160 values than expected Mar 23, 2015 at 7:07
  • @WizardOfOzzie Hmm, odd. I'm getting the same issue on known-good values from network transactions. It might be a bug with this IDE. Lemme check with python-bitcoinlib.
    – Nick ODell
    Mar 23, 2015 at 8:25

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.