Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# ============================================
# SOLANA MEME COIN SNIPER BOT - Environment Variables
# ============================================
# Copy this file to .env and fill in your values
# NEVER commit your .env file to git!

# Wallet Configuration (REQUIRED for trading)
# Export your Phantom wallet private key (base58 format)
WALLET_PRIVATE_KEY=your_wallet_private_key_here

# Helius API Key (OPTIONAL - for real-time monitoring)
# Get free key at: https://helius.dev
HELIUS_API_KEY=your_helius_api_key_here

# Telegram Alerts (OPTIONAL)
# Create a bot via @BotFather on Telegram
TELEGRAM_BOT_TOKEN=your_telegram_bot_token_here
TELEGRAM_CHAT_ID=your_chat_id_here

# Logging Level (OPTIONAL)
# Options: error, warn, info, debug
LOG_LEVEL=info
45 changes: 45 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Dependencies
node_modules/

# Environment variables (NEVER commit these!)
.env
.env.local
.env.*.local

# Logs
logs/
*.log
npm-debug.log*

# Uploads (temporary files)
uploads/*
!uploads/.gitkeep

# Build outputs
dist/
build/

# IDE and editor files
.idea/
.vscode/
*.swp
*.swo
*~
.DS_Store

# OS files
Thumbs.db

# Private keys and secrets (extra safety)
*.pem
*.key
private_key*
secret*

# Test coverage
coverage/

# Misc
.cache/
tmp/
temp/
284 changes: 283 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,283 @@
# Coin-tracker
# 🎯 Solana Meme Coin Sniper Bot

A personal, locally-run Solana meme coin sniper bot with an AI-powered finance companion. Built with Node.js using only free and open-source tools.

![Dashboard Preview](https://via.placeholder.com/800x400/0d1117/58a6ff?text=Solana+Sniper+Bot+Dashboard)

## ✨ Features

### Core Sniping
- 🔍 **Real-time token detection** on PumpFun and Raydium via Helius WebSocket
- 🎯 **Customizable filters**: Liquidity, market cap, volume, price limits
- ✅ **Safety checks**: RugCheck API integration, honeypot detection
- 📊 **Auto take-profit/stop-loss**: Configurable multipliers (2x, 3x, 5x)
- 🔒 **Simulation mode**: Test strategies without risking real funds

### Dashboard
- 📈 **Real-time watchlist** with DexScreener data
- 💼 **Position tracking** with P&L display
- 📜 **Trade history** logging
- ⚙️ **Live configuration** of all parameters
- 🔔 **Desktop & Telegram notifications**

### AI Finance Companion
- 💬 **Local AI chat** powered by Ollama (Llama 3.1)
- 📷 **Image analysis** for charts/screenshots (LLaVA)
- 🧠 **Context-aware responses** using your watchlist & trading data
- 🔐 **100% private** - runs entirely on your machine

## 🚀 Quick Start

### Prerequisites
- Node.js 18+
- (Optional) [Ollama](https://ollama.ai) for AI features
- (Optional) [Helius](https://helius.dev) API key for real-time monitoring

### Installation

```bash
# Clone the repository
git clone <repo-url>
cd solana-sniper-bot

# Install dependencies
npm install

# Start the bot
npm start
```

Then open http://localhost:3000 in your browser.

### Setting Up Your Wallet

⚠️ **IMPORTANT**: Never share your private key!

```bash
# Export your Phantom wallet private key and set it as an environment variable
export WALLET_PRIVATE_KEY="your_base58_private_key_here"

# Or create a .env file
echo 'WALLET_PRIVATE_KEY=your_key_here' > .env
```

### Setting Up AI Features (Optional but Recommended)

```bash
# 1. Install Ollama from https://ollama.ai

# 2. Pull the required models
ollama pull llama3.1 # For text chat
ollama pull llava # For image analysis

# 3. Ollama runs automatically, or start it with:
ollama serve
```

### Getting a Helius API Key (Optional)

1. Sign up at https://helius.dev (free tier available)
2. Create an API key
3. Add it to `config.json`:
```json
"rpc": {
"heliusApiKey": "your_api_key_here"
}
```

## 📁 Project Structure

```
solana-sniper-bot/
├── app.js # Main entry point
├── config.json # All configuration options
├── package.json # Dependencies
├── src/
│ ├── bot/
│ │ ├── sniper.js # Main sniping orchestrator
│ │ ├── filters.js # Token filtering logic
│ │ ├── trading.js # Buy/sell execution
│ │ └── safety.js # Safety checks & MEV protection
│ ├── api/
│ │ ├── dexscreener.js # DexScreener API integration
│ │ ├── rugcheck.js # RugCheck API for safety
│ │ └── helius.js # Helius RPC & WebSocket
│ ├── dashboard/
│ │ └── server.js # Express server & routes
│ ├── ai/
│ │ ├── ollama.js # Ollama client
│ │ └── chat.js # Chat session manager
│ ├── alerts/
│ │ └── notifications.js # Desktop & Telegram alerts
│ └── utils/
│ ├── wallet.js # Wallet management
│ └── logger.js # Logging utility
├── public/
│ ├── index.html # Dashboard UI
│ ├── css/style.css # Styles
│ └── js/dashboard.js # Frontend logic
├── uploads/ # Temporary image uploads
└── logs/ # Log files
```

## ⚙️ Configuration

All settings are in `config.json`. Key options:

### Sniping Settings
```json
{
"sniping": {
"enabled": true,
"simulationMode": true, // Set to false for real trading

"buyAmount": {
"default": 0.1, // Default buy amount in SOL
"min": 0.01,
"max": 0.5
},

"filters": {
"minLiquidity": 1000, // Minimum liquidity ($)
"maxLiquidity": 10000, // Maximum liquidity ($)
"minMarketCap": 1000,
"maxMarketCap": 50000,
"maxTokenPrice": 0.1, // Skip expensive tokens
"requireRugcheckPass": true
},

"takeProfit": {
"enabled": true,
"targets": [
{ "multiplier": 2, "sellPercent": 50 },
{ "multiplier": 3, "sellPercent": 30 },
{ "multiplier": 5, "sellPercent": 20 }
]
},

"stopLoss": {
"enabled": true,
"triggerPercent": -30
}
}
}
```

### For Small Accounts ($10-50)
```json
{
"wallet": {
"maxBalancePercentPerTrade": 10,
"minBalanceReserve": 0.01
},
"sniping": {
"buyAmount": {
"default": 0.05,
"min": 0.01,
"max": 0.1
},
"filters": {
"maxTokenPrice": 0.01,
"maxMarketCap": 10000
}
}
}
```

### AI Settings
```json
{
"ai": {
"enabled": true,
"ollamaUrl": "http://localhost:11434",
"defaultModel": "llama3.1",
"visionModel": "llava"
}
}
```

### Telegram Alerts (Optional)
```json
{
"alerts": {
"telegram": {
"enabled": true,
"botToken": "YOUR_BOT_TOKEN",
"chatId": "YOUR_CHAT_ID"
}
}
}
```

## 🎮 Usage

### Dashboard Controls
1. **Start/Stop Bot**: Control automatic sniping
2. **Simulation Mode**: Toggle between simulation and real trading
3. **Watchlist**: Add/remove tokens to track
4. **Manual Snipe**: Click on a token to manually snipe it
5. **AI Chat**: Ask questions about crypto, analyze charts

### AI Chat Examples
- "What is the current trend for BONK?"
- "Analyze my watchlist for potential trades"
- "What's the risk level of tokens under $10K market cap?"
- "Explain what liquidity means in DeFi"
- Upload a chart screenshot: "What pattern do you see here?"

## 🛡️ Safety Features

- **Simulation Mode**: Default ON - no real trades until you're ready
- **RugCheck Integration**: Automatic safety scoring
- **Honeypot Detection**: Checks for freeze authority and suspicious patterns
- **Dev Wallet Analysis**: Monitors for concentrated holdings
- **Slippage Protection**: Configurable max slippage (default 15%)
- **Balance Guards**: Won't spend more than configured limits

## ⚠️ Disclaimers

1. **This is NOT financial advice**. Meme coin trading is extremely risky.
2. **Only use funds you can afford to lose completely**.
3. **Start with simulation mode** and small amounts.
4. **Do your own research** before trading any token.
5. This software comes with **NO WARRANTY**.
6. Past performance does not indicate future results.

## 🔧 Troubleshooting

### Bot won't start
- Check that Node.js 18+ is installed: `node --version`
- Run `npm install` to ensure all dependencies are installed
- Check logs in `./logs/` directory

### Wallet not connecting
- Verify your private key is correct (base58 format)
- Ensure the environment variable is set: `echo $WALLET_PRIVATE_KEY`
- Check that you have SOL in your wallet

### AI not responding
- Install Ollama: https://ollama.ai
- Pull required models: `ollama pull llama3.1`
- Check Ollama is running: `curl http://localhost:11434/api/tags`

### No tokens detected
- Add your Helius API key to config.json
- Check that the bot is started (green "Bot Running" badge)
- Ensure you're monitoring during active market hours

## 📝 License

MIT License - Use at your own risk.

## 🤝 Contributing

Contributions welcome! Please:
1. Fork the repository
2. Create a feature branch
3. Submit a pull request

## 📞 Support

- Check the [Issues](../../issues) page
- Review logs in `./logs/` directory
- Ask the AI companion for help!
Loading