This repository contains the core service for copy trading on the Solana blockchain. It is designed to facilitate the creation and management of copy trading strategies, allowing users to automatically replicate trades from a target wallet.
Follow these instructions to install Bun JavaScript runtime (official documentation):
# For macOS operating systems
brew install oven-sh/bun/bun
# Verify the installation by checking the version
bun --version
# Configure shell environment
# First, identify your current shell environment:
echo $SHELL
# Add the following configuration to your shell profile file (e.g., ~/.zshrc):
export BUN_INSTALL="$HOME/.bun"
export PATH="$BUN_INSTALL/bin:$PATH"
Create a .env
file in the project root with the following content:
PRIVATE_KEY_BASE58=<private_key_base58> # Your private key in Base58 format
Use the solRpcWsSubscribeManager
in the main function to subscribe to the target account:
./scripts/run-sol-trade-dev.sh
# or
# set NOT_USE_CLI to false in the env
bun run ./src/cli.ts -k <private_key_base58>
Build the project for production deployment:
./scripts/build-sol-trade.sh
The service comes with an interactive CLI for managing copy trading strategies.
Ensure you have built the project for production as described above.
The CLI is located in the dist
directory.
The CLI is built using Bun and is located in the dist
directory. To run the CLI, you need to have the Bun runtime installed.
You can run the CLI directly from the dist
directory:
./dist/sol-trade -k <private_key_base58>
The CLI provides the following functionality:
- View Service Status - Check the WebSocket connection status and active strategies
- List Active Strategies - View all configured copy trading strategies
- Create Buy Strategy - Set up a new strategy to copy buy trades from a target wallet
- Create Sell Strategy - Set up a new strategy to copy sell trades from a target wallet
- Remove Strategy - Delete an existing strategy
- Exit - Gracefully shut down the service
Creating a Buy Strategy:
- Select "Create buy strategy" from the main menu
- Enter the target wallet address to copy trades from
- Provide a name for your strategy
- Enter the amount of SOL to use for trades (in lamports)
- Set your desired slippage tolerance in basis points (e.g., 100 = 1%)
Creating a Sell Strategy:
- Select "Create sell strategy" from the main menu
- Enter the target wallet address to copy trades from
- Provide a name for your strategy
- Set the fixed selling percentage in basis points (e.g., 500 = 5%)
- Set your desired slippage tolerance in basis points
Managing Strategies:
- Use "List active strategies" to view all current strategies
- Use "Remove strategy" to delete a strategy that's no longer needed
- Use "View service status" to check the connection and activity status
The service utilizes Jupiter for transaction processing on the Solana blockchain.
- General Documentation
- API Overview
- Comprehensive API Documentation
- Supported Decentralized Exchanges
- Fee Structure Information
- Platform Fee Clarification
- Legacy API Documentation
- Swap Instructions Documentation
- Jupiter API Swap Transaction with Priority Fee
- Understanding Transaction Fees on Jupiter Swaps
- Implementing Priority Fees on Solana
- Helius Priority Fee API Documentation
- Transaction Fee Optimization Discussion
- Transaction Speed Optimization
- Solana Fees and Burn Tracker
- Official Solana Transaction Fee Documentation
- Requesting Optimal Compute Budget
- JavaScript/TypeScript Helpers for Solana
- Optimizing Compute Usage on Smart Contracts
- Axen Sniper Bot Documentation
- Adding Custom Fees to Jupiter Swaps
- Jupiter API Trading Bot Guide
- Solana Trading Bot Discussion
- Automated Memecoin Trading Bot
- Trading Bot Usage Discussion
- Building Solana Trading Bots Guide
- ARB Protocol Jupiter Bot Implementation
- Copy Trading Implementation Guide
- Failed Swap Transaction Analysis
- How to get all tokens held by a wallet in solana