3

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?

1 Answer 1

4

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();

2
  • 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
    Commented May 31, 2017 at 4:06
  • Indeed, the new address seems to be a valid testnet address :) . Glad to be of help!
    – cpsola
    Commented May 31, 2017 at 8:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.