Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function sendAll(accountNum, coinbase) {
- var accs = eth.accounts;
- personal.unlockAccount(accs[accountNum]);
- var amount_to_send_eth = web3.fromWei(eth.getBalance(accs[accountNum]), "ether");
- var amount_to_send_wei = amount_to_send_eth *1000000000000000000;
- var transactionFee = web3.eth.gasPrice * 22000;
- var total_amount_to_send_wei = amount_to_send_wei - transactionFee;
- console.log(total_amount_to_send_wei);
- eth.sendTransaction({from:eth.accounts[accountNum], to: eth.accounts[0], value: total_amount_to_send_wei });
- }
- function collect(coinbase) {
- var accs = eth.accounts;
- for (var acctNum in accs) {
- if (accs[acctNum] == coinbase) {
- console.log("skip coinbase");
- continue;
- }
- if (eth.getBalance(accs[acctNum]) < 210000000000000){
- console.log("skip small amount tx");
- continue;
- }
- sendAll(acctNum, coinbase);
- }
- }
- // for example cold wallet from bsc testnet dev
- collect("0x91735ef23d55cc7c5f31fca74cf2dcc9ff3015a6");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement