Here are four Ethereum Node Records (as per EIP-778):

  - "enr:-Iu4QGuiaVXBEoi4kcLbsoPYX7GTK9ExOODTuqYBp9CyHN_PSDtnLMCIL91ydxUDRPZ-jem-o0WotK6JoZjPQWhTfEsTgmlkgnY0gmlwhDbOLfeJc2VjcDI1NmsxoQLVqNEoCVTC74VmUx25USyFe7lL0TgpXHaCX9CDy9H6boN0Y3CCIyiDdWRwgiMo"
  - "enr:-Iu4QLNTiVhgyDyvCBnewNcn9Wb7fjPoKYD2NPe-jDZ3_TqaGFK8CcWr7ai7w9X8Im_ZjQYyeoBP_luLLBB4wy39gQ4JgmlkgnY0gmlwhCOhiGqJc2VjcDI1NmsxoQMrmBYg_yR_ZKZKoLiChvlpNqdwXwodXmgw_TRow7RVwYN0Y3CCIyiDdWRwgiMo"
  - "enr:-Iu4QLpJhdfRFsuMrAsFQOSZTIW1PAf7Ndg0GB0tMByt2-n1bwVgLsnHOuujMg-YLns9g1Rw8rfcw1KCZjQrnUcUdekNgmlkgnY0gmlwhA01ZgSJc2VjcDI1NmsxoQPk2OMW7stSjbdcMgrKEdFOLsRkIuxgBFryA3tIJM0YxYN0Y3CCIyiDdWRwgiMo"
  - "enr:-Iu4QBHuAmMN5ogZP_Mwh_bADnIOS2xqj8yyJI3EbxW66WKtO_JorshNQJ1NY8zo-u3G7HQvGW3zkV6_kRx5d0R19bETgmlkgnY0gmlwhDRCMUyJc2VjcDI1NmsxoQJZ8jY1HYauxirnJkVI32FoN7_7KrE05asCkZb7nj_b-YN0Y3CCIyiDdWRwgiMo"

How to retrieve IP address and Port from the ENR? How do I know that this format is using my node's public IP address and not the local or private IP address?

What's the gain by not being easily able to verify the IP address?

  • 1
    The answer to your last question is allegedly in the Motivation section, pretty much at the top of the web-page that you've linked. It lists two reason: 1. Improve cryptographic agility (pretty obscure, since it is just stated, but not actually explained in any manner). 2. Allow every node to determine the actual endpoint of some other node which has changed its endpoint and publishes a new record (i.e., the protocol allows to determine which record is newer). Again, it is not explained why encrypting the IP is needed here to begin with, since a sequence number should suffice. – goodvibration Mar 18 at 10:35
  • Regarding your first question, I doubt that it is possible to retrieve the data contained in the ENR, because it is not encrypted, but signed. In opposed to encryption, where the private key owner can decrypt the encrypted data and obtain the original data, with signature, the private key owner (or anyone else for that matter) cannot decrypt the encrypted data and obtain the original data. Signature is designated for verification (by everyone), not for decryption. – goodvibration Mar 18 at 10:40
  • Of course, the private key owner probably has the original data to begin with, but that doesn't matter in the context of this question (since you're obviously not the private key owner). – goodvibration Mar 18 at 10:46
  • 1
    the enr is not encrypted. It is rlp encoded and signed with the private key. – pd176 Mar 20 at 11:54

There is also a rust enr-cli library to assist with decoding ENR strings.

You can install it via cargo install enr-cli --version 0.1.0-alpha

An example of its use is:

$ enr-cli -e -Iu4QGuiaVXBEoi4kcLbsoPYX7GTK9ExOODTuqYBp9CyHN_PSDtnLMCIL91ydxUDRPZ-jem-o0WotK6JoZjPQWhTfEsTgmlkgnY0gmlwhDbOLfeJc2VjcDI1NmsxoQLVqNEoCVTC74VmUx25USyFe7lL0TgpXHaCX9CDy9H6boN0Y3CCIyiDdWRwgiMo  
ENR Read
Sequence No: 19
Node ID: 0x0fd2..5fd3
TCP Port: 9000
UDP Port: 9000
| improve this answer | |

You can use the enr library (written in rust).

use enr::Enr;

fn main() {
    let enr_string = "-Iu4QGuiaVXBEoi4kcLbsoPYX7GTK9ExOODTuqYBp9CyHN_PSDtnLMCIL91ydxUDRPZ-jem-o0WotK6JoZjPQWhTfEsTgmlkgnY0gmlwhDbOLfeJc2VjcDI1NmsxoQLVqNEoCVTC74VmUx25USyFe7lL0TgpXHaCX9CDy9H6boN0Y3CCIyiDdWRwgiMo";

    let enr: Enr = enr_string.parse().unwrap();
        "Enr ip: {}, tcp port: {}",
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.