Well yes that is possible, you can also connect 2 of them parallel based on your RAM, but you'll most probably get an out of memory error
if you could try to connect 3 or more in parallel. But I don't think it is possible to share blockchains, its data between each other,
How can I create connected multiple blockchains?:
With Ethereum alone it's not possible (yet), unless you implement a
custom solution.
But when you run multiple geth
process for each private blockchain on the background, by using nodejs
you could have connection to each different blockchains and their contracts, and they can send information between each other.
I would suggest to connect each private blockchain individually each will have its own folder to store its blockchain.
First on your node you have to create your private ethereum network on 2 different named folders (for example: --"datadir="/home/MyEthereumEbloc_1"
and --datadir="/home/MyEthereumEbloc_2"
), this will also create different geth.ipc
for each. ipc:/home/MyEthereumEbloc_1/geth.ipc
and ipc:/home/MyEthereumEbloc_2/geth.ipc
.
Later on you should run 2 different geth
process with different --port
number, --identity
, --networkid
that you want to connect, --rpcport
empty port that you could use and --bootnode
that you would like to connect. Since 2 organization has their own private blockchain, their ip and port number will be unique for each.
For example: You could also run following commands in between nohup &
which will run geth
on the background.
geth --port 3000 --networkid 12345 --identity node1 --nodiscover \
--nat none --datadir="/home/MyEthereumEbloc_1" --rpc --rpcaddr="localhost"\
--rpcport 8545 --rpccorsdomain="*"--ipcapi "admin,eth,net,web3,debug"\
--bootnodes enode://$id@<ip_1>:<port_1>
-
geth --port 3001 --networkid 54321 --identity node2 --nodiscover \
--nat none --datadir="/home/MyEthereumEbloc_2" --rpc --rpcaddr="localhost"\
--rpcport 8546 --rpccorsdomain="*" --ipcapi "admin,eth,net,web3,debug" \
--bootnodes enode://$id@<ip_2>:<port_2>
inside nodejs
: since --rpcport 8545
is linked to --bootnodes enode://$id@<ip_1>:<port_1>
and since --rpcport 8546
is linked to --bootnodes enode://$id@<ip_2>:<port_2>
you can access the blockchain that is in your organisation by creating different web3 variables (web3_1, web3_2) inside nodejs
.
var web3_1 = new Web3();
web3_1.setProvider(new web3_1.providers.HttpProvider('http://localhost:8545'));
var web3_2 = new Web3();
web3_2.setProvider(new web3_2.providers.HttpProvider('http://localhost:8546'));
if(!web3_1.isConnected()) console.log("not connected");
else console.log("connected");
if(!web3_2.isConnected()) console.log("not connected");
else console.log("connected");
Please note that if you run 2 geth process in one machine, it has been recommended that minimum 8GB RAM required, 4GB RAM for each. https://ethereum.stackexchange.com/a/9906/4575