Finding Transactions with seldom used opcodes for testing

2

I'm trying to implement a script evaluator and would like to get some real testing data from the blockchain (testnet or mainnet). Are there transactions whose input scriptSigs combined with the previous transaction's scriptPubKey use any/all of these op_codes? I'd like to compile a collection of such transactions as test vectors.

98: op_ver,
101: op_verif,
102: op_vernotif,
107: op_toaltstack,
108: op_fromaltstack,
109: op_2drop,
111: op_3dup,
112: op_2over,
113: op_2rot,
114: op_2swap,
115: op_ifdup,
116: op_depth,
119: op_nip,
120: op_over,
121: op_pick,
122: op_roll,
123: op_rot,
125: op_tuck,
139: op_1add,
140: op_1sub,
143: op_negate,
144: op_abs,
146: op_0notequal,
147: op_add,
148: op_sub,
154: op_booland,
155: op_boolor,
156: op_numequal,
157: op_numequalverify,
158: op_numnotequal,
159: op_lessthan,
160: op_greaterthan,
161: op_lessthanorequal,
162: op_greaterthanorequal,
163: op_min,
164: op_max,
165: op_within,
168: op_sha256,
170: op_hash256,
171: op_codeseparator,

Jimmy Song

Posted 2018-10-22T03:08:12.440

Reputation: 7 067

Just to make sure I'm understanding, you'd like a compiled list of transactions which have these OP_ codes in their scriptPubKey? Would you prefer a spreadsheet and what info do you exactly need? TXID and ASM?KappaDev 2018-10-22T04:45:27.880

1I would like transactions which spend utxos with these op codes either in the scriptPubKey or redeemScript.Jimmy Song 2018-10-22T14:19:17.450

I believe the early blocks of testnet contain a bunch of unusual transactions as a sort of test suite. So that might be one place to start looking.Nate Eldredge 2018-10-22T14:40:10.820

1

@JimmySong I wrote this small PHP script which I believe should work, but after running this overnight for 12+ hours I quickly realized this is quite inefficient and will likely take too long. Perhaps someone with SQL knowledge can utilize this to obtain the required info?

KappaDev 2018-10-22T21:30:19.047

1@NateEldredge, I checked the first 400 or so blocks of testnet and did not find anything that uses any of these script codes.Jimmy Song 2018-10-22T21:59:53.687

@JimmySong: Okay, sorry about the wild goose chase. Of course, you ought to be able to manually create and spend some transactions like this on testnet, which may be more expedient than writing the code to search for existing ones.Nate Eldredge 2018-10-22T22:04:13.173

A slightly bigger search yielded some interesting tx's on testnet. I'll post them as my own answer.Jimmy Song 2018-10-23T00:52:38.873

Answers

1

I did some digging with a parser I wrote and found 6 transactions that test a lot of the op codes:

efdf1b981d7bba9c941295c0dfc654c4b5e40d7b9744819dd4f78b8e149898e1
9aa3a5a6d9b7d1ac9555be8e42596d06686cc5f76d259b06c560a207d310d5f5
c5d4b73af6eed28798473b05d2b227edd4f285069629843e899b52c2d1c165b7
74ea059a63c7ebddaee6805e1560b15c937d99a9ee9745412cbc6d2a0a5f5305
e335562f7e297aadeed88e5954bc4eeb8dc00b31d829eedb232e39d672b0c009
dc3aad51b4b9ea1ef40755a38b0b4d6e08c72d2ac5e95b8bebe9bd319b6aed7e

These are all on testnet and test a very large number of the OP_CODES I requested. Here are still ones I'm looking for:

op_reserved
op_reserved1
op_reserved2
op_ver
op_verif
op_vernotif
op_2rot
op_2swap
op_1add
op_codeseparator

Jimmy Song

Posted 2018-10-22T03:08:12.440

Reputation: 7 067

1That'll be hard. OP_RESERVED, OP_RESERVED1, OP_RESERVED2, OP_VER, OP_VERIF, OP_VERNOTIF all immediately cause the script to fail, so they can't occur (unless in an unexecuted IF branch) in a valid spend. OP_VERIF and OP_VERNOTIF even cause failure when in an unexecuted IF branch.Pieter Wuille 2018-10-23T01:13:08.000

Thanks @PieterWuille, I was confused about that. So it's a lot like OP_RETURN but for IF branches? I guess I just need the last 4, then.Jimmy Song 2018-10-23T01:21:34.480