CHIPs · CHIP-2025-05 · activated
Functions: Function Definition and Invocation Operations
Adds OP_DEFINE and OP_INVOKE, so contract bytecode can be split into reusable, immutable functions.
Summary
This CHIP introduces OP_DEFINE (0x89) and OP_INVOKE (0x8a),
“enabling Bitcoin Cash contract bytecode to be factored into reusable functions.”
Motivation
The CHIP names three benefits:
- Smaller transactions. Removing duplicated bytecode makes room for finite field arithmetic, pairing-based cryptography, zero-knowledge proofs, homomorphic encryption and post-quantum cryptography.
- Privacy and operational security. Contracts can be designed to leak less about their security measures, assets and history.
- Auditability. Shared logic lives in one place, so contracts are shorter and easier to review.
What it specifies
- The VM gains a function table: a map from a function identifier to an immutable byte vector (the function body).
OP_DEFINEpops an identifier (0 to 7 bytes) and then a body, and stores the body in the table. Redefining an existing identifier is an error, so functions are immutable.OP_INVOKEpops an identifier, saves the current execution position on the control stack, runs the stored body, then resumes after theOP_INVOKE.- The number of functions and their size are bounded by existing VM limits (memory slots and the 10,000-byte stack element limit). Execution is charged by the VM Limits cost rules.
History
This CHIP replaced CHIP-2024-12 OP_EVAL, which proposed a single “evaluate this bytecode” opcode. Jason Dreyzehner withdrew OP_EVAL on 28 May 2025 and opened this topic with the new design. The Bitcoin Cash Node upgrade spec links the discussion thread “CHIP-2025-08 Functions (Takes 2 & 3)”, reflecting later revisions.
Current status
Activated on 15 May 2026 (version 2.0.2 was frozen for lock-in). The stakeholder table records 88 approvals, 1 disapproval (Coin Wallet) and 423 neutral; non-responses were counted as neutral.
Stakeholder positions
Only public statements we could link to. Silence is not listed as a position.