I'm attempting to learn the bitcoinj API and I've written the test code below. I created an account on:
so I can use fake coins and test sending/receiving. My account has 14 fake BTC's shown when I log in to the URL. However, my code below indicates I have 0 coins. Can someone help me understand what I missed? I used both getBalance
and getWatchedBalance
with no luck.
public class CheckBalance {
public static void main(String[] args) throws Exception {
// This line makes the log output more compact and easily read, especially when using the JDK log adapter.
BriefLogFormatter.init();
// Figure out which network we should connect to. Each one gets its own set of files.
final NetworkParameters params = TestNet3Params.get();
final String filePrefix = "forwarding-service-testnet";
// Parse the address given as the first parameter.
final Address forwardingAddress = new Address(params, "bogusHash"); //note, I replace bogusHash when I really run
// Start up a basic app using a class that automates some boilerplate.
final WalletAppKit kit = new WalletAppKit(params, new File("."), filePrefix);
// Download the block chain and wait until it's done.
kit.startAndWait();
System.out.println("You have : " +kit.wallet().getWatchedBalance() + " bitcoins");
System.exit(0);
}
}