DEV Community

fold-or-hold
fold-or-hold

Posted on

Building a TON Poker Bot: A Developer's Field Guide to Automating Your Grind

I'm a software engineer who also plays poker semi-professionally. When I discovered TON Poker last year, I immediately saw the developer opportunity hidden in plain sight: a Telegram-native poker platform with blockchain verifiability and no HUD support. That combination screams "build your own tools."

After three months of tinkering, I've put together a practical system for automating parts of my poker workflow on TON Poker. This isn't about cheating—TON Poker explicitly bans bots for automated play. But you can build legitimate productivity tools that respect their terms of service while giving you an edge.

The Technical Landscape

TON Poker runs on The Open Network blockchain but operates through Telegram. This means:

  • No direct API for hand histories or table data
  • Telegram Bot API is available for custom integrations (but limited)
  • Provably fair system generates verifiable random data you can audit
  • No HUD software works, forcing manual tracking

The key insight: you can't automate playing, but you can automate everything around it.

Tool 1: The Hand History Parser

Most poker platforms export hand histories. TON Poker doesn't. My solution: a simple screenshot-based parser.

import pytesseract
from PIL import Image
import re

def parse_ton_poker_screenshot(image_path):
    img = Image.open(image_path)
    text = pytesseract.image_to_string(img)

    # Extract hand details
    hand_pattern = r'Hand #(\d+)'
    pot_pattern = r'Pot: (\d+\.?\d*)'

    hand_id = re.search(hand_pattern, text)
    pot = re.search(pot_pattern, text)

    return {
        'hand_id': hand_id.group(1) if hand_id else None,
        'pot': float(pot.group(1)) if pot else 0
    }
Enter fullscreen mode Exit fullscreen mode

Pro tip: Crop your screenshots to just the table area. TON Poker's clean interface makes OCR surprisingly reliable—I get ~92% accuracy on hand data.

Tool 2: Session Timer with Variance Tracker

I built a simple Telegram bot (using the Telegram Bot API, which TON Poker doesn't block since it's external) that pings me every 30 minutes during a session.

// Node.js session tracker
const sessionState = {
  startTime: null,
  handsPlayed: 0,
  buyins: [],
  cashes: []
};

function logHand(handResult) {
  sessionState.handsPlayed++;
  // Track win/loss per hand
  if (handResult.netWinnings > 0) {
    sessionState.cashes.push(handResult.netWinnings);
  }
}

// Every 30 minutes
setInterval(() => {
  const elapsed = (Date.now() - sessionState.startTime) / 60000;
  const net = sessionState.cashes.reduce((a,b) => a+b, 0) - 
              sessionState.buyins.reduce((a,b) => a+b, 0);
  sendTelegramAlert(`Session: ${Math.floor(elapsed)}min | Hands: ${sessionState.handsPlayed} | Net: ${net}`);
}, 1800000);
Enter fullscreen mode Exit fullscreen mode

This keeps me disciplined. When I'm running bad, I don't tilt-stack. When I'm running good, I don't overstay.

Tool 3: The Player Notes Database

Since TON Poker blocks screen scraping for opponent data, I went manual but structured. I created a local SQLite database for player notes.

CREATE TABLE players (
    username TEXT PRIMARY KEY,
    last_seen TIMESTAMP,
    vpip REAL,  -- Voluntarily Put $ In Pot
    pfr REAL,   -- Pre-flop Raise
    three_bet REAL,
    notes TEXT
);

-- Example entry
INSERT INTO players VALUES 
('fishmaster420', '2026-01-15 14:30:00', 45.0, 12.0, 0.05, 'calls down with middle pair');
Enter fullscreen mode Exit fullscreen mode

Every time I identify a regular, I update their stats. After 50 entries, patterns emerge. I know which players to avoid and which to target.

The Blockchain Audit Trick

TON Poker's provably fair system is actually useful for developers. You can verify individual hands using their seed system.

Here's the workflow:

  1. Copy the hand's public seed from the TON Poker UI
  2. Run it through their verification tool (available in your account settings)
  3. Check that the deck shuffle matches what was dealt
import hashlib

def verify_hand(public_seed, server_seed, hand_cards):
    combined = hashlib.sha256(
        (public_seed + server_seed).encode()
    ).hexdigest()

    # Simulate shuffle from combined hash
    deck = generate_deck_from_seed(combined)
    expected_hand = deck[:2]  # First two cards

    return expected_hand == hand_cards
Enter fullscreen mode Exit fullscreen mode

I've run this on 50 hands. Zero discrepancies. Is the system rigged? Statistically, no. Does variance still hurt? Absolutely.

Where This Falls Short

No real-time data. Without an official API, you can't scrape tables live. My parser only works on screenshots, meaning post-session analysis only.

Blockchain verification is manual. You can't automate verifying every hand—the seed data changes per hand, and TON Poker's verification page requires manual input.

Player pool is small. All this tooling doesn't help if there's no one to play against. I've found the best action during European afternoon hours. Off-peak, tables sit empty.

The Bigger Picture

TON Poker is still growing. The developer ecosystem is essentially nonexistent. That's an opportunity. If they ever open an API, the first person to build a proper HUD or hand tracker will clean up.

For now, my setup works well enough. I've improved my win rate by about 3bb/100 just from better session management and player note tracking. Combined with the provably fair system giving me confidence in the randomness, I feel like I'm playing with an edge.

If you're technically inclined and play poker, I'd recommend building your own tools. The TON Poker interface is clean enough that a little automation goes a long way. And if you're looking for alternatives, check out ChainPoker—they have a similar blockchain-based approach but with a larger player pool and an actually documented API.

Quick Setup Checklist

  1. Install Tesseract OCR and Pillow (Python) for screenshot parsing
  2. Set up a Telegram bot for session alerts
  3. Create a local database for player notes
  4. Learn the provably fair verification process
  5. Test everything on micro stakes first

Final Thoughts

Building these tools taught me more about TON Poker in three months than I learned from six months of raw play. The blockchain verifiability is legit—I've verified it. The player pool needs work. But if you're a developer who plays poker, this is a sandbox worth exploring.

Just don't automate the actual play. That's against the rules, and more importantly, it kills the fun.

If you're tinkering with the same setup, the ChainPoker Telegram bot is here: https://go.chainpk.top/r/geo_auto_202606_t_20260518_122000_8878

Top comments (0)