Channels
A channel is a prepaid budget that your agent locks on-chain for one seller, together with a fresh session key that signs every request and payment on it. It has a service end, after which the seller stops serving it, and a grace period for final settlement. Opening one costs one Solana transaction; after that, thousands of requests can run against it with no on-chain step per request.
Why channels
Paying on-chain for every request would cost a transaction fee and a confirmation wait each time. A channel moves that cost to the edges: one transaction to open, one or a few redemptions batched by the seller, one to finalize. In between, the agent and seller exchange signed holds, receipts and vouchers off-chain.
What a channel records
| Field | Meaning |
|---|---|
vault |
Where the budget came from and where leftovers return. |
mandate |
The Mandate it was opened under, if any. |
seller_settler, seller_payout_token |
The seller's settlement key and the only account that can be paid. |
session_key |
The Ed25519 key that signs holds and vouchers for this channel. |
channel_epoch |
A per-vault counter: each new channel uses the vault's last epoch plus one. |
budget |
The most this channel can ever pay out. |
redeemed |
How much has been paid to the seller so far. |
service_end_unix (T) |
When service stops. Must be in the future when opening. |
grace_secs (G) |
Settlement time after closing begins: between 1 second and 30 days. |
close_deadline_unix (D) |
0 until someone starts closing; then min(T, now) + G. |
status |
Open or Closing. A finalized channel is deleted. |
Lifecycle
- Open.
open_channelmovesbudgetfrom your vault's free balance. Under a Mandate the program first checks that the Mandate chain is live, the seller pair is allowed, the times fit and the period budget has room. - Use. Your agent sends holds signed by the session key. The seller's gateway admits a request only if its cap fits in
budget − redeemed − unvouchered exposure. - Settle as you go. The agent signs vouchers; the seller redeems them on-chain whenever it likes. Each redemption increases
redeemed. - Begin closing. The owner, the Mandate's agent or the seller calls
begin_close, which setsD = min(T, now) + G. Once closing has begun, the reference gateway refuses new holds on the channel. If the Mandate was revoked or expired, anyone can callclose_on_revokedinstead. - Last redemptions. Until
D, the seller can still redeem the vouchers it holds. - Finalize. From
Don, anyone can callfinalize. It returnsbudget − redeemedto your vault's free balance, releases the Mandate reservation, deletes the channel and refunds its rent to whoever opened it.
One channel per seller, and topping up
The SDK keeps one open channel per seller and shares it among all your agent lanes. Calling wallet.open again for a seller with an open channel fails; use wallet.topUp(route, terms). The SDK's topUp opens a successor channel with the next epoch. Earlier holds and vouchers stay on the old channel until you close and finalize it. (The program also has a top_up instruction that adds free balance to an open channel; the SDK's topUp does not use it.)
Session keys
Each channel gets its own session key. By default the SDK generates it in memory; the Solana backend derives it from your authority key, the domain, the vault and the epoch, so it can be recovered after a restart. The session key can only sign holds and vouchers for its channel. It cannot withdraw from your vault or open new channels.
Epochs and replay safety
Vouchers name the channel address and its epoch. Because open_channel requires exactly last_channel_epoch + 1, a closed channel's address can never be recreated, so an old voucher can never be replayed against new money. If two opens race, the loser fails with EpochNotIncreasing (6024) and changes nothing; the SDK retries once with the next epoch.