Argent

The actor-based language, compiler, and runtime above Silverscript for multi-contract and multi-app Toccata covenant systems.

Argent is an actor-based language, compiler, and runtime built on top of Silverscript for building stateful, multi-contract, and multi-app covenant systems on Kaspa L1.

Applications are expressed as transaction-wide state transitions over covenant UTXOs. Actors own typed state, entries declare which actors they consume, emit, or observe, and become binds the successor actors created in one atomic transaction. Inter-Covenant Communication (ICC) extends the same model across independently compiled apps.

.ag source
    |
    v
Argent compiler (argentc)
    |
    +-- plain, auditable .sil contracts  -->  Silverscript  -->  Kaspa Script
    |
    +-- portable artifact.json
              |
              v
       argent-runtime (TxBuilder / ArtifactBundle)
              |
              v
   atomic multi-actor Kaspa transaction
Important

Status and production audit path: argent-lang/argent is under active development and still needs further audit and hardening before unreviewed general production use. However, because Silverscript is released for production and Argent compiles each actor into plain, auditable .sil contracts, builders are already using Argent for real applications by directly inspecting, testing, and auditing the generated .sil layer. This is the exact workflow used for the KCC-20 reference implementation.

Why Argent exists

Hand-written multi-contract covenant systems quickly accumulate mechanical, error-prone plumbing:

  • state serialization and hidden ABI fields;
  • template hashes and route-commitment proofs;
  • prefix/suffix witnesses for foreign templates;
  • leader/delegate input-group checks and exact output ordering;
  • cross-covenant observation and co-spend validation;
  • launch proofs and runtime transaction-builder metadata.

Argent lifts that application graph into source syntax. The compiler checks the declared state-machine edges, lowers each actor into a plain .sil contract (using Silverscript's AST APIs directly), and emits a portable artifact.json containing the runtime recipe for constructing valid transactions.

The actor mental model

Argent actors are not async actors with mailboxes or message queues. They are covenant UTXOs that get consumed and recreated by transactions. The shared idea with actor models is state ownership: an actor's contract code is the sole authority that can consume and mutate that actor's state.

A minimal two-actor app from the Argent README shows the whole loop:

state EventState {
    int remaining_tickets;
    int price;
}

state TicketState {
    byte[32] owner;
}

actor Event owns EventState {
    entry buy(byte[32] buyer)
    // `emits` declares the complete authorized actor-output shape for this entry.
    emits {
        event: Event,
        ticket: Ticket,
    } {
        require(remaining_tickets > 0);

        // Every emitted output's KAS value must be constrained or explicitly unrestricted.
        require(event.value == self.value + price);
        unrestricted(ticket.value);

        EventState next_event = {
            remaining_tickets: remaining_tickets - 1,
            price: price,
        };
        TicketState new_ticket = { owner: buyer };

        // `become` binds each emitted handle to its successor actor and state.
        become {
            event <- Event(next_event),
            ticket <- Ticket(new_ticket),
        };
    }
}

actor Ticket owns TicketState {
    entry transfer(byte[32] next_owner, sig owner_sig, pubkey owner_pk) emits next: Ticket {
        require(blake2b(byte[](owner_pk)) == owner);
        require(checkSig(owner_sig, owner_pk));
        unrestricted(next.value);
        TicketState new_state = { owner: next_owner };
        become next <- Ticket(new_state);
    }
}

// An app defines a closed actor family sharing a covenant boundary.
app Tickets {
    actor Event;
    actor Ticket;
}

One Event::buy transaction advances Event and creates an independently owned Ticket. Later transactions transfer that Ticket in parallel without touching Event. For a guided walkthrough of this app, watch Argent Episode 1 (YouTube) alongside the episode-01 branch of argent-template.

Core vocabulary

Keyword / constructMeaning
stateReusable persistent covenant state layout
actor ... owns ...Contract template owning a typed state layout
entryCallable leader transition path
delegateNon-leading verification path in a coordinated multi-input transition
consumesPeer covenant inputs consumed in the same transaction (supports bounded ranges)
emitsAuthorized output handles created by the entry (supports bounded ranges)
becomeTerminal binding of emitted handles to successor actors and next states
observesDeclares a foreign covenant view for Inter-Covenant Communication (ICC)
spawnsDeclares a constrained genesis covenant output group and binds its derived KIP-20 covenant_id
actor enumClosed set of runtime-selected actor targets within an app
actor_type<State>Runtime or statically linked handle identifying an actor implementation compatible with State
virtual / expandsDigest-backed state slots expanded into concrete structured fields on demand
appClosed actor set defining one covenant family

Route planning and compiler invariants

Inside a multi-actor covenant family, a shared KIP-20 covenant_id proves family membership, not actor role. Argent derives template commitments automatically from the app's route graph so each actor commits in advance to every successor actor it is allowed to create:

  • Same-actor continuations: Use cheaper exact-template checks and embed current-actor template lengths directly (keeping standard ABIs such as KCC-20 free of extra hidden arguments).
  • Foreign and dynamic transitions: Use template prefix/suffix witnesses or route-family commitment tables, with automatic inactive template witness pruning in TxBuilder.
  • Template-frame identity disjointness: Enforced across actor frames at compile, runtime load, inspect, and link time so two actors cannot collide ambiguously.
  • Leader/delegate input-group rules: Generated wrappers enforce exact consume coverage and leader continuation closure so delegates cannot be dragged into unintended transitions or authorize stray outputs.

See Argent's route planner and security invariants docs for the formal rules.

Note

Covenant ⊆ app (why every Argent app uses a KIP-20 covenant ID): Think of each live KIP-20 covenant (covenant_id) as a single instance bounded by one Argent app: every UTXO carrying that ID comes from the app's closed actor set, separate deployments get separate covenant_ids, and larger protocols compose multiple apps through ICC. While a simple single-input KAS script can rely on native KAS conservation alone, multi-actor coordination needs covenant_id for both mutable-peer identity (preventing forged stateful peer UTXOs) and transaction scoping (OpCov* / OpAuth* isolate the covenant's inputs and outputs inside composed transactions), while giving one uniform anchor for cross-app ICC and argent-genesis launch proofs.

Inter-Covenant Communication (ICC)

Real Kaspa applications rarely live in a single covenant family — for example, a DEX interacting with independent token covenants, or a prediction market minting tradable KCC-20 outcome shares. Argent models cross-app atomic co-spends directly through observes and .co_spent():

  • Closed ICC: Link against a compiled dependency app's artifact (ArtifactBundle pins exact dependency artifact IDs so mismatched builds are rejected before transaction construction). Statically linked foreign actors can be passed as byte[32] actor_type<State> handle constants while preserving nominal state identity.
  • Open ICC: Observe an abstract/virtual state interface (state X expands Base) bound dynamically at runtime — allowing protocols such as a DEX pair or registry to interoperate with any conforming asset capsule without recompiling.
  • Constrained genesis spawns: An entry can spawns a new local or linked foreign covenant family and bind its consensus-derived covenant_id atomically inside the transaction.

See ICC semantics for Argent-specific details, and Inter-Covenant Communication (ICC) for the underlying L1 co-spending, open-interface, and dynamic-dispatch patterns.

Tooling, runtime, and genesis proofs

The argent-lang/argent workspace ships four core pieces:

  • argentc (compiler CLI): Compiles .ag apps into sil/*.sil, artifact.json, and manifest.json, and inspects compiled artifacts without rebuilding:
argentc build app.ag --out build/app
argentc inspect build/app

argentc inspect reports per-actor script, state, and template sizes, static opcode counts, entry arguments, generated witnesses, route metadata, and signature-script size estimates.

  • argent-artifact: Portable artifact format wrapping upstream silverscript-abi alongside coordination, routing, dependency IDs, and witness recipes (Artifact::check_consistency()).
  • argent-runtime: Consumes artifact.json through TxBuilder, TxContext, EntryCall, and ArtifactBundle to construct atomic multi-actor and multi-app Kaspa v1 transactions.
  • argent-genesis (launch proofs): Because a live covenant UTXO only exposes a P2SH hash and a KIP-20 covenant_id, wallets, indexers, and auditors need a way to verify which app and initial actor states created that covenant ID. Argent provides a 3-layer verifiable proof stack (ConsensusGenesisProof → SilGenesisProof → ArgentGenesisProof):
argentc genesis compose app.ag --bootstrap genesis.json --out proof.json
argentc genesis verify proof.json --covenant-id <node-provided-id> --source app.ag

See Genesis proof tooling.

Auditing generated Silverscript

When preparing an Argent application for mainnet today, treat the generated .sil files as the contract artifact under audit:

  1. Commit pinned sil/*.sil, artifact.json, and manifest.json fixtures in Git so compiler or contract changes show up directly in code review.
  2. Review every generated .sil entrypoint for output-value constraints, covenant-group boundaries, authorization paths, and termination rules.
  3. Run direct VM tests (encoding transactions directly without trusting a builder to mask malformed cardinalities, role selections, or witnesses) alongside ABI regression tests.

Ecosystem and examples

Continue with Conventions (KCCs) and KCC-20 Fungible Tokens to see how standardized ABIs and the KCC-20 reference app are structured, or jump to Inline ZK for proof verification inside covenants.