Predikto is a Telegram bot that allows users to create and participate in prediction markets on the Aptos blockchain. This project combines the power of AI with blockchain technology to enable decentralized betting on future events.
- Create Prediction Markets: Users can create markets about any future event by simply describing it in natural language
- Aptos Blockchain Integration: All markets are created on-chain for transparency and security
- AI-Powered Interaction: Uses Claude AI to understand user intent and extract prediction details
- Wallet Management: Create new Aptos wallets or import existing ones
- Transaction Tracking: View your prediction market transactions on Aptos Explorer
- Start the Bot: Use the
/startcommand to create or import an Aptos wallet - Create a Market: Simply mention betting-related keywords along with what you want to bet on
- Example: "Let's bet on whether BTC will reach $200k by the end of the year"
- AI Processing: The bot extracts the question, description, and end date from your message
- On-Chain Creation: The prediction market is created on the Aptos blockchain
- Place Bets: Users can place bets on the outcome (Yes/No)
- Frontend: Telegram Bot API
- Backend: Next.js API routes
- Blockchain: Aptos (Testnet)
- AI: Claude 3.5 Sonnet via Anthropic API
- Agent Framework: Move Agent Kit & LangChain
- Database: MongoDB for user wallet management
-
Set environment variables:
TELEGRAM_BOT_TOKEN: Your Telegram bot tokenANTHROPIC_API_KEY: API key for Claude AIPANORA_API_KEY: API key for PanoraNEXT_PUBLIC_MONGO_URL: MongoDB connection string
-
Install dependencies:
pnpm install -
Run the development server:
pnpm run dev -
Set up webhook for your Telegram bot:
- Use ngrok or similar tool to expose your local server
- Set the webhook URL to
https://your-url.app/api/bot - Example:
curl https://api.telegram.org/bot<YOUR_BOT_TOKEN>/setWebhook?url=https://your-url.app/api/bot
The project uses a Move smart contract on Aptos for managing prediction markets. The contract handles:
- Market creation with question, description, and end time
- Placing bets on outcomes (Yes/No)
- Resolving markets and distributing winnings
- Viewing market information and user positions
The prediction market contract consists of the following key components:
Market: Stores market details including question, description, end time, betting amounts, and outcomeUserPosition: Tracks a user's bets in a specific marketPredictionMarketState: Global state containing all markets and user positions
create_market: Creates a new prediction market with specified parametersplace_bet: Allows users to place bets on Yes/No outcomesresolve_market: Resolves a market with the final outcomeclaim_winnings: Allows winners to claim their rewardsget_market_data: View function to retrieve market informationget_user_position: View function to check a user's position in a market
Contributions are welcome! Feel free to submit issues or pull requests to improve the project.
MIT
