Docs · Concepts

The account and its notes

What a Mesa account is made of, the four kinds of note, who owns them on chain, and how an account finds and reads its own.

A Mesa account is a set of keys and the notes those keys open. It has no account on Solana and no address. Everything it holds sits in the Privacy Rings pool as notes, and the account is whoever can read and spend them.

Notes

A note is one unspent output (a UTXO) in the Privacy Rings pool. The pool stores it as a commitment and a ciphertext. Its asset and amount are encrypted, and a note is spent by publishing a nullifier that reveals nothing about which note it was.

Every Mesa note also carries a piece of committed data that says what it is. There are four kinds.

NoteHoldsIts data
BalanceAn amount of one asset, free to placeWho may spend it
ShareA claim on a pool or a vaultThe pool or vault and the number of shares
ActionThe funds an order, a supply or another batch action has lockedThe action's terms, which open when its batch closes
PositionThe collateral of a borrow or a perpDebt or size, entry terms and the deadline it is renewed to

Your balance of an asset is the sum of your balance notes of that asset. A spend consumes notes and creates new ones: placing an order of 4 SOL from a 10 SOL balance note spends that note and creates an action note of 4 SOL and a balance note of 6 SOL.

One authority owns every note

On chain, every Mesa note has the same owner: the Mesa authority, a program address derived from the seed authority. In the default Ring the owner of each output is public, so this is the address the chain shows for everything inside Mesa. Your own address appears at deposit and at withdrawal and nowhere between.

One authority owns every note.

The authority signs a transaction in the pool only after the mesa program has verified a proof that fixes every Mesa-owned output of that transaction. What separates your notes from everyone else's is inside the commitment: each note is bound to keys only its holder has, and to a spend authorization only its owner can satisfy.

The keys behind an account

An account starts from one 32-byte master secret. In the app it is derived from a signature your wallet makes over a fixed message, so the same wallet always arrives at the same account. A script reads it from a key file. Two keys come from it.

  • The spend secret authorizes spending. Every note commits to a value derived from it and a fresh random nonce, and a circuit that spends on your behalf takes the secret as a private input.
  • The read seed derives the viewing key and nullifier key of every note you hold. With it, a note can be found, decrypted and checked for being spent.

The read seed together with the public half of the spend secret is your read-only key. It reads the whole account and spends nothing.

Holders

A note is encrypted to a holder: a pair of keys derived from the read seed. An account uses several, so that what opens in a batch cannot be linked to the account or to its other actions.

HolderDerived forOwns
Account holderThe account, onceBalance and share notes
Action holderEach action the account placesThat action's note
Receive holderEach action the account placesWhat that action settles into
Position holderEach position the account opensThat position

When an action opens, its receive holder becomes public as part of its terms. It is used for that one action and never again.

How an account reads itself

Mesa keeps no list of your notes. Your client rebuilds the account from the chain each time.

  1. Fetch Mesa's outputs

    Every Mesa transaction creates outputs tagged with the Mesa authority. The client pages through them from the API's GET /v1/notes, or directly from a Privacy Rings indexer with getShieldedTransactionsByTags.

  2. Try each with your keys

    The client tries to decrypt each output with the account holder's viewing key, and with the action, receive and position holders' keys for every counter up to the highest it has found plus a look-ahead window. An output that decrypts is yours.

  3. Drop what is spent

    For each note found, the client computes its nullifier with the holder's nullifier key and asks the indexer whether that nullifier exists. A note whose nullifier is absent is unspent.

What is left is the account: balances per asset, open orders, shares and positions. Decryption happens in your browser or your script. The API serves ciphertexts and never holds a key that opens them, except a position's own key when you enrol that position with the watcher.

Where the master secret lives

The app stores nothing. When you connect, your wallet signs the message Mesa account v1 followed by its own address, and the master secret is derived from that signature. Ed25519 signatures are deterministic, so signing again on another device recovers the same account. A script holds the master secret in a key file or derives it from a keypair's signature.

Anyone who holds the master secret, or can make that signature, holds the account.

Amounts and prices

Amounts are integers in the asset's smallest unit. Prices are quote atoms per base atom scaled by 10^12. Indexes and share prices are scaled by 10^18. The SDK and the app convert to and from decimals. The program reference gives each field's type.