2

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).

  1. Does Ethereum go through every block to find the current state of a variable? In this case, the time complexity would be O(n).

  2. Or does it use the storage trie (or related mechanism) to fetch the value?

  3. If yes this won't scale well. Any inputs on how to handle this?
  4. 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.

Thanks

1

1 Answer 1

2

Ethereum also maintains latest state and transitions it when new blocks are received. Quorum is a fork of Go-Ethereum implementation and does exactly the same + adds private state on top of public state. LevelDB is used to store that state.

Fabric and many of the others are benefiting from this design originally proposed in Ethereum papers.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.