What is the definition of an Enode ID or Enode URI? What is it used for and how is it made?
2 Answers
Expanding on Hudson Jameson's answer: "The hexadecimal node ID is encoded in the username portion of the URL"
The username portion is a 512-bit public key that is used to verify communication came from a particular node on the network.
More about the RLPx protocol used can be found here.
Main parts of that:
Node discovery and network formation are implemented via a kademlia-like UDP. Major differences from Kademlia:
- packets are signed
- node ids are public keys
- DHT-related features are excluded. FIND_VALUE and STORE packets are not implemented.
- xor distance metric is based on sha3(nodeid)
-
can you please link words or phrases instead of pasting plain links? :)– q9fCommented Feb 9, 2016 at 12:25
-
An enode is a way to describe an Ethereum node in the form of a URI.
The hexadecimal node ID is encoded in the username portion of the URL, separated from the host by an @ sign. The hostname can only be given as an IP address, DNS domain names are not allowed. The port in the host name section is the TCP listening port. If the TCP and UDP (discovery) ports differ, the UDP port is specified as query parameter "discport".
In the following example, the node URL describes a node with IP address 10.3.58.6
, TCP listening port 30303
and UDP discovery port 30301
.
enode://6f8a80d14311c39f35f516fa664deaaaa13e85b2f7493f37f6144d86991ec012937307647bd3b9a82abe2974e1407241d54947bbb39763a4cac9f77166ad92a0@10.3.58.6:30303?discport=30301
The enode uri scheme is used by the Node discovery protocol and can be used in the bootnodes
command line option of the client or as the argument to suggestPeer(nodeURL)
function in the JSRE.
More information on enode URI can be found here and is mentioned in this "Connecting to Ethereum" Wiki entry.
-
Is there a way via truffle to find out which enode url a node has? Commented Dec 29, 2017 at 18:46
-
@sunwarr10r in the console
admin.nodeInfo.enode
gives you the node's url; theadmin_nodeInfo
rpc json method returns the node info– scibuffCommented Aug 20, 2023 at 23:01