Advertisement
gofuncbrrr

check all keystore balances

May 7th, 2021
248
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function checkAllBalances() {
  2.     var totalBal = 0;
  3.     for (var acctNum in eth.accounts) {
  4.         var acct = eth.accounts[acctNum];
  5.         var acctBal = web3.fromWei(eth.getBalance(acct), "ether");
  6.         totalBal += parseFloat(acctBal);
  7.         console.log("  eth.accounts[" + acctNum + "]: \t" + acct + " \tbalance: " + acctBal + " ether");
  8.     }
  9.     console.log("  Total balance: " + totalBal + " ether");
  10. };
  11.  
  12. checkAllBalances();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement