Skip to content

load_artifact (Func)

Load a portable ABI artifact from JSON.

Takes what CompiledContract.artifact_json returns, or what upstream silverc -c writes. Compile once and ship the artifact; derive addresses and build unlocking scripts from it at runtime with no source and no compiler.

debug_call and compiling with different constructor arguments need the source and are not available from an artifact — an artifact describes one already-compiled contract.

PARAMETER DESCRIPTION
json

The artifact JSON.

TYPE: str

contract_name

Which contract to select. Omit for an artifact that holds exactly one (what compile produces).

TYPE: Optional[str] DEFAULT: None

RETURNS DESCRIPTION
ContractArtifact

The loaded artifact.

TYPE: ContractArtifact

RAISES DESCRIPTION
SilverScriptError

If the JSON is malformed, its schema version is unsupported, or contract_name is absent or ambiguous.

Note

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