FAQ
State channels FAQ
What is ERC-7824?
ERC-7824 is a proposed standard for cross-chain trade execution systems that use state channels. It defines structures and interfaces to enable efficient, secure, and scalable off-chain interactions while leveraging the blockchain for finality and dispute resolution.
What is a state channel?
A state channel can be thought of as an account with multiple balances (often just two). The owners of that account can update those balances according to predefined rules, which are enforceable on a blockchain. This enables peer-to-peer games, payments, and other few-user applications to safely trade blockchain assets with extremely low latency, low cost, and high throughput without requiring trust in a third party.
How do state channels work?
- Setup: Participants lock assets into a blockchain-based smart contract.
- Off-Chain Updates: Transactions or updates occur off-chain through cryptographically signed messages.
- Finalization: The final state is submitted on-chain for settlement, or disputes are resolved if necessary.
What are the benefits of state channels?
- High Performance: Transactions are processed off-chain, providing low latency and high throughput.
- Cost Efficiency: Minimal blockchain interactions significantly reduce gas fees.
- Privacy: Off-chain interactions keep intermediate states confidential.
- Flexibility: Supports a wide range of applications, including multi-chain trading.
What kind of applications use state channels?
State channels enable the redistribution of assets according to arbitrary logic, making them suitable for:
- Games: Peer-to-peer poker or other interactive games.
- Payments: Microtransactions and conditional payments.
- Swaps: Atomic swaps between assets.
- Decentralized Trading: Real-time, high-frequency trading applications.
How is Nitro Protocol implemented?
- On-Chain Components: Implemented in Solidity and included in the npm package
@statechannels/nitro-protocol
. - Off-Chain Components: A reference implementation provided through
go-nitro
, a lightweight client written in Go.
Where is Nitro Protocol being used?
The maintainers of Nitro Protocol are actively integrating it into the Filecoin Retrieval Market and the Filecoin Virtual Machine, enabling decentralized and efficient content distribution.
What is the structure of a state in state channels?
A state consists of:
- Fixed Part: Immutable properties like participants, nonce, app definition, and challenge duration.
- Variable Part: Changeable properties like outcomes, application data, and turn numbers.
In Nitro, participants sign a keccak256 hash of both these parts to commit to a particular state. The turnNum
determines the version of the state, while isFinal
can trigger an instant finalization when fully countersigned.
What is a challenge duration?
The challenge duration is a time window during which disputes can be raised on-chain. If no disputes are raised, the state channel finalizes according to its latest agreed state. In Nitro, it is set at channel creation and cannot be changed later. During this period, an unresponsive or dishonest participant can be forced to progress the channel state via on-chain transactions.
How do disputes get resolved in state channels?
Participants can:
- Submit signed updates to the blockchain as evidence.
- Resolve disputes based on turn numbers and application-specific rules stored in an on-chain
appDefinition
. - Finalize the channel after the challenge duration if no valid disputes arise.
Nitro Protocol introduces a challenge mechanism, enabling any participant to push the channel state on-chain, forcing the other side to respond. This ensures that unresponsive or malicious actors cannot stall the channel indefinitely.
What is the typical channel lifecycle in Nitro Protocol?
A direct channel often follows these stages:
- Proposed: A participant signs the initial (prefund) state with
turnNum=0
. - ReadyToFund: All participants countersign the prefund state, ensuring it is safe to deposit on-chain.
- Funded: Deposits appear on-chain, and participants exchange a postfund state (turnNum=1).
- Running: The channel can be updated off-chain by incrementing
turnNum
and exchanging signatures. - Finalized: A state with
isFinal=true
is fully signed. No more updates are possible; the channel can pay out according to the final outcome.
How do I finalize and withdraw funds from a direct channel in Nitro?
- Finalization (Happy Path): If a fully signed state with
isFinal=true
exists off-chain, any participant can callconclude
on the Nitro Adjudicator to finalize instantly. - Finalization (Dispute Path): If participants are unresponsive or disagree, one party can
challenge
with the latest supported state. After the challenge window, the channel is finalized if unchallenged or out-of-date states are resolved. - Withdrawing: Once finalized, participants use the
transfer
orconcludeAndTransferAllAssets
method to claim their allocations on-chain.