Session VM
An optional registry and coordination VM for the Lux Session messenger — service-node stake, swarm assignment by consistent hashing, uptime challenges, and storage commitments — with an explicit rule for when three C-Chain contracts are the better answer
Abstract
SessionVM is an optional on-chain registry and coordination layer for the Lux Session messenger — a private messaging overlay with post-quantum security (ML-KEM-768 + ML-DSA-65 + XChaCha20-Poly1305).
SessionVM is not part of the primary network (P / X / C). Most deployments
that want the Session messenger can get the same result with three C-Chain
contracts — ServiceNodeRegistry, SwarmCoordinator, StorageCommitment —
because the on-chain piece is just state bookkeeping. The heavy lifting
(network, crypto, storage) always happens off-chain over libp2p.
Activate SessionVM on a dedicated track-chain only when you need faster coordination than C-Chain block time, or you want messaging traffic isolated from settlement traffic on C-Chain.
When not to run SessionVM
- Small-scale deployment — use the C-Chain contracts.
- C-Chain throughput already covers your expected registration and uptime-challenge traffic.
- You do not need stake-weighted accountability.
When to run SessionVM
- A messaging-first deployment.
- Messaging traffic would crowd out other C-Chain users.
- You want a block cadence tuned for messenger coordination.
SessionVM does not implement the messaging protocol itself; that lives in
github.com/luxfi/session as a pluggable library. SessionVM provides service-
node registration and stake, swarm assignment, uptime challenges, storage
commitments, and epoch rotation.
The precompile chain-slot nibble is C=E per
LP-1220 — wired in only
when the track-chain that activates SessionVM also hosts an EVM companion
chain.
Implementation
SessionVM is one project in one place:
github.com/luxfi/session/
├── vm/ # VM implementation (package vm)
├── plugin/ # Plugin binary (package main)
├── crypto/ # ML-KEM + ML-DSA + AEAD
├── messaging/ # Message routing
├── network/ # libp2p overlay
├── protocol/ # Session wire protocol
├── swarm/ # Swarm assignment
└── storage/ # Inbox storage
The plugin binary builds from session/plugin/main.go directly. It is not in
chains/ — the Session project is self-contained and is loaded only on
track-chains that activate it.
Service node lifecycle
type ServiceNode struct {
NodeID ids.NodeID
PublicKey []byte // ML-DSA identity key
EncryptionKey []byte // ML-KEM-768 transport key
Stake uint64 // minimum 100 LUX
SwarmID uint32 // assigned swarm
Status Status // Active | Decommissioning | Retired
RegisteredAt uint64 // block timestamp
LastPingAt uint64 // block timestamp
UptimeScore uint32 // 0–10000 bps, rolling window
}
Registration
- The node submits
RegisterServiceNodeTxwith stake. - The node bootstraps its Session protocol daemon.
- The chain assigns a
SwarmIDby deterministic sampling. - The node announces itself to its swarm peers.
Uptime challenges
Every epoch (roughly one hour) each service node must answer a challenge
proving that it holds the full swarm inbox state, that it is reachable from at
least min_peers other nodes, and that it has enough storage free.
A node that fails the challenge loses stake — 0.5% per miss, up to 50% before automatic decommission.
Swarm assignment
Swarms are groups of about ten service nodes. Each inbox, derived from a recipient's public key, maps to exactly one swarm by consistent hashing:
swarm_id = BLAKE3(recipient_pubkey) mod num_swarms
Messages for that recipient are stored on every node in the swarm — a replication factor of about ten. That buys redundancy (any node in the swarm can serve the inbox), liveness (the recipient can fetch from several nodes), and privacy (no single node holds all messages).
Storage commitments
Each service node periodically commits to the Merkle root of its swarm state.
Commitments go on-chain via StorageCommitmentTx. Mismatched commitments
within a swarm trigger an off-chain reconciliation protocol and potential
slashing of the deviant nodes.
Activation scope
SessionVM is not part of the primary-network VM set (P / X / C). It activates only on track-chains that explicitly opt in. Networks that do not run the Session messenger simply never load this VM.
Relationship to other chains
| Chain / registry | Relationship |
|---|---|
| P-Chain | Service nodes stake LUX; P-Chain tracks total bonded stake |
| I-Chain | Recipient DIDs live on I-Chain; SessionVM resolves DIDs for routing |
| K-Chain | Transport keys are ML-KEM; key lifecycle is managed by K-Chain |
Reference
| Resource | Location |
|---|---|
| Session VM and library | github.com/luxfi/session/ |
| VM implementation | github.com/luxfi/session/vm/ |
| Plugin binary | github.com/luxfi/session/plugin/ |
| Session messenger spec | github.com/luxfi/session/docs/ |
Copyright
Copyright and related rights waived via CC0.