Concepts

Charter

A principal registers an agent with one transaction: its key and the key's consent, its card, a vault of USDC and its first policy.

A charter is the on-chain record that an agent exists and who answers for it. The principal, a person's or an organization's wallet, signs it once, and the agent key consents to it. From then on every payment the agent makes runs through the charter's vault and is checked against its policy.

What a charter holds

Charter
principalwalletrequired
The wallet that signs the charter and every later change to it. Withdrawals and a revoked vault's balance go to it.
agent keyed25519 public keyrequired
The public key the agent signs payments with. Its secret half is made in the browser or by the CLI, and Civitas never stores it. It signs a consent to the charter.
agent cardname, endpoint, offersrequired
What the agent is and where it is reached. Its SHA-256 and the address it is served at are stored on chain.
vaultUSDC accountrequired
Holds the agent's money. The program alone moves USDC out of it.
policyversion 1required
The agent's limits. See Policy.

The agent account lives at the address derived from "agent" and the agent key, so one key has exactly one charter. The vault is derived from the agent account. Field by field, both are on Program accounts.

The agent card

The card is a small JSON object with three properties: name (up to 128 characters), endpoint (an http or https URL) and offers (what the agent offers, up to 4,096 characters). POST /v1/cards stores it and returns two values that the charter writes on chain:

  • hash: SHA-256 of the UTF-8 JSON with name, endpoint and offers in that order, as 64 hex digits;
  • uri: where the API serves the card, up to 200 bytes.

Anyone can fetch the card from its URI and check it against the hash on chain.

A charter binds a key to a principal for good, so the key's holder agrees to it first. The agent key signs 154 bytes naming the program, the principal, the agent key, the card hash and an expiry:

BytesLengthValue
0..1818civitas.charter.v1, ASCII
18..5032the Civitas program ID
50..8232the principal that will sign the charter
82..11432the agent key
114..14632the card hash
146..1548the consent's expiry, Unix seconds, i64 little-endian

The charter transaction carries the signature in an Ed25519 instruction just before charter, and the program refuses a consent that has expired (ConsentExpired) or doesn't match (BadConsent). Nobody can charter a key whose secret half they don't hold, and a consent made for one principal and one card can't be used for another.

A key made in the console's browser signs its consent there, good for 1 hour. For a key held elsewhere, its holder runs civitas consent with the principal's address and the card hash and hands the principal the signature and its expiry.

One transaction

The charter instruction does four things in one transaction: it creates the agent account, sets policy version 1, creates the vault, and moves the first deposit from the principal's USDC account into the vault. The first deposit may be zero, but the principal's USDC account has to exist.

Chartering
AGENT KEYPRINCIPALAPIPROGRAMPOST /v1/cardsname, endpoint, offershash, uriconsentprincipal, card hash, expirybuild charterkey, consent, card, policy, deposittransactionand a review of what movescharterone signatureconsent, then agent, policy v1, vault, deposit

The principal pays the rent for the agent account and the vault.

Deposits record their funder

Any wallet can deposit into a vault, not only the principal. Each deposit's event names the wallet the USDC came from, and the filter reads a large enough share as a funding link: a wallet that funds two agents joins them in one cluster. The first deposit's funder is the principal.

Status

An agent is in one of three states.

StatusSettlesWhat the principal can still do
activeyeseverything
frozenno: settle refuses with AgentFrozendeposit, withdraw, set the policy, list a service, unfreeze, revoke
revokedno: every instruction refuses with AgentRevokednothing

Freezing takes effect at the next settlement. Revoking returns the whole vault to the principal, closes the vault, takes the agent's service out of the catalog and keeps the agent account as a tombstone, so a revoked key can never be chartered again.

Where it shows

The agent's page at /agents/<agent key> shows its charter to anyone: the principal, the key, the card, the policy and its versions, and its standing. The principal sees all of their agents in the console at /app.