3

How does a stellar-core node discover its peers?

I mean both on startup and on the go.

1

After startup, your node should have established connection with your indicated peers. On the go, there's not much to do with after startup. The nodes just exchange data and run consensus algorithm.

In stellar-core.config, there are several fields related to peers discovery (refer to example config here).


  1. NETWORK_PASSPHRASE="Public Global Stellar Network ; September 2015"

No one can join a network without knowing the "NETWORK_PASSPHRASE". This is like the name of the organization/network that you would like to join.

If you want to set up a private network, you will keep your NETWORK_PASSPHRASE as a secret. Without knowing this secret, random guys cannot discover your private network.


  1. KNOWN_PEERS=[www.myIP.com]

Suppose you are not in the network yet. You need some existing, running peers to pull you into the organization/network. Put an IP at "KNOWN_PEERS".

The IP/web address of the intended peer is like the location of your friend, which allows you to find him.

If you are already in the network and wants to pull somebody else in, let them add your IP under KNOWN_PEERS.


  1. PEER_PORT=11625

An IP address has many ports, just like a park can have many entrance gates. So, you also need to know which gate your friend is at.

11625 is the default value for peer port. If your peer changed its peer port, you will need to suggest a value for this field.

Without matching both the IP and peer port number, a peer cannot be discovered.


The above are the most basic ones for startup. For simplicity, complicated settings were not mentioned.

| improve this answer | |
  • So the list of peers is a manually maintained list? – Murukan Jul 6 '18 at 12:40
  • yes... and the node holder can decide on which nodes to trust... but you may change it when the node is running – cesarm Jul 8 '18 at 15:26
  • Isn't PEER_PORT for your code node? This says The port other instances of stellar-core can connect to you on. – Ramon Tayag Sep 26 '18 at 8:32
  • no, the list is not manually maintained: KNOWN_PEERS is to bootstrap the list of known peers, after that more peers are received when connecting to other peers. stellar.stackexchange.com/questions/231/… gives an idea of how it works. – MonsieurNicolas Oct 4 '18 at 22:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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