1

A private blockchain on Ethereum:

When we want to add more than one nodes, e.g. two nodes A and B, to a private blockchain, we let node A add the other node: admin.addPeer() and node B call A. Both nodes know the other nodes via their IP address. But their IP address may not be static.

Question 1: Do the nodes need to have static IP addresses to connect to each other?


Also, here it's said: "If your peers are not on the local network, you need to know your external IP address (use a service) to construct the enode url"

Question 2: What service does it mean? In this case, do we need to have a static IP address?

2 Answers 2

1

Initially you need a new node that wants to join the network to be able to find at least one other node on the network. This means that at the time it first joins, you need there to be another node that it can reach, and it needs you to tell it the address of that node. For that node to be reachable across the internet (assuming you don't have a VPN connecting them) this will mean you need that node's external IP address at that particular moment. You will also need that node to be accessible on that address, which may involve opening firewall ports and/or dealing with NAT settings.

Once two nodes are connected, they should (I think) be able to cope with their IP addresses changing, as long as they don't all change at the same time. This should work because once connected, both nodes have the address of the other node, so if A's address changes, it should still be able to reach B, and let B know about its new address. However you should test this, for example by connecting the nodes then rebooting the ISP's router box on one if them, which will normally get you a new IP address.

However, life is simpler if you can an least provision one node somewhere with a static IP address. That way you can set that address as a boot node for the others, and as long as that stays up, nodes can always reattach themselves reliably regardless of when they stop and start without the risk that you will need to manually tell nodes each others' new IP addresses.

0

I don't know the answer to question 1, I'm still trying to sort that out - but the answer to question 2 is to go to a web page like whatsmyip

There are others, so all you need to do to find them is do a browser search on "What is my IP".

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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