Skip to main content
Version: 0.5.x

App Sessions

App sessions are off-chain channels built on top of the unified balance that enable multi-party applications with custom governance rules.

Goal: Understand how app sessions work for building multi-party applications.


What is an App Session?

An app session is a temporary shared account where multiple participants can:

  • Lock funds from their unified balance
  • Execute application-specific logic (games, escrow, predictions)
  • Redistribute funds based on outcomes
  • Close and release funds back to unified balances

Think of it as a programmable escrow with custom voting rules.


App Session vs Payment Channel

FeaturePayment ChannelApp Session
ParticipantsAlways 22 or more
GovernanceBoth must signQuorum-based
Fund sourceOn-chain depositUnified balance
Mid-session changesVia resize (on-chain)Via intent (off-chain)
Use caseTransfersApplications

App Session Definition

Every app session starts with a definition that specifies the rules:

FieldDescription
protocolVersion (NitroRPC/0.4 recommended)
participantsWallet addresses (order matters for signatures)
weightsVoting power per participant
quorumMinimum weight required for state updates
challengeDispute window in seconds
nonceUnique identifier (typically timestamp)

The app_session_id is computed deterministically from the definition using keccak256(JSON.stringify(definition)).


Governance with Quorum

The quorum system enables flexible governance patterns.

How It Works

  1. Each participant has a weight (voting power)
  2. State updates require signatures with total weight ≥ quorum
  3. Not everyone needs to sign—just enough to meet quorum

Common Patterns

PatternSetupUse Case
Unanimousweights: [50, 50], quorum: 100Both must agree
Trusted Judgeweights: [0, 0, 100], quorum: 100App determines outcome
2-of-3 Escrowweights: [40, 40, 50], quorum: 80Any two can proceed
Weighted Votingweights: [20, 25, 30, 25], quorum: 51Majority by weight

Session Lifecycle

1. Creation

  • Funds locked from participants' unified balances
  • All participants with non-zero allocations must sign
  • Status becomes open, version starts at 1

2. State Updates

  • Redistribute funds with submit_app_state
  • Version must increment by exactly 1
  • Quorum of signatures required

3. Closure

  • Final allocations distributed to unified balances
  • Session becomes closed (cannot reopen)
  • Quorum of signatures required

Intent System (NitroRPC/0.4)

The intent system enables dynamic fund management during active sessions:

IntentPurposeRule
OPERATERedistribute existing fundsSum unchanged
DEPOSITAdd funds from unified balanceSum increases
WITHDRAWRemove funds to unified balanceSum decreases

:::info Allocations Are Final State Allocations always represent the final state, not the delta. The Clearnode computes deltas internally. :::


Fund Flow


Protocol Versions

VersionStatusKey Features
NitroRPC/0.2LegacyBasic state updates only
NitroRPC/0.4CurrentIntent system (OPERATE, DEPOSIT, WITHDRAW)

Always use NitroRPC/0.4 for new applications. Protocol version is set at creation and cannot be changed.


Best Practices

  1. Set appropriate challenge periods: 1 hour minimum, 24 hours recommended
  2. Include commission participants: Apps often have a judge that takes a small fee
  3. Plan for disputes: Design allocations that can be verified by third parties
  4. Version carefully: Each state update must be exactly current + 1

Deep Dive

For complete method specifications and implementation details: