> For the complete documentation index, see [llms.txt](https://mixfun.gitbook.io/mixfun/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://mixfun.gitbook.io/mixfun/flows/private-swap.md).

# Private Swap

> Swap tokens privately through intent-based matching.

{% hint style="danger" %}
**Save your note, and pick realistic slippage.** A lost note cannot be recovered. Swap withdrawals submit directly from your own wallet, so your receiving wallet needs SOL for gas.
{% endhint %}

## What is a Private Swap?

Private Swap is a cross-mint swap that breaks the on-chain link between the token you deposit and the token you receive. You deposit a flexible amount of token A into a swap pool, express an intent to receive token B, and the engine routes your swap. The result is a withdrawal of token B into any wallet you choose, with no on-chain link to the wallet that deposited token A.

Unlike Private Send and Shielded Pools, swap pools accept **flexible amounts** (within the pool's min/max bounds), not fixed denominations. The commitment you deposit includes the exact amount, so withdrawals can pay out precise outputs.

MixFun does not hold your tokens. The swap pool is an on-chain program account. Swap execution uses a combination of intent matching, batch auctions, and Jupiter V6 as a fallback, all without MixFun taking custody beyond the transaction that moves tokens.

**Core Features:**

* **Cross-mint privacy.** The deposit and withdrawal are of different tokens, so observers cannot infer a 1:1 match.
* **Flexible amounts.** Deposits can be any amount within the pool's min/max bounds, not a fixed denomination.
* **Intent-based matching.** The engine first tries to pair your intent with a complementary intent (pool-to-pool), then accumulates intents into batches.
* **Jupiter V6 fallback.** If intent matching doesn't fill within the routing window, the engine falls back to a relayed Jupiter swap, so you never wait forever for a counterparty.
* **Non-custodial.** Pools and commitments live on-chain; every state change is program-enforced.

## How it works

1. **Get a quote.** Enter input mint, output mint, and amount. The engine returns an estimated output using live Jupiter V6 pricing, plus the expected execution window.
2. **Deposit.** Your wallet signs a deposit of the input token into the swap pool. The deposit commitment includes the exact amount (this is what makes swap pools different from fixed-denomination pools).
3. **Save the note and submit an intent.** Along with the deposit note, you submit an intent to the engine: input commitment, output mint, minimum output, maximum slippage, and a ZK proof that you hold a valid commitment.
4. **Engine executes.** The engine tries three strategies in order: pool-to-pool match with a complementary intent, batched execution with other intents of the same pair, or Jupiter V6 relay. Status moves through pending → matched → executing → completed or failed.
5. **Withdraw.** Once the intent completes, withdraw the output token using your note and a proof. The swap withdrawal uses a dedicated `swap_proof` circuit and submits directly from your wallet.

## Liquidity

Swap pool liquidity is the sum of deposits waiting to be matched or batched. Because swaps are flexible-amount, the engine's ability to fill your intent depends on whether a complementary intent exists (someone deposited token B wanting token A, for example) or on whether Jupiter V6 can offer a route at acceptable slippage.

If your intent has tight slippage and the engine cannot find a match within its routing window, the intent fails and your deposit remains in the pool. You can cancel the intent and resubmit with wider slippage, or keep the deposit and withdraw it later.

## Who it's for

### Ideal for

* Converting an exposed token to a private, unlinked holding of a different token
* OTC-style swaps where counterparty discovery is part of the point
* Treasuries rebalancing between tokens without signaling the trade on-chain
* Users who want swap privacy and don't need a fixed denomination

### Not recommended for

* Urgent swaps. Intent matching takes longer than a direct DEX swap.
* Very large swaps that exceed the pool's max bound.
* Thinly traded pairs where Jupiter fallback slippage is unacceptable.
* Users who need deterministic execution in seconds.

## Summary at a Glance

* **Privacy Level:** Highest (cross-mint; no on-chain link between input and output).
* **Speed:** Intent matching takes seconds to a few minutes. Jupiter fallback is near-instant once triggered.
* **Fee:** 4% by default, with a hard floor of 2.5% (250 basis points), included in the quote. Small swaps are rejected when that fee would not cover the protected execution reserve.
* **Best For:** Private token swaps where unlinkability across mints matters more than execution speed.
* **Custody:** Non-custodial. Pool accounts hold deposited tokens; Jupiter fallback routes through a relayer-signed transaction but never takes custody beyond the single-block execution window.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://mixfun.gitbook.io/mixfun/flows/private-swap.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
