Skip to main content
Share Your Experience: Take the 2024 Developer Survey
162 votes

Ethereum block architecture

Here's my interpretation, based on the yellow paper: ...the Tries should look more like this:
Lee's user avatar
  • 8,568
24 votes

Ethereum block architecture

Here is a complete structure of a block and where it plays its role in Ethereum's blockchain. You asked for a diagram but i think this would be more explanatory.
Vishal Sharma's user avatar
21 votes

Ethereum Merkle Tree Explanation

The state has the information of all accounts in the blockchain, it is not stored in each block. The state is generated processing each block since the genesis block. Each block will only modify parts ...
Ismael's user avatar
  • 30.5k
18 votes

Where is the state data stored?

Technically the states are assembled into a state tree (patricia-tree) linked to the account (balance in case of EAOs and balance and storage in case of contract's account) and to the blocks (figures ...
Badr Bellaj's user avatar
  • 18.8k
14 votes

Ethereum Merkle Tree Explanation

Ethereum is said to have an account-based blockchain. The state isn't directly stored in each the block. To build a better conceptual understanding, we can say that all account states reside locally ...
Malone's user avatar
  • 1,590
12 votes
Accepted

Getting complete state of a smart contract

There is no way to do it via JSON RPC or with web3 API. I've created a repository on Github with an example showing how to read all Patricia trie entries in a block and in any contract storage using ...
medvedev1088's user avatar
10 votes

Ethereum block architecture

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 ...
Jouko Salonen's user avatar
10 votes
Accepted

How many trie's does Ethereum have?

This sounds correct to me. Referring to the graphical interpretation of the descriptions in the Yellow Paper, your 4 tries are shown in the "Information required to derive block header" section. ...
Richard Horrocks's user avatar
8 votes
Accepted

Is it possible to access storage history from a contract in solidity?

No, Solidity code (and EVM code in general) is only able to read the current state at the block at which it is being called. If it were able to read state at previous blocks you would need the entire ...
Edmund Edgar's user avatar
  • 16.9k
7 votes
Accepted

Full node sync only preserve the last 128 history states

The behavior has changed with the release of geth v1.8.0 Fromt the release notes Tracing and pruning: By default, state for the last 128 blocks kept in memory. Most states are garbage collected. ...
Ismael's user avatar
  • 30.5k
6 votes

Ethereum block architecture

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&...
samlaf's user avatar
  • 160
6 votes
Accepted

How was the state-bloat attack that led to the EIP 150 hardfork performed?

Ancient history, but here goes :-) There was one coordinating contract for the initial attack. A later version had a more complex algorithm to generate the empty account addresses, presumably to try ...
benjaminion's user avatar
  • 9,297
5 votes
Accepted

Getting current full state

Each node keeps a complete copy of the current state, and update it with each new block. New nodes need to reconstruct the state by replaying the state changes in each block, although state-trie ...
Tjaden Hess's user avatar
  • 37.1k
5 votes
Accepted

How is a post-transaction state calculated?

The state trie contains the balance of each account. Even transactions that throw an exception result in a reduction in the sender's balance through gas costs, which means that the resulting state is ...
Tjaden Hess's user avatar
  • 37.1k
5 votes
Accepted

Why are transaction tries in Ethereum not plain Merkle Tries?

First, it should be noted that there is no such thing as a "plain Merkle Trie". The Merkle tree found in Bitcoin is not a radix tree (trie). The main reason Ethereum uses a Patricia Trie for ...
Tjaden Hess's user avatar
  • 37.1k
4 votes

Is it possible to access storage history from a contract in solidity?

Yes, it is possible with Web3 at any given block. If your contract has: contract ValueStore { function getValue(uint param) constant returns (uint returnedValue); } Then, after instantiating ...
Xavier Leprêtre B9lab's user avatar
4 votes

Are there multiple instances of Ethereum state or a single latest image?

The ethereum state is stored on disk in a merkle tree separate from the actual data of the blockchain (ie. the blocks of transactions). The state is not included in blocks - only the state root is ...
Ethan's user avatar
  • 724
4 votes
Accepted

In the Ethereum Modified Merkle-Particia tree, what do the prefix, key and value signify?

Appendix D of the Yellow Paper, in defining the node types, states (italics mine): Leaf: A two-item structure whose first item corresponds to the nibbles in the key not already accounted for by ...
Lee's user avatar
  • 8,568
4 votes

How to access Geth's state trie

Doing this using web3 over RPC will take forever, as you've found. Reading the .ldb files is the way to go, and is something that's come up in similar questions before. I don't know of any working, ...
Richard Horrocks's user avatar
4 votes

How Ethereum state tree is formed?

[Q1] Records in the state trie can exist independently of the state root that references them. Each node is stored in what is essentially a flat hashmap, and nodes have references to allow them to ...
AusIV's user avatar
  • 620
4 votes
Accepted

Does geth --syncmode light download the State Trie?

The light client does not download state data. It downloads the header chain, and verifies the proof-of-work but not the transactions themselves. Each block includes a state root, which allows it to ...
AusIV's user avatar
  • 620
4 votes

Where are the Ethereum smart contracts actually stored?

from the ethereum yellow paper The world state, is a mapping between addresses and account states (a data structure serialised as RLP). Though not stored on the blockchain, it is assumed that the ...
Javier Marchetti's user avatar
3 votes

How Ethereum transaction tree is formed

I'm going to disagree with the conversation in the comments to the other answer. (Apologies in advance!) I think what's being outlined in the question is generally correct, at least from the way I'd ...
Richard Horrocks's user avatar
3 votes
Accepted

How can empty accounts with a nonce of zero appear on the blockchain?

When you send a zero value transaction to an account that does not exist. The same works for zero value creates (both through transactions and the CREATE opcode) as well as CALLing in to an account ...
Jeffrey W.'s user avatar
  • 1,939
3 votes
Accepted

How to calculate a root node in a Merkle Patricia tree?

Let's take a pseudo-code example: x00: {balance: 1} x01: {balance: 2} x02: {balance: 3} x03: {balance: 4} You calculate the first-level nodes: hashOf("x00: {balance: 1}", "x01: {balance: 2}") -> ...
Xavier Leprêtre B9lab's user avatar
3 votes

Reading Ethereum contract state variables

As the other answers stated, yes, the blockchain by itself cannot send or retrieve data to/from the real world. However, off-chain services can pull information from the blockchain. Everything that ...
Patrick Collins's user avatar
3 votes

Reading Ethereum contract state variables

In the context of your question, you can think of the blockchain as a database. A database on its own cannot "send data to the external world" - it requires some script to query the database and then ...
T9b's user avatar
  • 1,185
3 votes

Reading Ethereum contract state variables

Yes, this is correct. Everything on the blockchain is public, but only the current state is visible to smart contracts. Interestingly, using a Merkel proof, you can prove to a contract that another ...
Tjaden Hess's user avatar
  • 37.1k
3 votes
Accepted

Do the Ethereum clients store 'historic state' or just 'current state.'

An Ethereum full node does store historic state. In fact, every block contains the root of the state tree, such that it "snapshots" the entire state every block. The reason this is isn't a gargantuan ...
Matthew Schmidt's user avatar
3 votes
Accepted

How to collect all contract instantiations and count the bytecode redundancies?

Interesting idea! [Q]: how to collect the instantiations that happen within the contracts (-> new)? One option is to inspect transaction traces. Geth provides traceTransaction API https://github....
medvedev1088's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible