Skip to content

Commit e72872a

Browse files
authored
Merge pull request #8449 from ethereum/jc-node-architecture
add page on node architecture
2 parents 963cfbe + a8944c0 commit e72872a

File tree

5 files changed

+62
-0
lines changed

5 files changed

+62
-0
lines changed
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
---
2+
title: Node architecture
3+
description: Introduction to how Ethereum nodes are organized.
4+
lang: en
5+
---
6+
7+
An Ethereum node is composed of two clients: an [execution client](/developers/docs/nodes-and-clients/#execution-clients) and a [consensus client](/developers/docs/nodes-and-clients/#consensus-clients).
8+
9+
When Ethereum was using [proof-of-work](/developers/docs/consensus-mechanisms/pow/), an execution client was enough to run a full Ethereum node. However, since implementing [proof-of-stake](/developers/docs/consensus-mechanisms/pow/), the execution client needs to be used alongside another piece of software called a [“consensus client”](/developers/docs/nodes-and-clients/#consensus-clients).
10+
11+
The diagram below shows the relationship between the two Ethereum clients. The two clients connect to their own respective peer-to-peer (P2P) networks. Separate P2P networks are needed as the execution clients gossip transactions over their P2P network, enabling them to manage their local transaction pool, whilst the consensus clients gossip blocks over their P2P network, enabling consensus and chain growth.
12+
13+
![](node-architecture-text-background.png)
14+
15+
_This image is borrowed from geth.ethereum.org and uses the Geth logo to represent execution clients - there are other options for the execution client including Erigon, Nethermind and Besu_
16+
17+
For this two-client structure to work, consensus clients must be able to pass bundles of transactions to the execution client. Executing the transactions locally is how the client validates that the transactions do not violate any Ethereum rules and that the proposed update to Ethereum’s state is correct. Likewise, when the node is selected to be a block producer the consensus client must be able to request bundles of transactions from Geth to include in the new block and execute them to update the global state. This inter-client communication is handled by a local RPC connection using the [engine API](https://github.com/ethereum/execution-apis/blob/main/src/engine/specification.md).
18+
19+
## What does the execution client do? {#execution-client}
20+
21+
The execution client is responsible for transaction handling, transaction gossip, state management and supporting the Ethereum Virtual Machine ([EVM](/developers/docs/evm/)). However, it is **not** responsible for block building, block gossiping or handling consensus logic. These are in the remit of the consensus client.
22+
23+
The execution client creates execution payloads - the list of transactions, updated state trie, and other execution-related data. Consensus clients include the execution payload in every block. The execution client is also responsible for re-executing transactions in new blocks to ensure they are valid. Executing transactions is done on the execution client's embedded computer, known as the [Ethereum Virtual Machine (EVM)](/developers/docs/evm).
24+
25+
The execution client also offers a user interface to Ethereum through [RPC methods](/developers/docs/apis/json-rpc) that enable users to query the Ethereum blockchain, submit transactions and deploy smart contracts. It's common for RPC calls to be handled by a library like [Web3js](https://web3js.readthedocs.io/en/v1.8.0/), [Web3py](https://web3py.readthedocs.io/en/v5/), or by a user-interface such as a browser wallet.
26+
27+
In summary, the execution client is:
28+
29+
- a user gateway to Ethereum
30+
- home to the Ethereum Virtual Machine, Ethereum's state and transaction pool.
31+
32+
## What does the consensus client do? {#consensus-client}
33+
34+
The consensus client deals with all the logic that enables a node to stay in sync with the Ethereum network. This includes receiving blocks from peers and running a fork choice algorithm to ensure the node always follows the chain with the greatest accumulation of attestations (weighted by validator effective balances). Similar to the execution client, consensus clients have their own P2P network through which they share blocks and attestations.
35+
36+
The consensus client does not participate in attesting to or proposing blocks - this is done by a validator, an optional add-on to a consensus client. A consensus client without a validator only keeps up with the head of the chain, allowing the node to stay synced. This enables a user to transact with Ethereum using their execution client, confident that they are on the correct chain.
37+
38+
## Validators {#validators}
39+
40+
Node operators can add a validator to their consensus clients if 32 ETH is the deposit contract. The validator client comes bundled with the consensus client and can be added to a node at any time. The validator handles attestations and block proposals. They enable a node to accrue rewards or lose ETH via penalties or slashing. Running the validator software also makes a node eligible to be selected to propose a new block.
41+
42+
[More on staking](/staking/).
43+
44+
## Components of a node comparison {#node-comparison}
45+
46+
| Execution Client | Consensus Client | Validator |
47+
| -------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------- |
48+
| Gossips transactions over its p2p network | Gossips blocks and attestations overs its p2p network | Proposes blocks |
49+
| Executes/re-executes transactions | Runs the fork choice algorithm | Accrues rewards/penalties |
50+
| Verifies incoming state changes | Keeps track of the head of the chain | Makes attestations |
51+
| Manages state and receipts tries | Manages the Beacon state (contains consensus and execution info) | Requires 32 ETH to be staked |
52+
| Creates execution payload | Keeps track of accumulated randomness in RANDAO | Proposes blocks |
53+
| Exposes JSON-RPC API for interacting with Ethereum | Keeps track of justification and finalization | Can be slashed |
54+
55+
## Further reading {#further-reading}
56+
57+
- [Proof-of-stake](/developers/docs/consensus-mechanisms/pos)
58+
- [Block proposal](/developers/docs/consensus-mechanisms/pos/block-proposal)
59+
- [Validator rewards and penalties](/developers/docs/consensus-mechanisms/pos/rewards-and-penalties)
Loading

src/data/developer-docs-links.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@
4848
to: /developers/docs/nodes-and-clients/client-diversity/
4949
- id: docs-nav-nodes-as-a-service
5050
to: /developers/docs/nodes-and-clients/nodes-as-a-service/
51+
- id: docs-nav-node-architecture
52+
to: /developers/docs/nodes-and-clients/node-architecture/
5153
- id: docs-nav-networks
5254
to: /developers/docs/networks/
5355
description: docs-nav-networks-description

src/intl/en/page-developers-docs.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@
118118
"docs-nav-data-structures-and-encoding-ssz": "Simple serialize (SSZ)",
119119
"docs-nav-data-structures-and-encoding-web3-secret-storage": "Web3 secret storage definition",
120120
"docs-nav-rewards-and-penalties": "PoS rewards and penalties",
121+
"docs-nav-node-architecture": "Node architecture",
121122
"docs-nav-attack-and-defense": "PoS attack and defense",
122123
"docs-nav-pos-faqs": "Proof-of-stake FAQs",
123124
"page-calltocontribute-desc-1": "If you're an expert on the topic and want to contribute, edit this page and sprinkle it with your wisdom.",

0 commit comments

Comments
 (0)