Assets, Ethereum

Is Ethereum a State Machine?

Ethereum is a state machine. That is, it keeps track of a global state, which consists of all accounts and their balances, as well as all contract code and storage. The state is stored in a data structure called a Merkle Patricia tree. Each block contains a header and a list of transactions.

The header contains a timestamp, the block number, the parent block hash, the root hash of the state tree, the transaction root hash, and the receipts root hash. The transaction root hash is the hash of the transactions in the order they appear in the block. The receipts root hash is the hash of the receipts for each transaction in the order they appear in the block.

The state tree is stored in memory by each node in the Ethereum network. When a node receives a new block, it will update its state tree to reflect the changes contained in that block.

In this way, all nodes maintain an identical copy of the global state at all times.

The Ethereum Virtual Machine (EVM) is responsible for executing transactions and maintaining the state tree. It is a Turing-complete virtual machine, meaning that it can run any program that can be written in any programming language.

The EVM has its own instruction set, which is used to execute transactions and contracts.

NOTE: WARNING: Ethereum is not a state machine. Ethereum is a blockchain-based distributed computing platform that enables smart contracts to be executed on its network. It is important to note that Ethereum is not a state machine, as there are other technologies that can be used to create virtual machines and state machines.

Contracts are pieces of code that live on the Ethereum blockchain and can interact with other contracts or with accounts (external or internal). Contracts are written in a language called Solidity and can be deployed on the Ethereum blockchain by anyone.

Once deployed, a contract cannot be changed or deleted by its creator.

Accounts are either external accounts controlled by private keys or internal accounts controlled by contracts. External accounts are used to send transactions manually via wallets or programs such as Geth or Parity. Internal accounts are used to represent contracts on the blockchain.

When a contract is created, an internal account is also created along with it. This account stores all code and data associated with that contract.

The main difference between an external account and an internal account is that an external account has a private key associated with it while an internal account does not. This means that external accounts can sign transactions manually using their private keys, while internal accounts can only sign transactions programmatically using their contract code.

When a transaction is signed by an external account, it is sent to the network where it will be included in a block by miners. After being included in a block, the transaction will be executed by nodes in the network according to its transaction data and contract code (if applicable).

After execution, changes to global state will be made and these changes will be reflected in all future blocks miners create. This process continues until all transactions in a given block have been executed and all resulting changes to global state have been made.

Previous ArticleNext Article