A simple Python script for decoding Ethereum Node Record (ENR) strings.
The script:
- removes the
enr:prefix (if present), - performs Base64 URL decoding,
- performs RLP decoding,
- prints key fields (
signature,seq,id,ip,tcp,udp), - tries to parse the
ethentry (ForkID:fork_hash,next_fork).
- Python 3.8+
- Packages:
rlpeth-utils
pip install rlp eth-utilspython3 enrdecode.py "enr:-FDSjiog..."Or without the prefix:
python3 enrdecode.py "-FDSjiog..."--- ENR: enr:-FDSjiog... ---
Signature: 0x1234abcd...
Sequence No: 1
Scheme: v4
IP Address: 1.2.3.4
TCP Port: 30303
UDP Port: 30303
>>> ETH ENTRY (ForkID) <<<
Fork hash: 0x...
Next fork block: 0
- Invalid Base64 input:
Base64 decode error: ...
- Invalid RLP data:
RLP decode error: ...
- Wrong number of arguments:
- the script prints usage instructions.
- The script does not verify the ENR cryptographic signature, it only decodes content.
- The
ethfield may have a different format; in that case, the script prints anUnexpected ... formatmessage.