<p>Yes. You can create Mainnet and Testnet wallets using one Mnemonic Code.<br>
Here is an example to switch networks.</p>

<pre><code>&gt; java HelloWorld testnet
&gt; mrbZfHK4MuJYEH98w7gENLsrfnY1e4Lq8B

&gt; java HelloWorld mainnet
&gt; 1C5cNEE5YssHTAfXDYhrYRfXonwJe2u1Wf
</code></pre>

<p>.</p>

<pre><code>public class HelloWorld {

    public static void main(String[] args){

        String seedCode = "yard impulse luxury drive today throw farm pepper survey wreck glass federal";
        long creationtime = 1409478661L;
        DeterministicSeed seed = null;
        try {
            seed = new DeterministicSeed(seedCode,null,"",creationtime);
        } catch (UnreadableWalletException e) {
            e.printStackTrace();
        }

        NetworkParameters params;
        if (args[0].equals("testnet")) {
            params = TestNet3Params.get();
        } else {
            params = MainNetParams.get();
        }
        Wallet wallet = Wallet.fromSeed(params, seed);
        Address address = wallet.currentReceiveAddress();
        System.out.println(address);

    }
}
</code></pre>

CC BY-SA 3.0
2018-01-18T19:35:42.437Z
2018-01-18T19:35:42.437Z
ogw_yuya
<p>currently i am using bitcoinj library to create wallet for both <strong>Main-net and Test-net using Mnemonic code</strong>(Mnemonic Code is different for both), my question is can i create both Wallets(Test-net and Main-net) using one Mnemonic Code, if yes, then how?</p>

<bitcoinj><java><mnemonic-seed>
can i use one Mnemonic Code to create both(TestNet and MainNet) wallets
Zombie
# can i use one Mnemonic Code to create both(TestNet and MainNet) wallets

(Asked by: username_0 on 2018-01-18)

currently i am using bitcoinj library to create wallet for both **Main-net and Test-net using Mnemonic code**(Mnemonic Code is different for both), my question is can i create both Wallets(Test-net and Main-net) using one Mnemonic Code, if yes, then how?

**Tags:** bitcoinj, java, mnemonic-seed


---

## 1 answers

### Answer by username_1 on 2018-01-18. Score: 1

Yes. You can create Mainnet and Testnet wallets using one Mnemonic Code.  
Here is an example to switch networks.

```
> java HelloWorld testnet
> mrbZfHK4MuJYEH98w7gENLsrfnY1e4Lq8B

> java HelloWorld mainnet
> 1C5cNEE5YssHTAfXDYhrYRfXonwJe2u1Wf

```

.

```
public class HelloWorld {

    public static void main(String[] args){

        String seedCode = "yard impulse luxury drive today throw farm pepper survey wreck glass federal";
        long creationtime = 1409478661L;
        DeterministicSeed seed = null;
        try {
            seed = new DeterministicSeed(seedCode,null,"",creationtime);
        } catch (UnreadableWalletException e) {
            e.printStackTrace();
        }

        NetworkParameters params;
        if (args[0].equals("testnet")) {
            params = TestNet3Params.get();
        } else {
            params = MainNetParams.get();
        }
        Wallet wallet = Wallet.fromSeed(params, seed);
        Address address = wallet.currentReceiveAddress();
        System.out.println(address);

    }
}

```


---

