Docs/Core concepts

Private rooms

TESTNET

Open a new private loan in private_room_v2 and a new sealed sale in sale_room_v2. A v1 private_room settle writes every losing rate on chain. Do not open one. The finish that publishes every sale bid is the classic sale_room. v2 finish and settle carry a proof and leave losing values sealed. The walkthrough is Hand this to your agent. The relayer bodies are on Private flows & credentials.

Essey's private rooms keep both sides of every flow shielded: the price is sealed, and the money moves through a shielded pool instead of a wallet anyone can follow. There are two: the private loan room and the gated sale room. Both run in Sui Dollar (USDsui), USDC and SUI, and both are proven end to end on Sui testnet.

Agent, API, relayer, chainStatic diagram · Open full size ↗
Agent, API, relayer, chainThe agent calls the self-serve API for a sponsored lending transaction and the relayer for a shielded bid or offer. v2 rooms settle with a Groth16 proof, so only the winner and the winning value reach Sui. Seal releases keys to the host after close.OFF CHAIN · YOUR AGENT AND ESSEYON SUI · MOVE PACKAGEScredentialsponsoredtransactionsYour agentSDK 0.1.12 · MCP 0.1.16Self-serve APIbuilds the tx · you signSeal key serversthreshold 2 · after closeCredential issuerdregg · one commitmentSui gRPCthe SDK reads and sendsRelayerproof tx · fee floor 0.01Access switchCLOSED → INVITE→ PUBLICone admin switch ·pause · gate epochprivate_room_v2proof settlewinning rate onlysale_room_v2proof finishwinning price onlyShieldedPoolUSDC, tUSDsui, SUIone pool eachGroth16 + dreggbound to n0
Scroll sideways to see the whole diagram.
Agent to the self-serve API for a sponsored lending transaction, and to the relayer for a shielded bid or offer. v2 rooms settle with a proof.Source: docs/concepts/private-rooms.md
Text version
OFF CHAIN   Your agent (SDK · MCP · API) -> Fresh wallet (or the relayer) -> Sui full node
            Relayer (submits the proof) -> Sui full node (gRPC / GraphQL)
            Issuance API (signs a dregg credential) · Seal key servers (threshold decryption)
ON SUI      Sui full node -- transactions --> Access switch (CLOSED -> INVITE -> PUBLIC)
            Access switch -> Private loan room -> ShieldedPool<C>
            Access switch -> Gated sale room   -> ShieldedPool<C>
            ShieldedPool<C>: one per coin (Sui Dollar (USDsui), USDC, SUI), Groth16 proof + dregg check, bound to n0

The building blocks#

From Sui and Mysten#

  • Move objects. Every room, pool and loan is a Move object with its own rules, checked by Sui validators on every transaction.
  • Seal. Mysten's threshold encryption. A bid or an offer is encrypted to a policy written in Move; the key servers release the key only when that policy says yes, for example after bidding closes and only to the borrower.
  • Groth16 and Poseidon on Sui. Sui verifies BN254 Groth16 proofs and Poseidon hashes natively, so a zero-knowledge proof is checked on chain in the same transaction that moves the money.

From Essey#

  • ShieldedPool<C>. One shielded pool per coin: ShieldedPool<USDSUI>, ShieldedPool<USDC> and ShieldedPool<SUI>. A member deposits once and later spends from a private note. Each spend publishes a nullifier n0, so a note is spent exactly once, and the spend names the relayer address, so a relayer can never redirect funds.
  • The dregg credential. A zero-knowledge membership credential. The Essey issuer signs Poseidon(commitment, expiry, epoch) with a Baby Jubjub key; the member proves inside the Groth16 proof that it holds a signed credential, without revealing which one. The credential is bound to the spend's n0, which gives three properties:
    • One bid per member per room. The room records the member's room tag; a second bid from the same member is refused.
    • Unlinkable across rooms. The tag is derived per room, so in PUBLIC two rooms cannot tell they saw the same member. In CLOSED and INVITE the gate pass identifies the invited member to the gate by design.
    • Revocable by epoch. Bumping the gate epoch retires every credential of the old epoch at once. The issuer signs one commitment per account per epoch and never learns the member's secret.
  • The relayer. Submits the proof and pays the gas, so the member's address never appears on chain. It is coin-aware: fees are set in each coin's own decimals.
  • The access switch. One admin switch stages launch: CLOSED (operators only) → INVITE (invited members, with per-member loan caps) → PUBLIC (any member with a credential).

The private loan room#

Loan room: private on both sidesStatic diagram · Open full size ↗
Loan room: private on both sidesOpen a v2 room, take a sealed offer through the relayer, and settle with a proof so only the winning rate is written on chain. Repay with a public coin. There is no repay_v2 relayer kind. A v1 settle publishes every losing rate.Borrower opensSUI collateral intothe room; terms publicSTEP 1Lender offersfrom the pool: rate sealedwith Seal, relayed,dregg-checkedSTEP 2Settle with a proofOnly the winning rateis written on chainSTEP 3Repay in publicA public coinno repay_v2 kindSTEP 4Or liquidateor claim a default;collateral covers thelender, surplus goes backSTEP 5Losing rates stay sealedA v1 settle publishesevery losing rate.Open a v2 room.
Scroll sideways to see the whole diagram.
A v2 loan settles with a proof, so only the winning rate is written on chain. Repay with a public coin. A v1 settle publishes every losing rate.Source: docs/concepts/private-rooms.md
Text version
1 BORROWER OPENS    SUI collateral into the room; terms public
2 LENDER OFFERS     from the pool: rate sealed with Seal, relayed, dregg-checked
3 BORROWER SETTLES  the loan lands in a private note
4 REPAY             shielded from a note, or public
5 OR LIQUIDATE      or claim a default; collateral covers the lender, surplus goes back
  1. Open. The borrower opens a PrivateLoanRoom with SUI collateral. The terms are public.
  2. Offer. A lender offers a rate, sealed with Seal, funded from its note in the shielded pool and submitted by the relayer. The pool proof and the dregg credential are both bound to the spend's n0.
  3. Settle. After the close, Seal releases the offers to the borrower only. The borrower settles the one it picks, and the principal lands in the borrower's private note. A relayed settle is bound to an action hash over the room, a nonce and every argument, so it cannot be replayed or re-bound.
  4. Repay. A v2 loan repays a public coin (repay_coin). The relayer has no repay_v2 kind. A v1 room can repay from a note (kind=repay). The caller of repay, liquidate or claim-default supplies lenderEnc. An empty ciphertext leaves the lender's note unscannable; the lender rebuilds it with ShieldedWallet.recoverRoomNote (MCP essey_shielded_recover). The winning lender's repay note reuses the room's public lender_pubkey and lender_blinding, so that repayment is linkable to the winning offer. Losing v2 offers stay sealed.
  5. Liquidation and default. An undercollateralized loan is liquidated; at maturity the lender claims the default, and any surplus collateral goes back to the borrower.

The gated sale room#

Sale room: a private bidStatic diagram · Open full size ↗
Sale room: a private bidDeposit, prove a dregg credential, seal the price, and let the relayer submit pool_bid. Finish carries a Groth16 proof. Only the winner and the winning price reach the chain. Losing bids stay sealed.DepositMember puts coinsinto ShieldedPool<C>STEP 1Prove membershipdregg credential, boundto the spend's n0STEP 2Seal the bidPrice encrypted withSeal in the browserSTEP 3Relayer submitspool_bid, not from themember's addressSTEP 4Prove the winnerGroth16 over the bidsonly winner and pricereach the chainSTEP 5Claim or refundWinner claims the item;others get theirdeposit backSTEP 6
Scroll sideways to see the whole diagram.
The price is sealed, the relayer submits the bid, and finish proves the winner. Losing bids stay sealed.Source: docs/concepts/private-rooms.md · docs/concepts/sealed-rooms.md
Text version
1 DEPOSIT           member puts coins into ShieldedPool<C>
2 PROVE MEMBERSHIP  dregg credential, bound to the spend's n0
3 SEAL THE BID      price encrypted with Seal in the browser
4 RELAYER SUBMITS   pool_bid, not from the member's address
5 CLOSE AND OPEN    Seal releases keys after close; the contract picks the highest
6 CLAIM OR REFUND   winner claims the item; others get their deposit back
  1. Deposit into the pool for the room's coin.
  2. Prove membership with a dregg credential bound to the spend's n0.
  3. Seal the price in the browser.
  4. Bid through the relayer with pool_bid. The bid locks the room's ceiling, so the amount on chain says nothing about the price.
  5. Finish. After the close, Seal releases the sale-room bid keys to the seller (room::seal_approve checks the key id, the clock, and that the sender is the seller). The seller calls room::finish. Every bid's price is readable from then on. The contract stores the winning price. Loan-room offer keys stay with the borrower.
  6. Claim or refund. The winner claims the item; every other bidder gets its deposit back into the pool and can withdraw. If the seller never finishes, anyone can expire the room after its finish window. That returns every deposit, shielded ones when anyone collects, and does not open the prices.

Access stages#

Access: three stages, one switchStatic diagram · Open full size ↗
Access: three stages, one switchRooms open in three stages: CLOSED for operators only, INVITE for invited members with loan caps, PUBLIC for members with a credential. One admin switch, a multisig AdminCap, sets the stage, and a gate epoch bump revokes every invite.CLOSEDOperators only:team agentsSTAGE 1INVITEInvited members,with loan capsSTAGE 2PUBLICOpen to memberswith a credentialSTAGE 3One admin switchmultisig AdminCap · a gate epoch bump revokes every invite
Scroll sideways to see the whole diagram.
One admin switch moves every room from CLOSED to INVITE to PUBLIC; a gate epoch bump revokes every invite at once.Source: docs/concepts/private-rooms.md
Text version
CLOSED -> INVITE -> PUBLIC
CLOSED   operators only: team agents
INVITE   invited members, with loan caps
PUBLIC   open to members with a credential
One admin switch (`AdminCap`) sets the stage; a gate epoch bump revokes every invite
StageWho may act
CLOSEDOperators the admin names, for round trips with small amounts
INVITEInvited members, each with a loan cap and a lifetime cap
PUBLICAny member holding a dregg credential

A pause stops new risk only: repay, liquidation and default claims keep working.

Three coins#

Three coins in every private flowStatic diagram · Open full size ↗
Three coins in every private flowtUSDsui is the testnet mock, minted by the hosted faucet. USDC comes from the hosted reservoir or Circle. SUI comes from the Sui testnet faucet. Each coin has its own shielded pool and the same proof.tUSDsuiTestnet mock coinhosted faucetUSDCLoans and bidsSUICollateralShieldedPool<C>one per coinsame proof,same dregg checkRelayercoin-aware: feesin each coin'sown decimals
Scroll sideways to see the whole diagram.
tUSDsui is the testnet mock from the hosted faucet. USDC comes from the hosted reservoir or Circle. SUI comes from the Sui testnet faucet. Each coin has its own pool.Source: docs/concepts/private-rooms.md
Text version
Sui Dollar (USDsui)  headline loan and bid coin  -> ShieldedPool 0x304df63ce2bc69ecae878b366813a5d21a3d5be3f85704a688621bffb0bba11c
USDC                 loans and bids              -> ShieldedPool 0xe9fa57e6030e630302f63b45c2e7f19629b06fb99c72ee600c0f1351f1a1075c
SUI                  collateral and bids         -> ShieldedPool 0x96db81b0f3cc2c804bb26fb835eaa7e41f73070e2153ed3e70ea1645d1707436
One ShieldedPool<C> per coin. Testnet has all three.
CoinRole
Sui Dollar (USDsui)The headline coin for loans and bids. On testnet it is the test coin tUSDsui (mock_usdsui::MOCK_USDSUI), minted by the hosted faucet.
USDCLoans and bids
SUICollateral

On Sui testnet#

  • Sale room package 0x48db0307be9b6aadbf9f29c28561e1b450348ab2786ea4853a8d7249c22979a1. It has room::attest_seller. Shielded pools: SUI 0x96db81b0f3cc2c804bb26fb835eaa7e41f73070e2153ed3e70ea1645d1707436, USDC 0xe9fa57e6030e630302f63b45c2e7f19629b06fb99c72ee600c0f1351f1a1075c, USDsui 0x304df63ce2bc69ecae878b366813a5d21a3d5be3f85704a688621bffb0bba11c. Access is PUBLIC.
  • Access switch: CLOSED → INVITE → PUBLIC, 37 of 37 passes and refusals as expected.
  • Loan room: a pool-funded lender offer, settle into a private note, then a public repay and a shielded repay, each in Sui Dollar (test) and USDC. Seal releases the rate to the borrower after close and refuses the lender. Each coin pair has its own market object, and a room settles against the market for its own pair: Market<SUI, USDC> (0x618b3e2946ff34462bf8af9ff2cafe444d7bb19b367e882ca67c9af59f1aad33), Market<SUI, USDSUI> (0x441827e6df0b201c85c2df88a4c43d3729d55a93d6b9618e167ea5d3110fbca6) and Market<USDSUI, SUI> (0x71a134124c544d1e79bd619c3cfc27f0a1a3b2f9e7ea4a077a7c4638da9023f9, read through pyth_oracle::read_inverse on the SUI/USD price). GET /v1/private/config lists all three under loanMarkets, each openable.
  • Liquidation, default claim with surplus returned, relayed settle and relayed cancel.
  • Proved settlement: sale room 0xeeacf6d88596fedfdcd66cc6510c3c84e08d249bdb1d2b956f3c931a33feb714 and private loan room 0x5e2dbc14e6687bb550e2f69fcdd328c21b252fdcf9c9dddce0f8aa33f37e9050. Each settles with a Groth16 proof over up to 16 sealed bids or offers, so only the winner and the winning price or rate reach the chain. See Sealed rooms.

Those runs are on chain. A hosted-relayer private loan settled and repaid in digest Bwu2Bsw61FcDgs2xiY4xvm4DWsDcxT1W5FGaM6mHEevd / Er5GRmgaYiyxAQn8ozpHnmKES66Jt26PV8AzqPc1xXV5 (room 0xba214e557a70e933fffb6b5fa04252e3e2124c416c2005b9d5b1e961048c56bd). Fresh private sales on USDC, SUI and USDsui finished in FVz8D82frWQNz8mYzYx3JWoE4Vx1A3zUjyL8QnoE9VMb, GZSKAM9sfvZaZrMZjpdJJmu44PhX3nfSCiZoN9gQsers and BKSPRMQ6MVq1QdtXKJW2rhxdyEfp5zgnHi9M91VocgZs. Public lending on the cutover pool borrowed and repaid in 29e1vjf8FisQ5BTQGMMZx5MZWmygLuMnbkuHpjuLmJ57 / 2CnR89iw8mrT92Jisn2AzxARuoFYY1aeb7u6xQxRz4ow. The same ids are in Network and GET /v1/private/config.