ryvo-cmt-v5 message.
The examples below mirror the current protocol tests. They use raw Anchor calls so you can see the exact accounts and signatures involved.
What you will build
By the end of this guide, you will have:- Two registered participants.
- One funded payer.
- One open payment channel.
- One signed unilateral commitment.
- One successful direct settlement.
Prerequisites
- Anchor workspace wired to the Ryvo program at
3UyUFeNsUYPpM6hMRf7H8wg3MKEXQ82rqnsXhZrUwgSDondevnet - Two keypairs with a small amount of SOL on devnet
- One allowlisted settlement token. Gateway-channel v1 uses official devnet USDC, mint
4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU; resolve itstoken_idfromTokenRegistryorRYVO_PROTOCOL_DEVNET_USDC_TOKEN_ID.
1. Create the program client
2. Derive the PDAs
You will use deterministic PDA helpers throughout the protocol flow, so define these helpers once:The channel PDA seed order is
payer_id (u32 LE) || payee_id (u32 LE) || token_id (u16 LE) under the channel-v2 prefix. If you derive in a different order, settle_* instructions will reject the account.3. Register both wallets
Each wallet registers once and keeps the sameparticipant_id for the life of the deployment.
4. Deposit the settlement token
Ryvo only settles allowlisted tokens. Once the payer has a normal SPL token account, deposit from that account into the protocol vault:available_balance.
5. Create the channel
One one-way payment channel exists for eachpayer_id + payee_id + token_id relationship. Channels are permanent.
payeeOwner signer is only required when the payee’s inbound-channel policy demands consent. Under Permissionless, channel creation does not require the payee to sign.
6. Optionally lock funds
Locked funds are optional. Use them when the payee wants guaranteed payment capacity on the channel.7. Build the ryvo-cmt-v5 message
ryvo-cmt-v5 is cumulative. It does not say “pay 25 again.” It says “this channel is now authorized up to cumulative amount X.”
The helper below matches the real test suite:
8. Add the Ed25519 verification instruction
Ryvo expects the signed message to be verified by Solana’s Ed25519 program inside the same transaction:authorized_signer. This key signs new cumulative payment amounts for that channel. By default it is the payer wallet that created the channel; if the channel uses a different signing key, that key must sign here instead.
9. Submit settle_individual
The payee submits the settlement transaction:
message_domain, validates the canonical payer / payee / token / channel, then moves the delta between the old and new cumulative amounts.
10. Read the result
After settlement:channel.settled_cumulativehas advanced.- The payer balance has decreased by the delta.
- The payee balance has increased by the same amount.
- Any locked funds used by the settlement have been consumed first.
Where to go next
Bundle settlement
Settle many payers’ commitments for one payee in a single transaction.
Cooperative clearing
Compress many payments across many participants into one round.
Message formats
The exact byte layout of
ryvo-cmt-v5 and cooperative round messages.