Questions tagged [state-trie]
The state-trie tag has no usage guidance.
89
questions
89
votes
6answers
66k views
Ethereum block architecture
Where can I find a description (preferably a diagram like below) showing the block structure in an Ethereum blockchain?
Credits: Wikipedia
31
votes
3answers
12k views
Ethereum Merkle Tree Explanation
Here is my basic understanding about how Ethereum stores transactions
A hash is generated for each transaction
Then pairs are selected and a hash is generated for each pair
This way the last ...
26
votes
3answers
17k views
Where is the state data stored?
This question was asked on Reddit a while ago:
Where is the state data actually stored though? On the hard drive of each node? Separate from or within the blockchain?
— Reddit: Basic ...
13
votes
3answers
2k views
is there an easy way to get the full state of a contract?
I'm developing a quite complex contract with many state variables of all kinds. (mappings, arrays, uint, strings, bytes, etc).
For testing, it would be very useful to get a JSON (or similar) with the ...
9
votes
1answer
350 views
How was the state-bloat attack that led to the EIP 150 hardfork performed?
I understand that SELFDESTRUCT and mispricing of opcodes allowed many empty accounts to be created cheaply as explained in Why were empty accounts allowed to be on the blockchain? The answer to that ...
8
votes
2answers
2k views
Is it possible to access storage history from a contract in solidity?
With web3, I can access the history of the blockchain like this:
web3.eth.getBalance('0x1234') // returns current balance at address 0x1234
web3.eth.getBalance('0x1234', 1000) // returns balance at ...
8
votes
1answer
1k views
Getting complete state of a smart contract
From the yellow paper, I figured out that a contract has 4 components
1. nonce, 2. balance, 3. code, 4. storage. To know about the current state of a smart contract we need to know the all these ...
8
votes
1answer
1k views
How many trie's does Ethereum have?
Did I miss any trie below and get things right?
Transaction tries, one per block, root hash included in the block header
Transaction receipt tries, one per block, root hash included in the block ...
7
votes
3answers
1k views
Reading Ethereum contract state variables
Is this assumption correct ?
There is absolutely no way an ethereum contract can send data to the external world. It can only modify its state variables (later stored in the new block)and send ...
7
votes
1answer
104 views
Are there multiple instances of Ethereum state or a single latest image?
Are there multiple instances of Ethereum's state? That is, is there one per mined block? Or a single latest image?
Does Ethereum maintain a state snapshot, for every block since genesis, so that ...
6
votes
1answer
1k views
Full node sync only preserve the last 128 history states
While researching on the different sync modes and their behaviors, I learned that geth full sync will replay all transactions from the genesis and preserve all history states, while fast sync will ...
6
votes
2answers
2k views
How to access Geth's state trie
Using Geth, how can I extract a snapshot of the network state for a given block?
My Geth node runs a full sync (~300 gb) which means the state trie should already be saved down. I've tried accessing ...
6
votes
4answers
3k views
How Ethereum transaction tree is formed
I am looking for clarity on transaction tree structure. Below I have listed my understanding
If I am not wrong the state changes are tracked in a single state tree.
Each block has a state root hash ...
6
votes
1answer
178 views
How does knowing the root hash of a past world state help me to revert to this world state?
In section 4.1 of the Ethereum yellow-paper (http://gavwood.com/Paper.pdf) the following is written:
The world state (state), is a mapping between addresses (160-bit
identifiers) and account ...
5
votes
1answer
408 views
What is the current size of the Ethereum State?
What is the current size of Ethereum's state in bytes?
I am not asking about the size of the blockchain with blocks headers, transactions and receipts. I am looking for the size of all the structure ...
4
votes
2answers
322 views
Why are transaction tries in Ethereum not plain Merkle Tries?
I understand the Ethereum block header contains a Merkle Patricia Trie (MPT) root for the global state, one for receipts (which I don't understand but am not focussed on for now), and one for all the ...
4
votes
1answer
941 views
Getting current full state
In my quest to understand ethereum in depth, I ended up in this article, which contains the following image:
If the image above is correct, only the changes in state are taken in account to create ...
4
votes
1answer
418 views
How to collect all contract instantiations and count the bytecode redundancies?
I want to traverse the Ethereum blockchain, collect all contract instantiations, and count how often which bytecode has been instantiated.
As result I want to have a map with key:hash(bytecode) -> ...
4
votes
1answer
325 views
How can empty accounts with a nonce of zero appear on the blockchain?
Recently I have heard about zero balance accounts with a nonce of zero appearing on the blockchain.
My understanding is that any account that has been used in a transaction must have a nonce greater ...
4
votes
1answer
640 views
Do the Ethereum clients store 'historic state' or just 'current state.'
I assume, given the recent state clearing, that the Ethereum clients must only store the current state of each account as opposed to all historic state. (Otherwise, if it stored a record of all past ...
4
votes
1answer
291 views
Exploring Ethereum's state trie with golang
Exploring Ethereum's state trie with Node.js
It is a nice article to explore ethereum internal storage, but the code is Node.js.
Does anyone have a golang version?
4
votes
0answers
127 views
Question on initial sync and Freezer (SSD and HDD)
I've kicked off a fresh fast sync of Geth v1.9.2 and after 3 weeks it's still pulling states (state trie).
As per the documentation you can use the Freezer with a HDD as it references old data so ...
4
votes
0answers
179 views
How to generate a state root
I am trying to implement a Simplified World State Trie based on Merkle Patricia Tree.
Take the following image for example
there are four accounts
address value
a711355 ...
3
votes
1answer
1k views
Does geth --syncmode light download the State Trie?
I'd like to download some recent version of the Ethereum State Trie. I read here that geth --syncmode light downloads the current state. But does that only encompass the most recent blocks or also a ...
3
votes
1answer
1k views
How Ethereum state tree is formed?
As we know each block contains a state-root. Following image is taken from
https://blog.ethereum.org/2015/11/15/merkling-in-ethereum/.
Ethereum Wiki:
Constant light client reference: light ...
3
votes
1answer
693 views
How much time until the state data is PoW validated when using parity warp?
Ethcore claims parity --warp only takes one minute to sync the chain. I tried myself and it indeed takes around 2-3 minutes on my machine with a slightly bad connection.
0 ✓ user@hoster ~ $ parity -...
3
votes
2answers
289 views
reading contract bytecode from leveldb
Is there a way to read a deployed contract's bytecode from leveldb? From what I understand, within each account in the state tree, there exists the nonce, the balance, the codehash, and the storage ...
3
votes
2answers
346 views
Storage trie - are trie nodes reused for two contract instances with the same storage content?
Reading geth code and various posts here, I think I have now a good understanding of how the data is stored in Ethereum (please correct me if I am wrong at some point).
At the lowest level we have a ...
3
votes
0answers
58 views
What happens in the account state when we pre-send ethers to a smart contract?
I'm asking this question in relation to this one : pre_sending Ether where the OP asked in a comment of the answer about what happens at the low-level when pre-sending ethers to a smart contract.
As ...
3
votes
0answers
43 views
Why using Merkle Patricia trie for keeping transactions and receipts instead of Merkle trie?
Using Merkle Patricia trie for keeping Ethereum states has the advantage of fewer changes in the data structure during the updates in the states compared to Merkle trie.
But what is the advantage of ...
3
votes
1answer
77 views
mining requires access to the entire blockchain?
I am reading the white paper and confused by two sentences bellow:
In the Section of Mining Centralization:
... miners are required to fetch random data from the state, compute some randomly ...
3
votes
0answers
962 views
Questions about geth state tree pruning [closed]
In current geth, how long (in terms of blocks) will a state tree node put into the death row before being pruned? Does this vary among different sync mode? And can we configure it?
Besides state ...
3
votes
0answers
90 views
What is an empty account if the state root is not empty?
"State-bloat" attacks led to an empty account being defined as an account that has zero balance, nonce and code.
There was a disagreement on EIP 161:
I disagree. An account should be considered ...
2
votes
2answers
91 views
If the World State only Stores Hashes of the Code, Where Is the Underlying Actual Code Stored?
Apologies in advance if it's a silly question.
I'm slowly making my way through the ethereum yellow paper.
Am I correct in saying that the ethereum world state does not contain any EVM code? It only ...
2
votes
1answer
778 views
How selfdestruct() works?
I'm wondering about how selfdestruct() actually works. Does it actually delete contract codes from the storage? Or just delete the contract address from state trie? If just deleting the contract ...
2
votes
1answer
189 views
Reason for World State
All Ethereum blocks contain a stateRoot field - That is, the root hash of the world state trie. I have two questions about that.
From what I've understood through all the reading I've done on Casper ...
2
votes
2answers
656 views
In the Ethereum Modified Merkle-Particia tree, what do the prefix, key and value signify?
What does the prefix '3☐' mean in the leaf nodes?
2
votes
1answer
115 views
Why does the blockchain store multiple copies of the same code?
Based on joeykrug's questions on Github: Is there any reason we need to store multiple copies of code if the same contracts use the same code? For example, if a contract is deployed and another ...
2
votes
1answer
338 views
How to calculate a root node in a Merkle Patricia tree?
I'm trying to understand a Merkle Patricia tree.
For example there are two accounts:
x00: {balance: 1}
x01: {balance: 2}
I can't understand how to begin building my trie.
RLP and HP encoding are ...
2
votes
1answer
422 views
Ethereum storage implementation at the database level - how is it stored
I have read the yellow paper many times as well as various articles, I suppose if I cannot find the answer here - I will look into the code.
My understanding is that each contract account contains a ...
2
votes
1answer
316 views
Merkle tree child hashing process
Each non leaf node of a Merkle tree is just the hash of the
concatenation of it's children.
Does this literally mean stick the 2 hashes together or is there a more intricate process involved?
i.e. ...
2
votes
2answers
160 views
Full Synchronisation with Geth Repeated Tree Node Error
I am doing a university project on the functionality of the EVM. I need to use debug.traceTransaction() function which requires a fully synchronized node. I have tried to sync Geth on a university VM ...
2
votes
2answers
159 views
Do state tree key/vaue maps reference state trees from other blocks?
Each block includes both a state root and the whole state tree. In the state trees, do key/value maps reference state trees from other blocks ?
2
votes
0answers
36 views
Why does Ethereum have nested trie structure that a storage trie is under a account in state trie?
As I understand it,
the leaf node of the state trie has account data.
The account data has a storage root,
and the variables of the contract are stored in the leaf node of the storage root.
But ...
2
votes
0answers
67 views
when syncing state trie of an Ethereum node, why not start from a recent block to reduce syncing time
as explained in this issue: https://github.com/ethereum/go-ethereum/issues/16218#issuecomment-371454280
when we are syncing an eth node, firstly it downloads the blocks, then the states, the first ...
2
votes
1answer
93 views
Leaf node with encodedPath containing only Hex-Prefix in Merkle Patricia Trie
A leaf node is defined as the tuple [encodedPath, value], and encodedPath uses the Hex-Prefix encoding. Is it possible we have a leaf node with encodedPath having only the prefix and no partial path ...
2
votes
0answers
148 views
Succinct contract state/storage root of a smart contract
In the yellow paper, it is mentioned(at section 4.1) that
storageRoot: A 256-bit hash of the root node of a Merkle Patricia tree that encodes the storage contents of the account (a mapping between ...
2
votes
0answers
128 views
How get public address from State Root leaf node (code inside)?
In article "Understanding the ethereum trie"is written that:
For the state trie, the keys are ethereum addresses.
So i obtain State Trie and in that trie I got Merkle Leaf node:
['9:', ' LEAF ...
2
votes
0answers
1k views
Geth traceTransaction: missing trie node [duplicate]
I have a fully synced Geth node and am trying to run the debug.traceTransaction() method, but it keeps giving me this error:
Error: missing trie node ...
1
vote
3answers
524 views
how do you check if the account exists in current state?
Currently there is no way to check somehow that an account exists in the trie. I am looking for something like this:
> web3.eth.accountExist("0x743623152a53b53be5f3463746726373")
true
>
Is a ...