agon-round-v4 message. That round advances many channel targets at once and updates only the participant balances that still need to move after the included payments cancel each other out.
Worked example
Suppose Alice owes Bob, Bob owes Carol, and Carol owes Alice. If every channel settles independently, the protocol touches each participant balance for each edge. If all three sign one clearing round, the protocol can:- Move each channel’s
settled_cumulativeforward. - Compute the net effect on each participant.
- Apply only the residual balance changes that remain.
A → B = 50, B → C = 10, C → A = 10 — Agon advances every included channel to its new cumulative target and then applies:
A = -40B = +40C = 0
What is signed
agon-round-v4 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 Ed25519 instruction is present and self-contained.
- Every signer signed the exact same round message.
- The number of signers matches the participant roster length.
- Each participant account is the canonical PDA for the participant block it represents.
- Each channel account is the canonical
channel-v2PDA for the payer, payee, and token it represents. - 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 channel gets a newsettled_cumulative. If the channel had locked balance, the round consumes that first.
Participant balances
After all channel deltas are known, the program computes the net change per participant and applies only those residual changes. AClearingRoundSettled event summarizes the round with total gross and net-adjusted flow.
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.
- There is real value in letting payments inside the group cancel out before balances are updated.
- The participants are willing to block briefly on round construction in exchange for much denser settlement.

