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

Viewing Keys & Selective Disclosure

How wallet viewing keys and single-transaction Transaction Viewing Keys (TVKs) prove settled fills without exposing wallet history.

Confidential trading requires selective disclosure: a trader or desk must be able to prove one settled execution to an auditor, accountant, or counterparty without revealing unrelated balances or other trades. Mera separates this into a Ring-scoped wallet viewing key fingerprint and per-trade Transaction Viewing Keys (TVKs).

Two levels of disclosure

Key typeScopeWhere it appearsWhat it reveals
Wallet viewing keyOne wallet in one Ring (viewingKeyFingerprint)/balance and GET /v1/balances/:walletUnspent CommitmentNote list and decrypted shielded balances for that wallet in that Ring
Transaction Viewing Key (TVK)One single settled trade/trade fills table, POST /v1/transactions/submit, GET /v1/fillsExact pair, mode, side, input amount, output amount, execution price, fee, slot, finality ms, commitment hash, nullifier hash, and transaction signature for that trade alone

Sharing a TVK reveals nothing about the trader's remaining shielded balance, other open hidden orders, or other fills in the same Ring.

TVK format and payload structure

A Mera v1 TVK is a base64-encoded JSON payload prefixed with mera_tvk_v1_:

text
mera_tvk_v1_<base64(UTF-8 JSON payload)>

The decoded TvkPayload contains 17 fields:

FieldTypeDescription
v1TVK schema version
settlementIdstringUnique settlement identifier (e.g. stl_...)
ringIdstringRing identifier where the fill cleared
pairIdstringTrading pair (e.g. SOL-USDC)
modestringswap, hidden-order, or sealed-rfq
sidestringbuy or sell
inputAmountstringExact input amount in base units (u64 string)
outputAmountstringExact net output amount in base units (u64 string)
executionPricenumberSettled execution price
feeAmountstringExact protocol fee paid in base units (u64 string)
feeBpsnumberProtocol fee rate in basis points at settlement
commitmentHashstring32-byte hex SHA-256 settlement commitment hash
nullifierHashstring32-byte hex taker input nullifier hash
slotnumberSolana slot in which the trade confirmed
finalityMsnumberMeasured confirmation latency in milliseconds
signaturestringBase58 Solana transaction signature
settledAtstringISO-8601 UTC timestamp

Cryptographic verification

When a TVK is submitted to /receipts or POST /v1/receipts/verify, the verifier executes three checks:

  1. Format check. Confirms the mera_tvk_v1_ prefix, valid base64 JSON, v === 1, and required string fields. Malformed input returns INVALID_TVK (400).
  2. Commitment hash check. Recomputes the domain-separated SHA-256 settlement commitment hash from the disclosed fields:
text
recomputed = SHA-256(
  "mera:settlement:v1:" || settlementId || ":" || ringId || ":" || pairId ||
  ":" || inputAmount || ":" || outputAmount || ":" || feeAmount
)

If recomputed !== payload.commitmentHash, any field was altered after settlement and the verifier rejects the key with INVALID_TVK (400).

  1. On-chain record check. Looks up the RfqSettlementRecord PDA (["settlement", ring_pubkey, SHA-256(settlementId)]) on Solana RPC via getAccountInfo and confirms the account exists and is owned by mera_core (3w9NcCZK118PzMLmfbS5si5Q5hpA3DMEuYyfVo5fkE1B). The result is returned in onchainMatched: boolean.

The first 16 bytes of commitmentHash are also stored on chain in RfqSettlementRecord.tvk_hint and emitted in the SettlementCleared event so indexers and auditors can match TVKs to on-chain records without scanning plaintext amounts.