如何从帐户中读取ETH值和其他令牌值?

时间:2017-11-08 15:24:06

标签: javascript node.js ethereum web3js ether

假设我使用此代码创建了以太坊帐户:

web3.eth.accounts.create();
> {
    address: "0xb8CE9ab6943e0eCED004cDe8e3bBed6568B2Fa01",
    privateKey: "0x348ce564d427a3311b6536bbcff9390d69395b06ed6c486954e971d960fe8709",
    signTransaction: function(tx){...},
    sign: function(data){...},
    encrypt: function(password){...}
}

如何稍后连接(解锁)该帐户并查看其中包含的所有ETH及其他令牌?

1 个答案:

答案 0 :(得分:0)

  

如何稍后连接(解锁)该帐户并查看其中包含的所有ETH及其他令牌?

eth.accounts向您显示所有已知帐户。要解锁并看到第一个的平衡:

> personal.lockAccount(eth.accounts[0])
> eth.getBalance(eth.accounts[0])