私はethereumの財布のバランスを取得したいので、私はweb3.jsとgo-ethereumで動作するethereumノードでアプリケーションを作成しました。Web3.js getBalanceは常に0を表示します
ウォレットにいくつかのエーテルがあり、ノードが同期されていますが、残高は常に0エーテルです。
この
は私のアプリです: ノードは、このコマンドで開始されvar Web3 = require('web3');
var web3 = new Web3();
web3.setProvider(new web3.providers.HttpProvider('http://localhost:8545'));
balance = web3.eth.getBalance('0x...');
console.log(balance);
:私はフェッチ
API Version : 0.19.0
Node Version : Geth/v1.7.2-stable-1db4ecdc/darwin-amd64/go1.9.1
Network Version : 1
Ethereum Version : 63
isConnected : true
{host: "http://localhost:8545", timeout: 0}
Listening : true
Peer Count : 25
{currentBlock: 4507134, highestBlock: 4507228, knownStates: 6019923, pulledStates: 6004673, startingBlock: 4506690}
:web3.jsを持つノードの
geth --rpc --rpccorsdomain "*"
ステータス
との取引web3.eth.getTransaction('0x..')
私はウォレットにいくつかのエーテルの移転を見ることができます。私はetherscanを確認すると、私はまだ論文を持って私の財布にエーテルが、私は最後のブロックチェックするとweb3.jsからバランスはまだ0
を返して:
web3.eth.getBlock("latest").number;
かと:
をweb3.eth.blockNumber;
0を返します。正常ではありませんか。
ありがとうございました。
'await web3.eth.getBalance( '0x ...'); ' –