A high-speed cryptocurrency trading bot for Binance Smart Chain (BSC) that supports both mainnet and testnet operations.
-
Dual Network Support:
- BSC Mainnet (real trading)
- BSC Testnet (practice & testing)
-
Trading Features:
- Token sniping (buy tokens immediately when liquidity is added)
- Take-profit and stop-loss mechanisms
- Manual and automatic selling
- Real-time price monitoring
- New token detection
-
Performance Optimizations:
- Multi-node transaction broadcasting
- Parallel processing
- Multiple RPC/WSS endpoints
- Optimized gas pricing
- Concurrent transaction handling
# Install required packages
pip install -r requirements.txt-
Install MetaMask:
- Visit https://metamask.io
- Download and add to your browser
- Create a new wallet
- SECURELY SAVE your seed phrase
-
Get Your Private Key:
- Open MetaMask
- Click three dots (⋮) menu
- Select "Account details"
- Click "Export Private Key"
- Enter your password
- Copy the private key
-
Configure Environment:
- Copy
.env.exampleto.env - Add your private key:
PRIVATE_KEY=your_private_key_here
- Copy
- Add BSC Testnet to MetaMask:
- Visit https://chainlist.org
- Search for "BSC Testnet"
- Connect wallet and add network
- Get Test BNB:
- Visit https://testnet.binance.org/faucet-smart
- Enter your wallet address
- Receive free test BNB
- Ensure you have real BNB in your wallet
- Double-check all settings before trading
Before using the BSC Testnet, please note:
- Mainnet BNB Requirement:
- Most BSC Testnet faucets require you to have a small amount of BNB (≥0.002 BNB) on BSC Mainnet
- This is an anti-spam measure implemented by faucets
- Without mainnet BNB, you may not be able to get test BNB
-
Official BSC Testnet Faucet:
- URL: https://testnet.binance.org/faucet-smart
- Requires: ≥0.002 BNB on mainnet
-
Alternative Faucets:
Note: All major faucets currently implement anti-spam measures requiring mainnet balance.
-
For Testing Without Mainnet BNB:
- Consider using local testnet (Ganache)
- Use alternative test networks
- Contact development communities for test tokens
-
For Full Testing:
- Acquire small amount of BNB on mainnet first
- Use verified faucets only
- Keep minimum required balance for faucet access
- Start the bot:
python sniper_bot.py- Choose Network:
=== Network Selection ===
1. BSC Testnet (for testing)
2. BSC Mainnet (real trading)
- Available Features:
- Buy tokens
- Sell tokens
- Monitor prices
- Detect new tokens
Here's a detailed walkthrough of using the bot:
# Install dependencies
pip install -r requirements.txt
# Create .env file with your private key
PRIVATE_KEY=abc123... # Your actual private key here$ python sniper_bot.py
=== Network Selection ===
1. BSC Testnet (for testing)
2. BSC Mainnet (real trading)
Choose network (1-2): 1
⚠️ Using BSC Testnet - Get free test BNB from: https://testnet.binance.org/faucet-smart
=== Crypto Sniper Bot Menu ===
1. Buy Token
2. Sell Token
3. Monitor Price
4. Detect New Tokens
5. Exit
Choose an option (1-5):Choose an option (1-5): 1
=== Buy Token ===
Enter token address (or 'back' to return): 0x123...
Enter amount of BNB to spend: 0.1
🔍 Analyzing token...
✅ Token verified
💰 Current Price: 0.00234 BNB
🚀 Sending buy transaction...
✅ Transaction successful! Hash: 0xabc...Choose an option (1-5): 3
=== Monitor Token ===
Enter token address: 0x123...
💰 Current Price: 0.00234 BNB
Set take-profit (% increase) [default=50]: 100
Set stop-loss (% decrease) [default=20]: 25
📊 Monitoring price...
Current: 0.00234 BNB
Target: 0.00468 BNB (take-profit)
Stop: 0.00175 BNB (stop-loss)
🔄 Price update: 0.00240 BNB (+2.5%)
🔄 Price update: 0.00255 BNB (+9.0%)
...Choose an option (1-5): 4
=== New Token Detection ===
Press Ctrl+C to stop monitoring
👀 Monitoring PancakeSwap for new tokens...
🆕 New token detected!
Address: 0x789...
Initial Liquidity: 50 BNB
Pair created with: WBNB
Time: 2024-01-20 14:30:45
Would you like to buy? (y/n): n
Continuing monitoring...# Scenario: Buy token and set up automatic take-profit
Choose an option (1-5): 1
Enter token address: 0x123...
Enter amount of BNB to spend: 0.1
Set take-profit (%): 50
🔄 Transaction flow:
1. Checking token contract... ✅
2. Verifying liquidity... ✅
3. Sending buy transaction... ✅
4. Setting up price monitoring... ✅
💫 Bot will automatically:
- Monitor price changes
- Sell when 50% profit is reached
- Handle gas optimization
- Manage slippage# When buying high-demand tokens
🔄 Broadcasting to multiple nodes:
Node 1 (Primary): Connected ✅
Node 2: Connected ✅
Node 3: Connected ✅
⚡ Speed Test Results:
- Node 1: 45ms
- Node 2: 38ms
- Node 3: 52ms
🚀 Using fastest node for transaction...# Example: Insufficient Balance
Error: Insufficient BNB balance
Required: 0.1 BNB
Available: 0.05 BNB
Solution: Add more BNB to wallet
# Example: High Slippage Warning
⚠️ Warning: High price impact detected!
Expected slippage: 25%
Recommended: Reduce trade size or increase slippage tolerance
# Example: Token Security Check
🔍 Token Security Scan:
✅ Contract verified
❌ Honeypot check failed
⚠️ High sell tax detected (25%)
Recommendation: Avoid this token📊 Transaction Performance:
- Submission time: 0.03s
- Block confirmation: 2.5s
- Gas optimization: Saved 0.001 BNB
- Node latency: 45ms average
🔧 System Status:
- Connected nodes: 3/3
- WebSocket status: Active
- Memory usage: 124MB
- Active monitors: 2These examples demonstrate:
- Real-world usage scenarios
- Expected outputs
- Error handling
- Performance metrics
- Security checks
- Multi-node operations
Tips for Best Results:
- Always start with small test amounts
- Monitor gas prices before large transactions
- Use price monitoring for volatile tokens
- Keep track of transaction hashes
- Check token security before buying
-
Wallet Safety:
- NEVER share your private key
- Use a dedicated trading wallet
- Keep minimal funds in trading wallet
- Backup seed phrase securely
-
Testing:
- Start with testnet
- Test all features before real trading
- Use small amounts initially
-
Environment:
- Keep
.envfile secure - Never commit private keys
- Don't share wallet details
- Keep
- Router:
0xD99D1c33F9fC3444f8101754aBC46c52416550D1 - WBNB:
0xae13d989daC2f0dEbFf460aC112a837C89BAa7cd - Factory:
0x6725F303b657a9451d8BA641348b6761A6CC7a17
- Router:
0x10ED43C718714eb63d5aA57B78B54704E256024E - WBNB:
0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c - Factory:
0xcA143Ce32Fe78f1f7019d7d551a6402fC5350c73
This bot is for educational purposes. Crypto trading carries high risk:
- Only trade what you can afford to lose
- Test thoroughly on testnet first
- No guarantee of profits
- Market conditions can change rapidly
- DYOR (Do Your Own Research)
Common issues:
-
"Private key not found":
- Check
.envfile exists - Verify private key format
- Check
-
"Insufficient funds":
- Ensure wallet has BNB for gas
- For testnet: use faucet
- For mainnet: add BNB to wallet
-
"Transaction failed":
- Check gas settings
- Verify token contract
- Ensure sufficient slippage
For issues and feature requests:
- Check troubleshooting guide
- Verify network settings
- Test on testnet first
- Document any errors
Remember: NEVER share your private keys or seed phrase when seeking support!