CashVM rules through May 2026
The May 2022 upgrade added transaction and spent-output introspection, expanded Script integers, and re-enabled OP_MUL. CashTokens added token introspection in 2023. In May 2025, high-precision arithmetic extended the Script number range. The maximum stack item length rose from 520 to 10,000 bytes, and the 201-operation limit gave way to a per-input operation cost budget. Separate limits bound hashing and control stack depth. Use the full specifications for limits and accounting when building or evaluating bytecode.
Since May 2026, OP_BEGIN and OP_UNTIL support resource-bounded loops. OP_DEFINE and OP_INVOKE allow a script to register and call reusable bytecode. The bitwise upgrade enables OP_INVERT for byte strings, OP_LSHIFTNUM and OP_RSHIFTNUM for VM numbers, and OP_LSHIFTBIN and OP_RSHIFTBIN for fixed-length byte strings. Native introspection · 2022 Script integers · Token introspection · Targeted VM limits · BigInt · Loops · Functions · Bitwise operations · Hex opcode index
The Bitcoin Script OP_DIV and OP_MOD operations are performed on script numbers, which are signed integers. However, there are multiple valid approaches to signed integer division, particularly with respect to how negative values are handled, so this must be disambiguated.
The above operations follow C-style integer division semantics.
For a given numerator and denominator, if OP_DIV returns quotient and OP_MOD returns remainder, the following relation must be true: numerator = quotient * denominator + remainder.
This allows for both negative quotients and remainders: the quotient is truncated toward zero, and the remainder has the sign of the numerator.
If the divisor is zero, OP_DIV and OP_MOD fail evaluation.
The following examples may provide clarity:
<5> <2> OP_DIV -> 2
<5> <2> OP_MOD -> 1
<-5> <2> OP_DIV -> -2
<-5> <2> OP_MOD -> -1
<5> <-2> OP_DIV -> -2
<5> <-2> OP_MOD -> 1
<-5> <-2> OP_DIV -> 2
<-5> <-2> OP_MOD -> -1