Skip to content

Class BSV::Script::Interpreter

Inherits: Object Includes: BSV::Script::Interpreter::Operations::Arithmetic, BSV::Script::Interpreter::Operations::Bitwise, BSV::Script::Interpreter::Operations::Crypto, BSV::Script::Interpreter::Operations::DataPush, BSV::Script::Interpreter::Operations::FlowControl, BSV::Script::Interpreter::Operations::Splice, BSV::Script::Interpreter::Operations::StackOps

Bitcoin script interpreter implementing the post-Genesis BSV script engine.

Evaluates unlock + lock script pairs, supporting the full BSV opcode set including restored opcodes (OP_MUL, OP_LSHIFT, OP_CAT, etc.) and post-Genesis rules (OP_RETURN as early success, no script size limits).

@example Evaluate scripts without transaction context

BSV::Script::Interpreter.evaluate(unlock_script, lock_script)

@example Verify a transaction input

BSV::Script::Interpreter.verify(
  tx: transaction, input_index: 0,
  unlock_script: input.script, lock_script: prev_output.script,
  satoshis: prev_output.satoshis
)

Constants

CONDITIONAL_OPCODES

Conditional opcodes must be processed even in non-executing branches to maintain correct nesting depth.

Attributes

astack [R]

Returns the value of attribute astack.

dstack [R]

Returns the value of attribute dstack.

Public Class Methods

evaluate(unlock_script, lock_script)

Evaluate unlock + lock scripts without transaction context.

Signature operations will always fail (no sighash available). - @param unlock_script [Script] the unlocking script - @param lock_script [Script] the locking script - @raise [ScriptError] if script execution fails - @return [Boolean] +true+ if execution succeeds

verify(tx:, input_index:, unlock_script:, lock_script:, satoshis:)

Verify a transaction input by evaluating its scripts. - @param tx [Transaction::Transaction] the transaction being verified - @param input_index [Integer] the input index within the transaction - @param unlock_script [Script] the input's unlocking script - @param lock_script [Script] the previous output's locking script - @param satoshis [Integer] the value of the previous output in satoshis - @raise [ScriptError] if script execution fails - @return [Boolean] +true+ if verification succeeds

Public Instance Methods

execute()

Not documented.