Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Understand project nodewatch #4

Open
hzysvilla opened this issue May 27, 2024 · 7 comments
Open

Understand project nodewatch #4

hzysvilla opened this issue May 27, 2024 · 7 comments

Comments

@hzysvilla
Copy link
Collaborator

How dose the nodewatch identity diffierent clients.

https://github.com/ChainSafe/nodewatch-api

@monperrus
Copy link
Contributor

@hzysvilla
Copy link
Collaborator Author

see also https://github.com/ethereum/node-crawler

got it.

@hzysvilla
Copy link
Collaborator Author

I looked through the code implementation of nodewatch. The nodewatch reuses the implementation of prysm.

Method

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.

Client identity

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.

@hzysvilla
Copy link
Collaborator Author

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.

@hzysvilla
Copy link
Collaborator Author

see also https://github.com/ethereum/node-crawler

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?

@hzysvilla hzysvilla changed the title Understan project nodewatch Understand project nodewatch Jun 3, 2024
@hzysvilla
Copy link
Collaborator Author

@monperrus

@monperrus
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants