I have had most of my relays and my only block producer running in P2P mode on mainnet for several months now and have produced blocks without any problems. Here is how I set my configs:
Relay config:
/etc/cardano/mainnet-config.json changes:
"TestEnableDevelopmentNetworkProtocols": true,
"EnableP2P": true,
"MaxConcurrencyBulkSync": 2,
"MaxConcurrencyDeadline": 2,
"TargetNumberOfRootPeers": 100,
"TargetNumberOfKnownPeers": 100,
"TargetNumberOfEstablishedPeers": 50,
"TargetNumberOfActivePeers": 20,
/etc/cardano/mainnet-topology.json complete file:
{
"LocalRoots": {
"groups": [
{
"localRoots": {
"accessPoints": [
{
"address": "bp1.terminada.io",
"port": 2700
}
],
"advertise": false
},
"valency": 1
}
]
},
"PublicRoots": [
{
"publicRoots" : {
"accessPoints": [
{
"address": "relays-new.cardano-mainnet.iohk.io",
"port": 3001
}
],
"advertise": true
},
"valency": 1
}
],
"useLedgerAfterSlot": 0
}
Note: LocalRoots is only the block producer. You need your relay to connect to your block producer in order to propagate the blocks produced.
Note: “useLedgerAfterSlot”: 0 tells the node to gather data about registered relays from the blockchain after slot 0 (ie. from the start of the blockchain).
Note: My block producer and relays use port 2700. Most people have theirs configured to use 3001 like the IOHK relays are.
Block producer config
/etc/cardano/mainnet-config.json changes:
"TestEnableDevelopmentNetworkProtocols": true,
"EnableP2P": true,
"MaxConcurrencyBulkSync": 2,
"MaxConcurrencyDeadline": 2,
"TargetNumberOfRootPeers": 5,
"TargetNumberOfKnownPeers": 5,
"TargetNumberOfEstablishedPeers": 5,
"TargetNumberOfActivePeers": 5,
/etc/cardano/mainnet-topology.json complete file:
{
"LocalRoots": {
"groups": [
{
"localRoots": {
"accessPoints": [
{
"address": "relays.terminada.io",
"port": 2700
}
],
"advertise": false
},
"valency": 4
}
]
},
"PublicRoots": []
}
Note: PublicRoots is empty
Note: Absence of useLedgerAfterSlot.
Check your logs at node start. You should see:
cardano-node[232505]: Public Roots:
cardano-node[232505]: Don’t use ledger to get root peers.
This is very important for your block producer because you only want it connecting with your own relays (LocalRoots) and not any external relays. In other words, you do not want your block producer to gather registered relays (root peers) information from the blockchain.
I have an internal DNS server that returns multiple IP addresses for “relays.terminada.io” - in fact it currently returns 4. Hence “valency”: 4 under “LocalRoots”.
Note the different TargetNumberOf[Root|Known|Established|Active]Peers for the block producer which I set to 5 when I currently only have 4 relays. I set it one higher than the valency of the LocalRoots but it will be limited to 4 anyway because there is no potential to connect any via PublicRoots. I just set this at 5 to allow me to add another relay easily and only update the topology file.
I set “MaxConcurrencyBulkSync”: 2 and “MaxConcurrencyDeadline”: 2. I set these to 2 because I didn’t want my block producer attempting to sync a block from more than 2 relays at once in case this would just waste processing time and potentially lead to increased risk of missed slot leader checks. Maybe it would be better at only 1? I don’t know if it would be beneficial to set these higher on relays but I set these the same on my P2P relays.
Under LocalRoots I set “advertise”: false. I also set “advertise”: false under LocalRoots for the relay. I am not sure about this but I believe that if set to true this would allow the block producer and relay to tell incoming connections about known local access points. I wondered if this could in some way cause leakage of information about how to connect to my block producer via my P2P relays gossiping with external P2P relays. In my case, it may not matter if set to true, because my firewall would prevent any external connection to my block producer.
Results:
I monitor block delay times on all my nodes and found that my P2P relays had less delay compared with my relays running in normal mode. I do still run one relay in normal mode. I have produced several blocks over the past few months using these settings.
I think that P2P works really well. However, obviously IOHK is not 100% confident yet under all conditions. I believe this is why it is hard to find proper documentation about what all the settings mean. For example, it is possible that it works very well if only a few nodes use it but may cause some sort of network partition if all nodes use it. This is why it is still being tested I guess. So be aware of the risks if you choose to run in P2P mode since it has not been officially recommended on mainnet yet.
One final point: You still need to ping api.clio.one with your topology data every hour (port, hostname, and latest block). If you don’t continue to ping this data to api.clio.one then you may find that your relays don’t get added to topology files used by other pool operators still running in normal mode. This could result in less incoming connections to your relays which could result in poor propagation of your produced blocks.