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

Add Networking Layer materials to /developers/docs #5838

Merged
merged 33 commits into from
May 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
9ac5380
initial commit: network landing pg & net addr page
jmcook1186 Mar 29, 2022
4ed547b
finish draft network-addr page
jmcook1186 Mar 29, 2022
7544e75
add formatting for eth.org
jmcook1186 Mar 29, 2022
55f4ae8
rename file to index.md
jmcook1186 Mar 29, 2022
f7fceee
update menus
jmcook1186 Mar 30, 2022
53ed215
fix page links and page-dev-index links
jmcook1186 Mar 30, 2022
1fb4e46
fix image links (html ->markdown)
jmcook1186 Mar 30, 2022
64d75fd
remove redundant image
jmcook1186 Mar 30, 2022
20b2950
fix page section links
jmcook1186 Mar 30, 2022
a9f7f92
rm notes accidentally committed & + to gitignore
jmcook1186 Mar 31, 2022
add5f43
update img link
jmcook1186 Mar 31, 2022
fe7a497
Update src/content/developers/docs/networking-layer/network-addresses…
jmcook1186 Apr 5, 2022
a68156f
Update src/content/developers/docs/networking-layer/network-addresses…
jmcook1186 Apr 5, 2022
cdc9548
Update src/content/developers/docs/networking-layer/network-addresses…
jmcook1186 Apr 5, 2022
59e2af7
Update src/content/developers/docs/networking-layer/network-addresses…
jmcook1186 Apr 5, 2022
7e410dd
Update src/content/developers/docs/networking-layer/index.md
jmcook1186 Apr 5, 2022
8c18b86
udpate according to @minimalsm review comments
jmcook1186 Apr 5, 2022
bf4c407
DevP2P info to DevP2P section, move link
jmcook1186 Apr 5, 2022
27cf522
update according to @minimalsm comments
jmcook1186 Apr 13, 2022
a142f55
Update index.md
jmcook1186 Apr 13, 2022
b088307
Update src/content/developers/docs/networking-layer/network-addresses…
jmcook1186 Apr 13, 2022
0776144
Update src/content/developers/docs/networking-layer/index.md
jmcook1186 Apr 13, 2022
afc103f
Update index.md
jmcook1186 Apr 13, 2022
5f47efc
2nd lev el heading -> 3rd level heading
jmcook1186 Apr 13, 2022
1fd8aa3
add to intro paragraph
jmcook1186 May 10, 2022
96de76b
Apply suggestions from code review
jmcook1186 May 10, 2022
6ea6f53
fix ip addr
jmcook1186 May 10, 2022
25445b0
mention engine api
jmcook1186 May 10, 2022
8ed6495
Update src/content/developers/docs/networking-layer/index.md
jmcook1186 May 10, 2022
cbc1e9e
update page link
jmcook1186 May 10, 2022
92f8a74
Merge branch 'network-layer' of https://github.com/jmcook1186/ethereu…
jmcook1186 May 10, 2022
ac610be
fix ip address typo
jmcook1186 May 16, 2022
b7cb0a8
Merge branch 'dev' into network-layer
minimalsm May 16, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
164 changes: 164 additions & 0 deletions src/content/developers/docs/networking-layer/index.md

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
---
title: Network addresses
description: An introduction to network addresses.
lang: en
sidebar: true
sidebarDepth: 2
---

Ethereum nodes have to identify themselves with some basic information to connect to peers. To ensure any potential peer can interpret this information, it is relayed in one of three standardized formats that any Ethereum node can understand: multiaddr, enode, or Ethereum Node Records (ENRs). ENRs are the current standard for Ethereum network addresses.

## Prerequisites {#prerequisites}

Some understanding of Ethereum's [networking layer](/developers/docs/networking-layer/) is required to understand this page.

## Multiaddr {#multiaddr}

The original Ethereum node address format was the 'multiaddr' (short for 'multi-addresses'). Multiaddr is a universal format designed for peer-to-peer networks. Addresses are represented as key-value pairs with keys and values separated with a forward slash. For example, the multiaddr for a node with IPv4 address `192.168.22.27` listening to TCP port `33000` looks like:

`/ip4/192.168.22.27/tcp/33000`

For an Ethereum node, the multiaddr contains the node-ID (a hash of their public key):

`/ip4/192.168.22.27/tcp/33000/p2p/5t7Nv7dG2d6ffbvAiewVsEwWweU3LdebSqX2y1bPrW8br`

## Enode {#enode}

An enode is a way to identify an Ethereum node using a URL address format. The hexadecimal node-ID is encoded in the username portion of the URL separated from the host using an @ sign. The hostname can only be given as an IP address; DNS names are not allowed. The port in the hostname section is the TCP listening port. If the TCP and UDP (discovery) ports differ, the UDP port is specified as a query parameter "discport"

In the following example, the node URL describes a node with IP address `10.3.58.6`, TCP port `30303` and UDP discovery port `30301`.

`enode://6f8a80d14311c39f35f516fa664deaaaa13e85b2f7493f37f6144d86991ec012937307647bd3b9a82abe2974e1407241d54947bbb39763a4cac9f77166ad92a0@10.3.58.6:30303?discport=30301`

## Ethereum Node Records (ENRs) {#enr}

Ethereum Node Records (ENRs) are a standardized format for network addresses on Ethereum. They supercede multiaddr's and enodes. These are especially useful because they allow greater informational exchange between nodes. The ENR contains a signature, sequence number and fields detailing the identity scheme used to generate and validate signatures. The ENR can also be populated with arbitrary data organized as key-value pairs. These key-value pairs contain the node's IP address and information about the sub-protocols the node is able to use. Consensus clients use a [specific ENR structure](https://github.com/ethereum/consensus-specs/blob/dev/specs/phase0/p2p-interface.md#enr-structure) to identify boot nodes and also include an `eth2` field containing information about the current Ethereum fork and the attestation gossip subnet (this connects the node to a particular set of peers whose attestations are aggregated together).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as before, do we have an updated term for eth2 here since the renaming?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the eth2 field persists - there are no updates to this in the capella, altair or bellatrix specs afaics


## Further Reading {#further-reading}

[EIP-778: Ethereum Node Records (ENR)](https://eips.ethereum.org/EIPS/eip-778)
[Network addresses in Ethereum](https://dean.eigenmann.me/blog/2020/01/21/network-addresses-in-ethereum/)
[LibP2P: Multiaddr-Enode-ENR?!](https://consensys.net/diligence/blog/2020/09/libp2p-multiaddr-enode-enr/)
6 changes: 6 additions & 0 deletions src/data/developer-docs-links.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,12 @@
to: /developers/docs/scaling/plasma/
- id: docs-nav-scaling-validium
to: /developers/docs/scaling/validium/
- id: docs-nav-networking-layer
to: /developers/docs/networking-layer/
description: docs-nav-networking-layer-description
items:
- id: docs-nav-networking-layer-network-addresses
to: /developers/docs/networking-layer/network-addresses/
- id: docs-nav-data-structures-and-encoding
to: /developers/docs/data-structures-and-encoding/
description: docs-nav-data-structures-and-encoding-description
Expand Down
3 changes: 3 additions & 0 deletions src/intl/en/page-developers-docs.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@
"docs-nav-transactions-description": "Transfers and other actions that cause Ethereum's state to change",
"docs-nav-web2-vs-web3": "Web2 vs Web3",
"docs-nav-web2-vs-web3-description": "The fundamental differences that blockchain-based applications provide",
"docs-nav-networking-layer": "Networking layer",
"docs-nav-networking-layer-description": "Explanation of Ethereum's networking layer",
"docs-nav-networking-layer-network-addresses": "Network addresses",
"docs-nav-data-structures-and-encoding": "Data structures and encoding",
"docs-nav-data-structures-and-encoding-description": "Explanation of the data structures and encoding schema used across the Ethereum stack",
"docs-nav-data-structures-and-encoding-rlp": "Recursive-length prefix (RLP)",
Expand Down
3 changes: 3 additions & 0 deletions src/intl/en/page-developers-index.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@
"page-developers-transactions-link": "Transactions",
"page-developers-web3-desc": "How the web3 world of development is different",
"page-developers-web3-link": "Web2 vs Web3",
"page-developers-networking-layer": "Networking Layer",
"page-developers-networking-layer-link": "Networking Layer",
"page-developers-networking-layer-desc": "Introduction to the Ethereum networking layer"
"page-developers-data-structures-and-encoding": "Data structures and encoding",
"page-developers-data-structures-and-encoding-link": "Data structures and encoing",
"page-developers-data-structures-and-encoding-desc": "Introduction to the data structures and encoding schema used in the Ethereum stack"
Expand Down
6 changes: 5 additions & 1 deletion src/pages/developers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,11 @@ const DevelopersPage = ({ data }) => {
<p>
<Translation id="page-developers-scaling-desc" />
</p>

<Link to="/developers/docs/networking-layer/">
<Translation id="page-developers-networking-layer-link" />
</Link>
<p>
<Translation id="page-developers-networking-layer-desc" />
<Link to="/developers/docs/data-structures-and-encoding/">
<Translation id="page-developers-data-structures-and-encoding-link" />
</Link>
Expand Down