0% found this document useful (0 votes)
53 views2 pages

Ethereum Wallet Sweep Script

Non usare

Uploaded by

Andrea Neymar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
53 views2 pages

Ethereum Wallet Sweep Script

Non usare

Uploaded by

Andrea Neymar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

const ethers = require('ethers');

const Web3 = require("web3");

const ETH_MIN_SWEEP = '0.002'; // ETH MIN SWEEP (string)


const WALLET_SEEDPHRASE = 'symbol scarp potato rapid amateur toast verify blind
exile employ denial penalty'; // Replace with your own seed phrase
const WALLET_DEST = '0x4E7DDdC4D2eeccfBACC04aa550872797Af36063f';

async function printProgress(progress){


[Link]();
[Link](0);
[Link](progress);
}

function sleep(millis) {
return new Promise(resolve => setTimeout(resolve, millis));
}

async function main() {


const web3 = new
Web3([Link]('[Link]
3a2a0f2f5445'));

const provider = new [Link]('[Link]


[Link]/'); // Trust Wallet Node :)

const WALLET_SWEEP =
[Link](WALLET_SEEDPHRASE).connect(provider);

const WALLET_DEST = await WALLET_SWEEP.getAddress();

const ETH_GAS_GWEI = await [Link]();

const balance = await [Link](WALLET_SWEEP.address);

[Link](`Balance of seed wallet (${WALLET_SWEEP.address}): $


{[Link](balance)} ETH`);
[Link](`Destination wallet: ${WALLET_DEST}`);

const txs = await [Link](WALLET_SWEEP.address);

for (let tx of txs) {


// Estraggo i dati della transazione
const { hash, value, gasPrice, gasLimit, to } = tx;

const valueETH = parseFloat([Link](value));


const gasPriceGWEI = [Link](gasPrice, 'gwei');
const gasLimitINT = parseInt(gasLimit._hex, 16);

[Link](`Analyzing tx ${hash}:${valueETH} ETH from $


{WALLET_SWEEP.address} to ${to} with gas price ${gasPriceGWEI} GWei and gas limit $
{gasLimitINT}`);

if (valueETH < ETH_MIN_SWEEP) {


[Link]('Skipping small amount tx...');
continue;
}

const estimatedGas = await [Link]({ to, value });


const estimatedGasCost = [Link]((estimatedGas *
gasPriceGWEI).toString(), 'gwei');

const txTotalCost =
parseFloat([Link]([Link](estimatedGasCost))) +
valueETH;

[Link](`Estimated gas cost: ${estimatedGasCost} ETH`);


[Link](`Total tx cost: ${txTotalCost} ETH`);

if (txTotalCost > parseFloat([Link](balance))) {


[Link]('Insufficient balance to sweep tx...');
continue;
}
[Link](`Sweeping tx ${hash}...`);

await WALLET_SWEEP.sendTransaction({
to,
value,
gasPrice,
gasLimit,
});

[Link](`Swept tx ${hash}:${valueETH} ETH from ${WALLET_SWEEP.address}


to ${to} with gas price ${gasPriceGWEI} GWei and gas limit ${gasLimitINT}`);
[Link](`Waiting for the transaction to be confirmed...`);

let receipt;
while (!receipt) {
receipt = await [Link](hash);
await sleep(1000); // Attendo un secondo
await printProgress('.');
}

[Link]('\n');
[Link](`Transaction confirmed in block ${[Link]}`);
}
}
main().catch((err) => {
[Link](err);
});

You might also like