Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Marcelluxx/TelegramTradinBot

Open more actions menu

Repository files navigation

Solana Telegram Trade Monitor Bot

License: MIT Version: 1.0.0 Build: Passing Solana: Mainnet/Devnet

A high-performance, secure, event-driven Solana trading bot with a modern web dashboard. The system monitors selected Telegram channels and groups in real-time, extracts SPL token addresses from incoming messages, and executes automated swap transactions on the Solana blockchain using dynamic priority fees and optional MEV protection (Jito).


⚡ Key Features

  • 🚀 Real-time Event Stream Engine — GramJS MTProto client listens to messages from specified groups/channels and extracts SPL token contracts within milliseconds.
  • 🔒 Enterprise-Grade Private Custody — User private keys are protected at rest using AES-256-GCM encryption. Decryption keys are loaded strictly from the environment, isolating database compromises.
  • 📊 Telemetry & Web Dashboard — A real-time web dashboard featuring live telemetry, wallet balances, active network configurations, system logs, and transaction history.
  • 📉 Congestion-Aware Priority Fees — Dynamic Compute Budget pricing calculations scale priority fees based on user trade size and network congestion.
  • 🛡️ MEV & Frontrun Protection — Optional integration with Jito RPC endpoints to bundle transactions and avoid predatory frontrunning.
  • 🔄 Dual-Network Hot-Swapping — Fully supports hot-swapping between devnet and mainnet configurations per user on the fly.
  • 🇮🇹 Localized Admin Console — Modern, responsive user interfaces localized in Italian with role-based access validation (ADMIN, DEV, USER).

🛠️ Tech Stack

┌────────────────────────────────────────────────────────────────────────┐
│                              Web Interface                             │
│                     EJS Templates • Bootstrap • Socket.IO               │
└───────────────────────────────────┬────────────────────────────────────┘
                                    │
┌───────────────────────────────────▼────────────────────────────────────┐
│                             Application Server                         │
│                    Express.js • Pino HTTP Logger • Sessions            │
└───────────────────────────────────┬────────────────────────────────────┘
                                    │
┌───────────────────────────────────┼────────────────────────────────────┐
│            Bot Engine             │             DB Layer               │
│        GramJS MTProto Client      │          PostgreSQL (pg)           │
└────────────────┬──────────────────┴──────────────────┬─────────────────┘
                 │                                     │
┌────────────────▼──────────────────┐ ┌────────────────▼─────────────────┐
│          Solana Web3 Core         │ │        Crypto Engine             │
│   @solana/web3.js • spl-token     │ │    AES-256-GCM • Bcrypt          │
└───────────────────────────────────┘ └──────────────────────────────────┘

🚀 Getting Started

Prerequisites

  • Node.js: v18.x or higher
  • Database: PostgreSQL 14.x or higher
  • API Credentials: Telegram API_ID & API_HASH from my.telegram.org

Installation & Initialization

  1. Clone the Repository:

    git clone https://github.com/yourusername/TwitterMonitorTrade.git
    cd TwitterMonitorTrade
  2. Install Node Modules:

    npm install
  3. Configure Environment: Create a local .env configuration file:

    cp .env.example .env

    Open .env and fill in your Telegram API, Solana RPC, and PostgreSQL database credentials.

  4. Initialize Database Schema: Ensure your PostgreSQL server is active and the target database exists, then run:

    npm run db:init
  5. Launch the System: Start the application web server and the Telegram listener bot:

    npm run dev

⚙️ Environment Variables Reference

Variable Description Example
PORT Web console application server port 3000
API_ID Telegram API identifier 29384812
API_HASH Telegram API secret hash a1b2c3d4e5f6...
TELEGRAM_SESSION Pre-authorized Telegram session string 1BJW...
PHONE_NUMBER Telegram account phone number +393331234567
TESTNET_RPC Solana Devnet RPC endpoint https://api.devnet.solana.com
MAINNET_RPC Solana Mainnet RPC endpoint https://api.mainnet-beta.solana.com
JITO_RPC Jito Bundle RPC endpoint (MEV protection) https://beta-mainnet.jito.foundation:8899
FEE_COLLECTOR_PUBLIC_KEY Public key to collect system service fees E6x...
SESSION_SECRET Secret key used to encrypt Express sessions super_secret_string
ENCRYPTION_KEY 32-byte Base64 key for wallet encryption base64_32byte_key...
DB_HOST PostgreSQL server hostname localhost
DB_USER PostgreSQL username postgres
DB_PASSWORD PostgreSQL user password db_password
DB_NAME Target database name twittermonitortrade

📝 Commands Registry

The project exposes standard NPM tasks configured inside package.json:

Command Action
npm start / npm run dev Launches the web dashboard and attaches the Telegram event bot
npm run db:init Creates core PostgreSQL tables, indices, and constraints
npm run db:migrate Migrates legacy NeDB local data files into PostgreSQL
npm run db:add-columns Schema migration script to support password resets
npm run keys:encrypt Administrative script to encrypt unencrypted database private keys
npm run sql Launches an inline raw SQL query runner

🛡️ Security Architecture

  • Zero-Plaintext Wallet Storage: Wallet private keys are strictly stored encrypted using AES-256-GCM inside the database. Plaintext keys are never written to disk or logs.
  • Separation of Concerns: The decryption secret (ENCRYPTION_KEY) is stored outside the database structure (exclusively inside the local system environment).
  • Cryptographic Password Salting: Authentication passwords are encrypted using bcrypt salted with 12 rounds, protecting the web dashboard from offline brute-force attacks.
  • Strict RBAC Validation: Express route layers enforce access constraints using customized middleware checking ADMIN, DEV, and USER role permissions.

📜 License

This project is licensed under the MIT License - see the LICENSE file for details.

About

A high-performance event-driven Solana trading bot with a modern web dashboard, listening to Telegram in real-time with AES-256 key encryption and Jito MEV protection.

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages

Morty Proxy This is a proxified and sanitized view of the page, visit original site.