Auto TX Script
Gerekli Kurumlar
sudo apt install curl git wget htop tmux build-essential jq make lz4 gcc unzip screen -ysudo apt install -y curl git jq lz4 build-essential cmake perl automake autoconf libtool wget libssl-dev -ycurl -sL https://deb.nodesource.com/setup_20.x | sudo -E bash -Nodejs ve Npm Kurulumu
sudo apt-get install -y nodejs
sudo apt install nodejs npm
npm install -g [email protected]
npm install [email protected]nano airchainstx.jsconst readline = require('readline');
const Web3 = require('web3');
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});
rl.question('Enter your MetaMask wallet private key: ', (privateKey) => {
rl.question('Enter the wallet address you want to send to: ', (toAddress) => {
rl.question('Enter the amount you want to send (in tevmos): ', (amount) => {
rl.question('How often do you want to repeat the transaction? (in seconds): ', (interval) => {
const rpcURL = "http://localhost:8545"; // or your server's IP: "http://your-server-ip:8545"
const web3 = new Web3(new Web3.providers.HttpProvider(rpcURL));
function sendTransaction() {
const account = web3.eth.accounts.privateKeyToAccount(privateKey);
web3.eth.accounts.wallet.add(account);
web3.eth.defaultAccount = account.address;
const tx = {
from: web3.eth.defaultAccount,
to: toAddress,
value: web3.utils.toWei(amount, 'ether'),
gas: 21000,
gasPrice: web3.utils.toWei('1', 'gwei')
};
web3.eth.sendTransaction(tx)
.then(receipt => {
console.log('Transaction successful with hash:', receipt.transactionHash);
})
.catch(err => {
console.error('Error sending transaction:', err);
});
}
setInterval(sendTransaction, interval * 1000);
rl.close();
});
});
});
});
Last updated