Skip to content

chefallan/goemonai

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

1 Commit
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ€– GoemonAI - Solana Market Making Bot

A complete solution for a Solana market making bot that captures creator fees from Pump.fun and intelligently allocates them across market making, buyback/burn, and team operations.

🎯 Overview

GoemonAI is a sophisticated trading bot for Solana that:

  1. Monitors Pump.fun - Listens to creator fee events on Pump.fun
  2. Allocates Funds - Optimized fund distribution strategy
    • 80% to market making (price support and trading)
    • 15% to buyback and burn (reduce supply, increase scarcity)
    • 5% to team (operational costs)
  3. Tracks Everything - Provides real-time dashboard for complete transparency
  4. Manages Growth - Sustainable token economics through continuous buyback and burn

πŸ“ Project Structure

goemonai/
β”œβ”€β”€ bot/                 # Core trading bot
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ index.ts    # Express API server
β”‚   β”‚   β”œβ”€β”€ bot.ts      # Bot trading logic
β”‚   β”‚   β”œβ”€β”€ database.ts # SQLite persistence
β”‚   β”‚   └── types.ts    # TypeScript types
β”‚   β”œβ”€β”€ package.json
β”‚   β”œβ”€β”€ tsconfig.json
β”‚   └── .env.example
β”œβ”€β”€ website/            # React/Next.js dashboard
β”‚   β”œβ”€β”€ pages/          # Dashboard, Transactions, Stats
β”‚   β”œβ”€β”€ components/     # UI components
β”‚   β”œβ”€β”€ lib/            # API client
β”‚   β”œβ”€β”€ styles/         # Tailwind CSS
β”‚   └── package.json
β”œβ”€β”€ shared/             # Shared utilities
β”œβ”€β”€ docker-compose.yml  # Docker orchestration
β”œβ”€β”€ Dockerfile.bot      # Bot container
β”œβ”€β”€ Dockerfile.website  # Website container
β”œβ”€β”€ setup.sh           # Linux/Mac setup
└── setup.bat          # Windows setup

πŸ’° Fund Allocation Strategy

GoemonAI uses an optimized three-way allocation strategy:

Creator Fee
    ↓
β”œβ”€ 80% β†’ Market Making Wallet (price support & trading)
β”œβ”€ 15% β†’ Buyback & Burn Wallet (reduce supply)
└─ 5% β†’ Team Wallet (operational costs)

Why This Works

  1. Market Making Focus - 80% ensures strong price support
  2. Supply Reduction - 15% buyback & burn decreases token supply
  3. Lean Operations - 5% team allocation keeps overhead low
  4. Token Value - Continuous burning increases scarcity
  5. Sustainable - Scalable allocation strategy
  6. Professional - Proven tokenomics model

πŸš€ Quick Start

Prerequisites

  • Node.js 18+ and npm/yarn
  • Solana CLI (optional)
  • A Solana devnet/mainnet RPC endpoint
  • Bot wallet with initial SOL balance

Bot Setup

cd bot

# Install dependencies
npm install

# Create .env file
cp .env.example .env

# Edit .env with your configuration
nano .env
# Required:
# - SOLANA_RPC_URL: Your Solana RPC endpoint
# - BOT_PRIVATE_KEY: Your bot's wallet private key (base64 encoded)
# - TEAM_WALLET: Team's Solana address
# - MARKET_MAKING_WALLET: Market making wallet address
# - LOTTERY_WALLET: Buyback/burn wallet address

# Development
npm run dev

# Production
npm run build
npm start

Bot API available at: http://localhost:3001

Website Setup

cd website

# Install dependencies
npm install

# Create .env.local file
cp .env.example .env.local

# Development
npm run dev

# Production
npm run build
npm start

Dashboard available at: http://localhost:3000

πŸ”§ Configuration

Bot Environment Variables (.env)

# RPC Configuration
SOLANA_RPC_URL=https://api.mainnet-beta.solana.com

# Wallet Configuration (base64 encoded private key)
BOT_PRIVATE_KEY=your_base64_encoded_key_here

# Fund Destination Wallets
TEAM_WALLET=<team_solana_address>
MARKET_MAKING_WALLET=<market_making_solana_address>
LOTTERY_WALLET=<buyback_burn_solana_address>

# Pump.fun Program ID
PUMP_FUN_PROGRAM_ID=39azUhRZyodmcP2ZNaZjqwNcqRQB3hEd5e7g9qKB5qS1

# API Configuration
API_PORT=3001

Website Environment Variables (.env.local)

NEXT_PUBLIC_API_URL=http://localhost:3001

πŸ”Œ API Endpoints

The bot exposes REST API endpoints:

GET /api/health

Health check - returns bot and database status

GET /api/metrics

Current bot metrics and recent transactions

GET /api/transactions

Transaction history with pagination

Query Parameters:

  • limit - Number of transactions (default: 50)
  • offset - Pagination offset (default: 0)

GET /api/transactions/by-type/:type

Transactions filtered by type (fee_received, allocation, market_buy, etc.)

GET /api/stats

Aggregated statistics and fund allocation

Response includes:

  • totalFeesCollected - Total SOL fees collected
  • teamFunds - Total allocated to team
  • marketMakingFunds - Total allocated to market making
  • buybackBurnFunds - Total allocated to buyback/burn
  • allocation - Current allocation percentages

πŸ’Ύ Database

The bot uses SQLite for persistent data storage.

Tables

  • transactions - All transactions (fees, allocations, trades)
  • fund_allocation - Historical fund allocation records
  • metrics - Time-series bot performance metrics

Data is stored in bot_data.db in the bot directory.

🎨 Dashboard Features

Dashboard Page (/)

  • Real-time fund allocation visualization
  • Total fees collected
  • Fund distribution breakdown
  • Recent transactions
  • Auto-refresh every 5 seconds

Transactions Page (/transactions)

  • Full transaction history
  • Pagination support
  • Filter by transaction type
  • View allocation details
  • Links to Solscan explorer

Statistics Page (/stats)

  • Performance metrics
  • Fund distribution summary
  • Daily volume tracking
  • Profit/loss analysis
  • Current allocation percentages

🐳 Docker Deployment

Build and run with Docker:

# Build images
docker-compose build

# Start services
docker-compose up -d

# View logs
docker-compose logs -f

# Stop services
docker-compose down

Services will be available at:

  • Bot API: http://localhost:3001
  • Website: http://localhost:3000

πŸš€ Production Deployment

VPS/Cloud Server

# Clone repository
git clone https://github.com/yourusername/goemonai.git
cd goemonai

# Run setup script
bash setup.sh  # Linux/Mac
setup.bat     # Windows

# Start services
cd bot && npm run build && npm start &
cd ../website && npm run build && npm start &

Production Checklist

  • Update SOLANA_RPC_URL to mainnet
  • Configure real wallet addresses
  • Set up HTTPS/SSL certificate
  • Enable authentication if needed
  • Configure firewall rules
  • Set up monitoring/logging
  • Implement backup strategy
  • Test with small amounts first
  • Monitor bot activity closely

πŸ” Security Considerations

  1. Private Keys

    • Never commit .env files to git
    • Use base64 encoding for keys
    • Rotate keys periodically
    • Restrict file permissions (chmod 600)
  2. API Security

    • Disable public API endpoints in production
    • Implement authentication
    • Use HTTPS only
    • Add rate limiting
    • Enable CORS properly
  3. Wallet Security

    • Use separate wallets for different functions
    • Implement transaction limits
    • Regular security audits
    • Monitor for suspicious activity

πŸ› Troubleshooting

Bot not connecting to Pump.fun

# Test RPC endpoint
solana cluster-version --url <YOUR_RPC_URL>

# Check program ID
solana account <PUMP_FUN_PROGRAM_ID> --url <YOUR_RPC_URL>

Solutions:

  • Verify RPC URL is correct
  • Check Pump.fun program ID
  • Ensure bot wallet has SOL balance

Dashboard showing no data

# Check bot API health
curl http://localhost:3001/api/health

# Check database exists
ls -la bot/bot_data.db

Solutions:

  • Verify bot is running
  • Check NEXT_PUBLIC_API_URL is correct
  • Clear browser cache
  • Check browser console for errors

Transactions not appearing

Check:

  1. Bot is receiving fees from Pump.fun
  2. Database is accessible and writable
  3. Bot logs for errors: npm run dev

πŸ“Š Fund Allocation Example

If bot receives 100 SOL from creator fees:

Allocation Amount Wallet Purpose
Market Making 80 SOL Market Making Price support & trading
Buyback & Burn 15 SOL Buyback/Burn Supply reduction
Team 5 SOL Team Operations

πŸ“ˆ Market Making Logic

The bot implements:

  1. Order Placement - Places orders around market price
  2. Spread Management - Maintains profitable spreads
  3. Position Management - Balances inventory
  4. Risk Control - Implements safeguards

Note: Detailed algorithms should be customized based on your strategy

πŸ“š Technology Stack

Backend:

  • Node.js + TypeScript
  • Express.js (REST API)
  • SQLite (database)
  • @solana/web3.js (blockchain)

Frontend:

  • React 18
  • Next.js 14
  • Tailwind CSS
  • Recharts (visualization)

Deployment:

  • Docker
  • Docker Compose

🀝 Support

For issues and questions:

  1. Check the troubleshooting section above
  2. Review bot logs: npm run dev
  3. Check database: sqlite3 bot_data.db
  4. Verify configuration files

πŸ“ License

Provided for educational purposes.

⚠️ Disclaimer

This bot interacts with real blockchain assets. Use at your own risk. The developers are not responsible for financial losses. Always test on devnet first.


Built with ❀️ for the Solana ecosystem

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors