> ## Documentation Index
> Fetch the complete documentation index at: https://docs.fluton.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Many tokens, one pool

> How several tokens share one tree and one anonymity set in the pool, and why value can never move between them.

Fluton has one pool. One Merkle tree, one nullifier set, one **anonymity set** for every token it lists. A second token does not get its own pool; it gets an id.

That is the point: separate pools would split the crowd each withdrawal hides in. Sharing one tree means a USDC deposit and a WETH deposit thicken the same set of leaves, and a private transfer that names no token thickens it for all of them at once.

## Asset id

Each listed token is numbered in listing order: 1, 2, 3 … The **asset id** is hashed into every note's commitment, alongside the amount, the owner's public key and the blinding. A note is therefore permanently a note of that token: you cannot re-open it as another asset, because the commitment would not match.

The pool's registry maps an id to its three facts: the eTOKEN wrapper that holds the reserve, the underlying ERC-20, and the `rate` between note units and token base units (see [TOKEN and eTOKEN](https://docs.fluton.io/concepts/token-formats.md)). The listing is append-only, there is no delist or edit, and the pool refuses more than `MAX_ASSETS` assets, which is **32**. [Contracts](https://docs.fluton.io/reference/contracts.md) covers the rules a new wrapper has to satisfy.

## One join-split, one asset

Inside the circuit there is exactly one private `asset` signal per transaction, and it is hashed into all of the input and output commitments. So one join-split can only ever spend and create notes of a single token. Mixing is not forbidden by a check; it is unrepresentable.

To let the contract know which token it is paying or pulling, the proof carries one more public input, `publicAsset`, tied to the private asset by a single constraint:

```text theme={null}
(asset − publicAsset) · publicAmount === 0
```

The field has no zero divisors, so one of the two factors must vanish:

* **A transaction that crosses the pool boundary** has `publicAmount != 0`, which forces `asset == publicAsset`. It has proved what its notes are made of. The pool reads `publicAsset` from `ExtData.asset`, never from the caller's proof struct, and uses it to pick the token, the wrapper and the rate.
* **A private transfer** has `publicAmount = 0`, so the constraint is satisfied whatever the asset is. The token stays private, and `publicAsset` is still bound by the proof, so nobody can patch it afterwards.

## Private transfers name no token

Because a transfer leaves the asset unconstrained, the pool insists that it also leaves it unnamed: with `extAmount = 0`, `ExtData.asset` must be 0, or the transaction reverts with `HiddenTransactionNamesAsset`. The calldata of a private transfer therefore contains no token, no amount and no recipient, whether it is relayed or sent from your own wallet.

Its three new leaves join **every** token's anonymity set at once. An observer looking at a USDC withdrawal cannot rule out any transfer in the tree as its ancestor, because no transfer admits to being USDC or not. Deposits and withdrawals always name their token: value visibly enters or leaves, so the token is public by construction.

## Why value cannot cross tokens

The argument is an induction over accepted transactions, and it rests on four facts:

1. **Every leaf has one opening.** A leaf enters the tree only as an output commitment of an accepted proof, and that proof range-checks the output amount below **2^248** and hashes it with the transaction's asset.
2. **A non-zero input must be such a leaf.** The circuit skips the membership check only for amount-zero dummies, so anything that contributes value was a real, range-checked output of the transaction's asset.
3. **Conservation holds over the integers**, not just modulo the field: outputs are under 2^248, inputs were too, and `extAmount` is bounded by uint64, so `sumIns + publicAmount = sumOuts` cannot wrap.
4. **The asset is pinned when value crosses.** By the constraint above, a transaction changes the unspent value of asset X by `publicAmount` when `publicAsset = X`, and by exactly 0 otherwise.

So the pool's per-asset counter `noteLiability[X]`, which the contract moves by `extAmount` on every accepted join-split, always equals the unspent note value of asset X. A note of an asset the pool does not list can only be worth 0, because value enters only through a listed asset's boundary: a transaction of an unfunded id has nothing but dummy inputs, and its non-negative outputs must therefore all be zero. Trying to spend a WETH note in a USDC transaction fails earlier still; under the transaction's asset that note hashes to a commitment that is not in the tree, so its membership check cannot pass.

`noteLiability[X]` is one of the four terms in the pool's [backing invariant](https://docs.fluton.io/concepts/token-formats.md), which is checked per asset and never mixes two of them.

## Canonical ExtData

If the public fields of a transaction were free-form, they would fingerprint the software that built it, and a fingerprint is a link. So the pool requires `ExtData` to be **canonical**: every field a route does not use must be zero, and anything else reverts.

| Field | When it may be non-zero |
| - | - |
| `recipient` | only when tokens leave the pool |
| `withdrawFee` | only when tokens leave the pool, and exactly the fee of that amount |
| `referrer` | only when tokens enter the pool, and never the pool itself |
| `asset` | zero exactly when `extAmount` is zero |
| `format` | confidential or public; must be confidential when `extAmount` is zero |
| `depositId` | only in a finalization of an eTOKEN deposit receipt |
| `chainId`, `pool` | always this chain and this pool |
| `encryptedOutputs` | always exactly three blobs of 168 bytes each |

A violation gets a specific error: `NonCanonicalExtData`, `HiddenTransactionNamesAsset`, `InvalidCiphertext`, `DepositIdNotAllowed`, `WrongChain`, `WrongPool` rather than a silent acceptance. And because `extDataHash` binds the whole struct, a submitter cannot quietly fill a field in to mark the transaction either ([Notes and proofs](https://docs.fluton.io/concepts/notes-and-proofs.md)).

What the two formats mean for crossing the boundary is on [TOKEN and eTOKEN](https://docs.fluton.io/concepts/token-formats.md); the contract-level registry and errors are in [Contracts](https://docs.fluton.io/reference/contracts.md), and the asset constraint in [Circuits](https://docs.fluton.io/reference/circuits.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.