EVM Deep Dives: The Path to Shadowy Super Coder 🥷 💻 - Part 4
It will introduce you to the Geth codebase, teach you about the Ethereum “World State” and further your overall understanding of the EVM.
This represents the Ethereum architecture and the data contained within the Ethereum chain.
Rather than look at the diagram as a whole we’ll analyze it piece by piece. For now, let’s focus on the “Block N Header” and the fields it contains
Take a look at this block 14698834 on etherscan and see if you can see some of the fields in the diagram.
type Header struct {
ParentHash common.Hash `json:"parentHash" gencodec:"required"`
UncleHash common.Hash `json:"sha3Uncles" gencodec:"required"`
Coinbase common.Address `json:"miner"`
Root common.Hash `json:"stateRoot" gencodec:"required"`
TxHash common.Hash `json:"transactionsRoot" gencodec:"required"`
ReceiptHash common.Hash `json:"receiptsRoot" gencodec:"required"`
Bloom Bloom `json:"logsBloom" gencodec:"required"`
Difficulty *big.Int `json:"difficulty" gencodec:"required"`
Number *big.Int `json:"number" gencodec:"required"`
GasLimit uint64 `json:"gasLimit" gencodec:"required"`
GasUsed uint64 `json:"gasUsed" gencodec:"required"`
Time uint64 `json:"timestamp" gencodec:"required"`
Extra []byte `json:"extraData" gencodec:"required"`
MixDigest common.Hash `json:"mixHash"`
Nonce BlockNonce `json:"nonce"`
// BaseFee was added by EIP-1559 and is ignored in legacy headers.
BaseFee *big.Int `json:"baseFeePerGas" rlp:"optional"`
}
We can see the values stated within the codebase match our conceptual diagram. Our goal is to get from the block header down to the storage of an individual contract.
To do so we need to focus on the “State Root” field of the block header highlighted in red.
The “State Root” acts like a [merkle root](https://www.investopedia.com/terms/m/merkle-root-cryptocurrency.asp#:~:text=A Merkle root is a,whole%2C undamaged%2C and unaltered.) in that it is a hash that is dependent on all the pieces of data that lie underneath it.
• State Root - Keccak Hash of the root node of state trie (post-execution)
key: the Ethereum address value: the Ethereum account object
the key-value mapping model of address to the Ethereum account.