Documentation

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

OperationWhoFeeEffect
DeployAnyone50 NORN (burned)Registers a new loom with metadata on the network
Upload BytecodeLoom operatorNoneUploads .wasm bytecode to the node and calls init()
ExecuteAny participantNoneRuns the contract with input data, mutates state
QueryAnyoneNoneRead-only contract execution, no state change
JoinAnyoneNoneJoin a loom as a participant
LeaveParticipantNoneLeave a loom

Loom ID is deterministic: BLAKE3(name ++ operator ++ timestamp).

Naming Rules

RuleConstraint
Length3--64 characters
Character setLowercase ASCII letters (a-z), digits (0-9), hyphens (-)
HyphensMust 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.toml

CLI 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-looms

RPC Methods

MethodParametersReturnsAuth
norn_deployLoomhex (hex-encoded borsh LoomRegistration)SubmitResultYes
norn_uploadLoomBytecodeloom_id (hex), bytecode_hexSubmitResultYes
norn_executeLoomloom_id (hex), input_hex, sender_hexExecutionResultYes
norn_queryLoomloom_id (hex), input_hexQueryResultNo
norn_joinLoomloom_id (hex), participant_hex, pubkey_hexSubmitResultYes
norn_leaveLoomloom_id (hex), participant_hexSubmitResultYes
norn_getLoomInfoloom_id (hex)Option<LoomInfo>No
norn_listLoomslimit, offsetVec<LoomInfo>No