[Ethereum] What does it mean by smart contract state.Where they get stored

contract-developmentstate-transition

I am new to ethereum. We understand that whenever some new transaction made Contract state changes. What does it mean exactly by state change. Where they get stored.Are they called distributed ledger. Except transaction are there any events which cause state changes.

Best Answer

What does it mean exactly by state change.

State change in a smart contract refers to a Transaction, which means two parties involved in the transaction will have some changes. For instance, if you send some money from one account to another - there will be changes on both sides. Similarly, it applies to data related transactions as well.

If you want to update the value of a variable defined in the smart contract then since you are going to use blockchain storage, so updating the variable is a state change here because you are making a transaction to make it happen. While this update/addition transaction, you will end up spending some gas.

Where they get stored.

The state changes get stored on the blockchain itself in terms of the transaction on distributed ledger.

Are they called distributed ledger.

Distributed ledger are not state or state changes, but on distributed ledger, you will have blocks of all transactions(state-changes) which happen on blockchain

Except transaction are there any events which cause state changes.

No, only transactions are the only way to state change on the blockchain.

Related Topic