- Introduction
- Features
- Architecture
- Prerequisites
- Installation
- Configuration
- Usage
- Contributing
- Code of Conduct
- License
Moonbot Token Sniper Bot is a sophisticated tool designed for the Solana blockchain ecosystem. It monitors transactions in real-time, detects potential token purchases, and executes automated buy operations based on predefined criteria. Additionally, it integrates with Discord and Telegram to provide real-time notifications and manage user interactions through invite codes.
- Real-Time Transaction Monitoring: Listens to Solana transactions via POST requests (a webhook) and processes them to identify token purchases.
- Automated Token Sniping: Executes buy operations for tokens that meet specific criteria such as Fairly Distributed Value (FDV) thresholds.
- Discord Integration: Provides a Discord bot for managing invite codes, enabling/disabling access, and sending notifications to designated channels.
- Telegram Integration: Sends real-time alerts to Telegram threads corresponding to different transaction sources.
- Database Management: Utilizes PostgreSQL to store and manage token data, signals, and user invite codes.
- Encryption: Encrypts sensitive information such as keypairs using AES-256-CBC encryption for enhanced security.
- Retry Mechanism: Implements robust retry logic for transaction submissions to handle network or API failures gracefully.
The project is structured into several key components:
- Transaction Handler (
src/index.ts
): Listens to incoming transactions, parses them, and determines whether to execute buy operations or send notifications. - Utilities (
src/lib/utils.ts
): Contains helper functions for interacting with the Solana blockchain, fetching token data, calculating prices, and managing retries. - Database Interface (
src/lib/postgres.ts
): Manages all interactions with the PostgreSQL database, including querying and inserting data. - Discord Bot (
src/discord.ts
): Handles Discord interactions, command processing, and sending notifications to Discord channels. - Configuration (
.env.template
): Manages environment variables required for secure operations.
Before setting up Moonbot, ensure you have the following:
- Node.js (v14 or later)
- npm or yarn
- PostgreSQL database
- Solana Wallet with necessary permissions
- Discord Account for bot integration
- Telegram Account for bot notifications
-
Clone the Repository
git clone https://github.com/thevalkar/moonbot.git cd moonbot
-
Install Dependencies
Using npm:
npm install
Using yarn:
yarn install
-
Set Up the Database
Ensure PostgreSQL is installed and running. Create a new database for the project.
createdb moonbot_db
Run the schema setup using the
schema.sql
file:psql -d moonbot_db -f schema.sql
This command will execute the SQL statements in
schema.sql
to set up the necessary tables and structures in your database.
-
Environment Variables
Create a
.env
file in the root directory based on the provided.env.template
.cp .env.template .env
Populate the
.env
file with your configuration:KEYPAIR_ENCRYPTION_KEY= KEYPAIR_ENCRYPTION_IV= DATABASE_URL=postgres://postgres:password@localhost:5432/database DISCORD_BOT_TOKEN= TELEGRAM_BOT_TOKEN= RPC_URL=https://mainnet.helius-rpc.com/?api-key=api_key JITO_PAYER_KEYPAIR=[...,...,...] API_PORT=443 HTTPS_KEY_PATH=/etc/letsencrypt/archive/server.com/privkey1.pem HTTPS_CERT_PATH=/etc/letsencrypt/archive/server.com/fullchain1.pem
- KEYPAIR_ENCRYPTION_KEY: Hex-encoded key for encrypting keypairs.
- KEYPAIR_ENCRYPTION_IV: Hex-encoded initialization vector for encryption.
- DATABASE_URL: PostgreSQL connection string.
- DISCORD_BOT_TOKEN: Token for Discord bot integration.
- TELEGRAM_BOT_TOKEN: Token for Telegram bot integration.
- RPC_URL: RPC endpoint for Solana interactions.
- JITO_PAYER_KEYPAIR: Jito payer keypair for sending bundles.
- API_PORT: Port to run the API
- HTTPS_KEY_PATH: Absolute path for HTTPS cert key
- HTTPS_CERT_PATH: Absolute path for HTTPS cert
-
Configure Discord Bot
Ensure your Discord bot has the necessary permissions and is added to your server. Update the
GUILD_ID
,ROLE_ID
, and channel IDs in the code if necessary. -
Configure Telegram Bot
Set up a Telegram bot via BotFather and obtain the bot token. Update the
TELEGRAM_BOT_TOKEN
in your.env
file.
-
Start the Server
Using npm:
npm start
Using yarn:
yarn start
The server will start on the specified port (default is 45000).
-
Interacting via Discord
- Enable/Disable Moonbot: Use the
/enable
command in Discord to toggle access. - Notifications: Receive real-time notifications in designated Discord channels when potential token purchases are detected.
- Enable/Disable Moonbot: Use the
-
Interacting via Telegram
Receive alerts and updates in corresponding Telegram threads based on transaction sources like Raydium, Pumpfun, and Moonshot.
-
Webhook Integration
The Express server listens for incoming webhook transactions. Send a POST request to the server's root endpoint (
/
) with transaction data to trigger processing.
Contributions are welcome! Please follow these steps:
-
Fork the Repository
-
Create a Feature Branch
git checkout -b feature/YourFeature
-
Commit Your Changes
git commit -m "Add some feature"
-
Push to the Branch
git push origin feature/YourFeature
-
Open a Pull Request
Please read our Code of Conduct to understand the standards we expect from our community members.
This project is licensed under the MIT License.
Disclaimer: Use this bot responsibly. The developers are not liable for any losses or damages caused by the use of this bot.