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 page on node architecture #8449

Merged
merged 13 commits into from
Dec 13, 2022
Merged
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
---
title: Node architecture
description: Introduction to how Ethereum nodes are organized and where Geth fits.
jmcook1186 marked this conversation as resolved.
Show resolved Hide resolved
lang: en
sidebaDepth: 2
jmcook1186 marked this conversation as resolved.
Show resolved Hide resolved
---

An Ethereum node is composed of two clients: an [execution client](https://ethereum.org/en/developers/docs/nodes-and-clients/#execution-clients) and a [consensus client](https://ethereum.org/en/developers/docs/nodes-and-clients/#consensus-clients).
minimalsm marked this conversation as resolved.
Show resolved Hide resolved

Originally, an execution client alone was enough to run a full Ethereum node. However, ever since Ethereum turned off [proof-of-work](https://ethereum.org/en/developers/docs/consensus-mechanisms/pow/) and implemented [proof-of-stake](https://ethereum.org/en/developers/docs/consensus-mechanisms/pow/), the execution client has needed to be coupled to another piece of software called a [“consensus client”](https://ethereum.org/en/developers/docs/nodes-and-clients/#consensus-clients) in order to keep track of the Ethereum blockchain.
jmcook1186 marked this conversation as resolved.
Show resolved Hide resolved

The execution client is responsible for transaction handling, transaction gossip, state management and supporting the Ethereum Virtual Machine ([EVM])(https://ethereum.org/en/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.
jmcook1186 marked this conversation as resolved.
Show resolved Hide resolved

The relationship between the two Ethereum clients is shown in the schematic below. The two clients each connect to their own respective peer-to-peer (P2P) networks. This is because the execution clients gossip transactions over their P2P network enabling them to manage their local transaction pool. The consensus clients gossip blocks over their P2P network, enabling consensus and chain growth.
jmcook1186 marked this conversation as resolved.
Show resolved Hide resolved
minimalsm marked this conversation as resolved.
Show resolved Hide resolved

![node-architecture](node_architecture.png)
minimalsm marked this conversation as resolved.
Show resolved Hide resolved

_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, Akula and Besu_

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).

## What does the execution client do? {#execution-client}

The execution client is responsible for creating the execution payloads - the list of transactions, updated state trie plus other execution related data - that consensus clients include in their blocks. It is also responsible for re-executing transactions that arrive 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).
jmcook1186 marked this conversation as resolved.
Show resolved Hide resolved

The execution client also offers a user-interface to Ethereum by exposing a set of [RPC methods](/developers/docs/apis/json-rpc) that enable users to query the Ethereum blockchain, submit transactions and deploy smart contracts. Often, the RPC calls are abstracted by a library such as [Web3js](https://web3js.readthedocs.io/en/v1.8.0/) or [Web3py](https://web3py.readthedocs.io/en/v5/) or a user-interface such as a browser wallet.
jmcook1186 marked this conversation as resolved.
Show resolved Hide resolved

In summary, the execution client is:

- a user gateway to Ethereum
- home to the Ethereum Virtual Machine, Ethereum's state and transaction pool.

## What does the consensus client do? {#consensus-client}

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). The consensus client has its own peer-to-peer network, separate from the network that connects execution clients to each other. The consensus clients share blocks and attestations over their peer-to-peer network. The consensus client itself does not participate in attesting to or proposing blocks - this is done by a validator which is 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 right chain.
jmcook1186 marked this conversation as resolved.
Show resolved Hide resolved

## Validators {#validators}

Validators can be added to consensus clients if 32 ETH have been sent to 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.
jmcook1186 marked this conversation as resolved.
Show resolved Hide resolved

Read more about [proof-of-stake](https://ethereum.org/en/developers/docs/consensus-mechanisms/pos/).
Copy link
Contributor

Choose a reason for hiding this comment

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

Is pos the right call out here? Feel like staking makes more sense for this specific section.

jmcook1186 marked this conversation as resolved.
Show resolved Hide resolved

jmcook1186 marked this conversation as resolved.
Show resolved Hide resolved
## Further Reading
jmcook1186 marked this conversation as resolved.
Show resolved Hide resolved

minimalsm marked this conversation as resolved.
Show resolved Hide resolved
[Proof-of-stake](src/content/developers/docs/consensus-mechanisms/pos)

jmcook1186 marked this conversation as resolved.
Show resolved Hide resolved
[Block proposal](src/content/developers/docs/consensus-mechanisms/pos/block-proposal)

[Validator rewards and penalties](src/content/developers/docs/consensus-mechanisms/pos/rewards-and-penalties)
jmcook1186 marked this conversation as resolved.
Show resolved Hide resolved
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions src/data/developer-docs-links.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@
to: /developers/docs/nodes-and-clients/client-diversity/
- id: docs-nav-nodes-as-a-service
to: /developers/docs/nodes-and-clients/nodes-as-a-service/
- id: docs-nav-node-architecture
to: /developers/docs/nodes-and-clients/node-architecture/
- id: docs-nav-networks
to: /developers/docs/networks/
description: docs-nav-networks-description
Expand Down
1 change: 1 addition & 0 deletions src/intl/en/page-developers-docs.json
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@
"docs-nav-data-structures-and-encoding-ssz": "Simple serialize (SSZ)",
"docs-nav-data-structures-and-encoding-web3-secret-storage": "Web3 secret storage definition",
"docs-nav-rewards-and-penalties": "PoS rewards and penalties",
"docs-nav-node-architecture": "Node architecture",
"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.",
"page-calltocontribute-desc-2": "You'll be credited and you'll be helping the Ethereum community!",
"page-calltocontribute-desc-3": "Use this flexible",
Expand Down