May 15, 2022 · activated · block 740,238
May 2022: native introspection and 64-bit math
Contracts can read their own transaction directly (native introspection opcodes), do 64-bit arithmetic, and multiply with OP_MUL.
What changed
Activation came when the median time past reached Unix time 1652616000
(15 May 2022, 12:00 UTC). Block 740,237 was the first with a median time past past that mark, so block 740,238 is the
first block under the new rules.
Two CHIPs activated:
- CHIP-2021-02 Native Introspection added 14 opcodes
(
0xc0–0xcd) that push facts about the current transaction onto the stack:- Whole transaction:
OP_INPUTINDEX,OP_ACTIVEBYTECODE,OP_TXVERSION,OP_TXINPUTCOUNT,OP_TXOUTPUTCOUNT,OP_TXLOCKTIME. - Per input:
OP_UTXOVALUE,OP_UTXOBYTECODE,OP_OUTPOINTTXHASH,OP_OUTPOINTINDEX,OP_INPUTBYTECODE,OP_INPUTSEQUENCENUMBER. - Per output:
OP_OUTPUTVALUE,OP_OUTPUTBYTECODE.
- Whole transaction:
- CHIP-2021-03 Bigger Script Integers widened script numbers from
32-bit to 64-bit and re-enabled
OP_MUL. Overflows now fail the script instead of producing odd results.
Why
Introspection. Covenants (contracts that control where their coins can go next) already
worked on BCH, but only through a trick: push a copy of the transaction’s signing data, check it with both
OP_CHECKSIG and OP_CHECKDATASIG, then pick it apart. The CHIP says this doubled or tripled the size of even simple covenant transactions, and
advanced ones hit the 1,650-byte unlocking script limit. The CHIP gives contracts
direct access to the same facts “without increasing transaction validation costs.”
Bigger integers. 32-bit math capped values at 2,147,483,647. In satoshis that is about 21 BCH. Any contract holding more had to emulate bigger math, which was hard to secure and bloated transactions. 64-bit numbers cover any possible output value (the total supply is about 2.1 quadrillion satoshis).
The CHIPs recommended shipping both together: OP_UTXOVALUE and OP_OUTPUTVALUE return amounts that only fit in
64-bit numbers.
What it enables
- Much smaller covenants. Checking “output 0 must pay at least X to address Y” becomes a handful of opcodes.
- Contracts of any size. A vault, escrow or pool can safely hold thousands of BCH.
- Real financial math. Multiplication plus 64-bit range makes interest, price and ratio calculations practical.
- Tooling support. CashScript’s author committed in the CHIP to support the full set of introspection opcodes.
The CHIP lists early builders who relied on these features: General Protocols (AnyHedge), be.cash, Causes Cash recurring payments, Mistcoin, Flipstarter and others. Together with CashTokens in 2023, this upgrade laid the base for UTXO-based apps like DEXes and lending on BCH.