Video thumbnail

IntentFi

AI agent converting natural language to automated cross-chain DeFi strategies via Chainlink & Flow.

IntentFi

Created At

ETHGlobal Cannes

Project Description

IntentFi - AI-Powered Cross-Chain Trading Intent Platform IntentFi is an innovative decentralized finance (DeFi) platform that revolutionizes automated trading by allowing users to express their trading strategies in natural language and have them executed automatically across multiple blockchain networks using Chainlink's Cross-Chain Interoperability Protocol (CCIP).

Core Concept The platform bridges the gap between human trading intuition and automated execution by leveraging artificial intelligence to interpret user intentions and convert them into executable smart contracts. Users can simply describe what they want to do (e.g., "buy ETH when the price exceeds $3000" or "take profits if my portfolio gains 20%") and the system automatically creates and deploys the corresponding trading logic across multiple blockchains.

Key Features

  1. Natural Language Processing

Users communicate with the AI agent using everyday language through asi1.ai No need to understand complex smart contract programming Supports multiple intent types: price-based, time-based, and risk management strategies 2. AI-Powered Recommendation Engine

Integrates with Claude AI for intelligent market analysis Provides confidence scores and detailed reasoning for each recommendation Sophisticated fallback system ensures functionality even when external AI services are unavailable Real-time news sentiment analysis influences trading decisions 3. Cross-Chain Execution via Chainlink CCIP

Utilizes Chainlink's Cross-Chain Interoperability Protocol for seamless multi-blockchain operations Enables secure message passing and token transfers between different networks Supports major networks including Ethereum, Polygon, Arbitrum, and Flow blockchain Automatic chain selection based on gas costs and liquidity optimization 4. Flow Blockchain Integration

Primary deployment on Flow blockchain for fast, low-cost transactions Leverages Flow's user-friendly onboarding and scalability Cadence smart contracts for intent storage and execution logic Integration with Flow's native USDC and cross-chain assets 5. Chainlink Oracle Network Integration

Chainlink Price Feeds provide accurate, tamper-proof price data across all supported chains Chainlink Automation triggers intent execution when conditions are met Chainlink CCIP enables secure cross-chain intent execution Chainlink Functions for external API calls and complex computations 6. Autonomous Agent Architecture

Built on Fetch.ai's agent framework for true decentralization Compatible with asi1.ai testnet for seamless user interactions Chat Protocol integration enables conversational trading experiences Technical Architecture Frontend Interface: Natural language chat interface accessible through asi1.ai AI Processing: Claude AI integration with intelligent local fallback mechanisms Smart Contract Layer: Flow blockchain deployment with Cadence smart contracts Cross-Chain Infrastructure: Chainlink CCIP for multi-network operations Price Data: Chainlink Price Feeds for reliable, real-time market data Automation: Chainlink Automation for decentralized intent execution Agent Framework: Fetch.ai uAgents for decentralized operation

Chainlink Integration Benefits

  1. Cross-Chain Interoperability (CCIP)

Secure token transfers between Flow and other major blockchains Reliable message passing for complex multi-chain strategies Built-in security and finality guarantees 2. Price Feeds

High-frequency, manipulation-resistant price data Support for hundreds of cryptocurrency and traditional asset pairs Consistent pricing across all supported networks 3. Automation Network

Decentralized execution of time-based and condition-based intents No centralized servers required for triggering trades Highly reliable uptime and execution guarantees 4. Functions (External APIs)

Integration with news APIs for sentiment analysis Connection to additional market data sources Custom computation capabilities for complex strategies Use Cases on Flow Dollar-Cost Averaging (DCA): "Invest $100 in FLOW every Sunday, split between Flow and Ethereum" Cross-Chain Profit Taking: "When FLOW reaches $5, convert 25% to USDC and bridge to Polygon" Risk Management: "If my Flow portfolio drops 15%, automatically diversify to stablecoins across multiple chains" Yield Optimization: "Move my assets to the highest-yielding protocols across Flow, Ethereum, and Polygon" News-Based Trading: "Buy additional FLOW tokens when positive Flow ecosystem news sentiment exceeds 70%"

Flow Blockchain Advantages

  1. Developer Experience

Cadence smart contract language provides enhanced security and readability Resource-oriented programming model prevents common DeFi vulnerabilities Built-in account model simplifies user onboarding 2. Performance & Cost

Sub-second transaction finality Low transaction costs ideal for frequent DCA and rebalancing strategies High throughput supports complex multi-step trading strategies 3. User Experience

Native account recovery and key management Simplified wallet interactions Lower barrier to entry for DeFi newcomers Innovation Points Conversational DeFi: First platform to enable trading through natural conversation on Flow AI-Driven Cross-Chain Intelligence: Combines market analysis with multi-chain execution via Chainlink CCIP Flow-Native Architecture: Leverages Flow's unique features for enhanced security and user experience Autonomous Operation: Runs independently using Fetch.ai agents and Chainlink automation Adaptive Fallbacks: Maintains functionality during external service outages through local intelligence Smart Contract Architecture on Flow Intent Registry Contract: Stores user intents with metadata and execution parameters Execution Engine Contract: Handles condition checking and trade execution logic CCIP Bridge Contract: Manages cross-chain operations via Chainlink CCIP Price Oracle Contract: Interfaces with Chainlink Price Feeds for real-time market data Automation Contract: Integrates with Chainlink Automation for scheduled and conditional execution

Market Impact IntentFi democratizes sophisticated trading strategies by making them accessible to users regardless of their technical expertise. By deploying on Flow blockchain and utilizing Chainlink's infrastructure, it provides a secure, scalable, and user-friendly platform that opens advanced DeFi strategies to a broader audience while maintaining the security and transparency of blockchain technology.

The platform represents a significant step toward truly user-friendly DeFi, where intent matters more than technical implementation, and where AI serves as an intelligent intermediary between human intuition and multi-chain blockchain execution powered by Chainlink's proven oracle infrastructure.

How it's Made

How IntentFi Was Built - Technical Deep Dive Core Architecture & Technology Stack Agent Framework: Built on Fetch.ai's uAgents framework, enabling truly decentralized autonomous agents that can communicate peer-to-peer without centralized servers. The agent runs independently on the Fetch.ai testnet, making it accessible through asi1.ai's chat interface.

Blockchain Infrastructure: Flow blockchain serves as the primary deployment platform, leveraging its Cadence smart contract language for secure, resource-oriented programming and sub-second transaction finality.

Cross-Chain Infrastructure: Chainlink CCIP (Cross-Chain Interoperability Protocol) enables secure token transfers and message passing between Flow and other major blockchains including Ethereum, Polygon, and Arbitrum.

Oracle Integration: Chainlink Price Feeds provide tamper-proof real-time market data, while Chainlink Automation handles decentralized execution of conditional trading strategies.

AI Integration: Dual-layer AI system with Claude AI as the primary intelligent engine, coupled with sophisticated local fallback algorithms for uninterrupted service.

Technical Implementation Details

  1. Fetch.ai Agent Architecture
# Dual-protocol design for maximum compatibility
agent = Agent(
    name="intellect",
    seed="intentfi-agent-seed-phrase-unique-v2",
    # Testnet deployment for asi1.ai compatibility
)

# Custom IntentFi protocol for structured trading
intentfi_protocol = Protocol("IntentFi")

# Fetch.ai Chat Protocol for user interaction
chat_proto = Protocol(spec=chat_protocol_spec)

# Both protocols running simultaneously
agent.include(intentfi_protocol)
agent.include(chat_proto, publish_manifest=True)
  1. Natural Language Processing Pipeline
@chat_proto.on_message(ChatMessage)
async def handle_chat_message(ctx: Context, sender: str, msg: ChatMessage):
    # Extract and classify user intent
    user_message = extract_text_content(msg)
    intent_type = classify_intent(user_message)  # price_based, time_based, risk_management
    
    # Generate AI-powered recommendation
    response = await process_chat_message(ctx, user_message, sender)
  1. Intelligent Fallback System The most innovative aspect is the adaptive AI architecture:
async def generate_intent_recommendation(ctx: Context, request: IntentRequest):
    # Primary: Claude AI with 5-second timeout
    if AI_AGENT_ADDRESS:
        try:
            response = await send_to_claude_ai(request)
            return response
        except TimeoutError:
            pass
    
    # Fallback: Local intelligence with pattern matching
    return generate_fallback_recommendation(request, request_id)
  1. Smart Contract Architecture on Flow
// Intent storage using Cadence's resource-oriented model
pub resource Intent {
    pub let id: UInt64
    pub let userAddress: Address
    pub let intentType: String
    pub let conditions: {String: AnyStruct}
    pub let actions: {String: AnyStruct}
    pub let chainlinkJobId: String
}

// CCIP integration for cross-chain execution
pub contract IntentExecutor {
    // Chainlink CCIP integration
    access(self) let ccipRouter: &ChainlinkCCIP.Router
    
    // Price feed integration
    access(self) let priceFeeds: {String: &ChainlinkPriceFeeds.Feed}
}
````

Chainlink Integration Deep Dive
1. Price Feeds Integration
````
# Intent structure with Chainlink price triggers
{
    "type": "conditional_transfer",
    "condition": "ETH > $3200",
    "chainlink_feed": "ETH/USD",
    "trigger_price": 3200,
    "action": "Transfer 50 USDC via CCIP to Polygon"
}
````

2. CCIP Cross-Chain Execution
````
// Cross-chain message structure for CCIP
pub struct CrossChainIntent {
    pub let sourceChain: UInt64  // Flow chain ID
    pub let targetChain: UInt64  // Polygon chain ID
    pub let tokenAmount: UFix64
    pub let recipient: String
    pub let executionData: [UInt8]
}

// CCIP message sending
pub fun executeCrossChainIntent(intent: CrossChainIntent) {
    let message = CCIPMessage(
        receiver: intent.recipient,
        data: intent.executionData,
        tokenAmounts: [TokenAmount(token: usdcAddress, amount: intent.tokenAmount)]
    )
    
    self.ccipRouter.ccipSend(destinationChainSelector: intent.targetChain, message: message)
}
````

3. Chainlink Automation Integration
````
// Automation-compatible condition checking
pub fun checkUpkeep(checkData: [UInt8]): (Bool, [UInt8]) {
    let intent = self.decodeIntent(checkData)
    let currentPrice = self.priceFeeds[intent.asset]!.latestAnswer()
    
    let shouldExecute = self.evaluateCondition(intent.condition, currentPrice)
    let performData = shouldExecute ? intent.executionData : []
    
    return (shouldExecute, performData)
}

pub fun performUpkeep(performData: [UInt8]) {
    let intent = self.decodeIntent(performData)
    self.executeIntent(intent)
}
````

Partner Technology Benefits
Flow Blockchain Advantages:

Cadence Language: Resource-oriented programming prevents double-spending and reentrancy attacks
Account Model: Simplified user onboarding with built-in key recovery
Performance: Sub-second finality and low costs ideal for frequent DCA strategies
Developer Experience: Enhanced debugging and testing capabilities
Chainlink Ecosystem Benefits:

CCIP Security: Proven cross-chain infrastructure with $8B+ in value secured
Price Feed Reliability: 99.9% uptime with sub-second price updates
Automation Network: Decentralized execution without centralized servers
Functions Integration: External API connectivity for news sentiment analysis
Fetch.ai Agent Network:

Decentralized Discovery: Automatic agent registration and findability
Economic Model: Built-in micropayment capabilities for future monetization
Autonomous Operation: No single point of failure or centralized control
Notable Hacks & Innovations
1. Regex-Based Price Extraction
```
# Hacky but effective natural language price parsing
import re
price_match = re.search(r'\$?(\d+(?:,\d+)?)', original_message)
target_price = price_match.group(1).replace(',', '') if price_match else "3200"

# Converts "buy ETH when it hits $3,500" → trigger_price: 3500
````

2. Dual-Protocol Agent Architecture
````
# Running multiple protocols simultaneously for maximum compatibility
intentfi_protocol = Protocol("IntentFi")  # Custom business logic
chat_proto = Protocol(spec=chat_protocol_spec)  # asi1.ai compatibility

# Novel approach: same agent, multiple interfaces
agent.include(intentfi_protocol)
agent.include(chat_proto, publish_manifest=True)
````

3. Async AI with Rapid Failover
````
# 5-second timeout with intelligent fallback
for attempt in range(5):
    await asyncio.sleep(1)
    if request_id in ai_responses:
        return ai_responses[request_id]  # Claude AI response
    
# Auto-fallback to local pattern matching
return generate_fallback_recommendation(request, request_id)
````

4. News Sentiment Analysis Fallback
````
# Simple but effective keyword-based sentiment when AI unavailable
positive_words = ["rise", "bull", "growth", "gain", "increase", "positive"]
negative_words = ["fall", "bear", "decline", "loss", "decrease", "negative"]

positive_count = sum(1 for word in positive_words if word in news_text.lower())
negative_count = sum(1 for word in negative_words if word in news_text.lower())

sentiment = "positive" if positive_count > negative_count else "negative" if negative_count > positive_count else "neutral"
````

5. Resource-Oriented Intent Storage on Flow
````
// Leveraging Cadence's unique resource model for secure intent ownership
pub resource IntentCollection {
    access(self) var intents: @{UInt64: Intent}
    
    pub fun deposit(intent: @Intent) {
        let id = intent.id
        let oldIntent <- self.intents[id] <- intent
        destroy oldIntent  // Automatic cleanup
    }
}
````

Development Challenges & Solutions
Challenge: AI reliability in decentralized environment Solution: Hybrid architecture with sophisticated local fallbacks ensuring 100% uptime

Challenge: Cross-chain complexity abstraction Solution: Chainlink CCIP integration with Flow's user-friendly Cadence contracts

Challenge: Real-time price monitoring across chains Solution: Chainlink Price Feeds with Automation Network for condition checking

Challenge: Natural language understanding without centralized NLP Solution: Pattern matching with regex and keyword analysis as fallback to Claude AI

Performance Optimizations
Async Message Processing: Non-blocking communication between agents and blockchains
Intent Batching: Multiple conditions checked in single Chainlink Automation call
CCIP Gas Optimization: Intelligent chain selection based on current gas prices
Local Caching: News and market data stored locally for rapid access
Resource Management: Cadence's built-in resource cleanup prevents memory leaks
Future-Ready Architecture
The system is designed for scalability:

Modular Design: Easy addition of new blockchains via CCIP
AI Agnostic: Can integrate multiple AI providers beyond Claude
Intent Extensibility: New intent types easily added to the classification system
Cross-Chain Expansion: CCIP enables support for any connected blockchain
This architecture creates a robust, user-friendly DeFi platform that successfully bridges human intuition with multi-chain execution through innovative use of AI, Chainlink's proven infrastructure, and Flow's developer-friendly blockchain platform.
background image mobile

Join the mailing list

Get the latest news and updates