Full Bitcoin script interpreter.
Executes unlocking and locking scripts to verify transaction inputs. Supports all standard opcodes including stack, arithmetic, crypto, comparison, flow control, and splice operations.
Limitations
OP_CHECKLOCKTIMEVERIFY (0xB1) and OP_CHECKSEQUENCEVERIFY (0xB2) are currently treated as NOPs and are not fully validated against transaction lock_time or input sequence numbers.
Summary
Functions
Verify an unlocking script against a locking script.
Types
@type flag() ::
:utxo_after_genesis
| :verify_minimal_data
| :verify_clean_stack
| :enable_sighash_forkid
@type opts() :: [ flags: [flag()], sighash_fn: (BSV.Script.t(), non_neg_integer(), non_neg_integer() -> {:ok, binary()} | {:error, term()}) ]
Functions
@spec verify(BSV.Script.t(), BSV.Script.t(), opts()) :: :ok | {:error, term()}
Verify an unlocking script against a locking script.
Returns :ok on success or {:error, reason} on failure.
Options
:flags- List of verification flag atoms:sighash_fn- Function for OP_CHECKSIG sighash computation
Examples
iex> {:ok, lock} = BSV.Script.from_asm("OP_1")
iex> BSV.Script.Interpreter.verify(%BSV.Script{}, lock)
:ok