<p>Yes, you can. Just be sure to specify different data directories and configure them to use different ports.</p>

CC BY-SA 3.0
2013-06-15T18:53:39.927Z
I assume that the "specify different data directories" is now obsolete, right?
o0'.
CC BY-SA 3.0
2011-11-25T05:12:42.277Z
2011-11-25T05:12:42.277Z
David Schwartz
<p>I don't see any reason why not.
I've read somewhere in <a href="https://bitcointalk.org/index.php?topic=24209.0" rel="nofollow">this thread</a> that people run various instances of multicoin for similar purposes.</p>

CC BY-SA 3.0
2011-11-24T23:33:36.837Z
2011-11-24T23:33:36.837Z
jtimon
<p>I am running two nodes in the same server just as you wanted, you can follow below steps:<br>
<strong>1.</strong> create two separate config files: 
<code>bitcoin_mainnet.conf</code> and  <code>bitcoin_testnet3.conf</code> in ~/.bitcoin  </p>

<p><strong>2.</strong> make the rpc port and datadir different from each other<br>
<strong>sample conf:</strong><br>
<strong>testnet</strong>  </p>

<pre><code># This config should be placed in following path:
# ~/.bitcoin/bitcoin_testnet3.conf

# [core]
# Specify the location of the configuration file. To use non-default location, create a default location config file containing this setting.
conf=~/.bitcoind/bitcoin_testnet3.conf
# Specify a non-default location to store blockchain and other data.
datadir=/mnt/bitcoin

# [debug]
# Run this node on the Bitcoin Test Network.
testnet=1

# [rpc]
# Accept command line and JSON-RPC commands.
server=1
# Accept public REST requests.
rest=1
# RPC user
rpcuser=rpcuser
# RPC password
rpcpassword=rpcpass
# RPC allow ip (allow all)
rpcallowip=0.0.0.0/0
# RPC bind
rpcbind=0.0.0.0
# get all transaction
txindex=1
</code></pre>

<p><strong>mainnet</strong>  </p>

<pre><code># This config should be placed in following path:
# ~/.bitcoin/bitcoin_mainnet.conf

# [core]
# Specify the location of the configuration file. To use non-default location, create a default location config file containing this setting.
conf=~/.bitcoind/bitcoin_mainnet.conf
# Specify a non-default location to store blockchain and other data.
datadir=/mnt/bitcoin/mainnet

# [debug]
# Run this node on the Bitcoin Test Network.
#testnet=1

# [rpc]
# Accept command line and JSON-RPC commands.
server=1
# Accept public REST requests.
rest=1
# RPC user
rpcuser=rpcuser
# RPC password
rpcpassword=rpcpass
# RPC allow ip (allow all)
rpcallowip=0.0.0.0/0
# RPC bind
rpcbind=0.0.0.0
# get all transaction
txindex=1
</code></pre>

<p><strong>3.</strong> use below commands to get the node up:
    bitcoind -conf=/root/.bitcoin/bitcoin_testnet3.conf -daemon
    bitcoind -conf=/root/.bitcoin/bitcoin_mainnet.conf -daemon</p>

<p><strong>4.</strong> now you can use rpc to interactive testnet &amp; mainnet in different port.  </p>

<p><strong>5.</strong> this approch has a downside, that is when using CLI to interactive you can only connect to one network,you can check which network you are connecting with by:<br>
<code>bitcoin-cli getblockchaininfo</code> which will returns info something like below. "chain": "test" means it's testnet.  </p>

<pre><code>{
  "chain": "test",
  "blocks": 1443057,
  "headers": 1443057,
  "bestblockhash": "00000000000000e9f4078f12d44ee643fd9711e93ad4ddaab5af1977741ce053",
  "difficulty": 11974980.94624031,
  "mediantime": 1542001244,
  "verificationprogress": 0.9999998425668387,
  "initialblockdownload": false,
  "chainwork": "0000000000000000000000000000000000000000000000d119525c684f1418b3",
  "size_on_disk": 22997637713,
  "pruned": false,
  "softforks": [
    {
      "id": "bip34",
      "version": 2,
      "reject": {
        "status": true
      }
    },
    {
      "id": "bip66",
      "version": 3,
      "reject": {
        "status": true
      }
    },
    {
      "id": "bip65",
      "version": 4,
      "reject": {
        "status": true
      }
    }
  ],
  "bip9_softforks": {
    "csv": {
      "status": "active",
      "startTime": 1456790400,
      "timeout": 1493596800,
      "since": 770112
    },
    "segwit": {
      "status": "active",
      "startTime": 1462060800,
      "timeout": 1493596800,
      "since": 834624
    }
  },
  "warnings": "Warning: unknown new rules activated (versionbit 28)"
}
</code></pre>

<p><strong>6.</strong> to avoid this downside, you can create two user in liunx and make bitcoind instant run by different linux users, I have done it before, it works.</p>

CC BY-SA 4.0
2018-11-12T06:09:09.463Z
2018-11-12T06:09:09.463Z
Shiming
<p>Is it possible to run two separate bitcoind instances on one system at the same time, one for mainnet, other for testnet?</p>

<bitcoin-core><bitcoind><testnet>
Running two bitcoind instances for different nets
ThePiachu
# Running two bitcoind instances for different nets

(Asked by: username_0 on 2011-11-24)

Is it possible to run two separate bitcoind instances on one system at the same time, one for mainnet, other for testnet?

**Tags:** bitcoin-core, bitcoind, testnet


---

## 3 answers

### Answer by username_1 on 2011-11-25. Score: 2 | Accepted answer

Yes, you can. Just be sure to specify different data directories and configure them to use different ports.

> **Comments:**
> **username_2**: I assume that the "specify different data directories" is now obsolete, right?  

---

### Answer by username_3 on 2011-11-24. Score: 0

I don't see any reason why not.
I've read somewhere in [this thread](https://bitcointalk.org/index.php?topic=24209.0) that people run various instances of multicoin for similar purposes.


---

### Answer by username_4 on 2018-11-12. Score: 0

I am running two nodes in the same server just as you wanted, you can follow below steps:  
**1.** create two separate config files:
`bitcoin_mainnet.conf` and `bitcoin_testnet3.conf` in ~/.bitcoin

**2.** make the rpc port and datadir different from each other  
**sample conf:**  
**testnet**

```
# This config should be placed in following path:
# ~/.bitcoin/bitcoin_testnet3.conf

# [core]
# Specify the location of the configuration file. To use non-default location, create a default location config file containing this setting.
conf=~/.bitcoind/bitcoin_testnet3.conf
# Specify a non-default location to store blockchain and other data.
datadir=/mnt/bitcoin

# [debug]
# Run this node on the Bitcoin Test Network.
testnet=1

# [rpc]
# Accept command line and JSON-RPC commands.
server=1
# Accept public REST requests.
rest=1
# RPC user
rpcuser=rpcuser
# RPC password
rpcpassword=rpcpass
# RPC allow ip (allow all)
rpcallowip=0.0.0.0/0
# RPC bind
rpcbind=0.0.0.0
# get all transaction
txindex=1

```

**mainnet**

```
# This config should be placed in following path:
# ~/.bitcoin/bitcoin_mainnet.conf

# [core]
# Specify the location of the configuration file. To use non-default location, create a default location config file containing this setting.
conf=~/.bitcoind/bitcoin_mainnet.conf
# Specify a non-default location to store blockchain and other data.
datadir=/mnt/bitcoin/mainnet

# [debug]
# Run this node on the Bitcoin Test Network.
#testnet=1

# [rpc]
# Accept command line and JSON-RPC commands.
server=1
# Accept public REST requests.
rest=1
# RPC user
rpcuser=rpcuser
# RPC password
rpcpassword=rpcpass
# RPC allow ip (allow all)
rpcallowip=0.0.0.0/0
# RPC bind
rpcbind=0.0.0.0
# get all transaction
txindex=1

```

**3.** use below commands to get the node up:
bitcoind -conf=/root/.bitcoin/bitcoin\_testnet3.conf -daemon
bitcoind -conf=/root/.bitcoin/bitcoin\_mainnet.conf -daemon

**4.** now you can use rpc to interactive testnet & mainnet in different port.

**5.** this approch has a downside, that is when using CLI to interactive you can only connect to one network,you can check which network you are connecting with by:  
`bitcoin-cli getblockchaininfo` which will returns info something like below. "chain": "test" means it's testnet.

```
{
  "chain": "test",
  "blocks": 1443057,
  "headers": 1443057,
  "bestblockhash": "00000000000000e9f4078f12d44ee643fd9711e93ad4ddaab5af1977741ce053",
  "difficulty": 11974980.94624031,
  "mediantime": 1542001244,
  "verificationprogress": 0.9999998425668387,
  "initialblockdownload": false,
  "chainwork": "0000000000000000000000000000000000000000000000d119525c684f1418b3",
  "size_on_disk": 22997637713,
  "pruned": false,
  "softforks": [
    {
      "id": "bip34",
      "version": 2,
      "reject": {
        "status": true
      }
    },
    {
      "id": "bip66",
      "version": 3,
      "reject": {
        "status": true
      }
    },
    {
      "id": "bip65",
      "version": 4,
      "reject": {
        "status": true
      }
    }
  ],
  "bip9_softforks": {
    "csv": {
      "status": "active",
      "startTime": 1456790400,
      "timeout": 1493596800,
      "since": 770112
    },
    "segwit": {
      "status": "active",
      "startTime": 1462060800,
      "timeout": 1493596800,
      "since": 834624
    }
  },
  "warnings": "Warning: unknown new rules activated (versionbit 28)"
}

```

**6.** to avoid this downside, you can create two user in liunx and make bitcoind instant run by different linux users, I have done it before, it works.


---

