Open hzysvilla opened 4 months ago
got it.
I looked through the code implementation of nodewatch. The nodewatch reuses the implementation of prysm.
In a nutshell, there are two stages for the prysm's network running. i) Node discovery follows discv5 [1] packages. ii) After obtaining the nodes, they use libp2p library to communicate between each node. Come back to nodewatch, it first use discv5 to collect node information and use libp2p to get the client types.
The nodewatch parses the client information from the peer.ID of libp2p node. Function GetAgentVersion() gets user-agent from peer.ID. Function SetUserAgent() parses the client types from user-agents. This loop gets specific client types.
All the blockchain clients will set a user-agent for their types when the clients initialize the libp2p objection. See https://github.com/prysmaticlabs/prysm/blob/b08e69112716a4e0d0bfcf345e95696f0f42ba6b/beacon-chain/p2p/options.go#L94, version.BuildData() is the version of prysm.
After we launch a client, we can also run command
curl -s http://localhost:8080/metrics | egrep '^connected_libp2p_peers{'
to get the types of clients.
see this issue.
I don't understand why every clients must set the client information in their user-agent, and I read the specification of the consensus layers but find nothing. I'll try to understand it.
Besides, I think we need a method to get the exact number of clients distributed. Nodewatch only collects all node information through a single node. I think the structure obtained by this method is not accurate enough.
The node-crawler just collects the information of the execution layers. It seems that our framework will work at the consensus layer. Do I still need to look at its implementation?
@monperrus
I don't understand why every clients must set the client information in their user-agent, and I read the specification of the consensus layers but find nothing.
It's a good practice among internet clients. browser, crawlers, etc do so. it's not mandatory though.
see also ethereum/node-crawler The node-crawler just collects the information of the execution layers.
good to know. yes, you're right, we concentrate on the consensus layer first.
How dose the nodewatch identity diffierent clients.
https://github.com/ChainSafe/nodewatch-api