I develop a simple Java/Maven/JSP app for bitcoin and generated the address 167Bqf3Mi3gnfhw5DhCfoYNTMxqANt3Zky I would like to send some money to this address from a bitcoin testnet faucet. I feel it weird that none of the testNet faucet out there seems to recognize the address and indicate it as invalid. Funny thing is I used the same code for generating the address that is provided in the BitcoinJ github page.

How should I approach from here?


Testnet uses a different address format than the main network. Testnet addresses start with an "m" or "n". The address you are using starts with a "1" and is therefore for the main network. This is why the testnet faucets say the address is invalid.

From the documentation of BitcoinJ, it seems that you can configure your code to use the testnet with:

params = TestNet3Params.get();

  • Thanks for the answer. This helps me a lot. The reason it was created in the first place is that I have used public static NetworkParameters networkParameters = MainNetParams.get();. I later changed the code to public static NetworkParameters networkParameters = TestNet3Params.get(); and else if (networkParameters == TestNet3Params.get()) { bitcoin.useTor(); // bitcoin.setDiscovery(new HttpDiscovery(networkParameters, URI.create("http://localhost:8080/peers"), }. New test net address n3xE28g8cmVYNU5VeGFazoqfGj2PaZUXYN – Arefe May 31 '17 at 4:06
  • Indeed, the new address seems to be a valid testnet address :) . Glad to be of help! – cpsola May 31 '17 at 8:01

Your Answer

