Tweetrade Powered by Alith

Project Name

Tweetrade using Alith

Problem Statement

Despite the growing popularity of decentralized finance (DeFi), executing trades remains a technically intensive process. Many users lack the tools or knowledge to interact with smart contracts directly or navigate DEX aggregators efficiently. There’s also no seamless bridge between social interfaces like Twitter and on-chain trade execution.

Solution Overview

A Twitter-based AI trading bot built using Alith by LazAI can parse user commands from tweets or DMs, validate them with business logic, and securely execute trades through linked wallets. This makes DeFi trading accessible, social, and secure.

Project Description

This project creates a smart, Twitter-integrated AI agent that listens for trade instructions via tweets or DMs, understands the intent using a large language model (LLM), validates the context, and executes the trade via a smart contract wallet. It operates securely using Trusted Execution Environments (TEEs) and optionally anchors transaction proofs on-chain.

Innovative Components

  • Natural Language Trading: Accepts plain English commands for trading via Twitter.

  • TEE-Backed Wallet Security: Uses secure enclaves for private key handling.

  • Agent-Oriented Execution: Built on Alith’s AI agent architecture for composability and role definition.

  • Verifiable On-Chain Logging: Anchors execution proofs for full transparency.

  • Ownable Bots: Supports identity and governance features like iDAO roles.

Technical Structure

Component Tech Used
LLM GPT-4 or local LLM (Mistral, LLaMA via vLLM)
Agent Framework Alith by LazAI
Twitter Integration Twitter API v2 (via Tweepy/Node SDK)
Wallet Integration Smart contract wallets via Alith tooling
Secure Execution TEE-compatible compute with on-chain logging

Implementation Overview

  1. Setup Alith Agent: Configure an agent with a preamble to understand trading commands.

  2. Twitter Integration: Use Twitter’s API to detect tweets/DMs mentioning the bot.

  3. Command Parsing: Process messages using the LLM to extract structured instructions.

  4. Validation Layer: Apply filters for allowed tokens, trade limits, and safety rules.

  5. Wallet Execution: Use ethers.js or viem to sign and broadcast transactions.

  6. Response: Confirm action via tweet or DM.

  7. On-chain Anchoring (optional): Log transactions for proof and auditing.

Community Engagement Features

  • Social Trading: Users can follow or mirror each other’s trade commands.
  • Command Feeds: Public trade feeds for social proof and discovery.
  • Gamified Quests: Reward users for trade streaks or referrals.
  • iDAO Access Control: Community voting on trade policies or allowed assets.
13 Likes

Very cool concept! Bridging social platforms like Twitter with real on-chain trading could drastically lower the barrier for casual users.

Quick question: How do you plan to handle malicious or ambiguous tweet commands to avoid unintended trades?

3 Likes

Hello @penguinpecker ,

How does Tweetrade handle slippage, MEV protection, or multi-hop routes via DEX aggregators?

4 Likes

In order to prevent malicious commands, we put additional security flags in our llm model to limit the commands that dan be executed through tweets. Unless the flag becomes true to validate the command, the command wont go through. Additionally, we will import list of whitelisted tokens from 3rd party dex to limit the interaction with only legit tokens.

3 Likes

That’s a solid approach to safeguard your LLM interactions-implementing security flags adds a crucial layer of validation before executing commands. Integrating a whitelist from trusted DEXs further ensures that only legitimate tokens are involved, reducing risk significantly. Together, these measures create a robust defense against malicious inputs while maintaining functionality. Well done!

2 Likes

When we push the transaction through dex apis, we will have default values of slippage pre defined, at later stage more options can be given to user to define slippage right from the tweets.
To prevent Mev, We can use private rpcs provided by ankr, alchemy.
The multi hop routes are handled by dex aggregator themselves and we have little control over them.

4 Likes

Understood on the multi-hop routes being managed by the DEX aggregators themselves. Looking forward to seeing how this evolves! :slight_smile:

best wishes !

5 Likes

Looks promising, using alith opens endless ideas, I like this one

4 Likes

This is a really practical and much-needed idea. Connecting Twitter UX with on-chain trading can truly lower the barrier for many retail users — especially in the current market where simplified experiences really matter. I also like the use of TEE for wallet security and on-chain logging for transparency. Excited to see how the agent evolves and how you plan to drive adoption from crypto-native + new audiences

4 Likes

Looks promising, using alith opens endless ideas

5 Likes

really expect, alith actually makes change

5 Likes

Hi guys @penguinpecker @priyankg3 @han , interesting to see you guys interested for this idea.

But I think this wont work because I have already explored this idea and seen many existing teams building it . But the high Twitter API cost would make it un-feasible to execute such idea.

Twitter’s API doesn’t let you to effectively detect and then call smart contract. Plus the existing OKX solution will probably get more adoption.

3 Likes

Twitter API cost optimization is another debate. No one has built this on Metis yet, especially with Alith. As of now, only Bankr has a bot live on Base. I believe if executed well, Tweetrade has strong potential and adds a fun element to on-chain activity. Also, Twitter doesn’t need to call the smart contract directly. it’s just the Twitter API stream getting triggered, parsing the content, and passing it to the LLM model, then to Alith.

3 Likes