Skip to content

Commit 5b726c3

Browse files
authored
Update realgu.md
1 parent a86c850 commit 5b726c3

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

realgu.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,32 @@ func stf(parent types.Block, block types.Block, state state.StateDB) (state.Stat
5656
```
5757
问题: what exactly does a 'state' contains? what are the tries?
5858

59+
### 2024.02.12
60+
Ethereum state is stored in four different modified merkle patricia tries (MMPTs):
61+
- Transaction Trie
62+
- Receipt Trie
63+
- World State Trie
64+
- Account State Trie
65+
66+
计算机组成课flashback:
67+
68+
1 word = 32 bytes, 1 byte = 8 digits = 2 digits in hexadecimal
69+
70+
The EVM stack has a maximum size of 1024 items. PUSH -> PUSH -> ADD
71+
Also there's a program counter and JUMP. But where is compare and jump insn like bne, bge, blt?
72+
And there's an available gas counter.
73+
74+
75+
EVM memory is a byte array of 2<sup>256</sup> (or practically infinite) bytes . All locations in memory are well-defined initially as zero.
76+
MSTORE takes two values from the stack: an address offset and a 32-byte value. It then writes the value to memory at the specified offset.
77+
78+
In EVM, memory is dynamically allocated in multiples of 1 word “pages”. Gas is charged for the number of pages expanded.
79+
MSIZE: number of words/pages allocated
80+
81+
Storage can only be accessed via the code of its associated account. External accounts don't have code and therefore cannot access their own storage.
82+
83+
SSTORE takes two values from the stack: a storage slot and a 32-byte value. It then writes the value to storage of the account. So an account have associated storage
84+
5985

6086

6187
<!-- Content_END -->

0 commit comments

Comments
 (0)