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.

Verified

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:

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.

CHIPs in this upgrade

Sources

  1. 2022-05-15 Network Upgrade Specification (BCHN upgrade specs)
  2. CHIP-2021-02: Native Introspection Opcodes
  3. CHIP-2021-03: Bigger Script Integers
  4. Bitcoin Cash Node chainparams.cpp (upgrade8 height note)
  5. Blockchair block data (median time past check)