Notes and the one authority
In Privacy Rings a balance is a note: a commitment on chain whose asset and amount only its owner can read. In the default Ring the addresses that send and receive are public. Mesa therefore owns every note itself. Your balance, your order, your shares and your position are each a note owned by one Mesa program address, and the data committed inside the note says whose it is and what it is.
On chain, every Mesa action is that one address spending notes and creating notes for itself. The pool’s nullifiers hide which notes were spent. Only Mesa’s circuits read the committed data, and they prove that the person moving a note is the one it was committed to.
Notes owned by the Mesa address, inside Privacy Rings
Your viewing key finds your notes by their tag and reads them in your browser.
Your spending key proves a note is yours when you move it.
A read-only key opens the same view for someone you choose, and can spend nothing.
Each Mesa proof is Groth16, 128 bytes, verified inside the transaction that carries it beside the pool’s own 192-byte proof. Every circuit also proves that inputs equal outputs per asset, so the notes Mesa owns always sum to deposits minus withdrawals.
The batch
Time is cut into batches of fixed length. Anything that would move a public number goes into the batch that is open: an order, a supply, a borrow, a perp open or close. A batch has four steps.
1Place
An action locks its funds in a note and seals its terms to the batch’s close.
2Open
Buy 12.5limit 182.60Sell 4.0limit 182.10Buy 30.0limit 182.45Sell 18.2limit 182.90Sell 7.1limit 182.30Buy 2.4limit 181.95When the timelock round is out, every action in the batch opens at once.
3Clear
Buy 12.5at 182.40Sell 4.0at 182.40Buy 30.0at 182.40Sell 18.2not filledSell 7.1at 182.40Buy 2.4not filledOne price per market, the one that matches the most volume.
4Settle
fill → ownerfill → ownerfill → ownerback → ownerfill → ownerback → ownerEach action pays out to its owner’s commitment. The owner can be offline.
Place
You spend balance notes and create one action note. It locks the funds and commits to the action’s terms. The same terms are encrypted to the public randomness round that falls at the batch’s close, so nobody can read them before then and anybody can after.
Open
When that round is published, anyone can decrypt the batch’s actions and post them. The program checks each one against its commitment, so a wrong opening is refused. An action nobody opened in its window goes back to its owner with a reclaim.
Clear
For each market the clearing price is the single price that matches the most volume among the opened orders and the liquidity vault’s curve. It is posted with the batch and checked on chain. Supplies, borrows and perp actions net into one change of each pool’s totals.
Settle
Anyone can settle an opened action. It pays out to a commitment only its owner can spend: a fill at the clearing price, shares at the batch’s index, a position at the oracle price. You do not have to be online for any of it.
The sealing uses timelock encryption to drand quicknet, the public randomness beacon the batch is sealed to. No committee holds a key and no enclave is trusted: the round’s signature is the key, and it does not exist until the round does. The program never checks that signature. It checks each opened action against the commitment made at placement, which is what binds the terms.
Every market has a liquidity vault that trades in every batch along a constant-product curve, at the clearing price. It takes the batch’s net imbalance, so an order whose limit reaches the clearing price fills whole, and a market has depth from its first batch. A vault trades once per batch at the price that clears it, so nobody trades against its last price between blocks.
Positions that prove they are alive
A borrow or a perp is a note holding collateral, debt or size, and entry terms. It carries a deadline one heartbeat ahead, and its contents are timelock-encrypted to that deadline.
A position that keeps renewing
Each proof says only that it is healthy at the oracle price. Nobody reads it.
A position that stops
Its collateral, debt or size become readable only after a missed deadline.
Before the deadline, the position is renewed: a proof shows it is healthy at the current Pyth price, and the note is replaced by the same position with a new deadline. Renewing needs no spending key. Your open browser does it, or your own script, or the watcher, which holds that one position’s read-only key and can move nothing.
A position that is not renewed by its deadline opens. If it is unhealthy, anyone can repay its debt and take its collateral with the liquidation bonus, and what is left returns to its owner. If it is healthy, its owner renews it and it is sealed again.
The heartbeat and the collateral factors of each market are set together, so that under the market’s price limits a position cannot go from healthy to insolvent inside one heartbeat. Every unopened position therefore carries a proof of health no older than one heartbeat: lenders are shown solvency as a proof.
What the chain shows for every action
| When | What anyone can read |
|---|---|
| Deposit into Mesa, withdraw from it | Your address, with the amount encrypted, and the notes the Mesa address creates or spends. |
| Place an order, a supply, a borrow or a perp | The Mesa address spending notes and creating one. Nothing about the action. |
| The batch opens | Every action in it: side, amount and limit for an order; the amount for a supply or a borrow; size and direction for a perp. No owner on any of them. |
| The batch clears | One clearing price per market, the matched volume, the vault’s net trade, the change in each pool’s totals. |
| Settlement | New notes owned by the Mesa address. Which one is yours is inside the commitment. |
| A position renews | A proof that some position is healthy at the oracle price. Not which one, and not by how much. |
| A position lapses | That position’s collateral and its debt or size, readable from its missed deadline until it is renewed or liquidated. |
No instruction takes your address after deposit. Who can see what, and how to show your own books.
Fees and what they do
- Traders, on each fill
- The market’s liquidity vault, less the protocol share
- Borrowers, as interest
- The pool’s suppliers, less the reserve share
- Perp traders, on open and close, and funding
- The perps vault, less the protocol share
Each transaction also pays the pool’s tree fee of 5,000 lamports and Solana’s fees. The relayer carries them, so placing an order needs no SOL in a public wallet.
The protocol’s whole fee share buys MESA on the market and burns it. Fees and MESA, in full.
Addresses
- Mesa program
- 54GypueTVXksmm6m9vkFDincnUPJ7VrpKWx2SkWKZwHB
- Solana Privacy Program
- ring1GaLCuJnkUMVkX2JeZLTTX17wKsV4fZmPVzXANW
- User registry
- regy3WAeRXMYuMYxr5iK3Bf9Arr3PcxGxyzAddbiqDQ
- State tree
- 777pvSGe5LaBd9nCczvE2FXEauiwtfGJ5XRpjKyniGor