2

Is the contract data stored as a whole or it is spreaded out in the history of blockchain? I notice the input of a transaction issued to a contract contains only the Method ID follow by the method's parameters. After miner executes a transaction and accepted into the blockchain, how is the contract data being updated? Without using a contract method is it possible to retrieve the whole contract data by scanning the blockchain?

0

Ethereum stores the state as a mapping from addresses to data (contrary to Bitcoin, where balances are not stored explicitly, but have to be derived from unspent transaction outputs). When a miner executes a transaction, it performs all required computations (change ether balances, execute smart contract code) and arrives at a new blockchain state. As all computations are deterministic, all miners arrive at the same results, if they execute the same transactions in the same order.

Yes, you retrieve the whole state when starting your full node (see also this question).

0

This article written by me provides a complete and clear answer to your question. As the explanation is detailed it's better to not to copy and paste so much content here.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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