<p>Testnet uses a <a href="https://en.bitcoin.it/wiki/List_of_address_prefixes" rel="nofollow noreferrer">different address format</a> 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.</p>

<p>From the <a href="https://bitcoinj.github.io/getting-started-java" rel="nofollow noreferrer">documentation of BitcoinJ</a>, it seems that you can configure your code to use the testnet with:</p>

<blockquote>
  <p>params = TestNet3Params.get();</p>
</blockquote>

CC BY-SA 3.0
2017-05-31T04:06:56.550Z
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
CC BY-SA 3.0
2017-05-31T08:01:23.750Z
Indeed, the new address seems to be a valid testnet address :) . Glad to be of help!
cpsola
CC BY-SA 3.0
2017-05-30T09:20:32.177Z
2017-06-13T20:34:42.613Z
2017-06-13T20:34:42.613Z
cpsola
<p>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 <code>BitcoinJ</code> github page. </p>

<p>How should I approach from here? </p>

<testnet><bitcoinj><address-generation><java>
Why the bitcoin address is not valid in any of the testNet faucet
Arefe
# Why the bitcoin address is not valid in any of the testNet faucet

(Asked by: username_0 on 2017-05-30)

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?

**Tags:** testnet, bitcoinj, address-generation, java


---

## 1 answers

### Answer by username_1 on 2017-05-30. Score: 4 | Accepted answer

Testnet uses a [different address format](https://en.bitcoin.it/wiki/List_of_address_prefixes) 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](https://bitcoinj.github.io/getting-started-java), it seems that you can configure your code to use the testnet with:

> params = TestNet3Params.get();

> **Comments:**
> **username_0**: 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 `  
> **username_1**: Indeed, the new address seems to be a valid testnet address :) . Glad to be of help!  

---

