channels
one payment channel per provider. many calls, few settlements.
definition
voucher = sign(walt_key, [channel, cumulative_amount, nonce]) require cumulative_amount > channel.watermark channel.watermark = cumulative_amount
what it is
paying for every call with its own transfer is slow and wasteful when calls are small. for a provider walt uses often, it opens a channel: usdc is deposited once, and each call is paid with a signed voucher instead of a transfer.
a voucher states the total paid so far in that channel, not the price of one call. each new voucher is larger than the last. the provider can claim on chain at any time by presenting the newest one, and the program moves the channel's watermark up to that total.
only walt's key can sign a voucher that raises the total. a facilitator can close a channel at the current watermark but cannot send the funds anywhere else. when a channel closes, whatever was deposited and never claimed leaves the channel and is burned as coin.
what moves the watermark
| instruction | signer | effect |
|---|---|---|
| open_channel | walt | deposit usdc, watermark starts at zero |
| claim_channel | provider or facilitator present newest voucher, watermark rises to its total | |
| close_channel | walt or facilitator | pay out up to the watermark, burn the rest as coin |
notes
the watermark is the only number about a channel that lives on chain. the vouchers themselves stay between walt and the provider until one is claimed.
a ticket paid through a channel still gets its own receipt. the receipt names the voucher's nonce in place of a settlement signature.
figure
the parts of a channel. the filled part can only grow.
columns
| column | type | meaning |
|---|---|---|
| provider | pubkey | who the channel pays |
| deposited | u64 | usdc placed in the channel |
| watermark | u64 | highest total claimed so far |
| nonce | u64 | nonce of the newest claimed voucher |
| calls | u64 | calls paid through the channel |
| status | u8 | 0 open, 1 closed |