Skip to main content

Private Swaps

Swap one shielded token for another without leaving the pool. A swap spends a private note of the input token, routes the trade through the external call gateway to a server-quoted aggregator route (1inch), and credits a private note of the output token. If the trade can’t settle, the input token is refunded instead. Like earn, swaps are a gateway feature that each deployment enables separately.
swap quote, swap from-quote, and swap execute need your wallet private key on each run (the CLI prompts for it, or reads PRIVATE_KEY). swap status runs on a saved login session.

Finding Token IDs

Swaps take registry token ids, not addresses. privacy-boost tokens list prints each token’s id and decimals. The input token must advertise a 1inch-classic swap capability on the deployment.

Quote, Review, Submit

Fetch a quote and save it:
The quote is always printed as JSON. The fields to review are inputAmount, expectedOutputAmount, minOutputAmount (the slippage-bound minimum that gets signed), and priceImpactBps, all in raw token units. --max-slippage-bps sets how far below the quoted output a fill may land (default 50). With --human, --decimals is the input token’s decimals (default 18). Submit exactly that quote:
from-quote reuses the quote’s route and signed minimum byte for byte, so the economics you reviewed are the ones signed. It refuses a quote older than two minutes; fetch a new one if yours has expired. --quote '<json>' passes the quote inline instead of from a file. It is never read from stdin. Output:

One-Shot Swaps

swap execute fetches a fresh quote and submits it in one step, so nobody reviews the route being signed. It therefore requires a floor:
--min-acceptable-output is the least you accept, in raw output-token units, and must be non-zero. It is checked against the quote’s guaranteed minimum, not its expected output, so leave room for slippage: a floor at the expected output rejects every quote. Prefer quote and from-quote when a person reviews the trade.

Tracking a Swap

The status is printed as JSON and includes the gateway settlement and credit projection. creditStatus=completed means the output note was credited, and creditStatus=rescued means the escrow was paid to the rescue destination. Both end the wait for private credit. In history, a swap appears as two rows, one per epoch. privacy-boost history --collapse-gateway shows it as one.

Next Steps