{"id":18056985,"url":"https://github.com/thevalkar/moonbot","last_synced_at":"2025-04-11T04:40:29.173Z","repository":{"id":260177115,"uuid":"869937189","full_name":"thevalkar/moonbot","owner":"thevalkar","description":"Solana automated sniper and signals bot: watch transactions, snipe tokens on Raydium and Pump.fun, and alert on socials","archived":false,"fork":false,"pushed_at":"2025-03-20T21:24:22.000Z","size":472,"stargazers_count":22,"open_issues_count":0,"forks_count":11,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-03-28T03:32:35.454Z","etag":null,"topics":["pumpfun","pumpfun-bot","pumpfunbot","raydium","raydium-bot","raydium-volume-bot","solana","solana-nft","solana-program","solana-token"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/thevalkar.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-10-09T06:52:20.000Z","updated_at":"2025-03-20T21:24:26.000Z","dependencies_parsed_at":"2025-03-20T22:26:34.488Z","dependency_job_id":"84d9c8df-d4b2-4991-b7c2-ae1449e78c41","html_url":"https://github.com/thevalkar/moonbot","commit_stats":null,"previous_names":["thevalkar/moonbot"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thevalkar%2Fmoonbot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thevalkar%2Fmoonbot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thevalkar%2Fmoonbot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thevalkar%2Fmoonbot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thevalkar","download_url":"https://codeload.github.com/thevalkar/moonbot/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248345274,"owners_count":21088241,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["pumpfun","pumpfun-bot","pumpfunbot","raydium","raydium-bot","raydium-volume-bot","solana","solana-nft","solana-program","solana-token"],"created_at":"2024-10-31T02:05:57.516Z","updated_at":"2025-04-11T04:40:29.145Z","avatar_url":"https://github.com/thevalkar.png","language":"TypeScript","readme":"# Moonbot Token Sniper Bot\n\n![Moonbot Logo](https://www.mooners.xyz/mooners480.png)\n\n## Table of Contents\n\n- [Introduction](#introduction)\n- [Features](#features)\n- [Architecture](#architecture)\n- [Prerequisites](#prerequisites)\n- [Installation](#installation)\n- [Configuration](#configuration)\n- [Usage](#usage)\n- [Contributing](#contributing)\n- [Code of Conduct](#code-of-conduct)\n- [License](#license)\n\n## Introduction\n\nMoonbot 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.\n\n## Features\n\n- **Real-Time Transaction Monitoring:** Listens to Solana transactions via POST requests (a webhook) and processes them to identify token purchases.\n- **Automated Token Sniping:** Executes buy operations for tokens that meet specific criteria such as Fairly Distributed Value (FDV) thresholds.\n- **Discord Integration:** Provides a Discord bot for managing invite codes, enabling/disabling access, and sending notifications to designated channels.\n- **Telegram Integration:** Sends real-time alerts to Telegram threads corresponding to different transaction sources.\n- **Database Management:** Utilizes PostgreSQL to store and manage token data, signals, and user invite codes.\n- **Encryption:** Encrypts sensitive information such as keypairs using AES-256-CBC encryption for enhanced security.\n- **Retry Mechanism:** Implements robust retry logic for transaction submissions to handle network or API failures gracefully.\n\n## Architecture\n\nThe project is structured into several key components:\n\n1. **Transaction Handler (`src/index.ts`):** Listens to incoming transactions, parses them, and determines whether to execute buy operations or send notifications.\n2. **Utilities (`src/lib/utils.ts`):** Contains helper functions for interacting with the Solana blockchain, fetching token data, calculating prices, and managing retries.\n3. **Database Interface (`src/lib/postgres.ts`):** Manages all interactions with the PostgreSQL database, including querying and inserting data.\n4. **Discord Bot (`src/discord.ts`):** Handles Discord interactions, command processing, and sending notifications to Discord channels.\n5. **Configuration (`.env.template`):** Manages environment variables required for secure operations.\n\n## Prerequisites\n\nBefore setting up Moonbot, ensure you have the following:\n\n- **Node.js** (v14 or later)\n- **npm** or **yarn**\n- **PostgreSQL** database\n- **Solana Wallet** with necessary permissions\n- **Discord Account** for bot integration\n- **Telegram Account** for bot notifications\n\n## Installation\n\n1. **Clone the Repository**\n\n   ```bash\n   git clone https://github.com/thevalkar/moonbot.git\n   cd moonbot\n   ```\n\n2. **Install Dependencies**\n\n   Using npm:\n\n   ```bash\n   npm install\n   ```\n\n   Using yarn:\n\n   ```bash\n   yarn install\n   ```\n\n3. **Set Up the Database**\n\n   Ensure PostgreSQL is installed and running. Create a new database for the project.\n\n   ```bash\n   createdb moonbot_db\n   ```\n\n   Run the schema setup using the `schema.sql` file:\n\n   ```bash\n   psql -d moonbot_db -f schema.sql\n   ```\n\n   This command will execute the SQL statements in `schema.sql` to set up the necessary tables and structures in your database.\n\n## Configuration\n\n1. **Environment Variables**\n\n   Create a `.env` file in the root directory based on the provided `.env.template`.\n\n   ```bash\n   cp .env.template .env\n   ```\n\n   Populate the `.env` file with your configuration:\n\n   ```env\n    KEYPAIR_ENCRYPTION_KEY=\n    KEYPAIR_ENCRYPTION_IV=\n    DATABASE_URL=postgres://postgres:password@localhost:5432/database\n    DISCORD_BOT_TOKEN=\n    TELEGRAM_BOT_TOKEN=\n    RPC_URL=https://mainnet.helius-rpc.com/?api-key=api_key\n    JITO_PAYER_KEYPAIR=[...,...,...]\n    API_PORT=443\n    HTTPS_KEY_PATH=/etc/letsencrypt/archive/server.com/privkey1.pem\n    HTTPS_CERT_PATH=/etc/letsencrypt/archive/server.com/fullchain1.pem\n   ```\n   - **KEYPAIR_ENCRYPTION_KEY:** Hex-encoded key for encrypting keypairs.\n   - **KEYPAIR_ENCRYPTION_IV:** Hex-encoded initialization vector for encryption.\n   - **DATABASE_URL:** PostgreSQL connection string.\n   - **DISCORD_BOT_TOKEN:** Token for Discord bot integration.\n   - **TELEGRAM_BOT_TOKEN:** Token for Telegram bot integration.\n   - **RPC_URL:** RPC endpoint for Solana interactions.\n   - **JITO_PAYER_KEYPAIR:** Jito payer keypair for sending bundles.\n   - **API_PORT:** Port to run the API\n   - **HTTPS_KEY_PATH:** Absolute path for HTTPS cert key\n   - **HTTPS_CERT_PATH:** Absolute path for HTTPS cert\n\n2. **Configure Discord Bot**\n\n   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.\n\n3. **Configure Telegram Bot**\n\n   Set up a Telegram bot via BotFather and obtain the bot token. Update the `TELEGRAM_BOT_TOKEN` in your `.env` file.\n\n## Usage\n\n1. **Start the Server**\n\n   Using npm:\n\n   ```bash\n   npm start\n   ```\n\n   Using yarn:\n\n   ```bash\n   yarn start\n   ```\n\n   The server will start on the specified port (default is 45000).\n\n2. **Interacting via Discord**\n\n   - **Enable/Disable Moonbot:** Use the `/enable` command in Discord to toggle access.\n   - **Notifications:** Receive real-time notifications in designated Discord channels when potential token purchases are detected.\n\n3. **Interacting via Telegram**\n\n   Receive alerts and updates in corresponding Telegram threads based on transaction sources like Raydium, Pumpfun, and Moonshot.\n\n4. **Webhook Integration**\n\n   The Express server listens for incoming webhook transactions. Send a POST request to the server's root endpoint (`/`) with transaction data to trigger processing.\n\n## Contributing\n\nContributions are welcome! Please follow these steps:\n\n1. **Fork the Repository**\n\n2. **Create a Feature Branch**\n\n   ```bash\n   git checkout -b feature/YourFeature\n   ```\n\n3. **Commit Your Changes**\n\n   ```bash\n   git commit -m \"Add some feature\"\n   ```\n\n4. **Push to the Branch**\n\n   ```bash\n   git push origin feature/YourFeature\n   ```\n\n5. **Open a Pull Request**\n\n## Code of Conduct\n\nPlease read our [Code of Conduct](./CODE_OF_CONDUCT.md) to understand the standards we expect from our community members.\n\n## License\n\nThis project is licensed under the [MIT License](./LICENSE).\n\n---\n\n**Disclaimer:** Use this bot responsibly. The developers are not liable for any losses or damages caused by the use of this bot.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthevalkar%2Fmoonbot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthevalkar%2Fmoonbot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthevalkar%2Fmoonbot/lists"}