https://github.com/mikiw/eth-node-handshake
Minimalistic ethereum node handshake written in rust
https://github.com/mikiw/eth-node-handshake
ethereum protocol rust rust-lang
Last synced: 3 months ago
JSON representation
Minimalistic ethereum node handshake written in rust
- Host: GitHub
- URL: https://github.com/mikiw/eth-node-handshake
- Owner: mikiw
- License: mit
- Created: 2024-02-05T18:23:19.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-02-12T13:04:45.000Z (over 1 year ago)
- Last Synced: 2025-01-10T17:51:54.589Z (5 months ago)
- Topics: ethereum, protocol, rust, rust-lang
- Language: Rust
- Homepage:
- Size: 48.8 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Ethereum node handshake
Minimalistic ethereum node handshake mainly based on [devp2p](https://github.com/ethereum/devp2p) and [rust-devp2p](https://github.com/vorot93/devp2p).
Get remote enode of node from [here](https://ethernodes.org/nodes) and pass it as CLI argument:
```
cargo run enode://5eadf96217fa7a71010a709a7aceb4c0c541d7123865d430854ca1207e84d55242cfb34e99be7de213587db643de9a7f1ee3202a93d9fbfab58610ef9668a4b4@44.200.140.248:30303
Finished dev [unoptimized + debuginfo] target(s) in 0.28s
Running `target/debug/eth-node-handshake 'enode://5eadf96217fa7a71010a709a7aceb4c0c541d7123865d430854ca1207e84d55242cfb34e99be7de213587db643de9a7f1ee3202a93d9fbfab58610ef9668a4b4@44.200.140.248:30303'`
Connected to target adress: "44.200.140.248:30303"Hanshake completed succesfully
Received MAC is valid!Hello message from target node:
Hello { protocol_version: 5, client_version: "Geth/v1.13.4-stable-3f907d6a/linux-amd64/go1.21.3", capabilities: [Capability { name: "eth", version: 67 }, Capability { name: "eth", version: 68 }, Capability { name: "snap", version: 1 }], port: 0, id: PublicKey(52d5847e20a14c8530d4653812d741c5c0b4ce7a9a700a01717afa1762f9ad5eb4a46896ef1086b5fafbd9932a20e31e7f9ade43b67d5813e27dbe994eb3cf42) }
```TODO for the future:
- Geth and erigon nodes are working fine but some of them aren't, check which of them aren't and debug why is that,
- Add more unit tests and some integration tests,
- Improve code structure to handle different versions of the protocol,
- Sometimes first handshake works but the second doesn't, debug why is that.