115

Where can I find a description (preferably a diagram like below) showing the block structure in an Ethereum blockchain?

Diagram showing how Bitcoin transactions can be verified

Credits: Wikipedia

tayvano
  • 15,961
  • 4
  • 45
  • 74
zanzu
  • 5,360
  • 4
  • 25
  • 43
  • 1
    Correct me if I am wrong but this is not only relevant to Proof of Work, the Proof of stake will still use the same Merkle Tree right? – Cyberience Jun 27 '18 at 07:03
  • @Cyberience yes, Merkle trees are still being used today (Sep 2023, post-Merge). But Merkle trees will be replaced by Verkle trees during The Verge. Refer to this blog post for more info on Verkle trees. – Paul Razvan Berg Sep 22 '23 at 13:05

8 Answers8

162

Here's my interpretation, based on the yellow paper:

enter image description here

...the Tries should look more like this:

enter image description here

Lee
  • 8,548
  • 6
  • 46
  • 80
  • 7
    Hi @atomh33ls, do you mind sharing the source file for the illustrations (in whatever software format you used to create them). I would like to create an illustration for transactions trie. It will look almost the same as state trie except some details will be changed. Thank you! – medvedev1088 Oct 26 '17 at 10:29
  • Explain them to us in simple english – NaN Nov 27 '17 at 12:36
  • @atomh33ls I would also be interested in the source files. I really like this amazing overview! What software did you use? – kn1g Jun 08 '19 at 17:13
  • 2
    @atomh33ls +1 to the source file, please. If not, I'd also be happy recreating it in mermaid.js so the community could co-edit it. The three specific changes I have in mind are adding a note that the key size is shortened for simplified purposes, putting the tree complexity (max depth) in the bottom right, and adding and example of an extension node with prefix 1[]. – Olshansky Apr 23 '22 at 00:35
  • 2
    @Olshansk The main diagram svg is here. Alas I don't have the merkle diagram to hand. They seem like good ideas - will be interesting to see what you come up with.. – Lee Apr 25 '22 at 12:21
  • 1
    Has anyone dived into the details of whether there were changes to this after "the merge"? – Olshansky Nov 05 '22 at 19:05
  • 1
    @Olshansky the first diagram definitely requires an update after The Merge. Uncle blocks are now called dunkles. Also, these diagrams will become increasingly outdated as Ethereum transitions to The Surge, The Verge, The Purge, and eventually The Purge. – Paul Razvan Berg Sep 22 '23 at 09:20
82

Lets first start with my adaptation of this figure illustrating the Bitcoin block structure:

Boitcoin Blockchain architecture

So far so good. All fairly basic.

Enter Ethereum and things get a wee bit more complex. After reading through this and this, and as per @eth 's recommendation this, my best interpretation is the figure below:

![Ethereum Blockchain Architecture

The header field definitions are available in section 4.3 of the yellow paper.

medvedev1088
  • 10,996
  • 5
  • 35
  • 63
zanzu
  • 5,360
  • 4
  • 25
  • 43
  • 2
    Uncles is a hash (of a list of uncles), Yellow Paper has: "The Keccak 256-bit hash of the ommers list portion of this block". Codehash is just a hash since contracts are immutable. The pointers point to "hash of whole block header" (the Keccak-256 hash of all the bytes in the block header). To have a full diagram, should really consult the Yellow Paper... – eth Jan 29 '16 at 22:53
  • Updated response after consulting the YP. Starting to get clearer now. Thanks! – zanzu Feb 01 '16 at 12:34
  • Why are the transactions from block N linked to those of block N+1? – Sebi Jun 10 '16 at 08:31
  • 3
    These links correspond to contract state that has not changed in between blocks. Referencing the state from the previous blocks instead of replicating is more efficient from a block size perspective. – zanzu Jun 10 '16 at 09:49
  • 1
    You forgot the difficulty in bitcoin headers. – Jus12 Sep 23 '16 at 16:52
  • Are new mined transactions included in the block as a 'reference' (e.g: only hash of previously broadcasted transaction in mempool) or is the transaction structure fully inlined in the block?

    If inlined/copied: there is some redundant data ineffeciency, right? once where transaction is broadcasted into mempool and then when copied to the block?

    If block transaction references mempool transaction: what happens if a node validating block has an unknown transaction? e.g: transaction is not in node mempool?

    – Saad Malik Mar 29 '18 at 07:58
24

Here is a complete structure of a block and where it plays its role in Ethereum's blockchain.

Ethereum Block Structure

You asked for a diagram but i think this would be more explanatory.

Vishal Sharma
  • 518
  • 3
  • 9
12

The description can be found in the Yellow Paper which is the formal specification of the Ethereum protocol.

Here are the main pieces of a block:

4.3. The Block. The block in Ethereum is the collection of relevant pieces of information (known as the block header), H, together with information corresponding to the comprised transactions, T, and a set of other block headers U that are known to have a parent equal to the present block’s parent’s parent.

No diagram though (an opportunity for the community).

eth
  • 85,679
  • 53
  • 285
  • 406
10

Vitalik Buterin gives a compact answer:

Every block header in Ethereum contains 3 trees for three kinds of objects: Transactions, Receipts (essentially, pieces of data showing the effect of each transaction), State.

You can read a longer version with pictures here.

Achala Dissanayake
  • 5,819
  • 15
  • 28
  • 38
Jouko Salonen
  • 101
  • 1
  • 3
10

Here's a picture from V's article regarding data structures for light clients:

https://blog.ethereum.org/2014/02/18/ethereum-scalability-and-decentralization-updates/

enter image description here

high110
  • 4,756
  • 1
  • 21
  • 43
  • 4
    The above is an abstraction of a Merkle tree. I'm rather looking for the Ethereum block structure (including all the actual header fields). – zanzu Jan 22 '16 at 08:57
6

Extrapolating from the syntactic block structure, we can also ask what the semantic ethereum world state structure looks like. I use this diagram to explain the relationship between "on-chain", "off-chain", and everything in between, including L2 scaling solutions. Please see my accompanying blog post for more details.

enter image description here

samlaf
  • 160
  • 1
  • 4
1

Here is my interpretation based on the latest version of yellow paper(BERLIN VERSION beacfbd – 2022-10-24)

enter image description here

here is the whole link: https://medium.com/@JanessaTech/ethereum-a-latest-interpretation-of-yellow-paper-29ec14d05867