Skip to main content

Intents

In NEAR, an intent is a high level declaration of what a user wants to achieve. Think of it as telling the blockchain "what" you want to do, not "how" to do it. For example, instead of manually:

  • Finding the best DEX for a token swap
  • Calculating optimal routes
  • Executing multiple transactions

You simply express: "I want to swap Token A for Token B at the best price."

NEAR Intents is a revolutionary transaction framework that simplifies blockchain interactions for:

  • Users
  • Services
  • AI agents

The key innovation is that users no longer need to handle complex cross-chain transactions themselves. Instead, they declare their desired outcome, and a specialized network of solvers (including both AI agents and traditional market participants) competes to execute that intent in the most optimal way possible.

info

The NEAR intents protocol and the documentation are under active development.

The protocol has been renamed from Defuse to NEAR Intents. Any mentions of Defuse in the source code and documentation are to be replaced.

How It Works​

  1. Intent Creation: A user or AI agent expresses a desired outcome (ex: Swap Token A for Token B) and broadcasts the intent to a Solver Network of their choice.

  2. Solvers Compete: A off-chain decentralized network of solvers compete to fulfill the request in the most optimal way. When the solver network finds the best solution, it presents it as a quote to the originating user/agent for approval.

  3. Intent Execution: If the quote from the Solver Network is accepted, the intent begins execution. This is done by the solver performing a contract call (execute_intents) to the Intents smart contract on NEAR (intents.near) and passing the intent details. This contract then fullfills the request and (if needed) uses a Bridge to broadcast the intent to the destination chain. The NEAR Intent smart contract also verifies state changes and ensures the intent is settled correctly, reporting the outcome to the originating user/agent.

Here is a sequence diagram of the intent flow:


Intent Creation​

Users and AI agents can create various types of intents to interact with assets across different chains. Each intent represents a specific desired outcome while abstracting away the complexity of execution.

The main intent types supported by the intents.near contract are:

  1. Swap Intent: Exchange one token for another at the best available rate
  2. Transfer Intent: Move tokens between addresses or chains
  3. FT Withdraw Intent: Withdraw fungible tokens from the protocol
  4. NFT Withdraw Intent: Withdraw non-fungible tokens from the protocol
  5. MT Withdraw Intent: Withdraw multiple tokens in a single transaction
  6. Native Withdraw Intent: Withdraw native blockchain tokens (e.g., NEAR)

Each intent follows a standard structure that includes:

  • Source assets and amounts
  • Desired outcome parameters
  • Optional constraints (e.g., minimum output amount, deadline)
  • User signature authorizing the intent

For example, a Swap Intent might look like:

{
type: "swap",
input: {
token: "usdc.near",
amount: "1000000000" // 1000 USDC (6 decimals)
},
output: {
token: "wrap.near",
minAmount: "1150000000000000000000000" // Minimum 1.15 wNEAR
},
deadline: 1703187600000
}

Solvers​

NEAR Intents uses decentralized networks of solvers to fulfill intents. Each solver network is an off-chain message bus that facilitates:

  1. Communication between users and solvers
  2. Exchange of permits (signed state changes) between participants
  3. Competition between solvers to provide optimal solutions

When an intent is broadcast, the solver network communicates with multiple solvers simultaneously. Each solver analyzes the intent and proposes their solution, including execution path and pricing. The solver network then aggregates these responses and selects the most optimal solution before presenting a final quote to the user or agent.

Solver networks are typically specific to a single distribution channel (like a DeFi application) and may contain authorized/trusted solvers for that channel. These solvers:

  • Monitor for new intent broadcasts
  • Calculate optimal execution paths
  • Compete to provide the best quotes
  • Execute approved intents through the NEAR smart contract
  • Handle cross-chain coordination when needed

The decentralized nature of solver networks ensures:

  • Competitive pricing through solver competition
  • Redundancy and reliability
  • Specialized solvers for different types of intents

Intent Execution​

When a user accepts a quote from the Solver Network, the intent begins execution. This is done by the solver performing a contract call (execute_intents) to the Intents smart contract on NEAR (intents.near) and passing the intent details.

The NEAR Intents contract fullfills the request and (if needed) uses a Bridge to settle an intent cross-chain. The Intent smart contract also verifies state changes and ensures the intent is settled correctly, reporting the outcome to the originating user/agent.


Examples​

Here are some live examples of NEAR Intents in action:

warning

Currently there is no testnet deployment.

Was this page helpful?