Are you an LLM? Read llms.txt for a summary of the docs, or llms-full.txt for the full context.
Skip to content

Channel State

The ChannelState PDA account layout.


Each channel is stored as a Program Derived Address (PDA) on Solana. The PDA holds all financial state for the channel.

PDA derivation

Seeds: [b"amp-channel", funder_pubkey, recipient_pubkey, nonce_le_bytes]

The vault token account is a separate PDA:

Seeds: [b"amp-vault", channel_state_pubkey]

Account layout

Total size: 329 bytes (+ 8 byte discriminator = 337 bytes)

FieldTypeSizeDescription
bumpu81PDA bump seed
funderPubkey32Channel funder (payer / agent)
recipientPubkey32Channel recipient (service provider)
mintPubkey32SPL token mint (e.g. USDC)
vaultPubkey32Token account holding channel funds
balanceu648Current available balance
total_depositedu648Lifetime deposits
total_consumedu648Lifetime settled amount
rate_limitu648Max tokens per settle interval
settle_intervali648Seconds between settlements
last_settle_tsi648Last settlement timestamp
nonceu648Channel nonce
statusu810 = Active, 1 = Closed
created_ati648Creation timestamp
delegateOption<Pubkey>33Optional delegate pubkey
delegate_limitu648Max delegate consumption
delegate_consumedu648Current delegate consumption
stratum_enabledbool1Opt into multi-channel netting
stratum_cyclei648Netting cycle interval
stratum_authorityOption<Pubkey>33Stratum engine pubkey
parent_channelOption<Pubkey>33Upstream channel (for chaining)
child_channelsu81Active downstream channels
max_chain_depthu81Max chain depth (default: 3)
chain_depthu81Current chain depth (0 = root)

Status values

ValueMeaning
0Active — channel is open and accepting requests
1Closed — channel is closed, accounts reclaimed

Querying channels

Find channels by funder:

const channels = await program.account.channelState.all([
  { memcmp: { offset: 9, bytes: funderPubkey.toBase58() } }
])

Find channels by recipient:

const channels = await program.account.channelState.all([
  { memcmp: { offset: 41, bytes: recipientPubkey.toBase58() } }
])

Next steps