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/Guides
3 min read

Sealed RFQ Block Trades

Request sealed block quotes, compare signed maker responses with expiry timers, and settle atomically in one 150ms slot.

Sealed RFQ lets a trader or institutional desk request a firm block quote for a pair and size inside a sealed request envelope without broadcasting intent to public order books. Makers return signed quotes with a strict expiry window, and accepting one quote clears both sides atomically in settle_sealed_rfq.

How a sealed RFQ clears

  1. Request (`POST /v1/rfq/request`). Taker submits ringId, pairId, side, size, and ttlSeconds (5 to 120, default 30). The relay hashes the request into an envelopeHash, fans out the sealed request to connected makers, publishes an rfq_quote SSE event on /v1/events, and returns the requestId plus signed SealedRfqQuote responses.
  2. Compare (`GET /v1/rfq/:requestId/quotes`). Each quote carries quoteId, maker, makerLabel, price, outputAmount (net of protocol fee), feeAmount, feeBps, quoteCommitment, makerSignature, and expiresAt.
  3. Accept and build (`POST /v1/rfq/:requestId/accept/build`). Taker selects one quoteId before expiresAt. The API verifies Ring access, checks that both taker and maker hold unspent CommitmentNote balances covering the block, and returns an unsigned v0 settle_sealed_rfq transaction (cosigned: true).
  4. Sign and settle (`POST /v1/transactions/submit`). Taker signs first, the relay attaches the maker's co-signature and sends the transaction to Solana, and mera_core clears both shielded balances, transfers fee_paid to ProtocolConfig.fee_recipient, and writes an RfqSettlementRecord with a TVK receipt.

Clearing a sealed RFQ in /trade

  1. Open Terminal, verify the active Ring, and select the Sealed RFQ tab.
  2. Choose pair, side, block size, and TTL, then press Request Sealed Quotes.
  3. Review the returned signed quote card showing maker label, firm price, net output, fee (0.10% default), and live expiry countdown.
  4. Press Accept Quote before the timer reaches zero and sign the transaction in your wallet.
  5. Copy the resulting TVK receipt from the confirmation panel or recent fills table to verify in Receipts.

Clearing a sealed RFQ with @mera/sdk

mera.requestAndAcceptRfq requests quotes, picks the top returned quote, builds the settle_sealed_rfq transaction, signs it, and submits it:

ts
import { createMeraClient, keypairSigner } from '@mera/sdk'

const mera = createMeraClient({
  apiUrl: 'http://127.0.0.1:36102',
  signer: keypairSigner(takerKeypair),
})

const { rfq, quote, submission } = await mera.requestAndAcceptRfq({
  ringId: 'ring-default',
  pairId: 'SOL-USDC',
  side: 'sell',
  size: '10000000000', // 10 SOL block
  ttlSeconds: 30,
})

console.log('RFQ ID:', rfq.requestId, 'Envelope:', rfq.envelopeHash)
console.log('Accepted maker:', quote.makerLabel, 'Price:', quote.price)
console.log('Settled slot:', submission.slot, 'Finality:', submission.finalityMs, 'ms')
console.log('TVK:', submission.tvk)

Two-step RFQ inspection before accepting

Desks that enforce a minimum price or maximum spread check before signing can split the request and acceptance calls using mera.api:

ts
import { VersionedTransaction } from '@solana/web3.js'
import { fromBase64, toBase64 } from '@mera/sdk'

const rfq = await mera.api.requestRfq({
  wallet: takerKeypair.publicKey.toBase58(),
  ringId: 'ring-default',
  pairId: 'wBTC-USDC',
  side: 'sell',
  size: '10000000', // 0.1 wBTC (8 decimals)
  ttlSeconds: 20,
})

const best = rfq.quotes.find((q) => q.price >= 95_000)
if (!best) throw new Error('No quote met desk price floor')

const built = await mera.api.buildAcceptRfq(rfq.requestId, {
  wallet: takerKeypair.publicKey.toBase58(),
  quoteId: best.quoteId,
})

const tx = VersionedTransaction.deserialize(fromBase64(built.transactionBase64))
tx.sign([takerKeypair])

const settled = await mera.api.submitTransaction({
  id: built.id,
  signedTransactionBase64: toBase64(tx.serialize()),
})
console.log('Settled TVK:', settled.tvk)

Subscribing to live RFQ quotes via SSE

Listen to GET /v1/events (or mera.api.eventsUrl(ringId)) for real-time rfq_quote and fill_settled events. See REST & WebSocket API Reference for payload schemas.

Failure cases

  • QUOTE_EXPIRED (409): The quote's expiresAt timestamp passed before accept/build ran. Submit a new RFQ request.
  • INSUFFICIENT_SHIELDED_BALANCE (400): Taker has no single unspent note covering size.
  • UPSTREAM_UNAVAILABLE (502): Maker shielded inventory does not cover the requested block size.
  • RING_ACCESS_DENIED / RING_FROZEN (403): Wallet lacks permission in the target Ring.