-
Notifications
You must be signed in to change notification settings - Fork 0
/
sonicbyreverb.sh
75 lines (62 loc) · 2.52 KB
/
sonicbyreverb.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
66
67
68
69
70
71
72
73
74
75
#!/usr/bin/env node
import { Connection, Keypair, Transaction, SystemProgram, sendAndConfirmTransaction, LAMPORTS_PER_SOL } from "@solana/web3.js";
import chalk from "chalk";
import bs58 from "bs58";
import readline from "readline";
const BOLD_BLUE = '\033[1;34m';
const NC = '\033[0m';
console.log();
if (!Connection) {
console.error(`${BOLD_BLUE}Error: @solana/web3.js is not installed. Please install it using npm.${NC}`);
process.exit(1);
}
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});
rl.question(`Enter your Solana wallet private key:`, async (privkey) => {
try {
const connection = new Connection("https://api.devnet.solana.com", 'confirmed');
const from = Keypair.fromSecretKey(bs58.decode(privkey));
const to = Keypair.generate();
const txCount = 95;
console.log();
console.log(`${BOLD_BLUE}Generating ${txCount} transactions with random amounts and delays...${NC}`);
console.log();
for (let i = 0; i < txCount; i++) {
// Generate a random amount between 0.001 and 0.003 SOL (adjust range as needed)
const randomAmount = (Math.random() * (0.003 - 0.001) + 0.001).toFixed(4);
const lamports = Math.round(parseFloat(randomAmount) * LAMPORTS_PER_SOL);
const transaction = new Transaction().add(
SystemProgram.transfer({
fromPubkey: from.publicKey,
toPubkey: to.publicKey,
lamports: lamports,
}),
);
try {
const signature = await sendAndConfirmTransaction(
connection,
transaction,
[from],
{
commitment: 'confirmed',
}
);
console.log(chalk.blue('Transaction successful. Tx hash:'), signature);
console.log("Amount sent:", randomAmount, "SOL");
console.log();
} catch (error) {
console.error(chalk.red('Transaction failed:'), error.message);
console.log();
}
// Generate a random delay between 1 and 5 seconds
const randomDelay = Math.floor(Math.random() * 5) + 1;
await new Promise(resolve => setTimeout(resolve, randomDelay * 1000));
}
} catch (error) {
console.error(chalk.red('Error:'), error.message);
} finally {
rl.close();
}
});