Build · 2 of 4

Your first covenant

This is SimpleCovenant, verbatim from the official Silverscript tutorial. Twelve lines that already do something real: coins locked by it can only ever be sent to one predetermined recipient.

🚀 Skip the typing: kasstacker-starter packages this contract, the args file and the compile script as a GitHub template — its own CI re-proves the compile daily.

pragma silverscript ^0.1.0;

contract SimpleCovenant(pubkey recipient) {
    entry spend() {
        byte[36] recipientScriptPubKey = new ScriptPubKeyP2PK(recipient);
        require(tx.outputs[0].scriptPubKey == byte[](recipientScriptPubKey));
    }
}

What each piece does

Compile it

Save the contract as simple.sil in your Silverscript checkout. Because the contract takes a constructor parameter (the recipient), the compiler needs a value for it — supplied as a JSON file in the portable ABI format, where a pubkey is a 32-byte array. A zero key is fine for a first compile:

python3 -c "import json; print(json.dumps([{'kind': 'bytes', 'value': [0]*32}]))" > args.json
cargo run -p silverscript-lang --bin silverc -- simple.sil --constructor-args args.json -o artifact.json

The artifact is your compiled covenant. Omitting --constructor-args on a contract that has parameters fails with constructor argument count mismatch — the full format for every argument kind is in the repo's CONSTRUCTOR_ARGS.md.

Step through it

The repo ships a CLI debugger that runs entries against arguments so you can watch a rule pass or fail:

cargo run -p cli-debugger -- silverscript-lang/tests/examples/if_statement.sil \
  --function hello --ctor-arg 3 --ctor-arg 10 --arg 1 --arg 2

Point it at your own simple.sil and an entry once you've compiled it.

Getting it on-chain

Deployment means funding an address whose script is your compiled covenant, then spending it with a witness Witness The data supplied when spending — signatures, arguments, revealed scripts — that satisfies (or fails) the lock on the coins. that satisfies the entry — on testnet-10 first, always. The official tutorial focuses on the language rather than deployment tooling (checked 2026-09-10), so the practical paths today are the kascov.io playground and the patterns in the KCC20 book. A full deploy-and-spend walkthrough lands here as the tooling settles.

Your progress on this step

Esc to close