Loom Smart Contracts
Norn supports off-chain smart contracts called Looms -- WebAssembly programs that execute off-chain with on-chain fraud proof guarantees. Loom deployments are consensus-level: registrations are included in WeaveBlocks and propagate to all nodes via P2P gossip.
Loom Operations
| Operation | Who | Fee | Effect |
|---|---|---|---|
| Deploy | Anyone | 50 NORN (burned) | Registers a new loom with metadata on the network |
| Upload Bytecode | Loom operator | None | Uploads .wasm bytecode to the node and calls init() |
| Execute | Any participant | None | Runs the contract with input data, mutates state |
| Query | Anyone | None | Read-only contract execution, no state change |
| Join | Anyone | None | Join a loom as a participant |
| Leave | Participant | None | Leave a loom |
Loom ID is deterministic: BLAKE3(name ++ operator ++ timestamp).
Naming Rules
| Rule | Constraint |
|---|---|
| Length | 3--64 characters |
| Character set | Lowercase ASCII letters (a-z), digits (0-9), hyphens (-) |
| Hyphens | Must not start or end with a hyphen |
Contract SDK
The norn-sdk crate provides the building blocks for writing loom contracts in Rust, targeting wasm32-unknown-unknown. See the Contract SDK documentation for details.
# Build a contract
cargo build --target wasm32-unknown-unknown --release \
--manifest-path examples/counter/Cargo.tomlCLI Usage
# Deploy a loom (costs 50 NORN, burned)
norn wallet deploy-loom --name my-contract
# Upload bytecode to a deployed loom
norn wallet upload-bytecode --loom-id <LOOM_ID> \
--bytecode path/to/contract.wasm
# Execute a loom contract
norn wallet execute-loom --loom-id <LOOM_ID> --input 01
# Query a loom contract (read-only)
norn wallet query-loom --loom-id <LOOM_ID>
# Join/leave a loom
norn wallet join-loom --loom-id <LOOM_ID>
norn wallet leave-loom --loom-id <LOOM_ID>
# Query loom metadata
norn wallet loom-info <LOOM_ID>
# List all deployed looms
norn wallet list-loomsRPC Methods
| Method | Parameters | Returns | Auth |
|---|---|---|---|
norn_deployLoom | hex (hex-encoded borsh LoomRegistration) | SubmitResult | Yes |
norn_uploadLoomBytecode | loom_id (hex), bytecode_hex | SubmitResult | Yes |
norn_executeLoom | loom_id (hex), input_hex, sender_hex | ExecutionResult | Yes |
norn_queryLoom | loom_id (hex), input_hex | QueryResult | No |
norn_joinLoom | loom_id (hex), participant_hex, pubkey_hex | SubmitResult | Yes |
norn_leaveLoom | loom_id (hex), participant_hex | SubmitResult | Yes |
norn_getLoomInfo | loom_id (hex) | Option<LoomInfo> | No |
norn_listLooms | limit, offset | Vec<LoomInfo> | No |