Languages
Any language that compiles to a WASI Component can target Sigil. The first-party SDK is Rust; community SDKs exist for AssemblyScript and TinyGo.| Language | SDK | Notes |
|---|---|---|
| Rust | sigil-contract-sdk | Reference implementation. Procedural macros generate the ABI. |
| AssemblyScript | @sigil/contract-as | Community-maintained. |
| TinyGo | sigil-contract-go | Community-maintained. |
Contract structure
#[contract] macro exposes the public functions as ABI methods, generates the JCS argument codecs, and registers the contract in the zone’s namespace.
Lifecycle
| Phase | Description |
|---|---|
| Build | Compile to wasm32-wasi with --release. Output must be ≤ 2 MiB. |
| Deploy | Submit DeployContract with the WASM bytes. The chain pins by BLAKE3 hash. |
| Call | Submit CallContract with the contract id, method, args, and gas budget. |
| Read | Use sigil_callContract for read-only views; no gas, no state change. |
| Upgrade | Deploy a new version under a new contract id. The old id stays addressable. |
Gas
Wasmtime gas is metered per instruction plus per syscall:| Operation | Cost |
|---|---|
| Bytecode instruction | 1 gas |
| Storage read | 100 gas |
| Storage write (32 bytes) | 1,000 gas |
| Inter-contract call | 1,000 gas + callee cost |
| Cryptographic primitive (BLAKE3, Ed25519 verify) | 200 gas |
| JCS serialise / deserialise | 50 gas per byte |
State isolation
A contract has read and write access only to its own state partition. Cross-contract calls go through the explicit call interface and consume their own gas budget. There is no shared memory. State is stored under the contract id in the zone’s AkashaKV partition. Keys are arbitrary bytes; values are JCS-encoded.Determinism
Wasmtime is configured with non-deterministic features disabled:- No floating-point operations that vary across CPUs.
- No threads, no SIMD that depends on runtime feature detection.
- No NaN payload propagation.
- No wall-clock reads.
Limits
| Limit | Value |
|---|---|
| Max contract size | 2 MiB |
| Max stack depth | 512 frames |
| Max storage writes per call | 1,024 |
| Max inter-contract call depth | 16 |
| Max bytes returned to caller | 32 KiB |
Implementation
- Contract executor:
node/sigil-contract/src/executor.rs. - Zone integration:
node/sigil-zone/src/contract_namespace.rs. - Rust SDK:
sdks/rust/sigil-contract-sdk/.
See also
- Deploy a smart contract — end-to-end recipe.
- Organisation zones — zone model.
- Programmability — system contracts vs zones vs native executor.