Copy Trading on Solana: Follow Whale Wallets Automatically
Copy Trading on Solana: Follow Whale Wallets Automatically
The best traders on Solana are whales with insider knowledge. What if you could automatically copy every trade they make?
How Copy Trading Works
- Monitor target wallet for new token purchases (via WebSocket or polling)
- Detect the buy — new token appears in their holdings
- Execute the same trade — buy the same token within seconds
- Mirror their sells — when they sell, you sell
Architecture
Target Wallet (whale)
└─ Transaction stream (WebSocket)
└─ Filter: token transfers in
└─ Detected buy signal
└─ Execute same swap via Jupiter
└─ Confirm & track position
Step 1: Monitor Wallet Transactions
const { Connection, PublicKey } = require('@solana/web3.js');
const connection = new Connection('wss://api.mainnet-beta.solana.com');
const targetWallet = new PublicKey('WHALE_WALLET_ADDRESS');
// Subscribe to account changes
connection.onAccountChange(targetWallet, async (accountInfo) => {
console.log('Wallet activity detected!');
// Parse transaction to find what token was bought
const recentTx = await connection.getSignaturesForAddress(targetWallet, { limit: 1 });
const txDetail = await connection.getParsedTransaction(recentTx[0].signature);
// Extract token transfer details...
});
Step 2: Detect Buy Signals
function detectBuyFromTx(parsedTx, targetWallet) {
const instructions = parsedTx.transaction.message.instructions;
for (const ix of instructions) {
// Look for token transfers TO the target wallet
if (ix.parsed?.type === 'transfer' || ix.parsed?.type === 'transferChecked') {
const dest = ix.parsed.info.destination || ix.parsed.info.authority;
if (dest === targetWallet) {
return {
mint: ix.parsed.info.mint,
amount: ix.parsed.info.amount || ix.parsed.info.tokenAmount?.amount,
};
}
}
}
return null;
}
Step 3: Execute the Copy Trade
async function copyTrade(mintAddress, solAmount) {
// Get quote from Jupiter
const quote = await getJupiterQuote(
'So11111111111111111111111111111111111111112', // SOL
mintAddress,
Math.floor(solAmount * 1e9)
);
if (quote.priceImpactPct > 5) {
console.log('Price impact too high, skipping');
return;
}
// Execute swap
const txId = await executeJupiterSwap(quote, myWallet);
console.log(`Copied trade: ${txId}`);
}
Key Challenges
Timing
You need to execute within seconds of the whale's buy. Solutions:
- Use WebSocket subscriptions (faster than polling)
- Pre-sign transactions with dynamic compute
- Use Jito bundles for faster inclusion
Position Sizing
Don't copy 1:1 — a whale buying $100K and you buying $100K are very different. Scale proportionally:
const myBudget = 1.0; // SOL per copy trade
const maxSlippage = 300; // 3% for small caps
False Positives
Not every wallet transaction is a buy. Filter for:
- Actual token swaps (not transfers between own wallets)
- New positions (not adding to existing)
- Minimum trade size
Already Built
@solscanitbot has copy trading built in:
/copy <wallet_address> — Start copying a wallet
/unfollow <wallet> — Stop copying
/following — See all followed wallets
It handles all the edge cases: duplicate detection, position sizing, sell mirroring, and Jito MEV protection.
Free to use. 44 commands. Try it: t.me/solscanitbot