What is Ethereum and how it works?

Dec, 2020 - by CMI

What is Ethereum and how it works?

Ethereum is a decentralized open-source blockchain featuring smart contract functionality. Ether is the native cryptocurrency token of the Ethereum platform. It is the second-largest cryptocurrency by market capitalization, behind Bitcoin.

Ethereum & History

Bitcoin is the basis from which Ethereum was developed. Bitcoin is a form of decentralized money. Before bitcoin was developed, the only way to use money digitally was through an intermediary like a Paypal or bank. Even then, the money used was still a government-controlled and issued currency. However, without the need for an intermediary, Bitcoin changed all that by creating a decentralized form of currency that individuals could trade directly. Each Bitcoin transaction is confirmed and validated by the entire Bitcoin network. There’s no single point of failure so the system is virtually impossible to manipulate, shut down, or control.

This assures that money can be decentralized and could be implemented by society for instances such as voting, real estate, and social networks, these are based on centralized servers that control all of the data uploaded by users. If the technology behind Bitcoin i.e. Blockchain is used to decentralized this data there will be lesser security concerns. Blockchain technology was created by fusing existing technologies such as proof of work, cryptography, and decentralized network architecture together in order to develop a system that can reach decisions without a central authority. However, for a system to be truly decentralized, it needs a large network of computers to run it.

Ethereum was first proposed in late 2013 and brought to life in 2014 by Vitalik Buterin, who is the programmer, writer, and co-founder of Bitcoin Magazine. The Ethereum platform has thousands of independent computers running it. Once a program is deployed to the Ethereum network computers, also known as nodes, which ensures that the program is executed as written. Ethereum is the infrastructure for running Decentralized apps (Dapps) worldwide. It’s not a currency, it’s a platform. The currency used to incentivize the network is called Ether. Ethereum connects people directly through a powerful decentralized supercomputer.

How Ethereum works?

Ethereum’s coding language, Solidity, is used to write ‘Smart Contracts’ which is the logic that runs Dapps. Dapps on Ethereum are web applications backed by Ethereum smart contracts. Instead of using a centralized server or database, these applications rely on the blockchain as a backend for program logic and storage. They are called smart contracts as they deal with all the aspects of contract management, payment, enforcement, and performance. A smart contract is self-executing, letter strict, and immutable. There are two types of accounts in Ethereum, Externally Owned Account (EOA) is the most basic type of account, and private keys control the EOA’s that have an Ethereum address. Whereas, EOAs have some ability that includes to create contracts and trigger them as well as send and receive Ether. The second type of account is a Contract account that has code associated with them.  Own account which includes a unique Ethereum address is included to every contract deployed to the Ethereum network. A contract account does not have a private key that controls it unlike what is there in an external account. Instead, code that defines the contracts includes a set of predefined triggers that control the account which means the conditions to control how the contract operates are hardcoded from the get-go. Contract accounts like EOAs can send Ether if triggered or can create additional contract accounts or can receive Ether too. Contracts can’t be changed once they’ve been launched. Through messages, EOAs can interact with contracts and with other EOAs. These messages are wrapped inside transactions that are paid for in Ether.

Ethereum wallets

Ethereum wallets are applications that allow users to interact with the Ethereum network or Ethereum account. The device or software which stores both these keys and allows you to send and receive Ether is called an Ethereum wallet. The Ethereum wallet, also known as a client, holds the user’s private key, which is the secret password that gives users control over their coins. It also provides a public Ethereum address which is used to send Ethereum’s currency known as Ether. Some Ethereum wallets allow to transfer value or send Ether between accounts while other wallets allow to deploy or trigger a contract, and hence these wallets are known as ‘Smart contract wallets’. Similar to Bitcoin, wallets are sometimes mentioned as clients or nodes. There are two types of clients, light clients, and full clients. The entire Ethereum blockchain history since its establishment till date is held by a full node which is a computer. Running a full node has disadvantages like computer usage and increased memory, however, it allows users to verify transactions on the Ethereum blockchain without relying on a third party. Full nodes are a vital part of the Ethereum network that helps to execute contracts in a decentralized manner. Each node that receives a new block of transactions also executes the code inside these transactions.

Different programs that help to run an Ethereum full node are:

Mist – Mist was created in order to allow non-technical user interaction. Mist provides an easy user interface.

Geth – Which is additionally referred to as Go Ethereum is developed by Ethereum Foundation, a non-profit organization established to develop the code and community for Ethereum. This is the most popular and widely used program.

Parity – This is a private London-based company whose mission is to help businesses and organizations to capitalize on blockchain technology.

There are about 9713 nodes running Geth and $069 nodes running Parity. All full nodes are smart contract wallets that can deploy smart contracts to the Ethereum network.

Light nodes are programs that rely on third-party full nodes in order to get information when needed rather than holding a full copies of the blockchain which means they require less memory and can be operated on devices with limited space.

Transaction fees and Gas

Ether can be divided into one quintillion units, with the smallest unit called Wei. Ethereum wallets or apps available in the market are My Ether Wallet, Edge, Ledger Nano S, Trezoe One, Guarda Wallet, Mist, Exodus, etc.

Fees for transactions are usually calculated in Giga Wei. So, one quintillion Wei equals one Ether and one billion Wei equals one Giga Wei. There are also other names for different amounts of Wei. In Ethereum, the Ethereum network works on Gas. Each line of code that needs to be executed by the network will take up a certain amount of gas. Code stops running if user runs out of gas. Hence, users need to specify how much gas is to be used up front. If users' contract runs out of gas because of any inefficiency, the program will stop working in the mid. This system motivates smart contract programmers to keep the code optimized and clean. The Gas user pays to go to the miners who are investing in computing power in order to update the ledger of Ethereum transactions. Gas is not owned, it is used to measure how much work is needed to run a line of code. Gas is paid in Ether. For example, sending ether from one address to the other requires 21,000 gas units. The price of one gas unit changes all the time depending on the crowd of the network. The standard gas price is around 20Giga Wei.

Messages and Transactions

Transaction in Ethereum is used to refer to the signed data package that stores a message to be sent from an externally owned account. Transactions contain the recipient of the message, the amount of ether to transfer from the sender to the recipient, a signature identifying the sender, A STARTGAS value, representing the maximum number of computational steps the transaction execution is allowed to take, A GASPRICE value, representing the fee the sender pays per computational step and an optional data field.

Standard fields expected in any cryptocurrency are the recipient of the message, a signature identifying the sender and the amount of ether to transfer from the sender to the recipient. The GASPRICE and STARTGAS fields are important for Ethereum's anti-denial of service model. ‘Gas’ is the fundamental unit of computation. Usually, a computational step costs 1 gas, but some operations cost higher amounts of gas because they are more computationally expensive. In the transaction data, there is also a fee of 5 gas for every byte.

Messages

Contracts have the ability to send ‘messages’ to other contracts. Messages are virtual objects that are never serialized and exist only in the Ethereum execution environment. A message contains the recipient of the message, the sender of the message (implicit), and the amount of ether to transfer alongside the message, a STARTGAS value, and an optional data field.

Essentially, a message is like a transaction, except it is produced by a contract and not an external actor. A message is produced when a contract currently executing code executes the CALL opcode, which produces and executes a message. Like a transaction, a message leads to the recipient account running its code. Thus, contracts can have relationships with other contracts in exactly the same way that external actors can.

Furthermore, Ethereum technology can be applied in saving wallets, cloud computing, prediction markets, peer-to-peer gambling smart multisignature escrow, decentralized data feeding, insurance policies, etc.