debug_call (Func)¶
Debug a SilverScript contract call by simulating the full spend locally.
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.
The tx scenario dict takes the following keys:
Transaction keys
- 'version' (int): Transaction version (default 1).
- 'lock_time' (int): Transaction lock time (default 0).
- 'active_input_index' (int): The input being debugged (default 0).
- 'inputs' (list[dict]): Required. At least one input.
- 'outputs' (list[dict]): The transaction outputs.
Input keys
- 'utxo_value' (int): Required. The spent UTXO value in sompi.
- 'covenant_id' (bytes | str): 32 bytes or hex.
- 'state' (dict): Contract state fields carried by the spent UTXO.
- 'constructor_args' (list): Constructor arguments for this input, overriding the top-level 'constructor_args'. The active input's are the ones the debugged call runs against.
- 'prev_txid' (bytes | str), 'prev_index' (int), 'sequence' (int), 'sig_op_count' (int): Outpoint and input metadata.
- 'signature_script' (bytes | str), 'utxo_script' (bytes | str): Raw script overrides.
Output keys
- 'value' (int): Required. The output value in sompi.
- 'covenant_id' (bytes | str): 32 bytes or hex.
- 'authorizing_input' (int): Index of the authorizing input.
- 'state' (dict): The post-transition contract state to verify.
- 'constructor_args' (list): Constructor arguments for this output, overriding the top-level 'constructor_args'.
- 'script' (bytes | str), 'p2pk_pubkey' (bytes | str): Raw script overrides.
| PARAMETER | DESCRIPTION |
|---|---|
source
|
The SilverScript contract source.
TYPE:
|
function_name
|
The entrypoint to call. Defaults to the contract's
first entrypoint in source order, which need not be
TYPE:
|
args
|
Native Python values matching the entrypoint's parameters. For
covenant transition functions the leading
TYPE:
|
constructor_args
|
Native Python values for the contract's constructor parameters, used for inputs and outputs that do not name their own. Defaults to the active input's 'constructor_args'.
TYPE:
|
tx
|
Transaction scenario dict (see above). Defaults to a single-input, single-output spend of the contract.
TYPE:
|
trace
|
When True, record a per-statement execution trace on
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
DebugCallResult
|
The simulation outcome. Script failures are reported in the result, not raised.
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
SilverScriptError
|
If compilation fails, the entrypoint or an argument
is invalid, or the |
Note
Experimental. SilverScript and these bindings are under active development; the API may change in breaking ways between releases.