Opcodes · function · enabled

OP_DEFINE (0x89)

Stores a function body (bytecode) in the function table under an identifier of 0–7 bytes. Functions are immutable: redefining an identifier fails. This byte was OP_RESERVED1 before May 2026.

Verified
Stack in → out
body id → ∅
Cost
Base instruction cost 100 plus the byte length of the function body. Defined functions share the 1,000 memory-slot limit with stack and altstack items.
Bitcoin status
Not in Bitcoin (BTC)0x89 is OP_RESERVED1 in BTC; an OP_SUCCESS code in Tapscript.

Example

<OP_DUP OP_MUL> OP_0 OP_DEFINE OP_3 OP_0 OP_INVOKE OP_9 OP_EQUAL

Step through it opcode by opcode in Bitauth IDE, the in-browser BCH VM debugger.

Sources

  1. CHIP-2025-05 Functions: Function Definition and Invocation Operations
  2. Libauth BCH_2026_05 opcodes (bch-2026-opcodes.ts)
  3. Announcing Bitcoin Cash Node v29.0.0
  4. BCHN script interpreter (interpreter.cpp)