Glossary · deep dive

Opcode

A one-byte instruction in Bitcoin Script, such as OP_DUP or OP_CHECKSIG.

Bitcoin Script is a list of instructions read left to right. Each instruction is an opcode: a single byte that tells the interpreter what to do. Data pushes put bytes (like a signature or public key) onto a stack; other opcodes take items off the stack, work on them and push a result.

Examples

  • OP_DUP copies the top stack item.
  • OP_HASH160 replaces the top item with its SHA-256 then RIPEMD-160 hash.
  • OP_EQUALVERIFY fails the script unless the top two items are equal.
  • OP_CHECKSIG checks a digital signature against a public key.
  • OP_RETURN marks an output as provably unspendable, often used to embed small pieces of data.

Disabled and reserved opcodes

In 2010 several opcodes, such as OP_CAT and OP_MUL, were disabled to avoid denial-of-service bugs. Unused "NOP" opcodes were later redefined by soft fork: OP_NOP2 became OP_CHECKLOCKTIMEVERIFY and OP_NOP3 became OP_CHECKSEQUENCEVERIFY. In Tapscript, unused opcodes are called OP_SUCCESS and make future upgrades simpler.