Understanding Ethereum System
Idea of Ethereum was floored by the end of 2013. People started realizing that blockchain could be used for various other applications other than just money; like Asset issuance, crowdfunding, domain registration, title registration, gambling, prediction marketing, internet of things (IoT), voting and hundreds of similar applications.
Ethereum system provides the open-source blockchain platform with an in-built programming language which allows developers to write their code, test and run to check if it works properly. It has two types of account objects with unique address. The account for general people also called as 'User Account' is the one which is controlled by human with private keys. The other account is called as 'Contract', which basically is a set of instruction added to Ethereum to perform certain task. Both accounts use Ether (ETH) the official currency of Ethereum to execute any task on the blockchain.
Ethereum System State
Ethereum System State consists of key value mapping addresses to account objects. Each account object contains four pieces of data.
-
Nonces: It's basically highly technical thing, used to prevent transaction replay attacks.
-
Balance: How much balance the account has.
-
Code hash: Code is empty string for private key controlled account (User Account)
-
Storage trie root: It points to the storage of that contract.
Every contract has its own databases to read and write as needed. A contract cannot write to the other contract's storage databases. So, the contract's storage is their own property. Only the contract can read or write the storage to itself.
Ethereum State data (together with account balances, contract code and account nonce) is stored by every Ethereum client (or Ethereum node) on its hard drive. The Ethereum blockchain includes state roots (one per block) that store the root hash of the hash tree representing the system state at the time the block was generated.
Conceptually blockchain data can be separated as
• Chain data (the list of blocks forming the chain) - chain data is explicit and stored as the block chain itself.
• State data (the result of each transaction's state transition) - State data is implicit data. That is, its value is known only from calculation, not from the actual information communicated.
While all chain data will be needed to ensure the cryptographic chain-of-custody and that nothing has been tampered with, old state data can be discarded (pruning).
So currently, while both chain and state data are stored locally on the node's disk, only the chain data is strictly necessary. State data is can be ephemeral.
Code Execution
Every transaction specifies the “To” address it sends its message to (unless it's creating a contract) and its contents. If the “To” address is just the User Account (regular account) controlled by a private key, then it’s just moving ETH around. It means it is a simple financial transaction. But, if the “To” address is to Contract (code controlled account), then it will execute the set of instructions written in that contract.
Code can
-
Send ETH from that contract to the other contracts.
-
Read / Write contract storage.
-
Call (ie. start execution in) other contracts. Code can talk to other contracts.
It changes the state to the 'new state' after the completion of execution of code in the contract.
Every full node processes every transaction and stores the entire state just like Bitcoin.
From this standpoint, we can think Ethereum as of it as a full system. 'State' being a database, 'Contracts' as program that are sitting on one computer except the computer is highly distributed and on a highly-secured network backs by thousands of computers around the world.
Full node
Any computer that connects to Ethereum network is called a node. Nodes that download all the blocks and the transactions are called full nodes. Most nodes on the network are lightweight node instead of full nodes, but full nodes form the backbone of the network. All full node basically executes all the transactions, execute all the contracts. Some of them store history some of them do not.
Continued ...Ethereum Ecosystem (part-2)
If you like the article, please follow us at
twitter @ether_world
facebook EtherWorld