Mera
ExecutionInstant confidential swapsClear from encrypted balances in one 150ms slot.Hidden-size limit ordersLock encrypted size in a private escrow PDA.Sealed RFQ block tradesRequest signed quotes without leaking size.
Vault & AuditShielded vault & keysDeposit SOL, SPL, or Token-2022 into a Ring.Viewing key verifierDecrypt and prove a single settled fill.
Docs/Concepts
3 min read

Single-Slot Sealed Settlement

How Mera combines Alpenglow 150ms finality with atomic shielded settlement, the vault solvency invariant, and two-sided confidentiality.

Mera settles every swap, hidden-size limit order fill, and sealed RFQ block trade in a single Solana v0 transaction inside one 150ms slot. Both counterparties start from encrypted balances in the same Ring, nullify their spent input notes, receive encrypted output notes, and record a cryptographic settlement hash atomically.

Why 150ms finality matters for dark execution

Under Solana's legacy 12.8 second finality, a maker quoting a sealed block had to widen spreads to cover multi-slot price drift while waiting for confirmation. Anza's Alpenglow consensus upgrade reduced target finality to 150ms. At that latency, a maker can sign a sealed quote or match a private escrow and clear atomically in one slot without optimistic-UI rollback risk or an off-chain sequencer.

Two-sided confidentiality compared

Venue modelMaker quoting logicMaker inventoryTaker wallet & sizePost-trade balanceSettlement layer
Public Solana DEX / AggregatorPublicPublicPublicPublicSolana L1
One-sided Proprietary AMMPrivatePrivatePublicPublicSolana L1
MeraPrivatePrivate (shielded notes)Private (encrypted commitments)Private (encrypted commitments)Solana L1 (150ms slot)

One-sided proprietary AMMs shield the market maker's quoting curve while leaving every taker's wallet, fill size, and post-trade balance visible on the public ledger. Mera uses Solana Privacy Rings primitives so both makers and takers clear from encrypted UTXO balances natively on Solana L1.

What happens in one settlement transaction

A single v0 transaction compiled over Mera's Address Lookup Table executes the following steps atomically in mera_core:

  1. Access and state check. The instruction confirms ProtocolConfig.paused == false and RingConfig.frozen == false, and checks that the input CommitmentNote accounts belong to the Ring, match the expected mints, are unspent (spent == false), and hold sufficient balance.
  2. Double-spend prevention. The instruction marks the input notes spent and initializes one NullifierRecord PDA (["nullifier", ring, nullifier]) per spent input. Because Solana rejects duplicate account initialization, a spent note can never be reused.
  3. Protocol fee transfer. mera_core computes fee_paid = floor(gross_amount * fee_bps / 10_000) and executes token_interface::transfer_checked from the Ring's ShieldedVault token account to ProtocolConfig.fee_recipient's ATA, decrementing total_shielded and incrementing total_fees_collected.
  4. Output commitment creation. The instruction initializes encrypted output CommitmentNote PDAs (["note", ring, commitment]) for both the taker and the maker, and updates RingConfig.commitment_root to SHA-256(old_root || out_commitment_a || out_commitment_b).
  5. Settlement record and event. The instruction initializes an RfqSettlementRecord PDA (["settlement", ring, settlement_id_hash]) containing the commitment_hash, nullifier_hash, tvk_hint, fee_paid, and settled_slot, then emits a SettlementCleared CPI event (emit_cpi!).

The vault solvency invariant

For every Ring and mint, mera_core enforces a strict balance invariant across the ShieldedVault PDA and its SPL/Token-2022 token account:

text
vault_token_account.amount == sum(unspent CommitmentNote amounts) + sum(open PrivateEscrowOrder locked amounts)

Every deposit_shielded transfers tokens in and increases total_shielded by the exact same amount. Every withdraw_shielded burns a nullifier and transfers tokens out while decreasing total_shielded. Every settlement moves ownership between encrypted notes inside the same Ring vaults and transfers only fee_paid out to the fee recipient, reducing total_shielded by fee_paid. Every place_hidden_order locks an input note inside PrivateEscrowOrder, which either settles atomically via fill_hidden_order or returns in full via cancel_hidden_order.

Transaction assembly and co-signing

For two-sided executions (settle_confidential_swap and settle_sealed_rfq), the taker's wallet signs first as fee payer and taker signer. The matching relay receives the taker-signed v0 transaction at POST /v1/transactions/submit, attaches the maker's co-signature, and relays the completed transaction to Solana. This ordering respects Wallet Standard security requirements so wallets never reject pre-signed transactions.

Planned settlement upgrades

On Mera's roadmap, Build 1 adds parallel multi-maker sealed RFQ fan-out with Rotor and location-aware leader dispatch, and Build 2 switches mera_core's commitment and solvency verifier path to CPI into Helius Solana Privacy Rings' mainnet verifier program.