1

This question already has an answer here:

I know the functionality of merkle tree, it makes a root hash from a group of data.My question is how merkle tree is act in ethereum blockchain,precisesly in the place of transaction hash,block hash,how and where the root hash is used in the ethereum blockchain?

marked as duplicate by Richard Horrocks, Achala Dissanayake, kherwa, Briomkez, Nicolas Massart Mar 25 at 13:30

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

3

Ethereum is a blockchain, so it contains transactions packed into blocks. Once executed, transactions may modify account states. There are two kinds of accounts: simple, usually backed by private keys, and contracts.

State of simple account is basically ether balance and nonce, where nonce is a number incremented every time transaction originating from this account is executed. State of contract account is ether balance, nonce, contract's byte code, and hash of content of smart contract's storage. As long as smart contracts cannot initiate transactions, nonce for smart contract has different meaning and is incremented every time this smart contract deploys another smart contract.

Storage of each smart contract is organized as a separate Merkle-Patricia tree: a variation of Merkle tree that is able to efficiently store key=>value mapping with short keys. In this case keys are 256-bit storage addresses. States of all accounts are also organized as Merkle-Patricia tree, but this time keys are 160-bit account addresses.

Each block contains hash of accounts state as it was after executing all the transactions included into the block, so every node may easily verify that it executed transactions correctly.

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