Advertisement
syi3

Untitled

May 17th, 2019
414
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function unlockAll1(){
  2.         eth.accounts.forEach(
  3.                         function(e){    console.log( "Unlocking account " + e );
  4.                                         try {personal.unlockAccount( e,'',0)} catch(err) {console.log("can not unlock account: " + e + " error: " + err)}
  5.                                 })
  6. }
  7. unlockAll1();
  8.  
  9. function faucet2All(){
  10.                         var i =0;
  11.                         eth.accounts.forEach(
  12.                                         function(e){
  13.                                                         if ( e != eth.coinbase && web3.fromWei(eth.getBalance(e), "ether") < 5 )
  14.                                                                 {       console.log("sending some GWEI to account " + e +" from eth.coinbase  " + eth.coinbase );
  15.                                                                         try{eth.sendTransaction({from: eth.coinbase, to: e, value: 2e18})} catch (e){console.log(e);}
  16.                                                                 } else if (e != eth.coinbase && web3.fromWei(eth.getBalance(e), "ether") > 25){
  17.                                                                         console.log("sending some GWEI to eth.coinbase  " + eth.coinbase  +" from " + e );
  18.                                                                         try{eth.sendTransaction({from: e, to: eth.coinbase, value: 2e18})} catch (e){console.log(e);}
  19.                                                                                                                         }
  20.                                                         }
  21.                                                 )
  22.                 }
  23. faucet2All();
  24.  
  25. function GetAllBal(){
  26.         console.log("coinbase",eth.coinbase)
  27.         eth.accounts.forEach(
  28.                 function(e){
  29.                                 console.log(e, web3.fromWei(eth.getBalance(e), "ether"), "ETH");
  30.                         }
  31.         )
  32. }
  33. GetAllBal();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement