ethereum / devp2p

Ethereum peer-to-peer networking specifications
979 stars 275 forks source link

discv5: implementations list #163

Open fjl opened 3 years ago

fjl commented 3 years ago

This issue is for collecting links to all implementations. Please put a comment with a link to the source code. Please also provide a shell command that will run the discv5 listener.

fjl commented 3 years ago

go-ethereum:

https://github.com/ethereum/go-ethereum/tree/master/p2p/discover

how to run a discv5 node:

go build ./cmd/devp2p
./devp2p discv5 listen -nodekey ... -addr 127.0.0.1:9000
AgeManning commented 3 years ago

rust-discv5:

https://github.com/sigp/discv5

Version 5.1 is currently in a PR at this repository in the version-5.1 branch. Once it interops it will be merged down. Its in between different 5.1 versions currently.

To a run node, which periodically sends FINDNODE requests:

cargo run --example find_nodes -- 127.0.0.1 9001 false

NOTE: This will still bind to 0.0.0.0 but the ENR will display 127.0.0.1. You can set this to your local/external IP to modify the ENR emitted. It will listen on 9001. The final boolean indicates if you want to generate a random node_id. false indicates a fixed hard-coded id for debugging.

kdeme commented 3 years ago

nim-eth:

https://github.com/status-im/nim-eth

Version 5.1 is in a PR, branch is discv5-v1: https://github.com/status-im/nim-eth/tree/discv5-v1

You can use the dcli tool to test:

# Install required modules
nimble install
# Build dcli, v5.1
nim c -d:chronicles_log_level:trace -d:release -d:UseDiscv51:true --threads:on eth/p2p/discoveryv5/dcli
# Run it, e.g.
./eth/p2p/discoveryv5/dcli --log-level:debug --nat:extip:127.0.0.1 --bootnode:enr:<base64 encoding of ENR>
# Just ping another node
./eth/p2p/discoveryv5/dcli ping enr:<base64 encoding of ENR>
pipermerriam commented 3 years ago

ddht

https://github.com/ethereum/ddht/

v5.1 implementation in PR: https://github.com/ethereum/ddht/pull/92

Repository has installation and development setup instructions

Nashatyrev commented 3 years ago

Java v5.1 discovery is implemented: https://github.com/Nashatyrev/discovery/tree/feature/v5.1-last-updates-1 (PR pending to merge: https://github.com/PegaSysEng/discovery/pull/76)

To run test instance:

> git clone https://github.com/Nashatyrev/discovery -b feature/v5.1-last-updates-1
> cd discovery
> ./gradlew runTestDiscovery --args="127.0.0.1 9001"

CLI options:

DiscoveryTestServer arguments:
<externalIp> <listenPort> [privateKeySeed] [bootNode1] [bootNode2] ...
Examples:
23.44.56.78 9000
23.44.56.78 9000 5
23.44.56.78 9001 123 -IS4QIrMgVOYuw2mq68f9hFGTlPzJT5pRWIqKTYL93C5xasmfUGUydi2XrjsbxO1MLYGEl1rR5H1iov6gxOyhegW9hYBgmlkgnY0gmlwhLyGRgGJc2VjcDI1NmsxoQPKY0yuDUmstAHYpMa2_oxVtw0RW_QAdpzBQA8yWM0xOIN1ZHCCIyo