-
Notifications
You must be signed in to change notification settings - Fork 53
Node discovery v5 #19
Description
Introduction
Node discovery v5 is on it's way, which should make it a lot easier to discover suitable nodes. Though not standardized yet, it would be good to have some early experimentation/draft implementation to get closer to a feeling how the protocol (could) behave it would be good to have this library updated with a working implementation to support the practical usage in terms of a light client implementation.
Here are some draft documents on this. Also valuable in this regard: Talk from Felix at Devcon3.
Current py-evm
implementation work: ethereum/py-evm#209
Current Situation
Currently the library supports Node discovery v4 implemented in src/dpt
, where kbucket.js manages the list of peers in a Kademlia
-like DHT, message.js implements the different message types like ping
, pong
or neighbours
to discover new peers and server.js sets up a server to handle the discovery communication.
There are static tests for the message types in ./test/dpt-message.js, the integrated communication process is tested in ./test/integration/dpt-simulator.js as well as the corresponding eth
and les
files.
With the two peer-communication
example scripts in the examples
folder both ETH
and LES
(so full- and light client wire) communication can be tested in a real-world scenario by connecting to an actual network of in-production clients.
Task Description
Node discovery v5 updated the structure of Node records, brings changes to the communication flow by adding new packet types and introduces the concept of topics for exchanging on the capability of peers.
A first step into this task would be to work out some concept/idea where these additional/changed components fit into the existing v4 implementation and where current files/classes can be extended and where additional structures have to be set up. Since network communication implementation is very error-prone it will probably ease implementation to early on think along how to extend existing tests and add new tests for added functionality.
Goals
Though being still marked as "experimental" Geth has a working v5 discovery implementation for some time. Sufficient requirement for this issue to be completed is a working peer-communication
example where it is possible to set the discovery to v5
- e.g. by CL parameter or example internal constant - and get a working LES
and/or (optimally both) ETH
connection (working means here: e.g. LES
packets are actually passed through) in a reasonable amount of time (repeatedly < 5 min until first connection occurs).
Necessary side goals are:
- An extended code base which...
- follows the style principles and coding best practices of the existing code base
- is readable/maintainable for other developers
- introduces no or minimal code repetitions
- An extended test suite which keeps code coverage for the DHT on more-or-less the current level
- Some additions to the
README
docs which gives some usage guides and reflect the API changes
Required Skills
Everyone is invited to join and take on this task. Since this an advanced task requiring deeper knowledge of the Ethereum networking stack it is probably more likely that you succeed if you bring along skills/experience in the following fields:
- Experience with working on larger code bases in Node.js/modern
ES6
Javascript - Experience with the Node.js toolchain / ecosystem
- Knowledge/understanding of generic p2p networking concepts
- Some understanding of the Ethereum networking mechanics
- Experience with assuring code quality/testing
Guidance
For questions helping to understand the existing code base and the scope of this issue you will get active guidance by the creator of this issue (@holgerd77, EthereumJS team).