WHY ! WHY ! WHY!
I want to use the bitcoinj to get the balance from priv key OR public key.
the code is like following .
BlockStore blockStore = new BoundedOverheadBlockStore(params, file);
BlockChain chain = new BlockChain(params, wallet, blockStore);
System.out.println("Connecting ...");
PeerGroup peerGroup = new PeerGroup(params, chain);
peerGroup.setUserAgent("PingService", "1.0");
if (testNet) {
peerGroup.addPeerDiscovery(new IrcDiscovery("#bitcoinTEST3"));
} else {
peerGroup.addPeerDiscovery(new DnsDiscovery(params));
}
peerGroup.addWallet(wallet);
peerGroup.startAndWait();
peerGroup.downloadBlockChain();
System.out.println("You have " + Utils.bitcoinValueToFriendlyString(wallet.getBalance()) + " BTC");
the wallet has had EKeys which have btc.
But why the balance show me is 0.00? why? Any one help?