Cooperative clearing rounds are the densest settlement path in Ryvo. Instead of each channel settling independently, a group of participants signs one shared round message. That round advances many channel targets at once and settles all included lanes in one transaction.Documentation Index
Fetch the complete documentation index at: https://docs.ryvo.network/llms.txt
Use this file to discover all available pages before exploring further.
Worked example
Suppose Alice owes Bob, Bob owes Carol, and Carol owes Alice, all in the same token. If every channel settles independently, each lane needs its own settlement transaction. If all three sign one clearing round, the protocol can:- Move each channel’s
settled_cumulativeforward. - Consume lane-specific locked balances first.
- Apply participant-bucket balance deltas after all lane updates are known.
A -> B = 50, B -> C = 10, C -> A = 10, Ryvo advances every included channel to its new cumulative target in one transaction.
The key invariant is not “skip channel advancement through netting.” The key invariant is “every included cumulative channel target moves forward exactly as signed.”
This matters because channels are cumulative. Partial advancement of a signed target would leave replay surface for later settlement. Clearing rounds avoid that by advancing each included lane to its full signed target.
What is signed
The clearing-round body signs:- the deployment
message_domain - one shared
token_id - the participant roster
- each participant block’s outgoing channel targets
participant_id. Each entry inside the block points to the payee by payee_ref, which is an index into the signed roster. Reusing the roster by index is what keeps cooperative rounds byte-efficient.
For the exact byte layout, see Message formats.
What the program verifies
Whensettle_clearing_round runs, the program checks:
- The round message is present and self-contained.
- The aggregate BLS signature verifies against the exact same round message.
- The signer roster matches registered participant BLS keys.
- Each participant account is the canonical PDA for the participant block it represents.
- Each channel lane account is canonical for the payer, payee, and token.
- Every target cumulative amount moves forward.
- Every participant with a negative final position has enough balance to cover it.
What changes on-chain
A clearing round updates two kinds of state:Channel state
Every included lane gets a newsettled_cumulative. If that lane has locked balance, the round consumes that first.
Participant balances
After all lane deltas are known, the program applies participant-bucket token balance deltas in the same transaction. AClearingRoundSettled event summarizes round totals, including gross and adjusted balance-flow fields.
Example round construction
When to use this path
Choose cooperative clearing when:- Several participants are already coordinating and willing to co-sign one shared round.
- You want to advance many channels in one transaction while preserving cumulative-lane correctness.
- The participants are willing to block briefly on round construction in exchange for denser settlement.
