Skip to main content
added 199 characters in body
Source Link

Use the official web3 JavaScript library's method web3.eth.getBalance

Example Node.js code:

Web3 = require('web3');

var web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545"));

var balance = web3.eth.getBalance("0xc5910bcb2442e84845aa98b20ca51e8f5d2bee23");

console.log("Balance = ", + web3.fromWei(balance, "ether"));

You should change http://localhost:8545 to point to your own geth server.

Also the documentation linked above has some best practices for not overriding previously defined web3 objects, but I skipped them for brevity. Consult the docs yourself to see what all you can do with that lib.

If you cannot use Node.JS then you can read the Official Ethereum JSON RPC spec which tells you all of the methods available and how to use them.

Use the official web3 JavaScript library's method web3.eth.getBalance

Example Node.js code:

Web3 = require('web3');

var web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545"));

var balance = web3.eth.getBalance("0xc5910bcb2442e84845aa98b20ca51e8f5d2bee23");

console.log("Balance = ", balance);

You should change http://localhost:8545 to point to your own geth server.

Also the documentation linked above has some best practices for not overriding previously defined web3 objects, but I skipped them for brevity. Consult the docs yourself to see what all you can do with that lib.

Use the official web3 JavaScript library's method web3.eth.getBalance

Example Node.js code:

Web3 = require('web3');

var web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545"));

var balance = web3.eth.getBalance("0xc5910bcb2442e84845aa98b20ca51e8f5d2bee23");

console.log("Balance = " + web3.fromWei(balance, "ether"));

You should change http://localhost:8545 to point to your own geth server.

Also the documentation linked above has some best practices for not overriding previously defined web3 objects, but I skipped them for brevity. Consult the docs yourself to see what all you can do with that lib.

If you cannot use Node.JS then you can read the Official Ethereum JSON RPC spec which tells you all of the methods available and how to use them.

Source Link

Use the official web3 JavaScript library's method web3.eth.getBalance

Example Node.js code:

Web3 = require('web3');

var web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545"));

var balance = web3.eth.getBalance("0xc5910bcb2442e84845aa98b20ca51e8f5d2bee23");

console.log("Balance = ", balance);

You should change http://localhost:8545 to point to your own geth server.

Also the documentation linked above has some best practices for not overriding previously defined web3 objects, but I skipped them for brevity. Consult the docs yourself to see what all you can do with that lib.