Advertisement
gofuncbrrr

collect all money in coinbase

May 7th, 2021 (edited)
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function sendAll(accountNum, coinbase) {
  2.     var accs = eth.accounts;
  3.     personal.unlockAccount(accs[accountNum]);
  4.     var amount_to_send_eth = web3.fromWei(eth.getBalance(accs[accountNum]), "ether");
  5.     var amount_to_send_wei = amount_to_send_eth *1000000000000000000;
  6.     var transactionFee = web3.eth.gasPrice * 22000;
  7.     var total_amount_to_send_wei = amount_to_send_wei - transactionFee;
  8.     console.log(total_amount_to_send_wei);
  9.     eth.sendTransaction({from:eth.accounts[accountNum], to: eth.accounts[0], value: total_amount_to_send_wei });
  10. }
  11.  
  12. function collect(coinbase) {
  13.     var accs = eth.accounts;
  14.     for (var acctNum in accs) {
  15.         if (accs[acctNum] == coinbase) {
  16.             console.log("skip coinbase");
  17.             continue;
  18.         }
  19.         if (eth.getBalance(accs[acctNum]) < 210000000000000){
  20.             console.log("skip small amount tx");
  21.             continue;
  22.         }
  23.         sendAll(acctNum, coinbase);
  24.     }
  25. }
  26.  
  27. // for example cold wallet from bsc testnet dev
  28. collect("0x91735ef23d55cc7c5f31fca74cf2dcc9ff3015a6");
  29.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement