Why the bitcoin address is not valid in any of the testNet faucet

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?

Arefe

Posted 2017-05-30T08:09:19.293

Reputation: 203

Answers

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

cpsola

Posted 2017-05-30T08:09:19.293

Reputation: 1 453

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 2017-05-31T04:06:56.550

Indeed, the new address seems to be a valid testnet address :) . Glad to be of help!cpsola 2017-05-31T08:01:23.750