Skip to main content

Module script_num

Module script_num 

Source
Expand description

Bitcoin Script number encoding.

Bitcoin Script uses a special little-endian sign-magnitude encoding for numbers on the stack. This module provides conversion between this format and BigNumber.

§Format

  • Little-endian byte order
  • Sign bit in the MSB of the last byte (0x80)
  • Zero is represented as an empty array
  • Negative zero [0x80] is treated as false
  • Numbers must be minimally encoded (no unnecessary padding)

Structs§

ScriptNum
Bitcoin Script number utilities.