> For the complete documentation index, see [llms.txt](https://docs.yifi.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.yifi.io/swap-types/on-chain-swaps.md).

# On-chain Swaps

## On-chain Swaps

> Swap or bridge any supported token through audited routers – your funds never leave your control.

### What is an on-chain swap?

An on-chain swap is the most direct way to trade: execution happens entirely through smart contracts, and YiFi never takes possession of your funds at any point.

Rather than routing you to a single DEX, YiFi aggregates across on-chain route builders – [on-chain providers](/coverage/providers.md#providers) –  comparing routes across DEXs, bridges, and cross-chain aggregators to find the best available output for your pair and amount.

### **Core features**

* **Best available rate.** Routes are compared across every connected [on-chain builder](/coverage/providers.md#on-chain-providers) before you sign, rather than checking one DEX at a time.
* **Fully non-custodial.** Every swap is enforced by a smart contract and settles directly between your wallet and the liquidity source.
* **Fee transparency.** Network gas and provider fees are factored into the quoted output before you sign – no surprises after the fact.
* **EVM, Solana and multiple L1 coverage.** On-chain routing spans EVM networks, Solana and Layer 1 blockchains; see [Coverage](/coverage/chains-soon.md) for the live, queryable list.&#x20;

### How it works

{% stepper %}
{% step %}
**Request a quote**

Enter your source and destination tokens and an amount. YiFi queries connected on-chain route builders and returns the best available route.
{% endstep %}

{% step %}
**Approve, if needed**

First-time swaps of a given token may require a one-time token approval.
{% endstep %}

{% step %}
**Sign transaction calldata**

Confirm the transaction in your wallet. Same-chain swaps settle atomically; cross-chain routes execute as a multi-step bridge-and-swap sequence.
{% endstep %}

{% step %}
**Delivery**

The destination token arrives in your wallet on the target chain.
{% endstep %}
{% endstepper %}

### Who it's for

**Good fit for:**

* Traders who want the best available rate and lowest slippage
* Users who want the fastest path for a same-chain or cross-chain move
* Anyone who wants 100% on-chain, smart-contract-verifiable execution

**Not the best fit for:**

* Privacy-focused users – on-chain swaps are fully public and traceable (use [Private Swaps](/swap-types/private-swaps.md) instead)
* Users who'd rather not connect a wallet or sign a transaction (use the [off-chain rail](/swap-types/off-chain-swaps.md) instead)

### **On-chain Swaps –** Summary at a glance

* **Privacy:** Low – fully public and verifiable on-chain.
* **Speed:** Fast – typically seconds to a few minutes, depending on chain and route.
* **Custody:** Non-custodial throughout.
* **Best for:** Best-rate execution with full on-chain transparency.

### Integrating

On-chain routes are quoted and executed through the same lifecycle as the other rails (quote → order → status). See the private routing endpoints in the API Reference.
