Blockchain – Differences Between Blockchain State and Ethereum Singleton

blockchainminingstate

I am reading the Mastering Ethereum book and came across this piece:

Once mined into a block, transactions also modify the state of the Ethereum singleton, either by modifying the balance of an account (in the case of a simple payment) or by invoking contracts that change their internal state.

Reading further I come across:

As mentioned previously, it is important to remember that a contract’s code
cannot be changed. However, a contract can be “deleted,” removing the
code and its internal state (storage) from its address, leaving a blank
account.

Which again makes me think we have two sources of states with Ethereum. One on the blockchain and another one often referred to as internal state.

Can someone help me in understanding this better?

Are there actually two states to think about? If so what is the differences? If not, then how does the blockchain state differs from the Ethereum singleton internal state.

Best Answer

The "internal state" here refers to the state of the storage for a given Ethereum account. It is included in the state of Ethereum. Remember that Ethereum's state contains all accounts, including their storage and balances.

To modify an account's "internal state" (or storage), a transaction must be executed in the Ethereum current state involving a transition to a new Ethereum current state.

There is only one state at a time in Ethereum. From the yellow paper:

Ethereum, taken as a whole, can be viewed as a transaction-based state machine: we begin with a genesis state and incrementally execute transactions to morph it into some current state. It is this current state which we accept as the canonical “version” of the world of Ethereum.

Also, remember that a contract is nothing more than an account with a non-empty string in its "codeHash" field. See AN ACCOUNT EXAMINED for more information on account fields.

Related Topic