0

I have private Ethereum network running on my local network with two sealer node and one bootnode. I have deployed the private blockchain and configured it using geth. Now I want to create another node from another network to connect to that private blockchain deployed. How can I do that if I want to access a contract from the new node?

  • It two different networks, you cant reach one from another. – Зелёный Dec 20 '18 at 8:28
  • @Зелёный can't the new node be created using the external Ip of the bootnode? – ludo Dec 20 '18 at 8:36
  • It's confusing when you say "another network". In most blockchain ecosystem, "another network" would refer to the difference between the Ethereum mainnet and another network like Ropsten. These 2 networks can't simply be connected. I'm assuming in your original post that you mean the literal definition of network, as in connecting a node over the internet to your local network? – flygoing Dec 20 '18 at 18:39
  • @flygoing I meant connecting a new node that belongs to a different local network to my private blockchain like connecting my pc at home to another pc in the office network – ludo Dec 20 '18 at 22:06
0

You need to use same genesis file for both private-networks and keep the networkId same.

The from first node type:

admin.nodeInfo

{
  enode: "enode://7622844520524910d2ca3036c7e2e912a441ebfc13fad8d759046abe1a9d664cf5e09c5edb765ee0cfe64d64645f1b1b16cc6b2d1c4ec557e5eb96f09335f066@[::]:30312",
  id: "7622844520524910d2ca3036c7e2e912a441ebfc13fad8d759046abe1a9d664cf5e09c5edb765ee0cfe64d64645f1b1b16cc6b2d1c4ec557e5eb96f09335f066",
  ip: "::",
  listenAddr: "[::]:30312",
  name: "Geth/PrivateChain1/v1.8.7-stable-66432f38/linux-amd64/go1.10",
  ports: {
    discovery: 30312,
    listener: 30312
  },
  protocols: {
    eth: {
      config: {
        byzantiumBlock: 0,
        chainId: 193,
        eip150Hash: "0x0000000000000000000000000000000000000000000000000000000000000000",
        eip155Block: 0,
        eip158Block: 0,
        homesteadBlock: 0
      },
      difficulty: 4595264,
      genesis: "0xf6e5dec52d779d6f64e2962f4a60fb5e7072fc6d15935cf7425278b7784016f9",
      head: "0x5a26608afb28b4418c23d808f1df35a8f0baff0f193dcba3d102c25f83d84fe3",
      network: 1902
    }
  }
}

From node2:

To add node 1 in peer list of node 2, you need to pass enode info of node1 in addPerr function. Replace [::] with IP of node 1. Use localhost if running both nodes on same machine.

admin.addPeer("enode://3414c01c19aa75a34f2dbd2f8d0898dc79d6b219ad77f8155abf1a287ce2ba60f14998a3a98c0cf14915eabfdacf914a92b27a01769de18fa2d049dbf4c17694@:30301");

Then you can access smart contracts of node1 from node2.

  • PS: I have not tried it though but it should work. – Prashant Prabhakar Singh Dec 20 '18 at 8:42
  • Here I use a private bootnode for each node discovery on the network1. Is there a need to pass enode info of node1 to node2 of the external network? – ludo Dec 20 '18 at 8:52

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.