0

I know a little about Ethereum and how it works, but what am I wondering is that why we exactly need a transaction to be stored in Ethereum blockchain? What's confusing for me is that Ethereum client like Go using leveldb for keeping data like account storage in every node locally. Moreover if a user want to read/write the value of the variable/function of the contract, he send a transaction to change the state and it is broadcast to the network and a miner run this transaction in his VM and the VM get data from the account storage that store in the LevelDB and then change the value and whatsoever. Am I right till now?

If I am right, for reading and writing we keep looking for LevelDB not the transactions that stored in the Ethereum. In contrast in Bitcoin for knowing how much is the balance of somebody we check the last transaction to this account and see its UTXOs, but that is not happening in Ethereum. Because we just set the transaction to change the leveldb and nothing more happens (if I am not wrong). We keep changing the state and write transactions for that and the transaction store forever in blockchain.

So why do we exactly need chains of block for keep recording of transactions since all the data is in the separate database? Do we check transactions in the Ethereum? And if the response is yes, for what do we look for transactions and keeping them? so what happened exactly when a user read/write data from Ethereum? Is it refer to Transaction that stored in Ethereum or refer to a leveldb? and if it refer to a leveldb so what is the need for chain of block? That would be great if somebody help me from this confusion!

1

You are correct in that a node doesn't have to store all past transactions just the current state of all accounts. Now to your other questions:

So why do we exactly need chains of block for keep recording of transactions since all the data is in the separate database?

Transactions are essentially small proofs that the state was updated correctly. Containing call data and the users signature anyone can verify that the affected accounts were changed correctly according to one transaction. With no transactions anyone could simply claim that their balance went up by 1000 ETH without anybody being able to verify why and how. Transactions are like global receipts.

Do we check transactions in the Ethereum? And if the response is yes, for what do we look for transactions and keeping them?

Yes all nodes check transactions: they check the signature and what state changes the executed code led to. If a transaction is invalid or a block contains an invalid transaction it is rejected and not retransmitted by nodes to neighbor nodes.

so what happened exactly when a user read/write data from Ethereum? Is it refer to Transaction that stored in Ethereum or refer to a leveldb? and if it refer to a leveldb so what is the need for chain of block?

When a user changes data on ethereum all nodes processing his transaction simply store the changes in their leveldb if the transaction was valid. The blockchain is there to insure that nobody changes the order of transactions and that the network can agree upon the exact order of transactions and account states up to a certain blockheight. This is called consensus.

Hope this answered your questions.

5
  • thank you very much for your detailed response @MrClottom. But according to your answer actual data are stored in leveldb and Ethereum blockchain is merely a validation chain for these data to change without a need of a third person? Am I right?
    – MARiiii
    Nov 8 '20 at 8:11
  • Yes I mean technically you wouldn't need the leveldb, you could just run through the whole blockchain to recreate the current state. It's just querying the current state is faster when it is properly stored then having to run through the entire blockchain every time
    – MrClottom
    Nov 8 '20 at 9:47
  • So, the leveldb is just about the implementation and simplicity and in the technical Ethereum we do not need this, just like the Bitcoin that everything is inside the transaction and you can get data by referring to the transaction.@MrClottom Again am I right?
    – MARiiii
    Nov 8 '20 at 13:46
  • Yes, that's right
    – MrClottom
    Nov 8 '20 at 13:56
  • 1
    Thanks so much for your response. It helps me lot. @MrClottom
    – MARiiii
    Nov 8 '20 at 15:41

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