Setup Guide
Get your AI trading agent up and running in minutes.
All set! Your environment is configured correctly.
Getting Started
Welcome to Polymarket AI Agent — an autonomous trading system that uses multi-model AI consensus to identify and execute trades on Polymarket.
1
Configure Environment Variables
Create a .env file in the root directory with the following:
# BlockRun AI Configuration (Required for AI analysis)
# Your Base chain wallet private key - used for x402 micropayments
BLOCKRUN_WALLET_KEY=your_base_chain_private_key_here
# Dashboard Login
ADMIN_USER=admin
ADMIN_PASS=your_secure_password_here
# Flask app settings
FLASK_SECRET_KEY=your_flask_secret_key_here
# Polymarket Trading (Required for placing bets)
# Polygon wallet private key for trading
POLYGON_WALLET_PRIVATE_KEY=your_polygon_private_key_here
# Trading settings (Kelly Criterion)
INITIAL_BANKROLL=100
MAX_BET_PERCENTAGE=0.05
MIN_EDGE_PERCENTAGE=0.15
2
Setup BlockRun AI (Pay-per-use AI)
BlockRun Wallet Setup
BlockRun uses x402 micropayments — no API keys needed, just a wallet with USDC on Base chain.
- Create a wallet on Base chain (e.g., using MetaMask)
- Export your private key for the
BLOCKRUN_WALLET_KEY - Fund it with USDC on Base (only ~$0.001 per AI request)
- Visit blockrun.ai for more info
Polymarket Trading Wallet
For trading on Polymarket, you need a separate wallet on Polygon chain:
- Create or use an existing Polygon wallet
- Export your private key for
POLYGON_WALLET_PRIVATE_KEY - Fund it with USDC on Polygon for trading
- The agent will use this wallet to place bets
Pro Tip: You can use the same private key for both wallets — the same key works on Base (for AI) and Polygon (for trading). Different chains, same address.
3
Run the Application
Start the Flask application:
python app.py
Visit http://127.0.0.1:5000 in your browser to access the dashboard.
Additional Resources
- BlockRun AI — Pay-per-use AI with x402 micropayments
- Polymarket Documentation
- Web3.py Documentation
- GitHub Repository