Skip to main content

Module scriptnum

Module scriptnum 

Source
Expand description

Script number arithmetic with Bitcoin consensus rules. Script number arithmetic with Bitcoin consensus rules.

All numbers on the Bitcoin script stack are encoded as little-endian byte arrays with a sign bit in the most significant bit of the last byte. Numeric opcodes operate on 4-byte integers in [-2^31+1, 2^31-1] but results may overflow and remain valid as long as they are not reinterpreted as numbers.

Structs§

ScriptNumber
A script number using big integer arithmetic for overflow safety.

Functions§

check_minimal_data_encoding
Check that a byte array uses minimal data encoding.
minimally_encode
Minimally encode a byte array (used by OP_BIN2NUM).