A TypeScript tool that uses BIP44 derivation to scan child addresses and consolidate ETH balances to the root address on Optimism mainnet.
- Secure seed phrase input (interactive or environment variable)
- BIP44 derivation path:
m/44'/60'/0'/0/x(Ethereum standard) - Batch processing: 100 addresses at a time
- Automatic balance checking via Alchemy RPC
- Gas-optimized transfers (deducts gas fees from transfer amount)
- Always shows dry-run results before executing
- Continues scanning until no funded addresses are found
- Colored console output for better visibility
- Node.js 18+ or higher
- An Alchemy API key for Optimism Mainnet (Get one here)
- A seed phrase for the wallet you want to drain
- Clone this repository:
git clone <repository-url>
cd bip44drainer- Install dependencies:
npm install- Create a
.envfile:
cp .env.example .env- Edit
.envand add your Alchemy API key:
ALCHEMY_API_KEY=your_alchemy_api_key_hereRun the script and enter your seed phrase when prompted:
npm startThe script will:
- Ask for your seed phrase securely
- Scan batches of 100 addresses for ETH balances
- Show a dry-run of all planned transfers
- Ask for confirmation before executing
- Execute transfers if confirmed
You can set the seed phrase in your .env file (not recommended for security):
SEED_PHRASE=your twelve word seed phrase goes hereThen run:
npm start-
Derivation: Uses BIP44 path
m/44'/60'/0'/0/xwhere:m/44'/60'/0'/0/0= Root address (recipient)m/44'/60'/0'/0/1= First child addressm/44'/60'/0'/0/2= Second child address- And so on...
-
Scanning: Checks balances in batches of 100 addresses
-
Transfer: For each funded address:
- Estimates gas cost
- Calculates transfer amount = balance - gas cost
- Transfers to root address if profitable
-
Completion: Stops when a consecutive batch has no funded addresses
- Never share your seed phrase with anyone
- Never commit your
.envfile with actual credentials - Use interactive mode instead of storing seed phrase in environment
- This tool transfers real funds on mainnet - use with caution
- Always verify the dry-run results before confirming execution
Edit src/config.ts to customize:
chainId: Optimism mainnet (10)bip44Path: BIP44 derivation pathbatchSize: Number of addresses per batch (default: 100)
═══════════════════════════════════════════════════════════
BIP44 ETH DRAINER - OPTIMISM MAINNET
═══════════════════════════════════════════════════════════
ℹ Validating configuration...
✓ Configuration valid
ℹ Connecting to Optimism network...
✓ Connected to Optimism Mainnet
Root Address (Recipient): 0x1234...5678
ℹ Derivation path: m/44'/60'/0'/0/x
ℹ Batch size: 100 addresses
═══════════════════════════════════════════════════════════
SCANNING FOR FUNDED ADDRESSES
═══════════════════════════════════════════════════════════
Batch 1: Addresses 0 - 99
────────────────────────────────────────────────────────────
ℹ Deriving 100 addresses...
ℹ Checking balances...
✓ Found 3 funded addresses with 0.15 ETH total
═══════════════════════════════════════════════════════════
DRY RUN RESULTS
═══════════════════════════════════════════════════════════
Root Address (Recipient): 0x1234...5678
Batch 1 (0-99)
────────────────────────────────────────────────────────────
0xabcd...1234 → 0x1234...5678 0.05 ETH
0xefgh...5678 → 0x1234...5678 0.07 ETH
0xijkl...9012 → 0x1234...5678 0.03 ETH
✓ Total transfers planned: 3
Total amount to transfer: 0.15 ETH
⚠ Estimated total gas cost: 0.000063 ETH
Do you want to execute these transfers? (yes/no):
- Make sure you created a
.envfile - Add your Alchemy API key to the
.envfile
- Check that you entered exactly 12 or 24 words
- Verify the words are correct BIP39 words
- Ensure there are no extra spaces
- The address has ETH but not enough to pay for gas
- These addresses will be skipped automatically
MIT
This tool is provided as-is for educational and legitimate use cases only. Always verify transactions before confirming. The authors are not responsible for any loss of funds.