Opcodes · splice · enabled

OP_NUM2BIN (0x80)

Converts number n to a byte string of exactly `size` bytes, padding with zeros and keeping the sign bit. It uses the byte of the disabled OP_LEFT.

Verified
Stack in → out
n size → bin
Cost
Base instruction cost 100 plus result length (2025 VM limits).
Bitcoin status
Not in Bitcoin (BTC)0x80 is the disabled OP_LEFT in BTC; an OP_SUCCESS code in Tapscript.

Example

OP_2 OP_4 OP_NUM2BIN <0x02000000> OP_EQUAL

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

Sources

  1. BCHN upgrade specs: Restore disabled script opcodes, May 2018
  2. Libauth BCH_2023_05 opcodes (bch-2023-opcodes.ts)
  3. BIP-342: Validation of Taproot Scripts