0

Is there a way to get the account balance of any given address (address which is not belongs to me) using geth or by using a script which reading leveldb?

Similar to how etherscan (https://rinkeby.etherscan.io/accounts) showing balances.

1

You can get the balance of any account using web3.js using web3.eth.hetBalance('eth_address')

A sample code be something like this:

custom_func.prototype.GETBALANCE=function(address){
    return new Promise(function(fullfill,reject){
        web3.eth.getBalance(address).then(function(ethBal){
            if(ethBal){
                console.log("balance of account : "+address +" is: "+ethBal);
                fullfill(rethBal;            
            }else{
                reject(false);
            }
           }).catch(function(err){
               console.log(err);
               reject(err);
           })
    });
}
6

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.