Quick Start
Get the Base Audit Bot up and running in minutes. This guide will take you from zero to a fully operational bot monitoring the Base blockchain.Prerequisites: Python 3.11+, Git, and API keys for Basescan, Anthropic, and Twitter. See Installation for detailed setup.
Install Dependencies
Install all required Python packages:This installs:
web3>=6.0.0- Blockchain interactionanthropic>=0.40.0- Claude AI APItweepy>=4.14.0- Twitter integrationflask>=3.0.0- Webhook servergitpython>=3.1.40- Repository cloningrequests>=2.31.0- HTTP clientpython-dotenv>=1.0.0- Environment configuration
Configure Environment
Copy the environment template and add your API keys:Edit
.env with your favorite editor and add your credentials:.env
See Installation for detailed instructions on obtaining each API key.
Verify Operation
The bot is now running! Here’s what it’s doing:
- Scanning blocks every 15 minutes (configurable)
- Finding contracts with bytecode size ≥ 100 bytes
- Checking verification status on Basescan
- Discovering GitHub repos from verified source code
- Running audits with Claude AI
- Posting to Twitter when issues are found
./logs/bot.log for detailed activity:What Happens Next?
Once running, the bot operates autonomously:- Every 15 minutes (by default), it scans the latest 100 blocks on Base
- For each new contract deployment found:
- Checks if the contract is verified on Basescan
- Attempts to find the GitHub repository
- Clones the repo and finds all Solidity files
- Sends each file to Claude for security analysis
- Aggregates findings by severity (Critical/High/Medium/Low)
- Posts audit results to Twitter with contract details
- Monitors repositories for updates via webhooks
- Posts daily summaries at midnight UTC
- Responds to DM commands for manual audit requests
Expected Output
Successful Contract Audit
Unverified Contract (Skipped)
Testing the Bot
Test DM Commands
Send a direct message to your Twitter bot account:Docker Quick Start
Prefer containers? Use Docker Compose:Troubleshooting
Bot won’t start
No contracts being found
- Check RPC connection: Verify
BASE_RPC_URLis accessible - Increase block range: Set
BLOCKS_TO_SCAN=1000for more coverage - Lower size threshold: Set
MIN_CONTRACT_SIZE=50to catch smaller contracts
Twitter posting fails
- Verify all 5 Twitter credentials are set correctly
- Check app permissions include read/write access
- Ensure rate limits aren’t exceeded (bot respects limits)
Audits not running
- Check
ANTHROPIC_API_KEYis valid and has credits - Verify contracts are verified on Basescan
- Check logs for specific Claude API errors
Next Steps
Installation Guide
Detailed setup instructions and API key generation
Configuration
Customize scan intervals, webhook setup, and more
Architecture
Understand how the bot components work together
API Reference
Explore the codebase and extend functionality