Module script

Source
Expand description

Script

Scripts define Bitcoin’s digital signature scheme: a signature is formed from a script (the second half of which is defined by a coin to be spent, and the first half provided by the spending transaction), and is valid iff the script leaves TRUE on the stack after being evaluated. Bitcoin’s script is a stack-based assembly language similar in spirit to Forth.

This module provides the structures and functions needed to support scripts.

Structs§

Builder
An object which can be used to construct a script piece by piece
Instructions
Iterator over a script returning parsed opcodes
Script
A Bitcoin script

Enums§

Error
Ways that a script might fail. Not everything is split up as much as it could be; patches welcome if more detailed errors would help you.
Instruction
A “parsed opcode” which allows iterating over a Script in a more sensible way

Functions§

read_scriptbool
This is like “read_scriptint then map 0 to false and everything else as true”, except that the overflow rules don’t apply.
read_scriptint
Helper to decode an integer in script format
read_uint
Read a script-encoded unsigned integer