1

Can I use binary opcodes usually used for verifying keys to verify payment sizes?

It looks like these opcodes like OP_EQUALVERIFY and OP_NUMEQUALVERIFY are used for checking signatures or keys, rather than bitcoin amounts.

Example:

For an example use case, say my brother and I run a partnership, and all Bitcoin payments to our invoices go to a specific address.

The client would pay their invoice to a P2SH address, but any further spending from that invoice would have to go to my brother and I equally.

Conditions:

I want to lock outputs for a given input such that:

  1. The bitcoin input can only be spent to two specific outputs*, my brother's address and mine
  2. The amounts paid to these specific outputs must equal each other

*aside from change addresses

In the example above, could I use OP_NUMEQUALVERIFY or even the non-binary operator OP_GREATERTHANOREQUAL enforce that any client income was paid to me in an equal or greater amount than my brother?

3

This isn't possible.

You can use those arithmetic operators to compare any numerical values that you can get onto the stack - they are not inherently restricted to signatures and keys. But you would have to get the relevant data (output addresses, output amounts) onto the stack in the first place, and there is no opcode to do that. The script doesn't get to see that information, so you can't restrict the spending of a transaction in such ways.

Related: Can an account define conditional tags to blockchain

  • // , Ouch, I think this puts it squarely in the stupid question category, since I asked based on incorrect assumptions about the way Bitcoin scripting worked in the first place – Nathan Basanese Feb 28 '18 at 5:43

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.