Bet With Your Group Chat — Telegram bot that lets any group chat spin up a prediction market in 10 seconds.
"Will Sam quit by March?" · "Will ETH > $5k Friday?" · "Will our team ship by demo day?"
Crypto rails on TON. No fees. Winners take the pot.
- Add the bot to any Telegram group
- Create a market:
/create Will ETH hit $5k by Friday? - Tap to bet: 🟢 YES or 🔴 NO — preset amounts (0.1, 0.5, 1, 5 TON)
- Creator resolves when the outcome is known
- Winners get paid — parimutuel payout, proportional to stake
🎲 Market #1
━━━━━━━━━━━━━━━━━━
Will ETH hit $5k by Friday?
━━━━━━━━━━━━━━━━━━
🟢 YES: 3.50 TON (5 bets)
🔴 NO: 1.50 TON (3 bets)
💰 Pool: 5.00 TON
━━━━━━━━━━━━━━━━━━
🔵 Active
[🟢 0.1] [🟢 0.5] [🟢 1] [🟢 5]
[🔴 0.1] [🔴 0.5] [🔴 1] [🔴 5]
| Command | Where | What it does |
|---|---|---|
/start |
DM | Welcome + instructions |
/create <question> |
Group | Spin up a new market |
/markets |
Group | List active markets |
/resolve |
Group | Settle a market you created |
/balance |
Anywhere | Check your TON balance |
/deposit |
DM | Get wallet address + deposit memo |
/withdraw <addr> <amount> |
DM | Cash out TON |
/help |
Anywhere | How it works |
Message @BotFather → /newbot → copy the token.
npm install
npm run generate-walletThis prints a 24-word mnemonic + wallet address. Save both.
Create .env from env.example:
BOT_TOKEN=your_telegram_bot_token
TON_MNEMONIC=your 24 word mnemonic phrase here
TON_ENDPOINT=https://toncenter.com/api/v2/jsonRPC
TONCENTER_API_KEY=your_key (optional, get free at toncenter.com)
TON_NETWORK=mainnet
npm run dev # dev mode with hot reload
npm start # production- Telegraf — Telegram bot framework
- TON — crypto deposits, withdrawals, settlement
- SQLite — markets, bets, balances (zero infrastructure)
- TypeScript + tsx — no build step needed
src/
index.ts Bot + all command/callback handlers
db.ts SQLite — users, markets, bets, payouts
ton.ts TON blockchain — deposits, withdrawals
generate-wallet.ts One-time wallet generation script
Deposit flow: User sends TON to bot wallet with unique memo (g_<user_id>) → bot polls TonCenter API every 30s → auto-credits balance.
Payout model: Parimutuel — winners split the entire pool proportional to their bet size. No fees.
MIT