script – How to search for a transaction using a specific OPCODE?

I do not think it's possible. Most, if not all, block explorers and blockchain indexers do not completely disassemble scripts and index them so that they are searchable. To my knowledge, no software or service can search by transaction code during a transaction. It would be rather useless for a service to provide this because probably no one would use it and such an index would represent a huge cost in resources.

I think the best thing you can do is write a program that examines the scriptSig of each transaction and looks for the desired transaction codes. However, be careful not to interpret random bytes as opcodes. You will need something that can disassemble the scripts and check the disassembled scripts for the opcodes you want. In addition, such disassemblers will not be able to disassemble a redeemScript, which is the script where opcodes will actually be used for P2SH entries.


Instead of looking for an example of an opcode that has probably not been used, just try using it yourself. I recommend you read https://en.bitcoin.it/wiki/Script to get an idea of ​​how the opcode works. Then you can use a tool such as https://github.com/kallewoof/btcdeb to run and debug your script. In this way, you can learn how the opcode works through experiments and see exactly how a script interpreter will execute the script.