<p>if you don't have Bitcoin-core and bitcoin cash already installed alongside, follow my answer in <a href="https://bitcoin.stackexchange.com/questions/70403/installing-bitcoin-and-bitcoincash-on-same-server">here</a> to install Bitcoin-cash alongside Bitcoin-core.</p>

<p><em>It's so important creating a different username than bitcoin username because bitcoin and bitcoin cash use the same directory.</em></p>

<p>Now login to Bitcoin username and edit this file <code>~/.bitcoin/bitcoin.conf</code></p>

<p>so it becomes like that:</p>

<pre><code>rpcuser=myusername
rpcpassword=myRPCpa$$word
daemon=1
server=1
rpcport=5345
</code></pre>

<p>in here we are using different RPC port to bitcoin core. to know more about bitcoin config see <a href="https://jlopp.github.io/bitcoin-core-config-generator/" rel="nofollow noreferrer">this website</a>.</p>

<p>Now, do the same thing to Bitcoin-cash, and everything should work as it supposed to be. </p>

<p>if you have a firewall enabled, don't forget to allow chosen ports.</p>

CC BY-SA 3.0
2018-04-07T14:56:16.493Z
I use Mac OS can you show me an example for Mac OS as well?
西田龍
CC BY-SA 3.0
2018-04-07T15:09:08.680Z
And I saw there's a suspicion that both clients will try to use the same port, was this problem solved?
西田龍
CC BY-SA 3.0
2018-04-07T17:02:48.120Z
Yeah, we are using port 5345 for bitcoin-core and bitcoin cash will use port 8333 by default.
it doesn't really matter what are you using, just edit the config as above, and they should work alongside each other with no conflict.
Tailer
CC BY-SA 3.0
2018-04-07T13:35:23.900Z
2018-04-07T13:35:23.900Z
Tailer
<p>First you need to change their data directory. Run one of them, either BTC or BCH, with <code>-datadir=C:/somewhere</code>. Then create <code>bitcoin.conf</code> in that folder. It should look like:</p>

<pre><code>server=1
rpcuser=bitcoinrpc
rpcpassword=something
rpcport=8334
</code></pre>

<p>Make sure to set <code>rpcport</code> to something other than <code>8332</code> or <code>8333</code>. Also, add <code>port=something</code> to the <code>bitcoin.conf</code> of which node software that you like less.</p>

CC BY-SA 3.0
2018-04-07T15:10:31.543Z
Isn't there a doubt that both clients will try to use 8333 port and occur a problem?
西田龍
CC BY-SA 3.0
2018-04-07T17:15:57.367Z
@西田龍 That's why you should also add `port=BlahBlah` to one of them.
MCCCS
CC BY-SA 3.0
2018-04-08T12:56:43.517Z
I've never seen the way of specifying port number on bitcoin.conf but it can be used normally, right?
西田龍
CC BY-SA 3.0
2018-04-07T13:37:52.270Z
2018-04-07T13:49:03.467Z
2018-04-07T13:49:03.467Z
MCCCS
<p>You can, just run it with different port and each rpc will connect on each wallet port, the port could be configured in .conf file or as arg when you run bitcoin.exe</p>

CC BY-SA 3.0
2018-04-07T13:28:56.480Z
2018-04-07T13:28:56.480Z
Haddar Macdasi
<p>You can but u will need to run bitcoin and bitcoin cash server on a separate machine or same machine (if same machine, you will have to do little more config).</p>

CC BY-SA 3.0
2018-04-07T13:05:10.683Z
2018-04-07T13:05:10.683Z
zhiyan114
<p>I've looked for an exactly answer but I really couldn't find it.
So can someone let me know the why of doing what I'm asking correctly?</p>

<bitcoin-core><bitcoind><bitcoin-cash>
How can I exactly use both the rpc API of Bitcoin and the rpc API of Bitcoin cash on the same server or machine?
西田龍
# How can I exactly use both the rpc API of Bitcoin and the rpc API of Bitcoin cash on the same server or machine?

(Asked by: username_0 on 2018-04-07)

I've looked for an exactly answer but I really couldn't find it.
So can someone let me know the why of doing what I'm asking correctly?

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


---

## 4 answers

### Answer by username_1 on 2018-04-07. Score: 1

if you don't have Bitcoin-core and bitcoin cash already installed alongside, follow my answer in here to install Bitcoin-cash alongside Bitcoin-core.
It's so important creating a different username than bitcoin username because bitcoin and bitcoin cash use the same directory.
Now login to Bitcoin username and edit this file ~/.bitcoin/bitcoin.conf
so it becomes like that:
rpcuser=myusername
rpcpassword=myRPCpa$$word
daemon=1
server=1
rpcport=5345

in here we are using different RPC port to bitcoin core. to know more about bitcoin config see this website.
Now, do the same thing to Bitcoin-cash, and everything should work as it supposed to be. 
if you have a firewall enabled, don't forget to allow chosen ports.

> **Comments:**
> **username_0**: I use Mac OS can you show me an example for Mac OS as well?  
> **username_0**: And I saw there's a suspicion that both clients will try to use the same port, was this problem solved?  
> **username_1**: Yeah, we are using port 5345 for bitcoin-core and bitcoin cash will use port 8333 by default. it doesn't really matter what are you using, just edit the config as above, and they should work alongside each other with no conflict.  

---

### Answer by username_2 on 2018-04-07. Score: 0

First you need to change their data directory. Run one of them, either BTC or BCH, with -datadir=C:/somewhere. Then create bitcoin.conf in that folder. It should look like:
server=1
rpcuser=bitcoinrpc
rpcpassword=something
rpcport=8334

Make sure to set rpcport to something other than 8332 or 8333. Also, add port=something to the bitcoin.conf of which node software that you like less.

> **Comments:**
> **username_0**: Isn't there a doubt that both clients will try to use 8333 port and occur a problem?  
> **username_2**: @username_0 That's why you should also add `port=BlahBlah` to one of them.  
> **username_0**: I've never seen the way of specifying port number on bitcoin.conf but it can be used normally, right?  

---

### Answer by username_3 on 2018-04-07. Score: -2

You can, just run it with different port and each rpc will connect on each wallet port, the port could be configured in .conf file or as arg when you run bitcoin.exe


---

### Answer by username_4 on 2018-04-07. Score: -2

You can but u will need to run bitcoin and bitcoin cash server on a separate machine or same machine (if same machine, you will have to do little more config).


---

