-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.sh
executable file
·65 lines (51 loc) · 1.74 KB
/
main.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/bin/bash
# Script to automate wallet generation, dependency installation, and balance checking
set -e
# Configuration
DB_FILE="wallets.db"
DOCKER_IMAGE="planxthanee/ethereum-wallet-generator"
VENV_DIR="venv"
LIMIT=1000
THREADS=8
MODE=2
echo "🚀 Starting the Key Miner Script..."
# Step 1: Check if virtual environment exists, if not create it
if [ ! -d "$VENV_DIR" ]; then
echo "🔧 Creating virtual environment..."
python3 -m venv $VENV_DIR
fi
# Step 2: Activate the virtual environment
echo "🟢 Activating virtual environment..."
source $VENV_DIR/bin/activate
# Step 3: Install dependencies
if [ ! -f "requirements.txt" ]; then
echo "❌ requirements.txt not found. Exiting."
exit 1
fi
echo "📦 Installing dependencies..."
pip install --quiet -r requirements.txt
# Step 4: Run the Docker wallet generator
echo "⛏️ Generating wallets using Docker..."
docker run --rm -d -v $(pwd):/db $DOCKER_IMAGE \
-n 0 -limit $LIMIT -db $DB_FILE -c $THREADS -mode $MODE
# Wait for the Docker container to complete
echo "⏳ Monitoring Docker container..."
while [ "$(docker ps -q -f ancestor=$DOCKER_IMAGE)" ]; do
echo "💤 Wallet generation in progress... checking again in 5 seconds."
sleep 5
done
# Fixes file ownership issue that docker creates files as root user
sudo chown $USER:$USER wallets.db
# Add execution permission to view wallet script.
chmod +x view_wallets.sh
echo "✅ Wallet generation completed."
# Step 5: Run the key-miner.py script
if [ -f "key-miner.py" ]; then
echo "💰 Checking wallet balances..."
python3 key-miner.py --db $DB_FILE
else
echo "❌ key-miner.py script not found. Exiting."
exit 1
fi
echo "🎉 Process complete! Check the output for results."
echo "./view_wallets.sh wallets.db"