Updated: Jan 2
What is the blockchain and how is it mined
This is the 2nd part in our getting started series and before diving into DeFi we need to look at what a blockchain is and how mining works. See the end of this article for others in this series that we will be publishing over time.
Blockchains used by the likes of Bitcoin and Ethereum are well known for having mining being done on them but for many, understanding what that mining involves, is not well known. So below we simplify it and include a few links to some sites with further info.
Bitcoin and Ethereum are often intermixed when it comes to talk of crypto and blockchains and its easy to see why since they're both the most well-known and biggest (in terms of value) crpytocurrencies. However, Bitcoin has been created as a digital currency as opposed to Ethereum which is more of a ledger technology upon which further programs can be built and it is with Ethereum (and other ledger competitors) that decentralised applications/smart contracts can be built.
The Distributed Ledger
Whether Bitcoin or Ethereum, there is a publicly available distributed ledger recording all transactions ever made and since it is public, it is easy to prove whether a transaction is legitimate or not. Double spending (duplicate recording of the same transaction) can be avoided here.
These distributed ledgers work on a concept known as Merkle trees which are used to create hashes that summarise what has happened in the history of the blockchain. A hash is a cryptographically encrypted piece of output that changes inputs such as those seen below. We can see that even just a slight change in input can lead to very different output.
In terms of mining, this is the process that creates blocks of transactions that are added to the existing chain (e.g. in Ethereum). This is done by the miners computer performing a set of mathematical calculations (and do so via trial and error) in order to create a block of data that is added to the existing blockchain.
Consensus and Proof of Work
Currently, the way to prove that a block is able to be added to the ledger is via a consensus mechanism known as proof-of-work (PoW). This is a decentralised consensus mechanism that helps to validate new blocks of transactions added to the wider ledger (e.g. Ethereum's ledger) and is a way of proving the current state of the blockchain without a centralised authority.
If a slight change happens in a transaction, the resultant blocks and their hashes would be very different (as we showed above) and this would be easily spotted by the network and proven to be fraudulent or false.
The problem with Proof of Work
The problem with PoW is that it is computationally intense and as the blockchains have gotten bigger, the amoutn of effort to prove transactions has increased so much so that it's been calculated that Bitcoin consumes more electricity than countries like Switzerland, Norway and Bangladesh. If it were to continue this way on protocols like Ethereum where other apps are built, it would become unsustainable.
Graduating to Proof of Stake (and variants)
Ethereum 2.0 is a move to a Proof-of-Stake (PoS) model which is more energy efficient, lowers hardware requirements, leads to more nodes in a network (and thus a stronger network) and all of this leads to less environmental impact.
Prior to that happening, there has been a recently proposed EIP (Ethereum Improvement Proposal) which would reduce the amount of costs to perform a transaction (known as gas costs) and this is expected to come in prior to Ethereum 2.0 is rolled out. The EIP, proposed by Ethereum founder, Vitaliy Buterun, is known as EIP4488 and can be seen here.
For more on this topic, check out the following links
The Full Series
Part 2 - What is the blockchain and how does mining work? - This article
Part 7 - Risks and Impermanent Loss
Part 8 - Tools and data to analyse tokens/cryptos
Part 9 - How to avoid scams?
Part 10 - Protocol types
Part 11 - What's on the horizon - the metaverse, DeFi 2.0
Part 12 - What is a DAO?