Crypto Telegram Bot Development: How to Build an Ethereum Trading Bot
By Merunas Grincalaitis, founder of MEV DAO and a developer who builds MEV, sniping and trading bots on Ethereum. Last updated: October 2026.
TL;DR: A crypto Telegram trading bot is two programs glued together: a Telegram bot that talks to users through the Bot API, and an Ethereum backend that reads the chain, builds swaps and signs transactions. You can get a read-only version working in an afternoon with BotFather, grammY and viem. The hard parts are key custody, honest transaction simulation and private submission, and those are what separate a toy from something people can trust with money.
I've built Telegram front ends for sniping, copy-trading and alert bots, and the Telegram part is always the easy bit. People ask me "how do I make a Telegram trading bot?" expecting the answer to be about chat commands. Most of the work, and nearly all of the risk, is behind them.
This guide walks through how I'd structure one for Ethereum mainnet today, with a minimal code start, the decisions that matter, and the mistakes I see most often.
What is a crypto Telegram trading bot?
It's a Telegram bot account whose commands and buttons trigger on-chain actions, like checking balances, buying a token or setting a limit order, through a server you control. Telegram only delivers messages. Everything crypto happens on your server.
A typical request goes like this:
- A user taps "Buy 0.1 ETH" in a chat.
- Telegram sends that update to your server.
- Your server checks the token, quotes the swap, simulates it, signs a transaction with the user's key and sends it to Ethereum.
- Your server reports the result back to the chat.
Bots like Banana Gun and Maestro follow this pattern. I compared how they work and what they charge in Banana Gun vs Maestro vs MEV DAO.
What does the architecture look like?
Split it into a thin Telegram layer, a trading engine, a signer and a chain layer, and keep the signer as isolated as you can. Here's the layout I use:
| Component | Job | What I typically use |
|---|---|---|
| Telegram layer | Commands, buttons, menus, user sessions | grammY (TypeScript) or python-telegram-bot |
| Trading engine | Quotes, slippage, token checks, order logic | Your own code + Uniswap contracts |
| Signer | Holds keys, signs transactions | Separate process or service, encrypted keys, KMS |
| Chain layer | Reads state, simulates, submits | viem or ethers, your own node or a paid RPC, a private RPC for sends |
| Storage | Users, settings, orders, audit log | Postgres or SQLite |
| Watchers | New pools, wallet tracking, price triggers | WebSocket subscriptions to your node |
The Telegram layer should never touch a private key. If your chat handler gets compromised, the worst case should be spam, not drained wallets.
How do you create the bot and connect it to Ethereum?
Create the bot with @BotFather, pick a bot library, connect a read-only Ethereum client, and only then add signing. Steps:
- Get a token. Message @BotFather in Telegram, send
/newbot, choose a name and username. You get an API token. Treat it like a password. - Pick a library. I use grammY for TypeScript; python-telegram-bot is the common Python choice.
- Pick a chain library. viem is my default for TypeScript. It's typed and fast, and it handles ABI encoding cleanly.
- Get an RPC. Your own node is best for latency. A paid provider is fine to start.
- Start read-only. Balances, quotes and alerts first. No keys yet.
A minimal working start:
import { Bot } from "grammy";
import { createPublicClient, http, formatEther, isAddress } from "viem";
import { mainnet } from "viem/chains";
const bot = new Bot(process.env.BOT_TOKEN!);
const client = createPublicClient({ chain: mainnet, transport: http(process.env.RPC_URL) });
bot.command("balance", async (ctx) => {
const addr = ctx.match.trim();
if (!isAddress(addr)) return ctx.reply("Usage: /balance 0xYourAddress");
const wei = await client.getBalance({ address: addr });
await ctx.reply(`${formatEther(wei)} ETH`);
});
bot.start(); // long polling; switch to a webhook in production
That's the whole Telegram side in principle. Everything after this is the real product.
Should you use long polling or webhooks?
Long polling is simplest for development; webhooks are better in production because Telegram pushes updates to you instantly. The Bot API docs describe both: getUpdates for polling, setWebhook for push.
| Long polling | Webhook | |
|---|---|---|
| Setup | Run the process, done | Needs a public HTTPS endpoint |
| Ports | Any | 443, 80, 88 or 8443 |
| Scaling | One poller per bot token | Works behind a load balancer |
| Verifying the sender | Not needed | Use the secret_token header check |
| Best for | Local dev, small bots | Production |
With webhooks, set a secret_token when you call setWebhook and reject any request that doesn't carry it in the X-Telegram-Bot-Api-Secret-Token header. Otherwise anyone who finds your endpoint can send fake "buy" updates.
How should a Telegram bot store private keys?
Encrypt every key at rest, keep decryption in a separate signer process, and give users a way to trade without handing you their main wallet. This is the decision that matters most. Telegram bot wallets have been drained through router bugs and phishing clones, which I covered in Are Telegram Trading Bots Safe?
Options from most to least custodial:
- Bot-generated wallets. The bot creates a fresh key per user and encrypts it with a key held in a KMS (envelope encryption). It's the easiest UX and what most sniping bots do, but you hold the funds, so your security is their security.
- Imported keys. Users paste a private key. I'd avoid offering this. People paste their main wallet, and now a chat log or a server breach can drain everything.
- Delegated permissions. The user keeps their wallet and grants limited rights. On ERC-4337 smart accounts, that means session keys. On a plain wallet, EIP-7702 lets an EOA delegate to contract code that can enforce limits. It's more work, and you need to explain it clearly, because malicious delegations are a known attack.
- User-signed. The bot prepares the transaction and the user signs it in their own wallet, for example through a Telegram Mini App with WalletConnect. Safest, but too slow for sniping.
Whatever you choose, never log keys or seed phrases, and never let the chat handler process read them.
How does the bot actually execute a swap?
Quote, check the token, simulate, sign, send privately, then confirm. Each step blocks a specific way to lose money:
- Quote. For Uniswap, call the Quoter contract or compute from pool reserves. The Uniswap docs cover the V4 contracts; most launches still trade on V2 and V3 pools too.
- Check the token. Simulate a buy and a sell on a fork or with
eth_callbefore letting a user buy. That catches most honeypots and absurd taxes. See how to spot a honeypot. - Set slippage from the quote. Compute
amountOutMinimumfrom the simulated output and the user's tolerance. Never send zero; that's an open invitation to get sandwiched. - Sign in the signer. The engine sends an unsigned transaction; the signer checks it against rules (allowed router, max value) and signs.
- Send privately. Public mempool sends get sandwiched. I route swaps through a private RPC like Flashbots Protect, or send bundles directly to builders for snipes. Background: What Is MEV Protection?
- Confirm and report. Wait for the receipt, parse the actual amounts from the logs, and post them back to the chat.
For snipes and same-block buys the execution layer gets much harder: gas bidding, builder tips and bundle timing. I wrote that part up separately in sniper bot gas settings.
What Telegram limits do you need to design around?
Telegram rate-limits bots, so a busy trading bot needs a message queue. According to the Bot FAQ, you should avoid sending more than one message per second in a single chat, bots can't send more than 20 messages per minute in a group, and bulk broadcasts top out at about 30 messages per second unless you enable paid broadcasts. Go over and you get HTTP 429 errors.
In practice:
- Edit one status message ("Pending... Confirmed") instead of sending five.
- Put alerts in a queue that respects per-chat limits.
- Never make a trade wait on a Telegram send. Execute first, notify after.
What are the most common mistakes?
Most failures I see come from security shortcuts and from treating Telegram as the product. The usual ones:
- Keys in the same process (or the same
.env) as the chat handler. - No allowlist of contracts the signer will sign for.
- Zero or fixed slippage instead of slippage from a fresh quote.
- Public mempool sends for every trade.
- No simulation before buys, so honeypots get through.
- No audit log of who requested which transaction.
- Copying an unaudited "Telegram sniper bot" repo from GitHub. Some are fine as references; some are outright scams.
AI tools can speed up the Telegram glue code a lot, but they're weak on exactly these parts. I tested that in Can ChatGPT Build a Crypto Trading Bot?
Frequently asked questions
How do I make a Telegram trading bot for crypto?
Create a bot with @BotFather, handle commands with a library like grammY or python-telegram-bot, and connect it to Ethereum with viem or ethers. Add signing only after you have encrypted key storage and transaction simulation in place.
Which programming language is best for a Telegram crypto bot?
TypeScript and Python both work well. I prefer TypeScript with grammY and viem because the Telegram and Ethereum libraries share one typed codebase; Rust makes sense only for the latency-critical execution part.
Is it legal to build a Telegram trading bot?
Building one is generally legal. Running it for other people's money can bring custody, licensing or tax obligations depending on your country, so check local rules before you take deposits.
How long does it take to build a Telegram trading bot?
A read-only alert bot can work in a day. A trading bot with safe key custody, simulation, private sends and a proper test suite takes much longer, usually weeks, depending on features.
Do Telegram bots need a server?
Yes. Telegram only relays messages; your code has to run somewhere, either polling for updates or receiving them on a webhook.
Can a Telegram bot steal my crypto?
A custodial bot that holds your key can move your funds, and so can anyone who hacks it. Use a separate wallet with only the funds you're trading, and revoke old router approvals.
Related guides
- How to Create a MEV Bot: From Mempool to First Bundle
- Are Telegram Trading Bots Safe? Key Custody and Hacks
- How Much Does a Custom MEV Bot Cost in 2026?
- ETH Copy Trading Bot: How Wallet Tracking Snipes Work
If you'd rather have someone build the engine and signer side properly, that's most of what I do. The custom MEV bot development page explains how I work, or message me on Telegram.