A comprehensive MEV solution that transforms token sniping from creator exploitation into a profitable auction system. Token creators can now monetize sniping activity through competitive bidding, while snipers compete transparently for early access.
Instead of losing value to front-running bots, this system enables:
- π Monetized Sniping: Token creators receive direct bribes from competing snipers
- π Fair Competition: Transparent bidding system with highest bribes winning
- β‘ Atomic Execution: Smart contracts ensure bribes are paid before snipes execute
- π Secure Infrastructure: End-to-end security from wallet generation to transaction execution
graph TB
subgraph "Snipers"
TG[π± Telegram Bot]
W[π Wallets]
end
subgraph "Backend Services"
BS[π€ Bot Service]
RPC[π RPC Proxy]
DB[(ποΈ MySQL)]
end
subgraph "Smart Contracts"
SC[β‘ Sniper Contract]
DEX[π DEX Router]
end
subgraph "Token Creators"
TC[π¨βπ» Creator]
MM[π¦ MetaMask/Rabby]
end
TG --> BS
BS --> DB
BS --> SC
SC --> DEX
TC --> MM
MM --> RPC
RPC -.->|Bundle Creation| BS
SC -.->|Bribe Transfer| TC
/backend - Go Backend Services
Tech Stack: Go, MySQL, Telegram Bot API, Ethereum JSON-RPC
- π€ Telegram Bot: User registration, wallet management, bid submission
- π RPC Proxy: Transaction interception and bundle construction
- πΎ Database: Secure wallet storage and bid management
- π¦ Bundle Manager: MEV transaction ordering and submission
π Backend Documentation β
/contracts - Smart Contracts
Tech Stack: Solidity, Foundry, Uniswap V2
- β‘ Sniper Contract: Atomic snipe execution with bribe transfers
- π§ͺ Test Suite: Comprehensive contract testing
- π Deployment Scripts: Automated deployment tools
π Contracts Documentation β
- Go 1.21+
- Foundry (latest)
- MySQL 8.0+
- Telegram Bot Token
- Base Network RPC
- Clone Repository:
git clone <repository-url>
cd sniper-bot- Backend Setup:
cd backend
cp .env.example .env
# Edit .env with your configuration
make setup- Contracts Setup:
cd contracts
forge install
forge build- Database Setup:
# Start MySQL container
docker run --name sniper-mysql \
-e MYSQL_ROOT_PASSWORD=root_password \
-e MYSQL_DATABASE=sniper_bot \
-p 3306:3306 -d mysql:8.0
# Initialize database
cd backend && make db-migrate- Deploy Contracts:
cd contracts
forge script script/Sniper.s.sol:SniperScript \
--rpc-url $BASE_RPC_URL \
--private-key $PRIVATE_KEY \
--broadcast- Start Services:
cd backend
make dev # Starts both bot and RPC services# Production deployment
docker-compose up -d
# View logs
docker-compose logs -f- Register via Telegram bot (
/register) - Submit bids for upcoming tokens (
/snipe <token> <bribe>) - Win based on highest bribe when LP is added
- Profit from early token access
- Configure MetaMask to use custom RPC endpoint
- Deploy token contract normally
- Add liquidity through standard DEX interface
- Receive automatic bribe payments from successful snipers
sequenceDiagram
participant S as Sniper
participant B as Bot Service
participant R as RPC Proxy
participant C as Smart Contract
participant T as Token Creator
S->>B: /snipe <token> 0.1 ETH
B->>B: Store bid in database
T->>R: Add liquidity transaction
R->>R: Detect LP_ADD
R->>B: Request snipe bundle
B->>B: Sort bids by amount
B->>R: Return ordered transactions
R->>C: Execute snipe bundle
C->>T: Transfer bribe (0.1 ETH)
C->>S: Transfer tokens
C->>B: Emit SnipeExecuted event
- Encrypted Wallet Storage: AES-256-GCM encryption for private keys
- Atomic Transactions: Smart contracts ensure bribe payment before token transfer
- Access Control: User isolation and permission management
- Input Validation: Comprehensive validation across all interfaces
- Connection Pooling: Efficient database connection management
- Indexed Queries: Optimized database performance
- Parallel Processing: Concurrent bid processing and bundle construction
- Gas Optimization: Efficient smart contract design
- Slippage Protection: Minimum output validation in smart contracts
- Gas Price Ordering: Proper transaction ordering in bundles
- Deadline Enforcement: Time-limited transaction execution
- Emergency Controls: Owner-only recovery mechanisms
| Component | Variables | Description |
|---|---|---|
| Backend | TELEGRAM_BOT_TOKEN |
Bot authentication |
BASE_RPC_URL |
Base network endpoint | |
DATABASE_URL |
MySQL connection | |
ADMIN_PRIVATE_KEY |
Admin wallet key | |
| Contracts | PRIVATE_KEY |
Deployment key |
UNISWAP_V2_ROUTER |
DEX router address |
# Backend services
curl http://localhost:8080/health # Bot service
curl http://localhost:8545/health # RPC service
# Database connectivity
cd backend && make test-mysql- Snipe Success Rate: Percentage of successful executions
- Bundle Construction Time: Time to build transaction bundles
- Database Performance: Query execution times
- Gas Usage: Contract execution costs
cd backend
make test # Run all tests
make test-coverage # With coverage reportcd contracts
forge test # Run all tests
forge test --gas-report # With gas analysis- Fork the repository
- Create feature branch:
git checkout -b feature/amazing-feature - Implement changes with tests
- Test thoroughly:
make test(backend) +forge test(contracts) - Submit pull request
- Comprehensive Testing: Maintain high test coverage
- Security First: Follow smart contract security best practices
- Documentation: Update docs for any interface changes
- Gas Optimization: Profile and optimize contract gas usage
- Token Creators: Maximize launch revenue through sniper bribes
- Snipers: Compete fairly for early access with transparent bidding
- Community: Reduced MEV extraction creates more equitable launches
- Searchers: Access structured MEV opportunities
- Builders: Integrate auction mechanisms into block building
- Validators: Capture value from structured MEV flows
This project is licensed under the MIT License - see the LICENSE file for details.
This software is provided for educational and research purposes only. Users are solely responsible for compliance with applicable laws and regulations. The authors disclaim all liability for any financial losses, legal issues, or other damages arising from the use of this software.
- π Issues: GitHub Issues
- π Documentation: Check component-specific READMEs
- π¬ Community: Join our Discord server
- π Security Issues: Report privately to
security@example.com
sniper-bot/
βββ π backend/ # Go backend services
β βββ π pkg/ # Core packages
β βββ π services/ # Service implementations
β βββ π scripts/ # Setup and utility scripts
β βββ π README.md # Backend documentation
β βββ π ARCHITECTURE.md
βββ π contracts/ # Smart contracts
β βββ π src/ # Solidity source code
β βββ π script/ # Deployment scripts
β βββ π test/ # Contract tests
β βββ π README.md # Contracts documentation
βββ π README.md # This file
βββ π docker-compose.yml
βββ π LICENSE
π Built with β€οΈ for the DeFi community - Transforming MEV from exploitation to fair competition