|
| 1 | +--- |
| 2 | +title: Node architecture |
| 3 | +description: Introduction to how Ethereum nodes are organized and where Geth fits. |
| 4 | +lang: en |
| 5 | +sidebaDepth: 2 |
| 6 | +--- |
| 7 | + |
| 8 | +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). |
| 9 | + |
| 10 | +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. |
| 11 | + |
| 12 | +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. |
| 13 | + |
| 14 | +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. |
| 15 | + |
| 16 | + |
| 17 | + |
| 18 | +_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_ |
| 19 | + |
| 20 | +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). |
| 21 | + |
| 22 | +## What does the execution client do? {#execution-client} |
| 23 | + |
| 24 | +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). |
| 25 | + |
| 26 | +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. |
| 27 | + |
| 28 | +In summary, the execution client is: |
| 29 | + |
| 30 | +- a user gateway to Ethereum |
| 31 | +- home to the Ethereum Virtual Machine, Ethereum's state and transaction pool. |
| 32 | + |
| 33 | +## What does the consensus client do? {#consensus-client} |
| 34 | + |
| 35 | +The consensus client deals with all the consensus logic that enables a client to stay in sync with the Ethereum network. This includes receiving blocks from peers and running a fork choice algorithm that ensures the client 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 cosnensus 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 enable a user to transact with Ethereum using their execution client, confident that they are on the right chain. |
| 36 | + |
| 37 | +## Validators {#validators} |
| 38 | + |
| 39 | +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. |
| 40 | + |
| 41 | +Read more about [proof-of-stake](https://ethereum.org/en/developers/docs/consensus-mechanisms/pos/). |
| 42 | + |
| 43 | +## Further Reading |
| 44 | + |
| 45 | +[Proof-of-stake](src/content/developers/docs/consensus-mechanisms/pos) |
| 46 | + |
| 47 | +[Block proposal](src/content/developers/docs/consensus-mechanisms/pos/block-proposal) |
| 48 | + |
| 49 | +[Validator rewards and penalties](src/content/developers/docs/consensus-mechanisms/pos/rewards-and-penalties) |
0 commit comments