<p>Some examples of early uses of <code>OP_IF</code>:</p>
<ul>
<li><a href="https://mempool.space/tx/d105d570237d5be5476287fb1cfefb660996c054af133995ad7c7a1c2a8054b6" rel="nofollow noreferrer">d105d570237d5be5476287fb1cfefb660996c054af133995ad7c7a1c2a8054b6</a> (2014-03-25): This script has two alternative branches, each containing a different 2-of-2 multisig.</li>
<li><a href="https://mempool.space/tx/15b11e8d4e5b9425f024b381ba0cb7a54a35e52389bb4855f505772ce685b39c" rel="nofollow noreferrer">15b11e8d4e5b9425f024b381ba0cb7a54a35e52389bb4855f505772ce685b39c</a> (2014-06-24): This script has two alternative branches, one requires three hash preimages and the other requires a signature.</li>
<li><a href="https://mempool.space/tx/ce0b4c3d01abaca1592f06c73013c327a8a94cf2de8258b262db32f31981198a" rel="nofollow noreferrer">ce0b4c3d01abaca1592f06c73013c327a8a94cf2de8258b262db32f31981198a</a> (2014-08-20): This script has two alternative branches, one requires a single signature and the other is a 2-of-2 multisig.</li>
<li><a href="https://mempool.space/tx/0b274321565b7eb2d7b71af60be3e3d7a710e6681c3407c9c51dd21e569614d9" rel="nofollow noreferrer">0b274321565b7eb2d7b71af60be3e3d7a710e6681c3407c9c51dd21e569614d9</a> (2014-09-11): This script uses two <code>OP_IF</code> opcodes to create three alternative branches, each containing a different 2-of-2 multisig.</li>
<li><a href="https://mempool.space/tx/2a1fe1e23bf766d87949415b49d11cacbe8d86dbc6071c311e798c37b3b906d9" rel="nofollow noreferrer">2a1fe1e23bf766d87949415b49d11cacbe8d86dbc6071c311e798c37b3b906d9</a> (2014-09-20): This script has two alternative branches, one requires a signature and the other requires a hash preimage.</li>
</ul>

CC BY-SA 4.0
2023-12-27T16:05:36.777Z
Re "What tools to use to extract the transactions (with OP_IF) from historical data?" did you query the blockchain data here yourself @Vojtech or use something else?
Michael Folkson
CC BY-SA 4.0
2023-12-27T16:38:47.053Z
I wrote a script that extracts this data from a local node.
Vojtěch Strnad
CC BY-SA 4.0
2024-01-02T21:13:16.570Z
@VojtěchStrnad - is that script something you could share here (i.e. a link to github or something?)
Hannah Vernon
CC BY-SA 4.0
2024-01-02T21:26:43.180Z
@HannahVernon Not meaningfully, it has a lot of private dependencies so you wouldn't be able to run it, and it extracts all kinds of scripts, it's not specialized for OP_IF so it's a lot more complicated than it needs to be for this task.
Vojtěch Strnad
CC BY-SA 4.0
2023-12-26T19:08:23.823Z
2023-12-26T21:13:14.153Z
2023-12-26T21:13:14.153Z
Vojtěch Strnad
<p>There is the OP_IF opcode in Script. What did users use the OP_IF opcode for (use cases except for Lightning) before 2023? What tools to use to extract the transactions (with OP_IF) from historical data?</p>

<script><opcodes>
What was the OP_IF opcode used for (except Lightning) before 2023?
Greg Tonoski
# What was the OP_IF opcode used for (except Lightning) before 2023?

(Asked by: username_0 on 2023-12-26)

There is the OP\_IF opcode in Script. What did users use the OP\_IF opcode for (use cases except for Lightning) before 2023? What tools to use to extract the transactions (with OP\_IF) from historical data?

**Tags:** script, opcodes


---

## 1 answers

### Answer by username_1 on 2023-12-26. Score: 5

Some examples of early uses of `OP_IF`:

* [d105d570237d5be5476287fb1cfefb660996c054af133995ad7c7a1c2a8054b6](https://mempool.space/tx/d105d570237d5be5476287fb1cfefb660996c054af133995ad7c7a1c2a8054b6) (2014-03-25): This script has two alternative branches, each containing a different 2-of-2 multisig.
* [15b11e8d4e5b9425f024b381ba0cb7a54a35e52389bb4855f505772ce685b39c](https://mempool.space/tx/15b11e8d4e5b9425f024b381ba0cb7a54a35e52389bb4855f505772ce685b39c) (2014-06-24): This script has two alternative branches, one requires three hash preimages and the other requires a signature.
* [ce0b4c3d01abaca1592f06c73013c327a8a94cf2de8258b262db32f31981198a](https://mempool.space/tx/ce0b4c3d01abaca1592f06c73013c327a8a94cf2de8258b262db32f31981198a) (2014-08-20): This script has two alternative branches, one requires a single signature and the other is a 2-of-2 multisig.
* [0b274321565b7eb2d7b71af60be3e3d7a710e6681c3407c9c51dd21e569614d9](https://mempool.space/tx/0b274321565b7eb2d7b71af60be3e3d7a710e6681c3407c9c51dd21e569614d9) (2014-09-11): This script uses two `OP_IF` opcodes to create three alternative branches, each containing a different 2-of-2 multisig.
* [2a1fe1e23bf766d87949415b49d11cacbe8d86dbc6071c311e798c37b3b906d9](https://mempool.space/tx/2a1fe1e23bf766d87949415b49d11cacbe8d86dbc6071c311e798c37b3b906d9) (2014-09-20): This script has two alternative branches, one requires a signature and the other requires a hash preimage.

> **Comments:**
> **username_2**: Re "What tools to use to extract the transactions (with OP_IF) from historical data?" did you query the blockchain data here yourself @Vojtech or use something else?  
> **username_1**: I wrote a script that extracts this data from a local node.  
> **username_3**: @username_1 - is that script something you could share here (i.e. a link to github or something?)  
> **username_1**: @username_3 Not meaningfully, it has a lot of private dependencies so you wouldn't be able to run it, and it extracts all kinds of scripts, it's not specialized for OP_IF so it's a lot more complicated than it needs to be for this task.  

---

