160 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,468
82 votes
Accepted

Ethereum block architecture

Lets first start with my adaptation of this figure illustrating the Bitcoin block structure: So far so good. All fairly basic. Enter Ethereum and things get a wee bit more complex. After reading ...
zanzu's user avatar
  • 5,350
33 votes
Accepted

Where is the state data stored?

Conceptually, there are 2 important components of an account-based blockchain: transactions represent state transition functions the result of these functions can be stored A "full/archival" node ...
Taylor Gerring's user avatar
23 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
  • 31k
17 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.7k
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

Ethereum block architecture

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 ...
eth's user avatar
  • 85k
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.9k
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

Ethereum block architecture

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/
high110's user avatar
  • 4,746
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.8k
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
  • 31k
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,112
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
5 votes

Where is the state data stored?

Fusing nuggets of information from multiple sources (primarily, this and this): State data (together with account balances, contract code and account nonce) is stored by every Ethereum ...
zanzu's user avatar
  • 5,350
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
  • 36.7k
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
  • 36.7k
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

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
  • 611
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
  • 611
4 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
  • 36.7k
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

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
  • 36.7k
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 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,929

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