Opcodes are Bitcoin Script's instructions: duplicate, hash, compare, check signatures and times. A clear reference to the opcodes you will see most.
The everyday set
| Opcode | Byte | What it does |
|---|---|---|
OP_DUP | 0x76 | Copies the top item |
OP_HASH160 | 0xa9 | Replaces the top item with its HASH160 |
OP_EQUAL | 0x87 | Pushes TRUE if the top two items are equal |
OP_EQUALVERIFY | 0x88 | Same, but fails immediately if they're not |
OP_CHECKSIG | 0xac | Checks a signature against a public key and the transaction |
OP_CHECKMULTISIG | 0xae | Checks m signatures against n public keys |
OP_CHECKLOCKTIMEVERIFY | 0xb1 | Fails if the transaction's locktime is too early |
OP_CHECKSEQUENCEVERIFY | 0xb2 | Fails if the relative timelock isn't met |
OP_RETURN | 0x6a | Marks the output as unspendable, used for data |
OP_0 to OP_16 | 0x00, 0x51–0x60 | Push small numbers |
"VERIFY" versions
Opcodes ending in VERIFY check something and stop the script with failure if it's false, instead of pushing FALSE. That keeps scripts short.
Disabled opcodes
Early on, Satoshi disabled opcodes such as OP_CAT and OP_MUL after bugs were found. Any script using a disabled opcode fails. Re-enabling some of them is a regular topic of Bitcoin proposals, which would need a soft fork.
Reading a real script
OP_DUP OP_HASH160 <20-byte hash> OP_EQUALVERIFY OP_CHECKSIG
76 a9 14 <…20 bytes…> 88 acThat's the classic Pay to public key hash (P2PKH) lock. The 14 means "push the next 20 bytes".
Opcodes added by soft forks
| Opcode | Added | Purpose |
|---|---|---|
| OP_CHECKLOCKTIMEVERIFY | 2015, BIP 65 | Absolute timelocks |
| OP_CHECKSEQUENCEVERIFY | 2016, BIP 112 | Relative timelocks |
| OP_CHECKSIGADD | 2021, BIP 342 | Efficient multisig in Tapscript |
New opcodes are added by redefining "no-op" opcodes, so old nodes still accept the scripts, which keeps upgrades as soft forks.
OP_SUCCESS in Tapscript
Taproot reserved many unused opcode numbers as OP_SUCCESSx, which make a script succeed today. Future soft forks can give them real meanings safely.
Key takeaways
- Opcodes are single-byte instructions in Script.
- VERIFY variants fail immediately instead of pushing false.
- Some opcodes were disabled early for safety.
Common questions
What does OP_CHECKSIG actually sign?
A hash of the spending transaction, built according to the signature's sighash flag.
Are there opcodes for loops?
No. Script has conditionals (OP_IF) but no loops.
How many opcodes does Bitcoin have?
Around 100 are defined and usable; several more are disabled or reserved.
Can new opcodes be added?
Yes, through soft forks that redefine reserved opcodes, as with CLTV and CSV.