The Coprocessor is the service that turns encrypted Intents into a committed Ledger root whenever there is something to settle, as often as once per batch interval. It runs as a Rust service inside a TEE, and around it sits an untrusted host stack: a relayer that lands transactions, a reader for Pyth’s price accounts on Solana, clients for Jupiter’s Price API and Router, a ciphertext store, an indexer, and the TypeScript SDK through which a trader places an order in one call. This chapter specifies that stack: how the service is cut between trusted and untrusted code, how one Crossing runs, how every input from the host is bound on chain so the enclave never has to trust it, how Commits land and recover, and how the enclave image is built so anyone can reproduce its measurement. Attestation and key custody are in Chapter 5, the Escape in Chapter 6, the Crossing math in Chapter 7 and the program in Chapter 9.
Service architecture
Encifher established the pattern Privium follows: on-chain programs hold handles to ciphertexts, ciphertexts live on a public data availability layer, and a coprocessor inside an enclave decrypts, computes on plaintext and commits attested, Merkle-anchored results, with decryption trust split across a threshold committee [1]. Privium specializes it to one workload, the Crossing, and draws the trust boundary tightly around the code that sees plaintext.
| Component | Domain | Holds | Role |
|---|---|---|---|
intake |
enclave | HPKE private key | Opens Intents, checks signature, nonce and expiry |
engine |
enclave | plaintext Ledger | Nets, clears and settles a Crossing (Chapter 7) |
ledger |
enclave | Merkle tree over ciphertext leaves | Re-encrypts touched leaves, computes |
signer |
enclave | Signs open_crossing, route_residual and Commit messages |
|
relayer |
host | a fee-payer key holding SOL only | Builds, simulates, sends and confirms transactions |
oracle |
host | the Jupiter API key it shares with router |
Reads Pyth’s sponsored price accounts and Jupiter’s reference prices |
router |
host | Jupiter API key | Requests /swap/v2/build routes |
store |
host | nothing secret | Posts ciphertext diffs as log_diff chunks; keeps Crossing journals and a diff mirror |
indexer |
host | nothing secret | Decodes program activity; serves leaves and proofs |
The host components carry no authority over funds. Every instruction that moves Pool tokens needs an enclave signature (Chapter 9), and the relayer’s key can only pay fees. The host can delay the enclave or feed it wrong data, so each input it supplies is bound to something the chain checks:
| Input from the host | Binding the program checks |
|---|---|
| Deposit entries read over RPC | Digest of the chain hashes at the consumed positions (Equation 9.1) |
| Ciphertext diff | Accumulator that log_diff builds on chain (Equation 4.10); the Commit must repeat it |
| Oracle prices | open_crossing derives each Pyth price account itself, verifies it and stores the prices’ hash ; the Commit must repeat it |
| Jupiter route | The enclave signs the route hash and ; the program measures the fill |
| Residual fills | Recorded on chain by route_residual; the Commit carries their hash |
| Previous root and Crossing index | commit requires and to match LedgerRoot |
A host that lies produces a Commit the program rejects. The worst a host can do is withhold service, and the answer to that is a second, independently hosted enclave (see Deployment) and, past slots, the Escape.
The workspace mirrors the boundary, so the enclave image links only crates that are meant to see plaintext:
[workspace]
resolver = "2"
members = [
"crates/types", # Intent, LedgerLeaf, CommitMsg, RouteMsg: shared wire formats
"crates/engine", # pure Crossing function, no I/O, no clock, no floats
"crates/enclave", # intake, ledger, signer, sealing; links engine
"crates/relayer", # host: transactions, retries, fee payer
"crates/feeds", # host: Pyth account reader, Jupiter clients
"crates/store", # host: DA writer and reader
"crates/indexer", # host: program decoder, leaf and proof API
]
[profile.release]
codegen-units = 1
lto = "fat"
panic = "abort"
Every dependency is pinned to an exact version in Cargo.lock and vendored, because the enclave’s measurement is a hash of the image and an unpinned resolver makes two honest builds differ (see the last section).
The Crossing loop
A Crossing is five steps: collect, open, cross, route and commit. It goes on chain only when it has something to settle, and the Coprocessor otherwise sends a heartbeat Commit that carries no asset. The loop below is the enclave’s view of it; each await on a host service crosses the boundary through a narrow, typed channel.
const SCAN_SLOTS: u64 = 25; // resting orders against the live reference
const HEARTBEAT_SLOTS: u64 = 750; // the longest gap between Commits
pub async fn run(mut c: Coprocessor) -> Result<()> {
let mut last_scan = 0;
loop {
let head = c.chain.ledger_root().await?; // host read, checked at Commit
let k = head.k + 1;
let cutoff = c.chain.wait_slot(head.last_commit_slot + c.cfg.batch_interval).await?;
let deposits = c.chain.deposits_since(&c.ledger.cursors()).await?;
let mut due = c.intake.has_due_work(cutoff, &deposits); // no price needed
if !due && cutoff >= last_scan + SCAN_SLOTS {
last_scan = cutoff;
let refs = c.oracle.reference(&c.intake.resting_assets()).await?; // Price API V3
due = c.intake.resting_may_fill(cutoff, &refs); // Equation 10.1
}
if !due && cutoff < head.last_commit_slot + HEARTBEAT_SLOTS {
c.chain.wait_slot(cutoff + 2).await?; // idle: nothing goes on chain
continue;
}
let batch = c.intake.drain(k, cutoff); // received before the cutoff
c.store.put_journal(k, &batch.sealed()).await?; // replayable by any registered peer
let mids = c.oracle.read_and_open(k, &batch.pairs(), &c.signer).await?; // verified on chain
let refs = c.oracle.reference(&batch.pairs()).await?; // Jupiter, gate only
let plan = c.engine.cross(&c.ledger, &batch, &mids.within(&refs))?; // Chapter 7
let mut fills = Vec::with_capacity(plan.residuals.len());
for r in &plan.residuals {
fills.push(c.router.route(k, r, &mids, &c.signer).await?); // recorded on chain
}
let heartbeat = !due; // carries no asset
let next = c.engine.settle(&c.ledger, &plan, &fills, &deposits, heartbeat)?;
let diff = c.ledger.encrypt_diff(&next)?; // AES-256-GCM leaves
let da = c.store.log_diff(k, &diff).await?; // δ^(k) from the on-chain accumulator
let msg = next.commit_message(k, head.root, da, &mids, &fills, &deposits);
c.relayer.commit(k, c.signer.sign(&msg), msg).await?;
c.ledger.apply(next); // only after the Commit confirms
}
}
A Crossing has something to settle when the enclave holds any of the work below at the cutoff. All but the last row it decides from its own state, with no price.
| Work | Counts when |
|---|---|
| Trade, cancel and Exit Intents | intake accepted one since the last cutoff |
| Deposits | a queue holds entries past the stored cuts, to credit or, when the note does not open, to refund |
| Exit pieces | a funded piece has reached its release slot |
| Expiries | an open order’s expiry lies below the cutoff |
| A resting order the market reached | its limit satisfies (10.1) |
Status and Receipt requests settle nothing and start no Crossing.
The last row needs a price. Every 25 slots (parameter: 5 s at the slot time of [10], a twelfth of the one-minute heartbeat on which Pyth refreshes the mids a resting order clears against [7]), the host reads Jupiter’s Price API V3 [8] for the assets of the resting orders, and the enclave counts the Crossing as due when a resting order on pair , with reference ratio of its base and quote USD prices, satisfies
The band holds every limit a crossable mid can reach, since Chapter 7 crosses a pair only within of the same reference, widened by the floor of the route bound. The scan decides only whether a Crossing begins. The Crossing then reads its mids on chain and fills by Chapter 7 alone, so the reference can start a Crossing or leave an order resting until the next scan, and never sets a price.
With nothing to settle, nothing goes on chain until 750 slots after the last Commit (parameter: 150 s at the slot time of [10], so twelve heartbeat intervals fit in the liveness window of Chapter 6). The Coprocessor then sends a heartbeat: a Crossing that drains no Intent, reads no price, routes nothing and carries no asset, which the program accepts with an empty asset list (Chapter 9). It is three transactions, open_crossing, one log_diff chunk and the Commit (est.: with no asset term, Equation 4.11 leaves the 80-byte header and any rewritten trader records, inside one 3,800-byte chunk). A day holds 432,000 slots at 200 ms [10], so an idle Pool lands 576 heartbeats, 1,728 transactions, a day (est.). Each heartbeat re-anchors the root and restarts the liveness window, so the gap between Commits measures the enclave’s liveness and never trading activity.
The cutoff is the slot at which the loop begins Crossing , never less than after Commit (Chapter 7). While work waits, it falls after the last Commit; after an idle stretch, at the slot the loop finds work. Intents received before the cutoff are the Crossing’s candidates. One received later keeps the work flag set, and Crossing begins as soon as allows. Intake stamps each Intent with the confirmed chain slot at which it arrives, not the loop’s last read, so the rule holds while a Crossing’s proofs are still being computed.
Three properties of this loop carry the rest of the design.
The engine is a pure function of , the plaintext Ledger, the Intent batch, the mids, the fills, the deposits. It reads no clock and no randomness, iterates over ordered maps only, and uses integer arithmetic in base units. Any enclave holding the same inputs computes the same , which is what makes the journal and the standby useful.
The ciphertext diff is on chain before the Commit is signed. log_diff returns , the accumulator (4.10) the program built from the confirmed chunks, and the Commit must match it, so every root the program accepts has its ciphertexts in Solana’s history. The Escape (Chapter 6) and any trader’s balance proof read from there.
The in-memory Ledger advances only after the Commit confirms. If the Commit fails for good, the enclave still holds the state that matches LedgerRoot, and the Crossing is retried with the fills already recorded.
The on-chain part of a Crossing is three dependent transaction stages: open_crossing, then the route_residual transactions, then the Commit. The routes of one Crossing all write its CrossingState, so the scheduler runs them one after another, but they need no confirmation between them and a leader can place them in the same block. Each stage waits for the previous one’s confirmation, which Alpenglow targets at about 150 ms [11], inside one slot at the slot time Chapter 9 cites. The shortest Crossing is therefore about three slots (est.), plus the Jupiter round trips and the log_diff chunks, which run while the previous stage confirms where their inputs allow. open_crossing accepts Crossing no sooner than slots after Commit lands (Chapter 9), so Crossings never overlap, and a Pool with work always waiting runs one Crossing every slots plus a Crossing’s own duration.
Intent intake
An Intent arrives as an HPKE ciphertext (RFC 9180) under the enclave’s attested HPKE key , published in the Registry and bound to the measurement as described in Chapter 5 [13]. The suite is DHKEM(X25519, HKDF-SHA256), HKDF-SHA256 and AES-256-GCM, and the HPKE info string is (3.8) of Chapter 3: the program id, the key epoch and the hash of its quote, so a ciphertext made for one deployment or key epoch does not open under another. Intents reach the enclave either over a TLS session that terminates inside the enclave or from post_intent transactions picked up by the indexer; both paths deliver the same bytes to intake.
pub fn open_intent(&mut self, ct: &IntentCiphertext, slot: u64) -> Result<Accepted, Reject> {
let info = [b"privium/intent/v1".as_slice(), &PROGRAM_ID, &self.epoch.to_le_bytes(), &self.quote_hash].concat();
let pt = hpke::single_shot_open::<Aes256Gcm, HkdfSha256, X25519HkdfSha256>(
&OpModeR::Base, &self.hpke_sk, &ct.encapped_key, &info, &ct.body, &[],
).map_err(|_| Reject::Undecryptable)?;
let signed: SignedIntent = borsh::from_slice(&pt).map_err(|_| Reject::Malformed)?;
let i = &signed.intent;
let acct = self.ledger.account(i.u).ok_or(Reject::UnknownAccount)?;
acct.auth_key.verify_strict(&i.signing_bytes(), &signed.sig).map_err(|_| Reject::BadSig)?;
if i.tau <= slot { return Err(Reject::Expired); }
if i.x == 0 || !self.pairs.contains(&i.pi) { return Err(Reject::Malformed); }
if !acct.nonce_fresh(i.nu) { return Err(Reject::Nonce); } // Chapter 4 nonce discipline
let need = i.max_debit(); // x·ℓ for buys (ℓ capped for market orders), x for sells
if acct.available(i.debit_asset()) < need { return Err(Reject::Balance); }
self.ledger.reserve(i.u, i.debit_asset(), need);
self.ledger.consume_nonce(i.u, i.nu);
Ok(Accepted { id: i.id(), crossing_hint: self.next_k })
}
The trader’s Ledger authorization key, not the wallet, signs the Intent, so placing an order needs no wallet prompt and leaves no wallet signature anywhere. The reservation makes a trader’s concurrent Intents in one Crossing unable to overspend; reservations not filled by expiry are released at the next Crossing. Rejections are returned on the session only to the sender. The symmetric layer is not the bottleneck: Encifher measures over one million AES-256-GCM operations per second in its enclave [1].
Ciphertext store and data availability
The store handles two kinds of object per Crossing:
- the journal : the Intent ciphertexts the enclave accepted, sealed again under a key derived from the Ledger data key that every admitted enclave holds (Chapter 5), written to the host store before
open_crossing; - the diff of Definition 4.4: the header, the rewritten leaves with their positions, the per-asset proofs and the entry records, posted on chain as
log_diffchunks before the Commit.
The diff holds the leaves the Crossing changed and the decoys of Chapter 8, so its size follows Equation 4.11, and Solana’s transaction history is its data availability layer. Anyone can rebuild every root from genesis by replaying diffs in order and checking each result against the on-chain and , which is how the indexer validates its own copy before serving it. A trader fetches their own leaf and its Merkle path from any mirror and decrypts it with their key; the leaf proves itself against the on-chain root, so the mirror needs no trust.
Oracle ingestion
Pyth sponsors price feed accounts on Solana for a set of commonly used feeds. For each feed id, the account at shard 0 of Pyth’s push oracle holds a PriceUpdateV2 that Pyth’s own pusher keeps current, for most feeds on a one-minute heartbeat and on every 0.5% move of the price [7]. Privium reads those accounts as they stand and posts no price update of its own. The oracle component derives each admitted asset’s account from the feed id in its AssetState, reads the accounts a Crossing needs in one getMultipleAccounts call after the cutoff, and hands them to the enclave, which signs their price inputs into the open_crossing message (Chapter 9). The accounts are live, so a push can land between that read and the open; the program then finds values other than the signed ones and rejects the open with MidsMismatch, and the host reads again. Once a Crossing is open its mids are fixed on chain, and a standby that reopens it keeps them.
open_crossing derives and checks each account and records whether its price is valid (Chapter 9). The maximum price age is 75 seconds (parameter): above the one-minute heartbeat with room for each push to land, so a live feed qualifies at every Crossing, and 15 seconds past the first missed beat of a feed whose pusher stops. A price past that age does not fail the open: the program records it as invalid, and the pairs that need it rest for that Crossing. The enclave reads the recorded mids and their validity back from the CrossingState, never from the host, and the confidence check of Chapter 7 runs on the same stored values.
A pushed price can trail the market by up to its heartbeat, so before it crosses, the enclave holds each valid mid against a live reference: Jupiter’s Price API V3, which prices a token from its last swapped price across Solana venues after filtering outliers [8]. The host requests the USD prices of the pair’s base and quote mints, the enclave divides them, and the pair crosses only while its mid lies within of that ratio (Chapter 7). The reference only decides whether a pair crosses: the clearing price is always the mid the program verified, so a host that withholds or bends the reference can make a pair skip a Crossing and nothing more. A pair whose AssetState names no feed has no verified mid and routes its whole flow as the Residual, its route bound set from the Jupiter reference price of its token.
Jupiter route building
Residuals use Jupiter’s Router path, GET https://api.jup.ag/swap/v2/build, which returns raw instructions and address lookup tables from Metis routing with no Jupiter swap fee [2]. Requests carry the team’s key in the x-api-key header; the paid tiers allow 10 to 150 requests per second, against 0.5 for keyless calls [4], and one Crossing makes one request per pair with a nonzero Residual plus rebuilds.
pub async fn build_route(&self, r: &Residual, mids: &Mids) -> Result<SignedRoute> {
let y_min = r.min_out(mids); // Chapter 7 bound in base units
let slippage_bps = r.slippage_bps_for(y_min); // the same bound, as Jupiter's knob
let q = [
("inputMint", r.in_mint.to_string()),
("outputMint", r.out_mint.to_string()),
("amount", r.in_amount.to_string()),
("taker", POOL_AUTHORITY.to_string()),
("payer", self.fee_payer.to_string()),
("destinationTokenAccount", vault0(&r.out_mint).to_string()),
("wrapAndUnwrapSol", "false".into()),
("slippageBps", slippage_bps.to_string()),
("maxAccounts", ROUTE_ACCOUNT_BUDGET.to_string()),
("transactionVersion", "1".into()),
("excludeDexes", self.excluded.join(",")),
];
let b: BuildResponse = self.http.get(BUILD_URL).query(&q)
.header("x-api-key", &self.api_key).send().await?.error_for_status()?.json().await?;
let ix = b.swap_instruction;
if ix.program_id != JUPITER_ID { return Err(RouteError::UnexpectedProgram); }
let threshold: u64 = b.other_amount_threshold.parse()?;
if threshold < y_min { return Err(RouteError::BelowBound); }
self.check_accounts(&ix)?; // no authority-owned account but vault 0s
Ok(SignedRoute { k: r.k, pair: r.pair, in_amount: r.in_amount, min_out: y_min, ix,
setup: b.setup_instructions, compute_unit_price: b.compute_unit_price })
}
With transactionVersion=1 the response returns no lookup tables and no compute budget instructions, and gives a computeUnitPrice field for the transaction config instead [3]. ROUTE_ACCOUNT_BUDGET is 64 minus the accounts route_residual adds of its own (fee payer, PoolConfig, Registry, CrossingState, two AssetState, the authority, the Jupiter and Pool programs, the Ed25519 program, the Instructions sysvar and the token program): 52 (est.). The enclave signs the route only after check_accounts confirms that the only token accounts owned by the authority in the list are the two shard-0 vaults, and that is at least the Chapter 7 bound; the program then enforces the same bound on the measured fill.
Before signing, the relayer simulates the transaction with the compute limit at 1,400,000 and sets the limit to 1.2 times the units consumed, as Jupiter prescribes for /build, clamping the returned price to a configured ceiling [5]. A simulation that fails at the CPI depth or instruction-trace limits of Chapter 9 names the failing program; the router maps it to its DEX label with GET /swap/v2/program-id-to-label [6], adds it to excludeDexes and rebuilds.
Commit submission and retries
All Pool transactions are v1, which carries its limits in the message config: the compute unit limit, the loaded accounts data size and a priority fee stated as a total in lamports [9]. A v1 transaction with either limit unset gets zero and fails immediately [9], so the relayer always sets both from a simulation.
pub async fn commit(&self, k: u64, sig: Signature, msg: CommitMsg) -> Result<Confirmed> {
let ixs = [ed25519_ix(&self.enclave_pk, &sig, &msg.bytes()), commit_ix(k, &msg)];
let mut fee = self.fees.start(k);
for attempt in 0..self.cfg.max_rebuilds {
let bh = self.rpc.latest_blockhash().await?;
let sim = self.rpc.simulate_v1(&ixs, bh, Limits::MAX).await?;
if let Some(e) = sim.err() { return Err(classify(e)); } // StaleRoot, OutOfOrder: stop
let limits = Limits {
compute_units: (sim.units_consumed * 12 / 10) as u32,
loaded_bytes: round_up_32k(sim.loaded_accounts_data_size),
priority_fee_lamports: fee.next(attempt),
};
let tx = self.build_v1(&ixs, bh, limits)?.sign(&self.fee_payer)?;
let until = bh.last_valid_block_height;
while self.rpc.block_height().await? <= until {
self.send_all(&tx).await; // same bytes, idempotent
if let Some(c) = self.rpc.confirmed(&tx.signature()).await? { return Ok(c); }
self.wait_slots(2).await;
}
}
Err(CommitError::Exhausted)
}
A blockhash expires 150 blocks after it was issued [12], about 30 seconds at the slot time Chapter 9 cites. Within that lifetime the relayer resends the same signed bytes, which is safe because a transaction signature can land once. After expiry it rebuilds with a fresh blockhash and a higher priority fee, which is also safe, because the Commit itself is idempotent at the program level: it requires and equal to the stored root, so a second copy of an already-landed Commit fails with OutOfOrder and the relayer treats that error as confirmation after reading LedgerRoot. Under Alpenglow, live since epoch 1064 with finality targeted at about 150 ms [11], the relayer applies the new state on finalized confirmation without a long wait. The relayer does not use durable nonces for Commits; durable nonces are being replaced by on-chain offline-signer programs [15], and a Commit has no need for an offline signing window.
The lease covers a silent opener. open_crossing records the opening enclave key, and only that key may route and commit Crossing until lease_slots have passed. The lease is 300 slots (parameter): two full blockhash lifetimes for the opener to land its Commit, and well inside the liveness window of Chapter 6. Past the lease, a standby enclave reads the journal , reopens with the mids and fills already on chain, and replays the pure engine to the same settlement. Residual fills already executed are part of its input, so no swap is repeated.
Indexer
The indexer decodes every Pool transaction into typed events: deposits with their note blobs, post_intent ciphertexts, Crossing opens with their mids, recorded fills, Commits with their roots and DA commitments, Exit releases and Escape claims. It serves three consumers: the enclave (deposits since a cursor, Intent blobs since a slot), the SDK (a trader’s leaf and Merkle path, Exit release status) and the public (per-Crossing net flow, which the chain already shows).
Because Pool transactions are v1, every read path passes maxSupportedTransactionVersion: 1. Without it getTransaction fails with error -32015 and block reads cannot decode the transaction, and clients that read compute limits or priority fees from ComputeBudget instructions find nothing, since v1 keeps them in the message config [9]. The indexer checks each replayed root against the program’s LedgerRoot and each diff against , and stops serving a Crossing whose data does not reproduce the on-chain root.
The TypeScript SDK
The SDK puts a trade behind one call:
import { Privium } from "@privium/sdk";
const privium = await Privium.connect({ wallet, rpc: process.env.RPC_URL! });
await privium.deposit("USDC", 500);
const fill = await privium.trade("SOL/USDC", "buy", 2.5); // market order
await privium.trade("SOL/USDC", "sell", 1, { limit: 210, expiry: "30s" });
await privium.exit("SOL", 1.5, { to: freshAddress });
Underneath, trade builds and seals an Intent and waits for the Crossing that settles it:
export async function trade(
this: Privium, pair: string, side: "buy" | "sell", size: number, opts: TradeOpts = {},
): Promise<Fill> {
const { base, quote } = await this.markets.resolve(pair); // mints, decimals, feeds
const slot = await this.rpc.getSlot().send();
const intent: Intent = {
u: this.account.id,
pi: [base.mint, quote.mint],
s: side === "buy" ? 1 : -1,
x: toBaseUnits(size, base.decimals),
l: opts.limit === undefined ? marketLimit(side) : toPriceUnits(opts.limit, base, quote),
tau: slot + slotsFrom(opts.expiry ?? "60s"),
nu: await this.account.nextNonce(),
};
const sig = await this.account.authKey.sign(intentSigningBytes(intent));
const enclave = await this.registry.activeKey(); // attested (Chapter 5)
const ct = await hpkeSeal(enclave.hpkePk, encodeSignedIntent(intent, sig), intentInfo(enclave));
const receipt = this.opts.onChain
? await this.postIntent(ct) // post_intent, any payer
: await this.intake.submit(enclave, ct); // session to the enclave
return this.watchFill(receipt, intent); // reads own leaf, decrypts
}
watchFill polls the indexer for the trader’s leaf at each new Commit, verifies its Merkle path against the on-chain root and decrypts it locally; the fill price and size come out of the trader’s own balance change. Prices and sizes cross the API as decimals and are converted to base units once, with the mint’s decimals; nothing downstream sees a float. slotsFrom converts durations at the current slot time read from the cluster, because slot length changed in 2026 and code that hardcodes 400 ms per slot drifts [10].
Wallet flows
A trader’s wallet appears on chain for deposits and nowhere else. Everything after the deposit is signed by keys derived from one wallet signature:
const DOMAIN = "Privium account v1\nThis signature derives your Privium keys. It moves no funds.";
export async function deriveAccount(wallet: MessageSigner): Promise<AccountKeys> {
const sig = await wallet.signMessage(new TextEncoder().encode(DOMAIN)); // Ed25519, deterministic
const ikm = await crypto.subtle.importKey("raw", sig, "HKDF", false, ["deriveBits"]);
const derive = async (label: string) => new Uint8Array(await crypto.subtle.deriveBits(
{ name: "HKDF", hash: "SHA-256", salt: new Uint8Array(32), info: utf8(label) }, ikm, 256));
return {
authSeed: await derive("privium/auth/v1"), // A_u: Ed25519 seed that signs Intents
viewSeed: await derive("privium/view/v1"), // vk_u: viewing root (Chapter 11)
escapeSeed: await derive("privium/escape/v1"), // y_u: escape key (Chapter 6)
salt: await derive("privium/salt/v1"), // varsigma_u: owner-tag salt (Chapter 4)
noteSeed: await derive("privium/note/v1"), // X25519 seed for deposit notes
};
}
Ed25519 signatures are deterministic [16], so the same wallet always yields the same keys and a trader recovers their account on any device from the wallet alone. The flows are:
| Flow | Wallet prompts | What lands on chain |
|---|---|---|
| Open account | one message signature | nothing |
| Deposit | one transaction | a token transfer into a vault shard and a queue entry |
| Trade | none | nothing from the trader; the Pool’s net Residual per Crossing |
| Exit | none | a release from a vault to the address the trader named |
| Escape | none | a request, Council re-encryption shares and the trader’s claim proof, paid to the trader’s address (Chapter 6) |
An Exit can pay a Helius Ring deposit address, so the funds enter an encrypted balance on arrival [17]; Chapter 8 measures what that does to linkage.
Observability
The enclave emits structured events from a fixed schema and nothing else; there is no free-form logging inside the boundary, so no code path can print plaintext. The schema carries only values the chain already shows or that describe the machine: Crossing index, stage latencies (drain, open, cross, route, DA write, Commit), transaction outcomes and error classes, enclave health and key epoch. Counts of Intents and rejections are exported per Crossing rounded up to a power of two, enough to size capacity without giving a timing analyst (Chapter 8) a per-batch count. The host exports the rest: RPC latency and error rates, Jupiter response times, DA write latency, the relayer’s fee spend and SOL balance. Alerts fire on the conditions that precede a missed Commit: a lease more than half spent, a DA write past its budget, a relayer balance below one day of fees.
Deployment and reproducible enclave builds
Two Coprocessor instances run on separate hosts with separate cloud attestation roots where the TEE allows it, each with its own relayer fee payer. Both are registered in the Registry, which holds up to four keys so rotation can overlap (Chapter 5). One opens each Crossing; the other follows the journal and the chain and takes over at lease expiry. Because the engine is deterministic and every input is either on chain or in the journal, the standby needs no live channel to the primary.
The enclave image is built so that anyone can reproduce its measurement from the tagged source. The toolchain is pinned in rust-toolchain.toml, every crate is vendored and locked, timestamps come from the commit, and the image is assembled by a hermetic build that records its inputs:
#!/usr/bin/env bash
set -euo pipefail
git checkout "v${RELEASE}"
export SOURCE_DATE_EPOCH="$(git log -1 --format=%ct)"
export CARGO_HOME="$PWD/.cargo-home" RUSTFLAGS="-C debuginfo=0 --remap-path-prefix=$PWD=/src"
cargo vendor --locked vendor/ > .cargo/config.toml
cargo build --release --locked --offline -p privium-enclave
nix build .#enclave-image --option sandbox true # kernel, initrd, rootfs, cmdline
./tools/measure result/image > measurement.json # values the quote must report
sha256sum result/image measurement.json
solana-verify build --library-name privium_pool # on-chain program, Docker build
The release publishes the image hash, the expected measurement values and the program hash side by side. The program hash is checked with the Solana Verify CLI, whose record sits in a PDA anyone can recheck [14]; the measurement is what register_enclave compares against the attestation quote, through the chain of trust described in Chapter 5. A trader who wants to know what code holds their balances rebuilds both and compares two hashes against two on-chain records.
References
- N. Lokhande et al., “Encifher: A Trusted-Execution Coprocessor for Confidential Computation on Solana”, IACR ePrint 2026/1504, July 2026. https://eprint.iacr.org/2026/1504
- “Build” (Swap API V2 Router path), Jupiter, 2026. https://developers.jup.ag/docs/swap/build
- “Transaction Versions (v0 and v1)”, Jupiter, 2026. https://developers.jup.ag/docs/swap/advanced/transaction-versions
- “Rate Limits”, Jupiter Developer Platform, 2026. https://developers.jup.ag/docs/portal/rate-limits
- “Compute Units and Priority Fees”, Jupiter, 2026. https://developers.jup.ag/docs/swap/advanced/compute-units
- “Program ID to Label”, Jupiter, 2026. https://developers.jup.ag/docs/api-reference/swap/program-id-to-label
- “Sponsored Feeds” (Solana), Pyth Network, 2026. https://docs.pyth.network/pro/sponsored-feeds#solana
- “Solana Price API” (Price API V3), Jupiter, 2026. https://developers.jup.ag/docs/price
- “Versioned Transactions: legacy, v0 and v1”, Solana Foundation, 2026. https://solana.com/docs/core/transactions/versioned-transactions
- “Reduced Slot Times” (SIMD-0525), Solana Foundation, October 2026. https://solana.com/upgrades/reduced-slot-times
- “Alpenglow”, Solana Foundation, October 2026. https://solana.com/upgrades/alpenglow
- “Constants Reference”, Solana Foundation, 2026. https://solana.com/docs/core/constants-reference
- R. Barnes, K. Bhargavan, B. Lipp, C. Wood, “Hybrid Public Key Encryption”, RFC 9180, IRTF, February 2022. https://www.rfc-editor.org/rfc/rfc9180
- “Verified Builds”, Solana Foundation, 2026. https://solana.com/docs/programs/verified-builds
- “Durable Nonce Deprecation”, Solana Foundation, October 2026. https://solana.com/upgrades/durable-nonce-deprecation
- S. Josefsson, I. Liusvaara, “Edwards-Curve Digital Signature Algorithm (EdDSA)”, RFC 8032, IETF, January 2017. https://www.rfc-editor.org/rfc/rfc8032
- “Solana Privacy Rings”, Helius, 2026. https://www.helius.dev/blog/solana-privacy-rings