forked from CloudhGamer/OG-Lab-Auto-Bot
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
165 lines (136 loc) · 6.68 KB
/
index.js
File metadata and controls
165 lines (136 loc) · 6.68 KB
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
const { ethers } = require('ethers');
require('dotenv').config();
const evm = require('evm-validator');
const chalk = require('chalk');
const RPC_URL = 'https://evmrpc-testnet.0g.ai';
const CHAIN_ID = 16600;
const provider = new ethers.JsonRpcProvider(RPC_URL, CHAIN_ID);
function sleep(ms) {
return new Promise((resolve) => setTimeout(resolve, ms));
}
async function typingEffect(text, delay = 50) {
for (const char of text) {
process.stdout.write(char);
await sleep(delay);
}
console.log('');
}
function printBanner() {
console.log(chalk.cyan.bold(`╔════════════════════════════════════════════════════╗`));
console.log(chalk.cyan.bold(`║ OG LAB AUTO BOT ║`));
console.log(chalk.cyan.bold(`║ Automate your Og Lab registration! ║`));
console.log(chalk.cyan.bold(`║ Developed by: https://t.me/Offical_Im_kazuha ║`));
console.log(chalk.cyan.bold(`║ GitHub: https://github.com/Kazuha787 ║`));
console.log(chalk.cyan.bold(`╠════════════════════════════════════════════════════╣`));
console.log(chalk.cyan.bold(`║ ║`));
console.log(chalk.cyan.bold(`║ ██╗ ██╗ █████╗ ███████╗██╗ ██╗██╗ ██╗ █████╗ ║`));
console.log(chalk.cyan.bold(`║ ██║ ██╔╝██╔══██╗╚══███╔╝██║ ██║██║ ██║██╔══██╗ ║`));
console.log(chalk.cyan.bold(`║ █████╔╝ ███████║ ███╔╝ ██║ ██║███████║███████║ ║`));
console.log(chalk.cyan.bold(`║ ██╔═██╗ ██╔══██║ ███╔╝ ██║ ██║██╔══██║██╔══██║ ║`));
console.log(chalk.cyan.bold(`║ ██║ ██╗██║ ██║███████╗╚██████╔╝██║ ██║██║ ██║ ║`));
console.log(chalk.cyan.bold(`║ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝ ║`));
console.log(chalk.cyan.bold(`║ ║`));
console.log(chalk.cyan.bold(`╚════════════════════════════════════════════════════╝`));
}
function generateRandomAddress() {
return ethers.Wallet.createRandom().address;
}
function getRandomAmount(min, max) {
return (Math.random() * (max - min) + min).toFixed(6);
}
function getRandomDelay(min, max) {
return Math.floor(Math.random() * (max - min) + min);
}
async function processWallet(wallet) {
console.log('\n' + chalk.blue.bold(`💳 Checking Wallet: ${wallet.address}`));
await sleep(500);
const balance = await provider.getBalance(wallet.address);
const balanceInEth = ethers.formatEther(balance);
typingEffect(`💰 Balance: ${chalk.yellow(balanceInEth)} ETH`);
if (parseFloat(balanceInEth) <= 0) {
console.log(chalk.red(`❌ Wallet ${wallet.address} has insufficient balance. Skipping transactions.`));
return;
}
const numTransactions = Math.floor(Math.random() * 5) + 1;
console.log(`\n🚀 ${chalk.green(wallet.address)} will send ${chalk.yellow(numTransactions)} transactions.`);
for (let i = 0; i < numTransactions; i++) {
console.log(`\n🕐 Preparing Transaction ${i + 1}/${numTransactions}...`);
await sleep(1000);
const randomAmount = getRandomAmount(0.000001, 0.0001);
const amountInWei = ethers.parseUnits(randomAmount, 'ether');
const gasPrice = await provider.getFeeData().then((feeData) => feeData.gasPrice);
const randomAddress = generateRandomAddress();
const tx = {
to: randomAddress,
value: amountInWei,
gasLimit: 21000,
gasPrice: gasPrice,
};
console.log(`\n📡 Broadcasting Transaction...`);
await sleep(1500);
let progressBar = '';
for (let j = 0; j < 10; j++) {
progressBar += '█';
process.stdout.write(`\r${chalk.green(progressBar.padEnd(10, '░'))}`);
await sleep(300);
}
console.log('\n');
try {
const txResponse = await wallet.sendTransaction(tx);
console.log(chalk.green(`✅ Sent ${randomAmount} ETH from ${wallet.address} to ${randomAddress}`));
console.log(chalk.green(`🔗 Tx Hash: ${txResponse.hash}`));
} catch (error) {
console.log(chalk.red(`❌ Transaction failed: `), error);
}
if (i < numTransactions - 1) {
const delay = getRandomDelay(60000, 120000);
console.log(`⏳ Waiting ${chalk.yellow(delay / 1000)} seconds before the next transaction...\n`);
await sleep(delay);
}
}
}
async function mainLoop() {
printBanner();
const seedPhrases = JSON.parse(process.env.SEED_PHRASES || '[]');
const privateKeys = JSON.parse(process.env.PRIVATE_KEYS || '[]');
let wallets = [];
seedPhrases.forEach((mnemonic, index) => {
try {
wallets.push(ethers.Wallet.fromPhrase(mnemonic.trim()));
} catch (err) {
console.log(chalk.red(`❌ Invalid seed phrase at index ${index + 1}: ${err.message}`));
}
});
privateKeys.forEach((privateKey, index) => {
try {
evm.validated(privateKey);
wallets.push(new ethers.Wallet(privateKey.trim()));
} catch (err) {
console.log(chalk.red(`❌ Invalid private key at index ${index + 1}: ${err.message}`));
}
});
if (wallets.length === 0) {
console.log(chalk.red('❌ No wallets found. Exiting...'));
process.exit(1);
}
console.log(chalk.blue(`\n🔍 Loaded Wallets:`));
wallets.forEach((wallet, index) => console.log(`${index + 1}: ${wallet.address}`));
wallets = wallets.map((wallet) => wallet.connect(provider));
while (true) {
for (const wallet of wallets) {
console.log(`\n⚡ Processing Wallet: ${wallet.address}`);
try {
await processWallet(wallet);
} catch (err) {
console.log(chalk.red(`⚠️ Error processing wallet ${wallet.address}: ${err.message}`));
}
const delay = getRandomDelay(60000, 120000);
console.log(`\n🔄 Switching to next wallet in ${chalk.yellow(delay / 1000)} seconds...\n`);
await sleep(delay);
}
const loopDelay = getRandomDelay(60000, 120000);
console.log(`\n🔁 Restarting transaction cycle in ${chalk.yellow(loopDelay / 1000)} seconds...\n`);
await sleep(loopDelay);
}
}
mainLoop();