P2P Topology File Explained
Here we try to explain how and why your P2P files should be configured. UPDATED: 9/23/2024
Last updated
Here we try to explain how and why your P2P files should be configured. UPDATED: 9/23/2024
Last updated
As we move to full P2P we try to explain how and why your P2P files should be configured below.
Credits to PANL Pool and Earn Coin Pool for this guide.
❓What is the real difference from Public and Local peers and when and where should you use each?
❓Why use bootstrapping peers? What does it do and why is it need or not needed?
❓When to use advertise flag and why?
❓Can you have multiple Access Points and why?
❓When to use trustable flag and why?
What are local vs public peers and when should you use each?
As stated at link below:
local roots: should comprise local relays or a local block-producing node, and any other peers that the node needs to maintain a connection with. These connections are typically kept private. public roots: publicly known nodes (e.g. IOG relays, or ledger nodes). They are either read from the configuration file directly or from the chain. The configured ones will be used to pass a recent snapshot of peers needed before the node caches up with the recent enough chain to construct root peers by itself. ⚠️The node does not guarantee a connection with every public root, unlike local ones. However, by being present in the set, it gets an opportunity to establish an outbound connection with that peer.
Local Roots is designed for peers that the node should always keep as hot or warm, such as its own block producer. On the other hand, Public Roots serves as a source of fallback peers.
Source:
Bootstrapping peers are good for when your node has had an extended outage, you'll sync from those and trusted peers and then ledger once on tip.
Advertise will tell your peers "hey I have this really good peer, you should try to connect to them" which can give that relay more inbound connections. Could be used for situations like unregistered relays.
If you set advertise to true in topology file you must also add the following to your mainnet-config.json file:
Node Versions BEFORE 8.9.1 also require:
"ExperimentalProtocolsEnabled": true,
You can have multiple access points within Local Roots. Why would you want to use this? This way you can keep advertise as false for your BP while True for your relay. For example, below is a sample topology file for P2P where we have two access points
Trustable peers are composed by the bootstrap peers and the trustable local root peers. By default local root peers are not trustable.
Your own Relays and BP should be set to "trustable": true
✅Here we set "useLedgerAfterSlot": -1
so the BP doesn't try to connect to other nodes using ledger peer data.
✅We set "advertise": false
, since these are local root on BP and we want to keep private.
✅Since we have 2 Relays we set "valency": 2
, if we had 3 Relays it would be set to 3.
✅We need to set "bootstrapPeers": null
on BP and set our Relays to "trustable": true,
✅Last of all we leave Public Roots blank by using "publicRoots": []
In the sample below you need to change "relay1.Address" and "relay2.Address" to your relay address and change "port": 3001 to the port you use.
✅Here we use 2 Access Points under local roots so we can advertise our relays while hiding our BP
✅We set "advertise": false
, on BP Access Point since we want to keep private.
✅Since we have 1 additional Relays, (2 relays in total) we set "valency": 1
, if we had 2 additional Relays (3 relays in total), we would set "valency": 2
, and so on.
✅We need to set "bootstrapPeers"
to the address below and set our Relays to "trustable": true,
so we can sync if we get too far off the tip.
✅Last of all we leave Public Roots blank by using "publicRoots": []
In the sample below you need to change "relay2.Address" and "blockProducerAddress" to your relay and BP address and change "port": 3001 to the port you use.
Leave "bootstrapPeers" addresses and ports as is
✅See notes from example above and don't forget to change SPO.relay.Addresses and port below to match your SPO friends address and ports
Using these 3 samples you can modify to fit your situation.
You can add access points, turnoff or on advertise flag and trustable flag where necessary.
If this is the first time you are Enabling P2P on your node you need to make sure you took these 2 steps:
add:
On BP just add "EnableP2P": true,
line
and "PeerSharing": false,
line.
If you set advertise to true in topology file you must also add the following to your mainnet-config.json file:
Node Versions BEFORE 8.9.1 also require:
"ExperimentalProtocolsEnabled": true,
List crontabs by running:
Edit Crontab and remove relay-topology_pull.sh if you have one by running:
Take opportunity to update server and reboot
Thanks to the following pools for helping to put together these guides. Please consider delegating to their pools to support them. Are you a pool? Consider buying them a coffee