How XENONITE works
XENONITE is a shielded USDG pool with a set of products on top: perps, dark RFQ, cross margin, options, credit and swaps, plus Edge Cards and secret-ballot votes. Balances are notes in a Merkle tree, and every private action is an UltraHonk proof generated in your browser from one of ten Noir circuits.
Notes and the pool
A note is H(amount, H(pk, salt)), with H the Poseidon2 sponge and pk = H(1, sk). Your spend key sk is derived from one wallet signature. The pool keeps a depth-20 tree (about a million notes) and the last 64 roots, so a proof made against a slightly old root still verifies.
Spending a note publishes its nullifier H(2, sk, note). The contract refuses a nullifier it has seen, which stops double spends without revealing which note was spent. Every spend takes up to two notes and returns change as a new note.
deposit(inner, amount) public amount, leaf = H(amount, inner) withdraw(proof, root, nf[2], recipient, amount, relayFee, change)
Opening a trade
The open circuit proves that your notes are in the tree, that margin plus the 0.08% fee fits in them, that leverage is between 1x and 10x, and that the change note is correct. It also commits to the private half of the position and encrypts it to the keeper's Grumpkin key, inside the proof.
The contract reads the Chainlink price, checks it against your limit (0.5% from the price you saw), and stores the position as H(inner, H(market, side, size), entry).
| Public | market, side, size, entry, fee, that a position was opened |
| You and the keeper | margin, stop, take profit, owner key |
| Only you | which notes paid, your balance, your change |
Closing
The close circuit opens the position commitment and pays margin + pnl − fee into a new note locked to the owner's key, with a salt derived from the position. That is why a position the keeper closes still lands in your wallet: your browser can rebuild the payout note on its own.
- Owner close: needs your spend key. Fills at the oracle price, or worse for you if the price moved while you proved.
- Stop or take profit: anyone holding the opening can prove the trigger at exactly the oracle price.
- Liquidation: when equity falls under 5% of size, the margin goes to the house.
The keeper
The keeper decrypts new positions, watches the oracle and proves stops, targets and liquidations. Because encryption is proven in the open circuit, every position is readable by the keeper: nobody can hide from liquidation. The keeper can read your margin and stops. It cannot redirect a payout.
House book
The house is the counterparty. It earns fees and liquidated margin and pays profits. Profit per position is capped at 100% of its size, and a position can only open if the house holds its full size in reserve on top of every other open position, so the house can always pay.
Dark RFQ
For a block, ask the desk for a quote instead of taking the oracle. The desk signs a price for your market, side and size, valid for 90 seconds and within 1% of the oracle. The same open proof then fills at that price, so the fill never touches a public book. A quote works once.
Cross margin
A cross account is one hidden collateral balance, H(9, H(collateral, pk, salt)), backing up to four public legs. Every change is one cross proof: open the account, add or close a leg, top up from a note or withdraw to a note. The contract computes the realized PnL and fees, the unrealized PnL of what stays open and the 10% margin requirement from public data; the proof shows the hidden balance still covers it. Below 5% the keeper proves cross_liq and the collateral goes to the house.
Options
European calls and puts on any market, written by the house, 1 to 30 days, strikes within 30% of spot. The premium is intrinsic value plus 0.4 × vol × √T × size, at least 0.1%. You pay it from notes with option_buy; the option is owned by a hidden tag and the opening is encrypted to the keeper. At expiry the keeper proves option_settle at the oracle price and the payout, size × |S − K| / K capped at the size, becomes a note only your key can spend.
Credit
Lock ETH and borrow up to 50% of its value in USDG from the house. The loan is public, but the USDG lands as a hidden note and the loan is tagged H(5, pk, salt). Repay with a credit proof from any notes and send the ETH to any address. Interest is 8% a year. Under 80% collateral cover anyone can liquidate, and the ETH goes to the house.
Swap
Robinhood stock tokens move in and out of the stack through Uniswap v3. Buying is a withdraw proof whose recipient is an intent, H(swap, token, minOut, to), so the relay cannot change where the token goes or the slippage you accepted. Selling turns a token from your wallet into a new hidden note.
Edge Cards and the Showdown
Every closed perp adds a leaf H(10, commit, H(pnl, sign)) to a second tree. The standing circuit proves the combined PnL of up to four of your closed trades and shows it under any address you choose, without saying which trades. Each trade publishes a per-season nullifier, so it backs one card a season. The Showdown ranks the best card per address each week.
Secret ballot
Stake $XENONITE for a season to register a voter key with that weight (in micro-tokens). A proposal snapshots the voter tree; a ballot proof votes for, against or abstain and publishes H(7, sk, proposal), so each key votes once and nobody learns which registration it was. Votes are signals: the Council decides what to execute.
Upgrades and control
Every contract is an ERC-1967 proxy with a UUPS implementation. All of them are owned by a Timelock with a 48-hour minimum delay, and the only proposer and executor on the Timelock is the Council, a 2-of-2 multisig. Any change, from a deposit cap to an upgrade, is public for two days before it can run.
Limits and risks
- Not audited. One deposit is capped at 500 USDG and the pool at 25,000 USDG of user funds for launch. The Council raises both through the Timelock.
- Chainlink stock feeds update less often outside market hours. Fills use the last feed price.
- Your notes are stored in your browser. Clearing it loses them, and the funds with them, unless you have a backup. Press Back up in the hidden stack after every deposit or trade: the file is encrypted to your wallet's spend key, and Restore merges it back on any browser after you unlock with the same wallet.
- The relay and keeper are run by the team. The relay cannot alter a proof; if it stops, proofs can be sent from any wallet.
- Through the 48-hour Timelock, the Council can add markets, pause new deposits and trades (withdrawals and closes keep working), change the keeper key, upgrade contracts and withdraw only free house liquidity.
- The RFQ desk and the keeper are run by the team. A bad quote is bounded to 1% from the oracle; a missing keeper delays stops and settlement but cannot take funds.
Contracts
Pool: —
Verifiers are generated from the circuits by Barretenberg. Poseidon2 on-chain is the MIT poseidon2-evm Yul library.