<p>This isn't possible. </p>

<p>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 <a href="https://en.bitcoin.it/wiki/Script#Opcodes" rel="nofollow noreferrer">no opcode </a> 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.</p>

<p>Related: <a href="https://bitcoin.stackexchange.com/questions/70689/can-an-account-define-conditional-tags-to-blockchain/70691#70691">Can an account define conditional tags to blockchain</a></p>

CC BY-SA 3.0
2018-02-28T05:43:02.807Z
// , 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
CC BY-SA 3.0
2018-02-27T23:02:40.573Z
2018-02-27T23:02:40.573Z
Nate Eldredge
<p>Can I use binary opcodes <a href="https://bitcoin.org/en/developer-examples#transactions" rel="nofollow noreferrer">usually used for verifying keys</a> to verify payment sizes? </p>

<p>It looks like these opcodes like <a href="https://en.bitcoin.it/wiki/Script#Standard_Transaction_to_Bitcoin_address_.28pay-to-pubkey-hash.29" rel="nofollow noreferrer">OP_EQUALVERIFY</a> and <a href="https://duckduckgo.com/?q=op_numequalverify&amp;t=hg&amp;ia=web" rel="nofollow noreferrer">OP_NUMEQUALVERIFY</a> are used for checking signatures or keys, rather than bitcoin amounts.</p>

<p>Example:</p>

<p>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. </p>

<p>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.</p>

<p>Conditions:</p>

<p>I want to lock outputs for a given input such that:</p>

<ol>
<li>The bitcoin input can only be spent to two specific outputs*, my brother's address and mine</li>
<li>The amounts paid to these specific outputs must equal each other</li>
</ol>

<p>*aside from change addresses</p>

<p>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? </p>

<script><p2sh><business>
Can I use opcodes traditionally used for verifying keys to verify payment sizes?
Nathan Basanese
# Can I use opcodes traditionally used for verifying keys to verify payment sizes?

(Asked by: username_0 on 2018-02-27)

Can I use binary opcodes [usually used for verifying keys](https://bitcoin.org/en/developer-examples#transactions) to verify payment sizes?

It looks like these opcodes like [OP\_EQUALVERIFY](https://en.bitcoin.it/wiki/Script#Standard_Transaction_to_Bitcoin_address_.28pay-to-pubkey-hash.29) and [OP\_NUMEQUALVERIFY](https://duckduckgo.com/?q=op_numequalverify&t=hg&ia=web) 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?

**Tags:** script, p2sh, business


---

## 1 answers

### Answer by username_1 on 2018-02-27. Score: 3 | Accepted answer

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](https://en.bitcoin.it/wiki/Script#Opcodes)  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](https://bitcoin.stackexchange.com/questions/70689/can-an-account-define-conditional-tags-to-blockchain/70691#70691)

> **Comments:**
> **username_0**: // , 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  

---

