I have seen that nodes hold a storage trie and state trie. What are those tries and are there these two tries per a contract code (in every copy of the blockchain)?


There are 4 tries in total. See How many trie's does Ethereum have?

The state trie is globally scoped, and contains a mapping of all known accounts to their state. Each node of the state trie represents an account. The data structure of each node contains details about the account balance, nonce, the code associated with the account, as well as the hash of the root node of...

...the account's storage trie, which is a mapping of integer keys to other integer values.

...and are there these two tries per a contract code (in every copy of the blockchain)?

As above, the contract code is associated with a specific account in the state trie. This is represented by a single node in the trie. Each account will have its own entire storage trie.

  • I see, Who updates the state trie? what is the difference between a transaction receipt trie and a transaction trie? is every node in the state trie connect with an account contains a storage trie(of the account)?
    – adi
    Apr 21 '18 at 20:30
  • The tree is updated whenever there is a state change. (i.e. When a change is made to an existing account, or a new account comes into existence.) All nodes will make the changes to their own copy of the trie when they receive a new block. Yes, each node in the state trie (i.e. the account) has its own storage trie. A transaction trie is per block, and contains a trie of transactions in the block. The receipt trie contains log entries for the transactions in the transactions trie. Apr 28 '18 at 17:39
  • See: i.stack.imgur.com/afWDt.jpg Apr 28 '18 at 17:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.