Skip to content

Ethereum Blockchain

Ethereum Blockchain

Ethereum blockchain is very similar to Bitcoin’s but differs from it in its more extensive use of Merkle trees. This innovation allows for the existence of “lightweight clients” that only download and verify block headers and can still securely determine and verify any specific part of the blockchain state. While in Bitcoin a block header contains only the Merkle root hash of a Merkle tree, in Ethereum each block header contains a “state root,” which is essentially a root hash of a cryptographic hash tree containing the entire current state, including account balances, sequence numbers, code, and storage.

The Ethereum Blockchain

A light client will then normally download only the block headers, and if it wants to learn some specific value in the state (e.g. “what is the account balance 0x124b6f72?” or “what is the account storage 0x38c9f1e5 at key 178233?”) it can ask any “full node” in the network to provide it with a “branch”, i.e., a set of hashes from the data block that specifies that particular information; thus it can check the integrity of the branch itself. “) can ask any “full node” in the network to provide it with a “branch”, i.e., a set of hashes from the block of data that specifies that particular piece of information; thus, the light client can verify the integrity of the branch on its own. If the branch is correct, it accepts the response. The “light client” model is especially useful for smartphone and IoT/embedded users of Ethereum, as well as users with low-quality computers or slow or poor internet connections.

In order for a node to be part of the network, it must connect to other nodes in the network so that it can transmit transactions/blocks.

A node does not need to connect to every node in the network; instead, it connects to a few other nodes. But how does a node find other nodes in the network, since there is no central server that everyone can connect to? Ethereum has its own node discovery protocol, called Kadelima. In it you have a special type of nodes called Bootstrap nodes. Bootstrap nodes maintain a list of all nodes that are connected to them for a certain period of time.

When peers connect to the Ethereum network, they first connect to Bootstrap nodes, which share the lists of peers that have connected to them in the last period and allow them to connect to other nodes.

Ethereum Virtual Machine

The Ethereum Virtual Machine (EVM) is a worldwide computer that anyone can use, for a small fee, payable in ether.

The EVM is a single global 256-bit “computer” where all transactions are local to each node on the network and executed in relative synchronicity. This giant computer, which can be accessed by anyone with a node or application, makes it easy to move large amounts of money almost instantaneously. Although anyone can use this global virtual machine, no one can create fake money inside it or move funds without permission.

The EVM can execute programs written in the Solidity programming language. These programs, given a particular input, will always produce that given output, with the same underlying state changes. This makes Solidity programs completely deterministic and guaranteed, as long as you have paid enough gas for the transaction. Solidity programs are capable of expressing all tasks achievable by computers, making them theoretically Turing complete. When a user uploads a smart contract through their Ethereum node, it is included in the last block and propagated across the network, where it is stored on every other node in the network.

The EVM is fully sandboxed, free from interference, and isolated from other networks as well; this makes it impossible for a party to terminate a smart contract. In practical terms, this is because smart contracts have the power to hold assets (ether or other tokens) in escrow and only move them when the terms of the contract are met.

The EVM continuously runs a loop that attempts to execute whatever instruction is in the program counter. The program counter works like a queue in a store: each program takes a number and waits its turn. This loop has to perform some tasks: it calculates the gas cost for each instruction and uses memory, if necessary, to execute the transaction. This loop repeats until the VM finishes executing all the code, or an error is found and that transaction is rolled back.

State-machines can be thought of as mechanisms that never sleep. As a state-machine, the EVM has a constant history of all transactions within its memory banks.

Unlike people, who have an imperfect memory, the state-machine is the specific result of every single state change that has taken place within that machine since it was first turned on. The latest version of the state of the machine can be said to be the “truth” of that machine. In Ethereum, this truth is about account balances and the series of transactions that led to them.

In Ethereum, the block time is not a function of the ether issuance schedule as it is in Bitcoin. Instead, the blocking time is a variable that is kept as low as possible for quick confirmation of the transaction.

Each node performs transactions and stores the final state for various reasons. For example, if there is a smart contract that stores the names and details of all participants in a project, each time a new person is added, a new transaction is transmitted to the network. In order for any node to view the details of all project participants, it only needs to read the final state of the contract. Each transaction requires some computation and storage in the network. Therefore, there must be a transaction cost, otherwise the entire network would be flooded with spam transactions and miners would have no reason to include transactions but would start mining empty blocks. Each transaction requires a different amount of computation and storage; therefore, each transaction has different costs.

Gas

Gas is a unit of work used to measure the computational cost of an operation on Ethereum. Gas costs are paid with small amounts of ether.

The purpose of gas is twofold. First, it ensures a predefined reward for miners who execute the code and secure the network. Second, it circumvents the outage problem and ensures that execution cannot last longer than the time it was paid for in advance. Gas is a unit of work that cannot be held or hoarded. It simply measures how much effort each step in a transaction will take, in computational terms. In order to pay for gas costs, you simply add ether to your account and do not need to purchase it separately. Every possible transaction on the EVM has an associated gas cost.

Gas costs ensure that computing time on the network is priced appropriately. This works differently in Bitcoin, where the fee is based on the transaction size in kilobytes. Because Solidity’s code can be arbitrarily complex, a short snippet of instructions might generate a lot of computational work, while a long snippet might generate less. This is why the rates in EVM are based on the amount of work done, not the size of the transaction.

Gas is not priced in the ether because the latter, being publicly traded on cryptocurrency exchanges, is subject to speculative moments. Using the unit of account of gas for computation work is useful because it separates the computation price from the highly volatile price of ether.

If you send a set of hard-to-compute instructions to the EVM, the job will spend the ether allocated to the transaction and stop when the transaction is exhausted. It will have no effect on other people’s transactions. Scalability is effectively managed through the gas rate system. Miners are free to choose the transactions that pay the highest rates and can also choose the gas blocking limit collectively. The gas limit determines the amount of computation that can occur per block.

Transaction fees affect the amount of ether an account can transfer to another account. For example, if an account has a balance of five ethers, it cannot transfer all five to another account because doing so would not leave a balance from which to deduct transaction fees.

Account

There are two types of accounts in Ethereum: Externally owned accounts (EOA) and Contract accounts. An externally owned account (EOA) is controlled by a pair of private keys, which can be held by a person or an external server. In fact, EOAs are controlled by users, often through software external to the Ethereum platform. These accounts cannot contain EVM code. An EOA is characterized by the following properties: – it contains an ether balance – it is capable of sending transactions – it is controlled by the account’s private keys – it has no code associated with it – it contains a key/value database contained in each account, where the keys and values are both 32-byte strings.

Contract accounts are not controlled by humans, but by smart contracts that are executed by EVM. They have the following characteristics: – they have a balance in ether – they keep some contract code in memory – they can be activated by humans (sending a transaction) or by other contracts sending a message – when activated, they can perform complex operations – they have their own persistent state and can call other contracts – they do not have an owner after being released on the EVM – they contain a key/value database contained in each account, where keys and values are both 32 byte strings.

In short, EOAs are simple accounts without any associated code or data storage, while Contract accounts have both associated code and data storage.

EOAs are controlled by transactions created and cryptographically signed with a private key in the external, protocol-independent “real world,” while Contract accounts have no private keys and therefore “control” themselves in the predetermined manner prescribed by their smart contract. Both types of accounts are identified by an Ethereum address.

Solidity

Solidity is a new programming language used to write smart contracts, which can be executed by the EVM. It is a combination of network conventions, assembly language, and web development. Solidity is contract-oriented, with similarities to JavaScript and C. It allows for contract development and EVM bytecode compilation and is currently Ethereum’s flagship language. There are four languages in the Ethereum protocol at the same level, but the community preferred Solidity, which knocked out Serpent (similar to Python), Lisp-Like Language (LLL), and Mutan.

Mining Ethereum

Mining is the process by which the Ethereum network reaches consensus on the order of transactions in a given period of time. Bitcoin also uses mining to reach consensus, but the way things work on Ethereum is a little different, thanks to its ability to execute smart contracts.

Ether is created out of thin air during the mining process as payment for mining work done by computers. Because mining is computationally demanding, it can generate large electricity costs. Ethereum is moving from a proof of work to a proof of stake. The proof of work algorithm for the Ethereum protocol was Ethash, a feature created by developers to address the mining centralization problem present in Bitcoin. While Ethereum’s proof-of-stake date was originally set for January 2020, this deadline has not been met and it is unclear when Ethereum’s PoS will launch. PoW’s formula for blocking difficulty used a threshold of 10 seconds unlike Bitcoin where on average 10 minutes was taken.

PoS, on the other hand, is another way of validating transactions that works differently from PoW. Unlike miners, transaction validators lock or put their amount of cryptocurrency into play as collateral for the right to verify transactions.

Depending on the network, certain factors, such as the number of coins and the bet duration, determine whether or not a validator can verify a new block of transactions (as opposed to hashing in PoW). As in PoW, if you validate a new block, you are rewarded with new ethers.

One of the main limitations of the PoW model is the amount of energy required to power all the hardware that is used around the world to mine the most popular cryptocurrencies like Bitcoin and Ethereum.

Since Proof of Stake doesn’t require miners to use a lot of energy to validate transactions, many think such a system would be better for the environment as cryptographic networks are likely to get bigger and bigger and consume more and more energy.

Casper is the name of the implementation of Ethereum that will turn it into a PoS blockchain (Ethereum 2.0). Ethereum’s transition from 1.0 to 2.0 (also known as the “Serenity” update) will happen in 3 separate phases. Currently, there are 2 Casper implementations that have already been introduced to the Ethereum community: Casper Correct-by-Construction (CBC) and Casper Friendly Finality Gadget (FFG). Vitalik Buterin is conducting research on Casper FFG, which is the implementation that will power the first phase of Ethereum 2.0.

As Ethereum is transitioning to PoS and getting rid of mining, miners, who have accumulated mining equipment over the years, will likely not stop mining but will take their mining power to a different blockchain, causing other networks to increase their hash rate. Or, if they want to remain part of the Ethereum ecosystem, they will sell their mining ASICs to accumulate ether and participate in Proof of Stake.

Either way, miners will have time to decide on the best course of action, as the transition to Proof of Stake won’t happen overnight. In fact, the current version of Casper proposes to use PoS on every 100th block that is validated, meaning that the Ethereum 2.0 update will likely be a hybrid PoW/PoS block until all PoS nodes have been ready.

nv-author-image

Era Innovator

Era Innovator is a growing Technical Information Provider and a Web and App development company in India that offers clients ceaseless experience. Here you can find all the latest Tech related content which will help you in your daily needs.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.