I am a EOS newbie. I have some questions about the EOS p2p network, I hope the Technical god can help me.
(1) How does the EOS node service join the p2p network ?
(2) Is it connected via p2p-peer-address set in config.ini? After each synchronization, many p2p-peer-address are invalid. How do I get stable?
(3) Both btc and eth have the ability to automatically join the p2p network. How is the eos implemented, or because of what is willing to not implement this block ?
This is the way about BTC join in p2p network : https://juejin.im/post/5af90aa36fb9a07ac653244f
This is the way about ETH join in p2p network : http://bitebi86.com/archives/119
EOS.IO-based networks are manually constructed using p2p-peer-address settings. This was deemed acceptable as EOS.IO-based networks always have well known peers in the form of block producers, for whom network participants are expected to vote. A more swarm-based networking approach may be implemented as EOS.IO-based networks scale out.
To clean up invalid peers, consult the nodeos logs for the names of peers which do not successfully connect, remove them from your config.ini, gracefully shut down nodeos with kill `pgrep nodeos`, and restart nodeos _without_ using any of --genesis-json, --delete, --replay, or --hard-replay, but including other arguments not specified in your config.ini.
If you wish to remove peers without shutdown and restart, add --plugin eosio::net_api_plugin to your nodeos command line. This makes available the /v1/net/connect, /v1/net/disconnect, /v1/net/status, and /v1/net/connections APIs, which can be used to add and remove peers from a running nodeos. Note that the syntax of specified peers is not checked during use of the connect API, so it's possible to add invalid peers this way. They can be removed the same way. Use of the connections API can help you determine which of your configured peers are actually accepting requests. Use of the disconnect API does not remove a peer from config.ini—it must also be removed from the config file separately. Similarly the addition of a peer via the connect API does not add it to config.ini.
Also note that you should not publicly expose the API port of a nodeos instance with the net_api_plugin enabled, as there is no authentication mechanism for connect and disconnect commands.
Most helpful comment
EOS.IO-based networks are manually constructed using
p2p-peer-addresssettings. This was deemed acceptable as EOS.IO-based networks always have well known peers in the form of block producers, for whom network participants are expected to vote. A more swarm-based networking approach may be implemented as EOS.IO-based networks scale out.To clean up invalid peers, consult the
nodeoslogs for the names of peers which do not successfully connect, remove them from your config.ini, gracefully shut downnodeoswithkill `pgrep nodeos`, and restartnodeos_without_ using any of--genesis-json,--delete,--replay, or--hard-replay, but including other arguments not specified in yourconfig.ini.If you wish to remove peers without shutdown and restart, add
--plugin eosio::net_api_pluginto yournodeoscommand line. This makes available the/v1/net/connect,/v1/net/disconnect,/v1/net/status, and/v1/net/connectionsAPIs, which can be used to add and remove peers from a runningnodeos. Note that the syntax of specified peers is not checked during use of theconnectAPI, so it's possible to add invalid peers this way. They can be removed the same way. Use of theconnectionsAPI can help you determine which of your configured peers are actually accepting requests. Use of thedisconnectAPI does not remove a peer fromconfig.ini—it must also be removed from the config file separately. Similarly the addition of a peer via theconnectAPI does not add it toconfig.ini.Also note that you should not publicly expose the API port of a
nodeosinstance with thenet_api_pluginenabled, as there is no authentication mechanism forconnectanddisconnectcommands.