I am new to Ethereum and wish to know that how is data for a smart contract fetched in Ethereum Blockchain.
When we store the value of a variable in a smart contract, say simple storage (https://solidity.readthedocs.io/en/v0.4.25/introduction-to-smart-contracts.html).
Does Ethereum go through every block to find the current state of a variable? In this case, the time complexity would be O(n).
Or does it use the storage trie (or related mechanism) to fetch the value?
- If yes this won't scale well. Any inputs on how to handle this?
- It is the same for Quorum as well?
I am familiar with Hyperledger Fabric and know that the State DB/World state is maintained for such purposes.
Can anyone provide me some answers & detailed insights with reference to any yellowpaper, so that I can dig deep.