BSV.Tokens.Stas3.EngineVerify (bsv_sdk v2.0.0)

Copy Markdown View Source

End-to-end script-engine verification helper for STAS 3.0 transactions.

Given a fully-signed transaction produced by BSV.Tokens.Factory.Stas3, this module pulls out the unlocking script for a single input, builds a BIP-143 + ECDSA sighash_fn, and runs BSV.Script.Interpreter.verify/3 against that input's previous locking script.

This is the canonical end-to-end smoke check for STAS 3.0 in this SDK: if verify/4 returns :ok, the engine has accepted the transaction's unlock-vs-lock pair.

Output:

  • :ok — interpreter accepted the script pair.
  • {:error, reason} — interpreter rejected, with reason propagated from the interpreter (e.g. :invalid_split_range, :checksigverify_failed, :eval_false).

Summary

Functions

Verify a single input of tx against prev_locking_script (the locking script of the UTXO that input is spending) using the SDK's full script interpreter and a real BIP-143 sighash function.

Functions

verify(tx, input_index, prev_lock, prev_amount, opts \\ [])

@spec verify(
  BSV.Transaction.t(),
  non_neg_integer(),
  BSV.Script.t(),
  non_neg_integer(),
  keyword()
) :: :ok | {:error, term()}

Verify a single input of tx against prev_locking_script (the locking script of the UTXO that input is spending) using the SDK's full script interpreter and a real BIP-143 sighash function.

Options

  • :flags — interpreter flags. Defaults to [:utxo_after_genesis, :enable_sighash_forkid].
  • :trace — when true, asks the interpreter for an opcode-level trace and writes it to :trace_path (default /tmp/stas3_engine_trace.log).