Skip to content

AI Agent that gives crypto users details about their on-chain activity and proposes actions to them for profitability.

Notifications You must be signed in to change notification settings

swarmzero/web3-wrapped

Repository files navigation

Web3 Wrapped

AI-powered analysis of your on-chain activity, delivering personalized insights with a fun, meme-worthy twist. Get your 2024 Web3 Wrapped analysis by running the tool directly or tweeting your wallet address to the bot.

Overview

Web3 Wrapped is an AI-powered analytics tool that provides personalized insights into users' crypto trading activities. Similar to Spotify Wrapped, it analyzes on-chain data to create shareable summaries of your trading patterns, portfolio composition, and behavior - all delivered with humor and crypto culture references.

Features

  • Multi-Chain Support: Currently supports Base (EVM) and Solana chains
  • Year-in-Review Analysis: Comprehensive analysis of your 2024 trading activity
  • Trading Pattern Analysis: Evaluates your trading timing, frequency, and style
  • PnL Tracking: Highlights your best and worst trades of the year
  • Token Categories: Analyzes your token preferences using CoinGecko categories
  • Shareable Results: Tweet-sized analysis (under 280 characters)
  • Twitter Bot Integration: Get your analysis by tweeting your wallet address

Architecture

The project uses a swarm of specialized AI agents that analyze different aspects of your wallet:

  • EVM Analyst Agent: Analyzes Base chain activity with a focus on:

    • Trading patterns and timing
    • Token preferences and choices
    • PnL performance and notable trades
  • Solana Analyst Agent: Analyzes Solana chain activity with a focus on:

    • SPL token trading behavior
    • Meme token participation
    • Notable trades and timing

Environment Variables

Create a .env file with the following:

# Required API Keys
MORALIS_API_KEY=           # Required: For fetching on-chain data from Base and Solana
COINGECKO_API_KEY=         # Required: For token categorization and price data

# API URLs (Optional - defaults provided)
MORALIS_BASE_URL=https://deep-index.moralis.io/api/v2.2
MORALIS_SOLANA_URL=https://solana-gateway.moralis.io

# SwarmZero Configuration
SWARMZERO_DATABASE_URL=    # Required for production: PostgreSQL connection URL
SWARMZERO_LOG_LEVEL=INFO   # Optional, defaults to INFO

# Twitter Bot Configuration (Optional)
TWITTER_API_KEY=
TWITTER_API_SECRET=
TWITTER_ACCESS_TOKEN=
TWITTER_ACCESS_TOKEN_SECRET=
TWITTER_BEARER_TOKEN=
TWITTER_BOT_USERNAME=
TWITTER_ENABLE_STREAMING=false  # Optional: Enable streaming mode if you have Pro access

# Logging Configuration
LOG_LEVEL=INFO            # Optional, defaults to INFO

Setup

  1. Clone the repository
  2. Install Poetry if you haven't already:
curl -sSL https://install.python-poetry.org | python3 -
  1. Install dependencies:
poetry install
  1. Copy .env.example to .env and add your API keys
  2. Run the database migration:
python -m scripts.db.migrate_coins

This will migrate the coin dictionary from data/coin_dict.json to the PostgreSQL database. Ensure that the SWARMZERO_DATABASE_URL in your .env file is set to the correct database URL.

  1. Run the application:
# Interactive console mode
poetry run python main.py

# Twitter bot mode
poetry run python main.py --twitter-bot

Usage

Interactive Console

The console mode allows you to analyze any wallet address directly:

  1. Run the application: poetry run python main.py
  2. Enter a wallet address when prompted
  3. Get a personalized analysis of the wallet's 2024 activity

Twitter Bot

The bot responds to mentions with wallet analyses:

  1. Tweet your wallet address to the bot
  2. The bot will reply with your personalized Web3 Wrapped analysis
  3. Analysis includes trading patterns, notable trades, and token preferences

Deployment Guide

Prerequisites

  • Git repository with your code
  • Render.com account
  • API keys for Moralis and CoinGecko
  • Twitter Developer Account (if using Twitter bot)
  • PostgreSQL database

Render.com Deployment

  1. Database Setup:

    • Create a new PostgreSQL database in Render
    • Note the Internal Database URL
    • Modify the URL:
      • Change scheme from postgresql to postgresql+asyncpg
      • Use this as SWARMZERO_DATABASE_URL in your env vars
  2. Background Worker Setup:

    • Create a new Background Worker service
    • Connect to your repository
    • Configure build settings:
      • Build Command: curl -sSL https://install.python-poetry.org | python3 - && poetry install
      • Start Command: poetry run python main.py --twitter-bot
  3. Environment Variables: Add all required environment variables to your worker:

    MORALIS_API_KEY=
    COINGECKO_API_KEY=
    SWARMZERO_DATABASE_URL=
    LOG_LEVEL=INFO
    TWITTER_API_KEY=
    TWITTER_API_SECRET=
    TWITTER_ACCESS_TOKEN=
    TWITTER_ACCESS_TOKEN_SECRET=
    TWITTER_BEARER_TOKEN=
    TWITTER_BOT_USERNAME=
    
  4. Database Migration:

    • After deployment, run the coin dictionary migration:
    python -m scripts.db.migrate_coins

    This will populate the database with necessary coin data from data/coin_dict.json.

  5. Deploy:

    • Click "Create Background Worker"
    • Monitor the deployment logs
    • Check worker status in Render dashboard

Monitoring and Maintenance

  • Use Render's logging interface to monitor the worker
  • Set up alerts for service interruptions
  • Monitor API rate limits and usage

About

AI Agent that gives crypto users details about their on-chain activity and proposes actions to them for profitability.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages