Welcome to the second installment of the Ethereum blog series. Last time, we had a look at what Ethereum is, how it functions, and some of its components. This time we’re diving deeper, focusing on some of the other components and concepts as well as the different types of blockchain.
The Building Blocks of Ethereum
As with the internet, Ethereum isn’t just one thing, but rather a sum of many different parts. While components such as smart contracts, mist wallet, Ethereum Virtual Machine, and Web3js have already been discussed, the following section attempts to highlight the other specific components and illuminate the functionality each provides to the larger Ethereum network.
Performed by a miner, this computationally intensive work requires a lot of processing and time. The miner is subsequently rewarded for providing solutions to challenging math problems. This is done by putting the computer’s hardware to use with mining applications. Information using cryptocurrency-based transactions are applied in data blocks. These blocks are linked to several blocks, creating the entire blockchain.
A miner invests considerable time, computer space, and energy to sort through the blocks. On finding the right hash, the block is generated and submitted to the blockchain. After the newly created block is verified, the miner is rewarded a certain amount of Ether depending on the number of transactions processed in that block.
Blocks & Transaction
Other than fetching data present in a smart contract storage or creating accounts, all operations are performed by initiating transactions on the Ethereum blockchain. So, any transfer for Ether from one account to the other is performed via a transaction. In fact, any change of data state on a smart contract is performed through a transaction. Once submitted, transactions get a hash assigned which is used to fetch necessary details. All unconfirmed transactions are picked from the pool, grouped, analyzed, and operated on to find the hash to generate the block. This block is then added to the blockchain. The block number is set to null while the block generation is in progress.
Transactions on the Ethereum blockchain run on gas. Every transaction is required to include a gas limit and a fee. Gas is purchased for ether from the miners executing the code. Miners have the choice of including the transaction and collecting the fee
The total amount of gas required by the transaction to get processed should be less than or equal to the gas limit set for the transaction. If the provided gas limit is less than the required gas, all changes are reverted but the fee can still be collected by the miner. All excess gas not used by the transaction is reimbursed to the sender as Ether, ensuring no overspending.
The total ether cost of a transaction depends on the amount of gas consumed by the transaction and the price of one unit of gas specified in the transaction. For instance, adding two numbers costs 3 gas or calculating a hash costs 30 gas. So, total cost = gas used x gas price.
Frontier (first release of the Ethereum platform) launched with a default gas price of 0.05e12 WEI (i.e. smallest denomination of ether). In Homestead (second release), default gas price was reduced to 0.02e12 WEI. Miners have a default strategy for determining the gas price to charge. If the amount one is willing to pay is less, then the transaction will be rejected. Gas price oracle is a helper function in Geth client which tries to find an appropriate default gas price.
Decentralized Application (DAPP)
A DAPP has a backend code running on a decentralized peer-to-peer blockchain-based network, such as the Ethereum blockchain. It can have frontend code and user interfaces written in any language that can make calls to its backend. The frontend can be hosted in a decentralized storage like SWARM or IPFS.
A distributed storage platform and content distribution service – swarm ensures sufficiently decentralized and redundant storage of Ethereum’s public record. It stores and distributes DAPP code and blockchain data. The only way it is different from WWW is that uploads are not to a specific server. It provides peer-to-peer storage with zero downtime and is DDOS resistant and fault tolerant.
A communications protocol and tool set that allows DAPPs to communicate with each other and send signals in order to collaborate on a transaction.
Ethereum Naming Service (ENS)
This decentralized naming service on Ethereum is built using smart contracts. It translates human readable addresses into machine readable identities.
The diagram below depicts the functioning of the components:
Permissionless & Private Ethereum Blockchain
Both Bitcoin and Ethereum are permissionless Blockchains, implying that anybody can create an address and begin interacting with the network. On the other hand, a permissioned blockchain restricts the verification and issuance of transactions to a selected group of authorized people. In a permissioned blockchain, the records cannot be seen nor tampered with by unauthorized parties.
Despite issues with privacy and scalability, industry use cases show that disruption, disintermediation, and social infrastructure by nature requires an open, public Blockchain such as Ethereum.
On the other hand, there are private Blockchains where only known nodes are allowed to participate in the network. Private blockchain is constrained with read/write access alongside a consensus algorithm which allows only a preselected group of people to contribute and maintain the integrity of the private blockchain. In public chains on the other hand, there is no preference in read/write access or in the consensus algorithm for any given set of participants. In a private Ethereum blockchain, one could set the block gas limit to a very high number to allow for a larger transaction throughput than the one found on the public Ethereum chain. A private blockchain may also have a token, but in most cases this token holds no value. Ether earned during mining does not have value in private blockchain.
A consensus protocol maintains the order of transactions on a blockchain network despite threats. It is a measure to deter denial of service attacks and other service abuses such as spam on a blockchain network. Let us discuss the two consensus algorithms:
- Proof of Work (PoW)
The Proof of Work algorithm used in Ethereum is called Ethash. With PoW one knows if the chain is valid because the work is shown. PoW does not require all parties on the network (all nodes) to submit their individual conclusions in order for a consensus to be reached. It is a system which uses a ‘hash function’ to create conditions under which a single participant is permitted to announce their conclusions, and those conclusions can then be independently verified by all other system participants.
- Proof of Stake (PoS)
Miners have to put up a stake or lock up an amount of their coins, to verify a block of transactions. Having stake means having invested their own money in that company/network. The cryptographic calculations in PoS are much simpler for computers to solve. The miners only need to prove that they own a certain percentage of all the coins available in a given currency. If an individual owns 5% of all Ether, he’d be able to mine 5% of all transactions across Ethereum.
Ethereum is one of the most exciting technologies in the Blockchain space. The technology is currently immature, but as more people use it, test it, develop it, and build on it, it has the potential to improve and become more robust.