A Twitter bot that automatically tweets images of newly minted Boun NFTs on Berachain. The bot polls the contract every 5 minutes, detects new mints, and posts the NFT artwork to Twitter.
- 🔄 Automatically detects new Boun NFT mints
- 🖼️ Fetches on-chain SVG artwork and converts to PNG
- 🐦 Posts tweets with NFT images
- 🐳 Runs in a Docker container
- 🚫 Stateless - no database required
- ⚡ Handles multiple mints efficiently
- Docker installed on your system
- Twitter API credentials (from Twitter Developer Portal)
- Berachain RPC endpoint
- Boun NFT contract address
- Clone the repository:
git clone https://github.com/yourusername/bouns-bot.git
cd bouns-bot
- Create a
.env
file from the example:
cp .env.example .env
- Edit
.env
with your credentials:
RPC_URL=your_rpc_url_here
CONTRACT_ADDRESS=your_contract_address_here
TWITTER_API_KEY=your_twitter_api_key_here
TWITTER_API_SECRET=your_twitter_api_secret_here
TWITTER_ACCESS_TOKEN=your_twitter_access_token_here
TWITTER_ACCESS_SECRET=your_twitter_access_secret_here
- Build and run with Docker:
# Build the image
docker build -t bouns-bot .
# Run the container
docker run -d \
--name bouns-bot \
--env-file .env \
bouns-bot
-
Install Python 3.11 or higher
-
Install system dependencies (for cairosvg):
# Ubuntu/Debian
sudo apt-get install libcairo2-dev libpango1.0-dev
# macOS
brew install cairo pango
- Install Python dependencies:
pip install -r requirements.txt
- Run the bot:
python main.py
Variable | Description |
---|---|
RPC_URL |
Berachain RPC endpoint URL |
CONTRACT_ADDRESS |
Boun NFT contract address |
TWITTER_API_KEY |
Twitter API key |
TWITTER_API_SECRET |
Twitter API secret |
TWITTER_ACCESS_TOKEN |
Twitter access token |
TWITTER_ACCESS_SECRET |
Twitter access token secret |
Check container logs:
docker logs bouns-bot
-
Missing Twitter Credentials: The bot will run in mock mode, printing tweets to console instead of posting to Twitter.
-
RPC Issues: Check your RPC endpoint and ensure you have sufficient credits.
-
Container Crashes: Check logs with
docker logs bouns-bot
for error messages.
- The bot polls every 5 minutes to save RPC credits
- SVG images are converted to PNG using cairosvg
- Error handling ensures the bot continues running despite temporary failures
- No persistent storage - restarts will skip existing tokens
MIT
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request