Thinking about smart contract storage, how is the data arranged?
I know that every variable within a contract has an unique ID, therefore, it's possible to create a node with a structure like <varID, value>
and organize something like:
DATA_ROOT
|
/----------------------------------------\
/ \
H(H1 + H2) H(H3 + H4)
| |
/-----------------\ /-----------------\
/ \ / \
H(<varID1, value1>) H(<varID2, value2>) H(<varID3, value3>) H(<varID4, value4>)
Is the above correct?
This leads to this one more question:
Is this tree/trie full structure in the state tree under the node that identifies the contract account that owns this data?
ACCOUNT 0X9127...
|
/----------------|---------------\
/ | \
4817221 -------- BALANCE DATA_ROOT CODE ---------- 0xFA21E
|
/----------------------------------------\
/ \
H(H1 + H2) H(H3 + H4)
| |
/-----------------\ /-----------------\
/ \ / \
H(<varID1, value1>) H(<varID2, value2>) H(<varID3, value3>) H(<varID4, value4>)
Edit:
Summarizing my question: Is contract storage a sub-tree of the following trie?