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

# DeFi Intents: Intent-Based Execution Explained

> Learn about DeFi intents: intent-based transaction execution, how solvers work, and why intents are revolutionizing decentralized finance user experience

# DeFi Intents: Intent-Based Execution Explained

<Accordion title="What are DeFi intents?">
  **DeFi intents** are a new paradigm where users express *what* they want to achieve rather than *how* to achieve it. Instead of manually constructing transactions, users declare their desired outcome:

  | Traditional Approach                                                                        | Intent-Based Approach                      |
  | ------------------------------------------------------------------------------------------- | ------------------------------------------ |
  | "Call Uniswap router at 0x... with exactInputSingle, set path to WETH→USDC, amount 1e18..." | "Swap 1 ETH for USDC with best price"      |
  | User must know contracts, routes, parameters                                                | User states goal, system handles execution |

  The intent infrastructure finds the optimal path, handles approvals, and executes the transaction—all from a simple declaration.
</Accordion>

<Accordion title="How do DeFi intents work?">
  Intent-based systems have several components:

  ```
  ┌──────────────────────────────────────────────────────────┐
  │                    User Intent                            │
  │           "Swap 1 ETH → USDC, best price"                │
  └──────────────────────────────────────────────────────────┘
                             │
                             ▼
  ┌──────────────────────────────────────────────────────────┐
  │                    Intent Solver                          │
  │  • Queries multiple DEXs (Uniswap, Curve, 1inch...)     │
  │  • Finds optimal route and price                         │
  │  • Handles token approvals                               │
  │  • Manages slippage protection                           │
  └──────────────────────────────────────────────────────────┘
                             │
                             ▼
  ┌──────────────────────────────────────────────────────────┐
  │                   Execution Layer                         │
  │  • Bundles operations efficiently                        │
  │  • Submits atomic transaction                            │
  │  • Handles gas payment                                   │
  └──────────────────────────────────────────────────────────┘
  ```

  1. **User submits intent**: Declares desired outcome
  2. **Solver processes**: Finds optimal execution path
  3. **Quote generated**: User sees exact outcome before signing
  4. **Atomic execution**: All operations execute together
</Accordion>

<Accordion title="What types of intents are supported?">
  Biconomy's intent system supports a wide range of DeFi operations:

  | Intent Type  | Description                    | Example                                  |
  | ------------ | ------------------------------ | ---------------------------------------- |
  | **Swap**     | Exchange one token for another | "Swap 100 USDC for ETH"                  |
  | **Bridge**   | Move assets across chains      | "Bridge 1 ETH from Ethereum to Base"     |
  | **Deposit**  | Add liquidity or stake         | "Deposit 1000 USDC into Aave"            |
  | **Withdraw** | Remove liquidity or unstake    | "Withdraw all from Compound"             |
  | **Borrow**   | Take a loan                    | "Borrow 500 USDC against ETH collateral" |
  | **Repay**    | Pay back loans                 | "Repay 50% of my AAVE debt"              |

  ```typescript theme={null}
  // Intent examples with Biconomy
  const swapIntent = {
    type: "intent",
    intent: "swap",
    params: {
      from: { token: "ETH", amount: "1.0" },
      to: { token: "USDC" },
      slippage: 0.5 // 0.5% max slippage
    }
  };

  const bridgeIntent = {
    type: "intent",
    intent: "bridge",
    params: {
      token: "USDC",
      amount: "1000",
      fromChain: 1,
      toChain: 8453
    }
  };
  ```
</Accordion>

<Accordion title="What are intent solvers?">
  **Solvers** are specialized services that fulfill user intents by finding optimal execution paths. They compete to provide:

  * **Best prices**: Aggregate across DEXs, find arbitrage opportunities
  * **Lowest gas**: Optimize calldata and execution path
  * **Fastest execution**: Route through liquid pools
  * **MEV protection**: Shield users from sandwich attacks

  ```
  User Intent: "Swap 10 ETH → USDC"
                      │
          ┌───────────┼───────────┐
          ▼           ▼           ▼
     Solver A     Solver B     Solver C
     via Uniswap  via Curve    via 1inch
     $31,250      $31,300      $31,275
          │           │           │
          └───────────┼───────────┘
                      ▼
                Best: Solver B
                User gets $31,300
  ```

  Biconomy integrates with multiple solver networks to ensure users always get competitive execution.
</Accordion>

<Accordion title="How do intents differ from regular transactions?">
  | Aspect               | Regular Transactions       | Intent-Based                 |
  | -------------------- | -------------------------- | ---------------------------- |
  | **Specification**    | Exact calldata required    | Outcome-based declaration    |
  | **Route finding**    | User's responsibility      | Solver handles               |
  | **Optimization**     | Manual                     | Automatic                    |
  | **Composability**    | Complex to chain           | Native chaining support      |
  | **UX**               | Technical knowledge needed | Simple, declarative          |
  | **Failure handling** | User manages               | System optimizes for success |

  **Example comparison:**

  Regular transaction:

  ```typescript theme={null}
  // User must know exact contract, function, parameters
  const tx = {
    to: "0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45",
    data: "0x5ae401dc...", // Encoded swap params
    value: parseEther("1.0")
  };
  ```

  Intent-based:

  ```typescript theme={null}
  // Just declare what you want
  const intent = {
    intent: "swap",
    from: "ETH",
    to: "USDC", 
    amount: "1.0"
  };
  ```
</Accordion>

<Accordion title="Can intents span multiple chains?">
  Yes! Cross-chain intents are a core capability:

  ```typescript theme={null}
  const crossChainIntent = {
    instructions: [
      // Intent 1: Swap on source chain
      {
        chainId: 1,
        type: "intent",
        intent: "swap",
        params: { from: "ETH", to: "USDC", amount: "2.0" }
      },
      // Intent 2: Bridge to destination
      {
        type: "intent",
        intent: "bridge",
        params: { 
          token: "USDC",
          fromChain: 1,
          toChain: 8453
        }
      },
      // Intent 3: Deposit on destination
      {
        chainId: 8453,
        type: "intent",
        intent: "deposit",
        params: { protocol: "aave", token: "USDC" }
      }
    ]
  };
  ```

  The system:

  1. Finds optimal swap route on Ethereum
  2. Selects best bridge (cost vs. speed)
  3. Deposits on Base
  4. All with **one signature**
</Accordion>

<Accordion title="How does intent pricing work?">
  When you submit an intent, you receive a **quote** before execution:

  ```typescript theme={null}
  const quote = await biconomy.getQuote({
    intent: "swap",
    from: { token: "ETH", amount: "1.0" },
    to: { token: "USDC" }
  });

  console.log(quote);
  // {
  //   inputAmount: "1.0 ETH",
  //   outputAmount: "3125.50 USDC",
  //   minOutputAmount: "3109.87 USDC", // With 0.5% slippage
  //   route: "Uniswap V3 ETH→USDC",
  //   gasCost: "$2.50",
  //   priceImpact: "0.02%",
  //   validUntil: 1699900000
  // }
  ```

  The quote is:

  * **Guaranteed**: Execute within validity period for quoted price
  * **Slippage protected**: Minimum output amount enforced
  * **Transparent**: See route, fees, and price impact
</Accordion>

<Accordion title="What is intent composability?">
  Intents can be composed into complex workflows where each step depends on previous outputs:

  ```typescript theme={null}
  import { runtime } from "@biconomy/abstractjs";

  const composedIntents = [
    // Step 1: Swap ETH to USDC
    {
      type: "intent",
      intent: "swap",
      params: { from: "ETH", to: "USDC", amount: "1.0" }
    },
    // Step 2: Use EXACT output from step 1
    {
      type: "intent",
      intent: "deposit",
      params: {
        protocol: "aave",
        token: "USDC",
        amount: runtime.outputOf(0) // Dynamic reference
      }
    },
    // Step 3: Borrow against the deposit
    {
      type: "intent",
      intent: "borrow",
      params: {
        protocol: "aave",
        token: "DAI",
        amount: runtime.multiply(runtime.outputOf(0), 0.5) // 50% of deposited
      }
    }
  ];
  ```

  No leftover tokens, no estimation errors—execution is perfectly composed.
</Accordion>

<Accordion title="Are intents MEV-protected?">
  Yes, intent-based execution provides MEV protection through several mechanisms:

  | Protection             | How It Works                       |
  | ---------------------- | ---------------------------------- |
  | **Private submission** | Intents don't enter public mempool |
  | **Solver competition** | Solvers compete to give best price |
  | **Slippage bounds**    | Guaranteed minimum output          |
  | **Atomic execution**   | No intermediate states to exploit  |
  | **Trusted execution**  | Bundlers submit on user's behalf   |

  Unlike regular DEX swaps that can be sandwiched, intent-based swaps are protected from front-running and MEV extraction.
</Accordion>

<Accordion title="How do I use intents with Biconomy?">
  **Using AbstractJS SDK:**

  ```typescript theme={null}
  import { createMeeClient, buildIntent } from "@biconomy/abstractjs";

  const client = await createMeeClient({ account: smartAccount });

  // Build intent-based instructions
  const instructions = [
    buildIntent({
      type: "swap",
      from: { token: "ETH", chainId: 1, amount: "1.0" },
      to: { token: "USDC" }
    }),
    buildIntent({
      type: "bridge",
      token: "USDC",
      fromChain: 1,
      toChain: 8453
    })
  ];

  // Get quote and execute
  const quote = await client.getQuote({ instructions });
  const result = await client.executeQuote(quote);
  ```

  **Using Supertransaction API:**

  ```bash theme={null}
  curl -X POST "https://api.biconomy.io/v1/intent" \
    -H "x-api-key: $API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "intent": "swap",
      "params": {
        "from": { "token": "ETH", "amount": "1.0" },
        "to": { "token": "USDC" },
        "slippage": 0.5
      },
      "sender": "0x..."
    }'
  ```
</Accordion>

***

## Explore intent-based execution

<CardGroup cols={2}>
  <Card title="Onchain Orchestration" icon="diagram-project" href="/faq/onchain-orchestration">
    Coordinate complex multi-step operations
  </Card>

  <Card title="Multi-Chain Execution" icon="link" href="/faq/multi-chain-execution">
    Execute across chains with one signature
  </Card>
</CardGroup>
