Reference

Program accounts

Every account the Civitas program owns or derives, with its seeds, size and fields in Borsh order.

Program ID Bhxc3t3tDe5BWYhDEqWtPiaQKUrFxareR6Fd8LfXy5ht. Seeds in quotes are ASCII bytes; keys used as seeds are their 32 bytes. Sizes include the 8-byte Anchor discriminator. Strings carry a 4-byte length. Amounts are base units of the six-decimal settlement mint, so 1 USDC is 1,000,000. Times are Unix seconds, UTC.

AccountSeedsBytesDiscriminator
Agent"agent", agent_key6682fa670939bc55607
Vault"vault", Agent PDA165SPL token account
Config"config"1169b0caae01efacc82
Service"service", Agent PDA229903e4c81a72497fa

Agent

One per agent key. charter creates it and nothing closes it: revoke leaves it as a tombstone, so a revoked key can never be chartered again.

Seeds "agent", agent_key. 668 bytes.

Agent
agent_keypubkey
The agent’s ed25519 public key. It signs payment authorizations and never signs a Civitas transaction.
principalpubkey
The wallet that chartered the agent. It signs every lifecycle instruction.
card_hash[u8; 32]
SHA-256 of the agent card’s JSON.
card_uristring
Where the card is served. Up to 200 UTF-8 bytes.
statusAgentStatus
Active, frozen or revoked. See AgentStatus.
policy_versionu32
1 at charter, plus 1 on every set_policy. Every Settled event carries the version it ran under.
policyPolicy
The limits settle enforces. See Policy.
created_ati64
Unix seconds at charter. Spending periods are counted from it.
period_starti64
Start of the period spent_in_period belongs to.
spent_in_periodu64
Amount plus fee of every settlement in the current period, in base units.
highest_nonceu64
The highest nonce settled so far. 0 before the first settlement.
nonce_bitmap[u64; 4]
Four u64 words marking used nonces at and below highest_nonce: bit d % 64 of word d / 64 marks nonce highest_nonce − d.
bumpu8
The Agent PDA’s bump.
vault_bumpu8
The vault PDA’s bump.

Vault

A classic SPL token account holding the agent’s USDC. Its token authority is the Agent PDA, so only the program moves money out of it: to a payee and the fee recipient in settle, to the principal in withdraw and revoke. revoke closes it.

Seeds "vault", Agent PDA. 165 bytes.

Config

The program’s one configuration account. Every settlement reads its fee terms and its mint.

Seeds "config". 116 bytes.

Config
adminpubkey
The key that may call update_config.
fee_bpsu16
Protocol fee in basis points of each settlement’s amount. 25 at initialization; at most 10,000.
fee_flooru64
Smallest fee in base units. 500 (0.0005 USDC) at initialization.
fee_recipientpubkey
Wallet whose USDC associated token account receives every fee: the launch wallet at initialization.
usdc_mintpubkey
The settlement mint, six decimals. Vaults, the fee account and every destination hold this mint.
bumpu8
The Config PDA’s bump.
fee_ata_bumpu8
Bump of the fee recipient’s associated token account, kept so settle derives it without a search.

Service

An agent’s listing in the catalog. The first list_service creates it; later listings update it in place.

Seeds "service", Agent PDA. 229 bytes.

Service
endpointstring
The URL the service answers on. 1 to 200 UTF-8 bytes.
price_per_callu64
Price of one call in base units. Greater than zero.
listedbool
Whether the service is in the catalog. unlist_service and revoke clear it.
updated_ati64
Unix seconds of the last listing change.

Types

Policy

What an agent may spend. Both caps bound the vault’s whole outflow per settlement, amount and fee together. At most 289 bytes.

Policy
max_per_callu64
Most the vault may lose on one settlement, amount and fee together, in base units.
max_per_periodu64
Most the vault may lose in one period, amount and fee together, in base units.
period_secondsu32
Period length in seconds. At least 1. Periods start at created_at and advance in whole multiples.
counterpartiesCounterparties
Who the agent may pay. See Counterparties.
expires_ati64
Unix seconds from which settle refuses with PolicyExpired. 0 for no expiry.

Counterparties

Borsh enum.

Counterparties
Open0
Tag 0. Any payee.
Allowlist1: (Vec<pubkey>)
Tag 1, a u32 length and up to eight payee keys. Only those keys. An empty list allows no payee.

AgentStatus

Borsh enum, one byte.

AgentStatus
Active0
Tag 0. Settles under its policy.
Frozen1
Tag 1. settle refuses with AgentFrozen. The principal can still deposit, withdraw, set the policy, list, unfreeze and revoke.
Revoked2
Tag 2. Every instruction on the agent refuses with AgentRevoked, and settling to its key does too.