Pulsonic 2.0
A full trading platform for PulseChain: Telegram bot, web terminal, Rust sniper, own router and own chain indexer.
Tech Stack
Overview
Pulsonic 2.0 is the second generation of the Pulsonic trading bot. Version 1 proved there was demand: traders on PulseChain wanted to buy, sell and snipe tokens without fighting a DEX website. It also showed where a Telegram-only bot runs out of room:
- Discovery is hard in a chat window. Traders want to scan hundreds of new tokens, charts, holders and safety checks at a glance.
- Speed is the product. Snipers and limit orders compete with other bots inside the same block. Milliseconds decide who gets the price.
- The chain itself grew. New launchpads, Balancer-style vaults and a stableswap pool appeared on PulseChain. A router that only speaks Uniswap v2 leaves money on the table.
So the client and I decided to rebuild the platform from the chain up. Pulsonic 2.0 owns every layer: its own indexer, its own pricing, its own route engine, its own router contract, its own sniper and its own block-building relationship with the node.
Feature tour
Web trading terminal
The web app at pulsonic.cloud is a full trading terminal built with SvelteKit. Users sign in with a passkey or straight from Telegram (Mini App login), and they trade with the same wallets the bot uses.
- Staging Zone: three live columns (New Pairs, Almost Graduated, Graduated) that stream launchpad tokens as they are created, fill their bonding curve and move to a DEX. One click buys with a saved preset.
- Trending: ranked tokens with sparklines, market cap, liquidity, volume, holder stats and a security badge.
- Token page: real-time candles, trades, positions, traders, holders, dev tokens, pool details, market and limit orders, and three buy/sell presets.
- Token audit: every token gets an automated safety check: can it be sold, buy/sell/transfer tax, owner, mint function, proxy and upgradeability, balance anomalies, verified source.
- Wallets, portfolio and bulk sell: multiple wallets per user, PnL per position, and selling many tokens across many wallets in one confirmation.
The terminal is fully responsive. On a phone, the same features sit behind a bottom navigation bar.
Snipers
A Sniper is a standing order: “when this kind of event happens, buy with this wallet, under these filters, and manage the exit like this.” There are four kinds:
- Creation: buy a launchpad token the moment it is created.
- Graduation: buy in the same block a token leaves its bonding curve for a DEX pool.
- DEX listing: buy any token at its first buyable moment on any DEX.
- Token: wait for one specific token to open trading and buy it first.
Each Sniper carries filters, take-profit and stop-loss rules, and exit guards. An exit guard watches the mempool and sells the whole position ahead of a dangerous transaction, for example the token’s creator dumping their bag or liquidity being pulled.
Telegram bot
The bot is still the home for many traders, and it covers the core of the platform: buy and sell on any DEX, positions with live PnL, limit orders, snipers, exit guards, multi-wallet, trending, token tracking, referrals and admin tools. A separate buy bot posts buy alerts into community groups. A demo of the bot is in the version 1 writeup.
Private RPC and bundles
Traders can point their own wallet at a public Pulsonic RPC endpoint. Transactions sent there skip the public mempool, so other bots cannot see them and front-run them. Searchers can also submit signed bundles that land only in blocks built through our node.
The challenges
1. Indexing a whole chain, correctly, in real time
Everything starts with data. Version 1 indexed a handful of DEXes. Version 2 needed every venue on the chain: Uniswap-style v2 and v3 pools, Algebra pools, two Balancer-style vaults, a Curve-style stableswap pool and several launchpad bonding curves. Each speaks a different event dialect.
Speed is only half the problem. Blocks get reorganized: a block the indexer already stored can be replaced by a different one. Each stored trade, candle and balance then becomes wrong.
2. Finding the best price in microseconds
A user’s buy can be split across several pools on several venues. Querying the chain for quotes is far too slow, and a route engine that guesses wrong costs the user money on every trade.
3. Winning the same block
Snipers race other bots. To buy a token in the same block it graduates, the sniper has to see the pending transaction that will cause the graduation, predict its outcome and land a buy right behind it. Many tokens also ship with trading disabled. The sniper must recognize the exact transaction that opens trading, whatever function name it uses.
4. Moving user funds safely
The router holds user funds for the length of one transaction. DEX aggregators have been drained many times through upgradeable proxies and leaked admin keys. One bug here is a loss of user money, not an outage.
Solutions
A self-healing chain indexer
The indexer decodes 76 event families through a single registry. Each family declares its event signature, its decoder and the stream it feeds. A Uniswap Sync and an equivalent event from another venue land in the same canonical stream, so downstream code never cares which DEX produced it.
For reorgs, every write inside a recent window of blocks is journaled with its previous value. When the indexer finds that a stored block hash no longer matches the chain, it:
- Finds the last good block.
- Undoes every journaled write above it in one database transaction.
- Rewinds its cursor and replays the new canonical blocks.
The repair is atomic, so a crash halfway through leaves the database as it was. The indexer also detects a repair storm: too many repairs in an hour means the node is disagreeing with itself, not the chain reorganizing. In that case the indexer stops and alerts instead of corrupting data.
On top of the raw events, a pricing pipeline builds candles, USD values, all-time highs and each token’s main pool, and it checks invariants on every batch before writing.
A Rust route engine over a local copy of the chain
The route engine keeps its own in-memory graph of every pool, updated block by block from the indexer, with exact v2, v3 and Algebra math. A quote takes microseconds against a one-second budget. Before sending, the router contract’s own on-chain quote() confirms the winning route, and the engine refuses to quote if its state falls more than 30 blocks behind the chain.
I first wrote the engine in TypeScript and later ported it to Rust once the pool graph grew large. To check quality, I also built an offline solver based on convex optimization (CFMM routing). It computes the best possible split for a trade, which gives a hard upper bound to benchmark the live engine against.
An immutable router contract
PulsonicRouter is one Solidity contract that swaps across six pool shapes: Uniswap v2, Uniswap v3, Algebra, Balancer v2 vault, Balancer v3 vault and stableswap. A route can split across several paths, and the paths may share pools.
Design decisions, each recorded as an architecture decision record:
- No proxy and no upgrade key. The contract cannot be changed, so there is no admin key to steal.
- Callback authentication by the pool address stored just before each swap, because PulseChain has no transient storage.
- A guarded fallback, so a new v2, v3 or Algebra venue can be traded without redeploying the router.
- Fees capped in the contract. The fee rides in calldata, but the contract rejects anything above a hard-coded maximum.
- The router reports the net amount it paid. This makes fills exact for tokens with transfer taxes or reflections.
A Rust mempool sniper
The sniper runs on our own PulseChain node, which pushes new blocks and pending transactions to it directly. For each pending transaction it:
- Executes it locally in
revmon a speculative copy of the next block’s state. This replaced thousands of failed remote traces from the TypeScript version. - Predicts new token addresses before the deploying transaction is mined.
- Gates every buy: it simulates the buy and selling the whole bag in
revm, with no network call, so it never buys a token that cannot be sold. - Finds the opener by simulating a buy behind each candidate transaction, never by matching function names.
Sends go out as one ordered batch, with Redis wallet locks, a nonce ledger and a journal for crash recovery. A lock guarantees that only one sniper instance can ever run at a time.
TypeScript where it fits, Rust where it counts
The platform is a Bun and TypeScript monorepo of about 25 services and 24 shared packages. Each worker consumes its own BullMQ queues (receipts, approvals, positions, limit orders, bulk sell, metadata, pool stats, realtime). The three hot paths are Rust:
| Service | Why Rust |
|---|---|
| Route engine | Exact pool math over a large in-memory graph, microsecond quotes |
| Sniper | In-process revm execution of every pending transaction, no GC pauses |
| Arbitrage | Millisecond budget for back-running trades over a ~1 GB pool graph |
Technology stack
- Languages: TypeScript, Rust, Solidity
- Runtime: Bun (TypeScript services), Tokio (Rust services)
- Frontend: SvelteKit, Tailwind CSS, Lightweight Charts, Satori for share images
- Data: PostgreSQL with Drizzle ORM, Redis, BullMQ
- Chain: own PulseChain node,
revm,alloy, ethers v6, Hardhat - Bots: Telegram Bot API, Telegram Mini App
- Operations: PM2 versioned releases with atomic symlink swaps and instant rollback, Docker for Postgres and Redis, nginx behind Cloudflare, systemd watchdog with Telegram alerts, restic and
pg_dumpbackups to S3
By the numbers
| Metric | Value |
|---|---|
| Commits | ~3,000 in 4.5 months |
| Services / packages | 25 / 24 |
| AMM deployments indexed | 19 |
| On-chain event families | 76 |
| Router pool shapes | 6 |
| TypeScript tests | ~12,700 |
| Rust tests | ~4,000 |
Migration from version 1
Existing users moved over without losing history. A cutover tool imported version 1’s trade history (about 188,000 trades from 817 users), about 8,700 wallets and every active sniper and limit order into the new schema.
















