1

I want to get the balance of a bitcoin wallet based on a private key. My wallet contains 0.0000155 BTC. But the following code always returns "You have 0 bitcoins". What is wrong with my code?

final WalletAppKit kit 
    = new WalletAppKit(MainNetParams.get(), new File("."), "test");
kit.startAsync();
kit.awaitRunning();

byte[] key = Base58.decode("MY0PRIVATE0KEY0DUMMYwz8ntrXngmQrhpPig9jj9hHwsLdoej");
kit.wallet().importKey(ECKey.fromPrivate(key));

System.out.println("You have : " + kit.wallet().getBalance() + " bitcoins");
eztam
  • 3,443
  • 7
  • 36
  • 54

0 Answers0