-
Notifications
You must be signed in to change notification settings - Fork 0
/
plume.sh
74 lines (62 loc) · 1.96 KB
/
plume.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
Plume.sh
#!/bin/bash
function echo_blue_bold {
echo -e "\033[1;34m$1\033[0m"
}
echo
if [ ! -f privatekeys.txt ]; then
echo_blue_bold "Error: privatekeys.txt file not found!"
exit 1
fi
if ! npm list ethers@5.5.4 >/dev/null 2>&1; then
echo_blue_bold "Installing ethers..."
npm install ethers@5.5.4
echo
else
echo_blue_bold "Ethers is already installed."
fi
echo
temp_node_file=$(mktemp /tmp/node_script.XXXXXX.js)
cat << EOF > $temp_node_file
const fs = require("fs");
const ethers = require("ethers");
const privateKeys = fs.readFileSync("privatekeys.txt", "utf8").trim().split("\\n");
const providerURL = "https://testnet-rpc.plumenetwork.xyz/http";
const provider = new ethers.providers.JsonRpcProvider(providerURL);
const contractAddress = "0x8Dc5b3f1CcC75604710d9F464e3C5D2dfCAb60d8";
const transactionData = "0x183ff085";
const numberOfTransactions = 1;
async function sendTransaction(wallet) {
const tx = {
to: contractAddress,
value: 0,
gasLimit: ethers.BigNumber.from(400000),
gasPrice: ethers.utils.parseUnits("0.2", 'gwei'),
data: transactionData,
};
try {
const transactionResponse = await wallet.sendTransaction(tx);
const walletAddress = wallet.address;
console.log("\033[1;35mTx Hash:\033[0m", transactionResponse.hash);
const receipt = await transactionResponse.wait();
console.log("");
} catch (error) {
console.error("Error sending transaction:", error);
}
}
async function main() {
for (const key of privateKeys) {
const wallet = new ethers.Wallet(key, provider);
for (let i = 0; i < numberOfTransactions; i++) {
console.log("Checking in from wallet:", wallet.address);
await sendTransaction(wallet);
}
}
}
main().catch(console.error);
EOF
NODE_PATH=$(npm root -g):$(pwd)/node_modules node $temp_node_file
rm $temp_node_file
echo
echo_blue_bold "Follow @ZunXBT on X for more guides like this"
echo