0

If bloackchain is designed to be decentralized, how a node can know the IP of at least one node of the blockchain in order to start communicating.

For example, if a bloackchain still does not have any node, and you add the first node of the network, when the second node is added, how does that node know the IP of the first node and vice versa?

l4x3 l4x3
  • 5
  • 1

1 Answers1

0

Nodes can broadcast their presence on a predefined port and in a predefined message format. Other nodes can be listening on this port, so that they "catch" the message from a new node (broadcasting their presence).

Some clients also have a predefined list of trusted nodes that are usually maintained by the network core development team or some other trusted groups, so that the client doesn't have to wait for other nodes to broadcast their presence and can communicate with these trusted nodes right away.

Petr Hejda
  • 40,554
  • 8
  • 72
  • 100
  • I have read something about that, but broadcaster is not supposed to work on the entire internet. (or so I have read) It is only for specific networks or local networks. How does that work then? – l4x3 l4x3 Apr 10 '21 at 12:03
  • @l4x3l4x3 This is more of an networking topic than software development, so you might get better and more detailed answers at https://serverfault.com/... But basically it's not broadcasting on `255.255.255.0` - it's rather building a map of peers that you can "broadcast" to using a set of individual calls (so this way they learn about your presence). You can get their list by connecting to the known list of peers and recursively getting addresses of their known peers, and their known peers... See [this](https://stackoverflow.com/a/41918937/1693192) SO answer and its comments for more details. – Petr Hejda Apr 10 '21 at 12:16