> For the complete documentation index, see [llms.txt](https://docs.ws.exchange/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.ws.exchange/protocol-overview/how-whiteswap-works.md).

# How WhiteSwap Works

![](/files/-MNNp6prV2xnBeyyz6DC)

WhiteSwap is an *automated liquidity protocol* powered by a [constant product formula](/protocol-overview/glossary.md#constant-product-formula) and implemented in a system of non-upgradeable smart contracts on the [Ethereum](https://ethereum.org/) blockchain. It obviates the need for trusted intermediaries, prioritizing **decentralization**, **censorship resistance**, and **security**. WhiteSwap is **open-source software** licensed under the [GPL](https://en.wikipedia.org/wiki/GNU_General_Public_License).

Each WhiteSwap smart contract, or pair, manages a liquidity pool made up of reserves of two [ERC20](https://eips.ethereum.org/EIPS/eip-20) tokens.

Anyone can become a liquidity provider for a pool by depositing an equivalent value of each underlying token in return for pool tokens. These tokens track pro-rata liquidity provider (LP) shares of the total reserves, and can be redeemed for the underlying assets at any time.

![](/files/-MNNpA7IfDDAbu0-o19X)

Pairs act as automated market makers, standing ready to accept one token for the other as long as the “constant product” formula is preserved. This formula, most simply expressed as `x * y = k`, states that trades must not change the product (`k`) of a pair’s reserve balances (`x` and `y`). Because `k` remains unchanged from the reference frame of a trade, it is often referred to as the invariant. This formula has the desirable property that larger trades (relative to reserves) execute at exponentially worse rates than smaller ones.

In practice, WhiteSwap applies a 0.30% fee to trades, which is added to reserves. As a result, each trade actually increases `k`. This functions as a payout to LPs, which is realized when they burn their pool tokens to withdraw their portion of total reserves. In the future, this fee may be reduced to 0.25%, with the remaining 0.05% withheld as a protocol-wide charge.

![](/files/-MNNpE2xVsc_5BtecQnv)

Because the relative price of the two pair assets can only be changed through trading, divergences between the WhiteSwap price and external prices create arbitrage opportunities. This mechanism ensures that WhiteSwap prices always trend toward the market-clearing price.

## Further reading <a href="#further-reading" id="further-reading"></a>

To see how token swaps work in practice, and to walk through the lifecycle of a swap, check out [Swaps](https://docs.ws.exchange/core-concepts/swaps). Or, to see how liquidity pools work, see [Pools](https://docs.ws.exchange/core-concepts/pools).

Ultimately, of course, the WhiteSwap protocol is just smart contract code running on Ethereum. To understand how they work, head over to [Smart Contracts](/protocol-overview/smart-contracts-1.md).


---

# 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:

```
GET https://docs.ws.exchange/protocol-overview/how-whiteswap-works.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
