SNIFF Sniper
A Solana token sniper delivered as a Telegram bot plus a web terminal. Monitor Telegram channels, auto-buy new contract addresses, manage positions, and earn referral commissions.
Architecture
/api→Shared PostgreSQL DB←Telegram bot(s)| Layer | Tech |
|---|---|
| Frontend | Next.js (App Router), Tailwind v4, next-themes, zustand-style useStore, axios, lucide-react |
| Auth | Telegram Login Widget (SNIFF_SNIPER_BOT) → bearer token in localStorage |
| Bot / services | Python, python-telegram-bot, solders, requests, Pillow |
| Chain | Raw JSON-RPC (no solana package) |
| Data | PostgreSQL (DATABASE_URL), shared by main and sniper bots |
Setup & Config
NEXT_PUBLIC_API_URL=http://localhost:8000/api # frontend WALLET_DERIVATION_SECRET=<long random string> # backend — never commit DATABASE_URL=postgres://… # backend assets/pnl_profit.png, assets/pnl_loss.png # PNL templates assets/fonts/MyriadPro-Regular.OTF # card font
WALLET_DERIVATION_SECRET stable. Every wallet key is derived from it; changing it makes existing wallets unrecoverable.Login
Users sign in with the Telegram widget. On success the layout stores the token and loads profile, positions and wallets. Until then an INITIALIZING… splash shows.
Dashboard
Refreshes every 15 s. Shows balance, all-time realized PnL, win rate, active positions, recent activity and top channels. USD totals use a fixed SOL price of 150.
Sniper terminal
Paste a CA (or arrive via /sniper?ca=…) to fetch a quote. Pick a wallet and slippage (10 / 25 / 50 %), then buy with presets (0.01–1 SOL) or a custom amount; sell 25/50/75/100 % of an open position. Slippage is sent as basis points.
Channels
Add public channels by @username, or private ones (needs an active Telegram session via the bot). Each has its own buy amount, slippage (stored in bps) and optional max market cap.
● Monitoring ActiveBuy 0.01 SOL · Slip 10% · Max MC NoneEdit · Delete
● Monitoring ActiveBuy 0.05 SOL · Slip 25% · Max MC $500,000Edit · Delete
Wallets
Each user gets wallet W1 automatically and may create up to 5. Balances are shown in the sniper terminal wallet selector and the header. See Wallet service for key derivation.
Transfers
Withdraw SOL to any Solana address. A successful transfer returns a Solscan link.
Referrals
Share your link t.me/sniff_bot?start=ref_<your_id>. You earn 20 % of each referred user’s trading fee. Earnings are claimable only if you hold verified SNIFF; otherwise they accrue as locked until you verify.
Leaderboard
Ranks groups by total volume and trade count.
312 trades
240 trades
198 trades
Verify
Checks SNIFF balance across your wallets. Verified holders unlock claimable referral earnings and 10 callers per group.
Settings
Toggle the auto-snipe engine and set default buy amount and slippage (UI in %, saved as bps).
Auto-buy tokens from monitored channelsON
Support
Submit a ticket; admins are notified and reply through the Telegram bot.
Telegram bot flows
| Command | Purpose |
|---|---|
/start [ref_ID] | Onboard, create W1, register referral |
/verify | Connect wallet & verify SNIFF |
/claim | Withdraw claimable referral balance |
PNL card
pnl_card.py overlays token, ROI, PNL, Invested and Position on a 3600×2880 template (pnl_profit.png / pnl_loss.png), auto-fitting font sizes, exported as JPEG (q85). Green #00dda3 for profit, red #e32f2f for loss.
Fee service
- Fee =
amount × fee_percent / 100; default 0.05 %, rounded to 9 decimals. - Whitelisted users pay 0.
- Safety: a configured percent above 10 falls back to 0.5 %.
transfer_fee_to_collectionsends a SOL transfer to the configured fee wallet (min 0.000001 SOL), signed by the user wallet and sent withskipPreflight.
Wallet service
Keys are deterministic: sha256(seed_material)[:32] → Keypair.from_seed. Seed material uses WALLET_DERIVATION_SECRET, a per-wallet random salt (new wallets), user id and wallet number. Legacy W1 (no salt) must match bot.py exactly. migrate_existing_wallets() adds salts to legacy rows.
Referral service
Self-referral and double-referral are rejected. Tiers from verify_wallet_holdings: whale (≥ 2 % supply), holder (> 0), guest.
Token & Solana services
token_service.py reads SNIFF balance and supply (mint 8ESs…pump) with RPC fallback. solana_service.py provides get_balance, is_holding_token and a Jupiter price lookup, all over raw JSON-RPC.
Notes
WALLET_DERIVATION_SECRET falls back to 'default-secret' if unset; the Jupiter price.jup.ag/v4 endpoint and public RPC URLs are rate-limited or deprecated; main.application is imported lazily by referral notifications.Screenshots are HTML simulations, not captures.