Expand description
Full Bitcoin script interpreter engine. Full Bitcoin script interpreter.
Executes locking and unlocking scripts to verify transaction inputs, supporting all standard opcodes and verification flags.
§Architecture
The interpreter does not depend on the transaction crate directly to avoid
circular dependencies. Instead, callers provide a TxContext trait
implementation that handles signature hash computation and verification.
§Example
ⓘ
use bsv_script::interpreter::{Engine, ScriptFlags};
let engine = Engine::new();
engine.execute(
&unlocking_script,
&locking_script,
ScriptFlags::ENABLE_SIGHASH_FORKID | ScriptFlags::UTXO_AFTER_GENESIS,
None, // no tx context needed for simple scripts
0,
)?;Re-exports§
pub use config::Config;pub use error::InterpreterError;pub use error::InterpreterErrorCode;pub use flags::ScriptFlags;pub use parsed_opcode::ParsedOpcode;pub use parsed_opcode::ParsedScript;pub use scriptnum::ScriptNumber;pub use stack::Stack;
Modules§
- config
- Interpreter configuration with pre/post-genesis limits. Interpreter configuration with pre/post-genesis limits.
- error
- Interpreter error types and error codes. Interpreter error types matching the Go SDK’s errs package.
- flags
- Script verification flags (bitmask). Script verification flags (bitmask).
- parsed_
opcode - Parsed opcode representation and script parser. Parsed opcode representation and script parser.
- scriptnum
- Script number arithmetic with Bitcoin consensus rules. Script number arithmetic with Bitcoin consensus rules.
- stack
- Script execution stack. Script execution stack.
- thread
- Script execution thread — the core interpreter engine. Script execution thread — the core interpreter engine.
Structs§
- Engine
- The script execution engine.
Traits§
- TxContext
- Transaction context trait — provides signature verification without circular dependency on bsv-transaction.