BITCOIN MAINNETLive explorer status
PROGRAMMABLE LOCKS

Script opcodes

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

OpcodeByteWhat it does
OP_DUP0x76Copies the top item
OP_HASH1600xa9Replaces the top item with its HASH160
OP_EQUAL0x87Pushes TRUE if the top two items are equal
OP_EQUALVERIFY0x88Same, but fails immediately if they're not
OP_CHECKSIG0xacChecks a signature against a public key and the transaction
OP_CHECKMULTISIG0xaeChecks m signatures against n public keys
OP_CHECKLOCKTIMEVERIFY0xb1Fails if the transaction's locktime is too early
OP_CHECKSEQUENCEVERIFY0xb2Fails if the relative timelock isn't met
OP_RETURN0x6aMarks the output as unspendable, used for data
OP_0 to OP_160x00, 0x51–0x60Push small numbers

"VERIFY" versions

Two opcodes in action: OP_DUP copies the top item, OP_HASH160 hashes the copy<pubkey>pubkeyOP_DUPpubkeypubkeyOP_HASH160pubkeyhashstack after each step, top item last
Two opcodes in action: OP_DUP copies the top item, OP_HASH160 hashes the copy

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             ac

That's the classic Pay to public key hash (P2PKH) lock. The 14 means "push the next 20 bytes".

Opcodes added by soft forks

OpcodeAddedPurpose
OP_CHECKLOCKTIMEVERIFY2015, BIP 65Absolute timelocks
OP_CHECKSEQUENCEVERIFY2016, BIP 112Relative timelocks
OP_CHECKSIGADD2021, BIP 342Efficient 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.

Share this guide
Share on X ↗

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.