Silverscript is a CashScript-inspired language and compiler that targets Kaspa script.
This repository is a Rust workspace. The main crate is silverscript-lang.
cargo test -p silverscript-langRun the compiler from the workspace with Cargo:
cargo run -p silverscript-lang --bin silverc -- contract.silBy default, silverc writes the compiled JSON artifact beside the source file as
contract.json. Use -o to choose another output path, or -c to write the
artifact to standard output:
cargo run -p silverscript-lang --bin silverc -- contract.sil -o artifact.json
cargo run -p silverscript-lang --bin silverc -- contract.sil -cFor a contract such as contract Limit(int limit), put its constructor arguments
in a JSON array:
[{ "kind": "int", "value": 100 }]Then pass the file to silverc:
cargo run -p silverscript-lang --bin silverc -- \
contract.sil --constructor-args args.jsonConstructor arguments are positional and use SilverScript's portable ABI JSON format. See Constructor argument JSON for every supported value type and more examples.
Use --ast-only to parse the source and emit AST JSON without compiling it:
cargo run -p silverscript-lang --bin silverc -- contract.sil --ast-onlyRun with --help to see all available options.
The workspace includes a source-level debugger for stepping through scripts:
cargo run -p cli-debugger -- \
silverscript-lang/tests/examples/if_statement.sil \
--function hello \
--ctor-arg 3 --ctor-arg 10 \
--arg 1 --arg 2silverscript-lang/– compiler, parser, and testsdebugger/session/–DebugSessionruntime (stepping, variable inspection)debugger/cli/–sil-debugCLI REPLsilverscript-lang/tests/examples/– example contracts (.silfiles)
See TUTORIAL.md for a full language and usage tutorial, DECL.md for the covenant declaration spec, and the KCC20 book.
See CREDITS.md for acknowledgements and credits.
To report a security vulnerability privately, follow the instructions in the security policy.
- Kaspa dependencies are pulled from https://github.com/kaspanet/rusty-kaspa.