2

I'm testing a P2TR script path spend.

The script tree contains a single script leaf with the following script:

hex: 5887
asm: OP_8 OP_EQUAL

The witness spending this output then consists of the following:

58 5887 <control block>

So the complete script should execute like this:

hex: 585887
asm: OP_8 OP_8 OP_EQUAL

However, when I try to send the transaction in to the network I get the following error:

error code: -26
error message:
mandatory-script-verify-flag-failed (Script evaluated without error but finished with a false/empty top stack element)

Is this to be expected? Or might there be something else wrong with my witness structure (or the original script)?

1 Answer 1

2

The witness only contains data pushes, unlike the scriptSig. Here the Script interpreter compares 0x58 and 8 and pushes 0 on the stack. Hence the error:

Script evaluated without error but finished with a false/empty top stack element

1
  • Perfect, thank you so much. I changed the witness from 58 5887 <control block> to 08 5887 <control block> and it worked. Much appreciated -- been banging my head against a wall for an hour over that one.
    – inersha
    Commented Sep 20 at 12:10

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.