📜  web3.js 获得平衡 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:01:33.936000             🧑  作者: Mango

代码示例1
// Get the Balance of an address on the Ropsten Ethereum TestNet
const Web3 = require('web3');
const infuraProjectId = "";
const ropstenAddress = "<0xROPSTEN_ADDRESS>";
const web3 = new Web3(new Web3.providers.HttpProvider(
    'https://ropsten.infura.io/v3/' + infuraProjectId
));
web3.eth.getBalance( ropstenAddress ).then(console.log);

// REFERENCES:
// https://blog.infura.io/getting-started-with-infura-28e41844cc89/