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

Support enode-id #6

Merged
merged 3 commits into from
Oct 26, 2022
Merged

Support enode-id #6

merged 3 commits into from
Oct 26, 2022

Conversation

AgeManning
Copy link
Owner

Upgrade to the latest ENR and also print an enode-id.

This leaves the TCP field blank if one does not exist in the ENR.

If an IP address does not exist, this does not print any ports.

@monperrus
Copy link

I confirm that it works:

$ target/debug/enr-cli read "enr:-Je4QEeZoiY8OrUxlckLuU8leuuSfnrveD8PdUnCvHavJJzcGQn7nKikWNV_ZxbRtPt6si-tQNwT_aIYpksq3O2Hzblbg2V0aMfGhPCv0OOAgmlkgnY0gmlwhIe10fKJc2VjcDI1NmsxoQNGM7sxj2Wuen_j9kqzHEmjqSxct1UxxbA9kwl7ha7NRIN0Y3CCdl-DdWRwgnZf"
ENR Read:
Sequence No:91
NodeId: 009eef756b05e36100f55bc3a7b88031daeb83a3ebb66c4ccef0677ec477df3e
EnodeId: enode://009eef756b05e36100f55bc3a7b88031daeb83a3ebb66c4ccef0677ec477df3e:135.181.209.242:30303?discport=30303
Libp2p PeerId: 16Uiu2HAmHP2e815N2Qik2ffbdsapJCLRY3uUobuLJVNoGJEZs7b9
IP:135.181.209.242
TCP Port:30303
UDP Port:30303
Known multiaddrs:
/ip4/135.181.209.242/udp/30303
/ip4/135.181.209.242/tcp/30303

Thanks a lot!

@monperrus
Copy link

For the record, answered my question on https://ethereum.stackexchange.com/questions/137275/how-to-translate-an-ethereum-enr-address-to-an-enode-address/138063#138063

Thanks again!

@AgeManning
Copy link
Owner Author

@monperrus - There was a bug in the previous implementation. The formatting for the enodeid was wrong. I have corrected it.

Also, couldn't find an exact specification, but the overview here: https://ethereum.org/en/developers/docs/networking-layer/network-addresses/#enode

Suggests that if the discovery port and the tcp port are the same, then to only list a single port.

I've made these changes.

@AgeManning AgeManning merged commit cfb4ba9 into master Oct 26, 2022
@monperrus
Copy link

monperrus commented Oct 26, 2022 via email

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

Successfully merging this pull request may close these issues.

None yet

2 participants