Skip to main content
added 73 characters in body
Source Link
Ehsan
  • 80
  • 5

If we had a simple table with key-value pairs, reading data was easy and quick with a complexity of 1. However, because we need to create a hash of the entire database, updating the data becomes more complicated as its complexity depends on the number of elements in the database. In the current data structure of Ethereum, the complexity of both read and write is determined by the height (per my recent observations for several random accounts, it is around 8) of the tree. The reason for hashing all the data is to show the state of the blockchain in every block header by stateRoot.

Additionally, there are other important parts of Ethereum based on this data structure, like the Snap protocol. Now, this protocol is crucial for nodes to synchronize their data. In this protocol, nodes request and share a portion of the tree. Nodes send both proof and data to each other. The proof is like a path from root of tree, and the receiver can verify the data simply by knowing the stateRoot due to the data structure's hashing property. Without this technique, syncing part of data would be almost impossible.

If we had a simple table with key-value pairs, reading data was easy and quick with a complexity of 1. However, because we need to create a hash of the entire database, updating the data becomes more complicated as its complexity depends on the number of elements in the database. In the current data structure of Ethereum, the complexity of both read and write is determined by the height of the tree. The reason for hashing all the data is to show the state of the blockchain in every block header by stateRoot.

Additionally, there are other important parts of Ethereum based on this data structure, like the Snap protocol. Now, this protocol is crucial for nodes to synchronize their data. In this protocol, nodes request and share a portion of the tree. Nodes send both proof and data to each other. The proof is like a path from root of tree, and the receiver can verify the data simply by knowing the stateRoot due to the data structure's hashing property. Without this technique, syncing part of data would be almost impossible.

If we had a simple table with key-value pairs, reading data was easy and quick with a complexity of 1. However, because we need to create a hash of the entire database, updating the data becomes more complicated as its complexity depends on the number of elements in the database. In the current data structure of Ethereum, the complexity of both read and write is determined by the height (per my recent observations for several random accounts, it is around 8) of the tree. The reason for hashing all the data is to show the state of the blockchain in every block header by stateRoot.

Additionally, there are other important parts of Ethereum based on this data structure, like the Snap protocol. Now, this protocol is crucial for nodes to synchronize their data. In this protocol, nodes request and share a portion of the tree. Nodes send both proof and data to each other. The proof is like a path from root of tree, and the receiver can verify the data simply by knowing the stateRoot due to the data structure's hashing property. Without this technique, syncing part of data would be almost impossible.

Source Link
Ehsan
  • 80
  • 5

If we had a simple table with key-value pairs, reading data was easy and quick with a complexity of 1. However, because we need to create a hash of the entire database, updating the data becomes more complicated as its complexity depends on the number of elements in the database. In the current data structure of Ethereum, the complexity of both read and write is determined by the height of the tree. The reason for hashing all the data is to show the state of the blockchain in every block header by stateRoot.

Additionally, there are other important parts of Ethereum based on this data structure, like the Snap protocol. Now, this protocol is crucial for nodes to synchronize their data. In this protocol, nodes request and share a portion of the tree. Nodes send both proof and data to each other. The proof is like a path from root of tree, and the receiver can verify the data simply by knowing the stateRoot due to the data structure's hashing property. Without this technique, syncing part of data would be almost impossible.