Skip to content

Install and setup

Silverscript is a Rust workspace. The main crate is silverscript-lang.

Terminal window
git clone https://github.com/kaspanet/silverscript
cd silverscript
cargo test -p silverscript-lang

If the tests pass, your toolchain is fine.

Editor support

Editor extensions ship in the repository under extensions/, backed by a tree-sitter grammar:

EditorPath
VS Codeextensions/vscode
Zedextensions/zed
Neovimextensions/silverscript.nvim

Syntax highlighting for .sil is worth setting up before you write anything. Covenant code is dense, and unhighlighted it reads as a wall.

The debugger

The workspace includes a source-level debugger — stepping, variable inspection, a REPL. For a language where failure normally shows up as “the spend was rejected”, being able to step a script is the difference between a minute and an afternoon.

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

Constructor arguments come first, then the arguments the spender supplies — mirroring the split between what is fixed at the address and what is provided at spend time.

Where the examples live

silverscript-lang/tests/examples/ holds over eighty .sil files, and they are the best reading material available: multisig, hodl vaults, escrows, last-will covenants, recurring allowances, and KCC-20 token contracts. Because they are test fixtures, they compile — which is more than can be said for most sample code.

Upstream reference