Skip to content

debug_call (Func)

Debug a SilverScript contract call by simulating the full spend locally.

Experimental: SilverScript and these bindings are under active development; the API may change in breaking ways between releases.

Compiles source with debug info, builds a synthetic transaction that spends the contract's P2SH UTXO with a call to the chosen entrypoint, and executes it through SilverScript's source-level debug engine. The result reports pass/fail; on failure it includes a source-level report with the failing statement, the call stack, and the decoded variables (locals, arguments, contract state) in each frame. console.log output is captured either way.

This simulates script validation on a synthetic transaction — it does not touch the network and says nothing about fees, mass, or maturity.

PARAMETER DESCRIPTION
source

The SilverScript contract source.

TYPE: str

function_name

The entrypoint to call. Defaults to the contract's first entrypoint. For covenant functions, use the source-level name (e.g. "add").

TYPE: Optional[str] DEFAULT: None

args

Native Python values matching the entrypoint's parameters. For covenant transition functions the leading State parameter is synthesized from the scenario's output states — pass only the source-level arguments after it.

TYPE: Optional[Any] DEFAULT: None

constructor_args

Native Python values for the contract's constructor parameters.

TYPE: Optional[Any] DEFAULT: None

tx

Optional transaction scenario dict. Defaults to a single-input, single-output spend of the contract. Keys: version (default 1), lock_time (default 0), active_input_index (default 0; the input being debugged), inputs, and outputs. Each input dict accepts utxo_value (required), covenant_id (32 bytes or hex), state (dict of contract state fields carried by the spent UTXO), constructor_args, prev_txid, prev_index, sequence, sig_op_count, signature_script, and utxo_script (raw bytes overrides). Each output dict accepts value (required), covenant_id, authorizing_input, state (the post-transition contract state to verify), constructor_args, script, and p2pk_pubkey.

TYPE: Optional[Any] DEFAULT: None

trace

When True, record a per-statement execution trace on result.trace: each executed statement with its source line, enclosing function, and the variables in scope when it was reached. Tracing changes what is recorded, not what executes. Covenant transition calls record no per-statement pauses (the engine verifies their bodies as a whole, as in the CLI debugger); the failure report still decodes them on failure.

TYPE: bool DEFAULT: False

RETURNS DESCRIPTION
DebugCallResult

The simulation outcome. Script failures are reported in the result, not raised.

TYPE: DebugCallResult

RAISES DESCRIPTION
SilverScriptError

If compilation fails, the entrypoint or an argument is invalid, or the tx scenario is malformed.