Installation
This guide covers everything you need to install and configure Base Audit Bot, including prerequisites, API key generation, and deployment options.Prerequisites
Before installing, ensure you have:Required Software
- Python 3.11 or higher - The bot uses modern Python features
- Git - For cloning repositories and the bot itself
- pip - Python package manager (included with Python)
Optional Software
- Docker & Docker Compose - For containerized deployment
- curl - For health check testing
API Keys Required
Installation Methods
Choose your preferred installation method:Python Virtualenv
Recommended for development and testing
Docker
Recommended for production deployment
Method 1: Python Virtualenv
Create Virtual Environment
Your terminal prompt should change to show
(venv) when the virtual environment is active.Install Dependencies
| Package | Version | Purpose |
|---|---|---|
| web3 | ≥6.0.0 | Ethereum/Base blockchain interaction |
| tweepy | ≥4.14.0 | Twitter API v2 client |
| anthropic | ≥0.40.0 | Claude AI API for auditing |
| flask | ≥3.0.0 | Webhook server |
| gitpython | ≥3.1.40 | Git repository operations |
| requests | ≥2.31.0 | HTTP requests |
| python-dotenv | ≥1.0.0 | Environment variable management |
| aiohttp | ≥3.9.0 | Async HTTP (optional) |
Method 2: Docker
Obtaining API Keys
Basescan API Key
Create Account
- Navigate to Basescan.org
- Click “Sign In” → “Click to sign up”
- Complete registration with email verification
Generate API Key
- Go to API Keys page
- Click “Add” to create a new API key
- Give it a descriptive name (e.g., “Base Audit Bot”)
- Copy the generated API key
Anthropic API Key
Create Account
- Visit Anthropic Console
- Sign up with your email or Google account
- Verify your email address
Add Credits
- Navigate to “Settings” → “Billing”
- Add payment method and credits
- The bot uses Claude Sonnet 4, which costs:
- Input: $3 per million tokens
- Output: $15 per million tokens
Generate API Key
- Go to “API Keys” in the console
- Click “Create Key”
- Name it (e.g., “Base Audit Bot”)
- Copy the key immediately (it won’t be shown again)
Twitter API Keys
Twitter requires the most credentials (5 different keys/tokens):Create Developer Account
- Go to Twitter Developer Portal
- Sign in with your Twitter account
- Click “Sign up for Free Account”
- Complete the application form:
- Choose “Hobbyist” → “Making a bot”
- Describe your bot’s purpose
- Agree to terms and conditions
Create Project and App
- In the Developer Portal, click “Projects & Apps”
- Create a new Project (name: “Base Audit Bot”)
- Create an App within the project
- Save the API Key and API Secret shown
Configure App Permissions
- Go to your app settings
- Navigate to “User authentication settings”
- Click “Set up”
- Enable OAuth 1.0a
- Set permissions to Read and Write
- Add callback URL (can be placeholder:
https://example.com) - Save changes
Generate Access Tokens
- Go to “Keys and Tokens” tab
- Under “Authentication Tokens”, click “Generate” for:
- Access Token
- Access Token Secret
- Also generate a Bearer Token if not already present
- Copy all tokens immediately
Configuration
Configuration Reference
| Variable | Description | Default | Required |
|---|---|---|---|
BASE_RPC_URL | Base mainnet RPC endpoint | https://mainnet.base.org | Yes |
BASESCAN_API_KEY | Basescan API key for contract verification | - | Yes |
ANTHROPIC_API_KEY | Anthropic API key for Claude | - | Yes |
TWITTER_API_KEY | Twitter OAuth 1.0a consumer key | - | Yes |
TWITTER_API_SECRET | Twitter OAuth 1.0a consumer secret | - | Yes |
TWITTER_ACCESS_TOKEN | Twitter access token | - | Yes |
TWITTER_ACCESS_SECRET | Twitter access token secret | - | Yes |
TWITTER_BEARER_TOKEN | Twitter API v2 bearer token | - | No* |
WEBHOOK_SECRET | Secret for GitHub webhook verification | - | No |
WEBHOOK_PORT | Port for webhook server | 5000 | No |
SCAN_INTERVAL_MINUTES | Minutes between scans | 15 | No |
BLOCKS_TO_SCAN | Number of blocks to scan per cycle | 100 | No |
MIN_CONTRACT_SIZE | Minimum bytecode size (bytes) | 100 | No |
LOG_LEVEL | Logging verbosity | INFO | No |
DATABASE_PATH | SQLite database location | ./data/bot.db | No |
TEMP_DIR | Temporary directory for clones | ./temp_repos | No |
*Bearer token is required for some Twitter API v2 endpoints like DM reading.
Running the Bot
Python Virtualenv
Docker
Verification
Next Steps
Configuration
Customize bot behavior and settings
Webhook Setup
Configure GitHub webhooks for repository monitoring
Deployment
Deploy to production environments
Troubleshooting
Common issues and solutions