A Twitter bot that automatically tweets images of newly minted Boun NFTs on Berachain. The bot monitors the Bouns auction contract to detect new mints and posts the NFT artwork to Twitter.
- 🔄 Automatically detects new Boun NFT mints via auction contract
- 🖼️ Fetches on-chain SVG artwork and converts to PNG
- 🐦 Posts tweets with NFT images
- 🐳 Runs in a Docker container
- 🚫 Stateless - no database required
- ⚡ Smart polling based on auction end times
- 🎯 Handles burned tokens correctly by tracking auction state
- Docker installed on your system
- Twitter API credentials (from Twitter Developer Portal)
- Berachain RPC endpoint
- Boun NFT contract address
- Boun Auction 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
NFT_CONTRACT_ADDRESS=your_nft_contract_address_here
AUCTION_CONTRACT_ADDRESS=your_auction_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 |
NFT_CONTRACT_ADDRESS |
Boun NFT contract address |
AUCTION_CONTRACT_ADDRESS |
Boun Auction 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 monitors the auction contract to detect new Bouns
- Smart polling adjusts frequency based on auction end times
- SVG images are converted to PNG using cairosvg
- Error handling ensures the bot continues running despite temporary failures
- No persistent storage - restarts will pick up from current auction state
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