Building the blocks of blockchain: Part two

Building the blocks of blockchain: Part two

Thus far, we have looked at the blockchain and its elements in isolation, and thus, we have yet to explain the most well-known feature of blockchain technology, decentralisation.

Consensus in a Distributed Network

To achieve decentralisation, the model of the blockchain that we have been discussing so far is distributed across a peer-to-peer (P2P) network, to form a distributed blockchain. A P2P network occurs when computers on the network function as suppliers and receivers of information receiving and sending data to and from other computers on the network. These computers on the network are known as nodes and each contains a copy of the entire existing blockchain, in Bitcoin’s case forming the Bitcoin network.

However, this poses a problem, how can we ensure that attackers can’t simply add blocks with fraudulent data to the blockchain? How do nodes on the network agree to which copy of the blockchain is correct? 

Nakamoto went to solve this issue by introducing a consensus mechanism known as the Proof-of-Work (PoW) which essentially is a rule that needs to be satisfied in order to add blocks to distributed blockchain. The proof-of-work is necessary as it provides security and trust in the network without the need for a trusted third party. 

The act of satisfying the proof-of-work is computationally taxing and requires mass amounts of energy and electricity. It involves introducing another special data input within a block known as a Nonce. A Nonce simply refers to a ‘number used only once’ and its function is to allow individuals—known as miners—to increment the nonce, such that it solves the proof-of-work. The role of miners who make up a portion of the nodes is to take new unconfirmed transactions that are broadcasted publicly on the network and bundle them into blocks. They then compete to satisfy the proof-of-work as quickly as possible for the particular block that they assembled. 

For example, the block below contains some sort of data and the miner’s job is to search for a nonce such that when hashed with all the other data inputs contained in the block, it will result in a hash value with four leading zeros

Graphical user interface, application

Description automatically generated

Graphical user interface, application

Description automatically generated

Graphical user interface, text, application, email

Description automatically generated

Once the mechanism has been satisfied, the block is considered valid and the first miner to do so will broadcast their newly mined block back onto the network. However, before it is officially added to the blockchain it must be verified and approved by at least 51% of all nodes on the network. This allows the nodes to cross-check the miner’s blockchain with their newly mined block to its own copy of the blockchain and check to see if there lies any discrepancy. If the transactions and information are valid, the nodes will accept the new block and add it to their blockchain, confirming all the transaction in that block.

Economically, this introduces a cost to mining and discourages attackers from adding fraudulent blocks, since they will incur the computational cost, only to be rejected by the majority of nodes. Thus, the proof-of-work mechanism encourages honestly in the network. In fact, the time it takes on average increases exponentially for every leading zero that is required. In 2009, the first block on the Bitcoin blockchain required eight leading zeros, whilst today the latest blocks mined requires 19 leading zeros

What is a Digital Coin?

The proof-of-work mechanism poses a serious question, that is if mining incurs a cost why would people mine at all. That is because Bitcoin and many other blockchains reward miners for solving the proof-of-work. In fact, this is how Bitcoins are minted and introduced into circulation. The first miner to solve the proof-of-work is rewarded Bitcoins, providing an incentive for miners.

Recall, that the data contained within the block could be anything which is true, however, in the case Bitcoin and many other blockchains this data are in fact financial transactions which contain information about the sender, receiver and quantity. Like the real world, there needs to be a verification process when it comes to sending and receiving money. In the case of Bitcoin, digital signatures which like their real-life counterparts, are used to allow senders and receivers to sign and verify transactions. However, unlike signatures in real life which are easily forgeable, digital signatures are secured using asymmetric cryptography and public-private key pairs, which we won’t dive into today. 

This transforms the blockchain into digital ledger—a record of financial transactions validated using digital signatures. 

Diagram, schematic

Description automatically generated

A digital coin is then defined as a ‘chain of digital signatures’, that is to say a digital coin is the digital ledger. This is quite a weird idea to wrap your head around but essentially what it means is that the amount of coins that you own is determined by the chain of ownership shown on the record of transactions. This is akin to the way digital money works at a bank. For instance, when you deposit $100 into the bank, you’ve exchanged physical cash in return for an electronic balance that you can see and when you make an electronic transaction such as sending $20 to Alice, no physical cash was exchanged. Rather, a transaction is added to your record that $20 was transferred away and similarly a transaction is added to Alice’s record that she received $20. Your respective balances are simply the sum of all recorded transactions.

Final Remarks

This essentially covers the fundamental components of Bitcoin and most other blockchains. In the case of Bitcoin, it essentially is a distributed, immutable record of all confirmed transactions that has occurred on the network. To add to the record, miner’s create blocks of unconfirmed transactions and compete to satisfy the proof-of-work. It is important to note that much of the concepts discussed in this two-part series cover only the surface of what a modern functioning blockchain looks like. There are layers and layers of technical intricacies in how modern blockchains such as Ethereum operate. Despite that, this article aims to serve as a starting point in your journey into the world of blockchain and cryptocurrency.

References

Blockchain.com (n.d.) Bitcoin Explorer

Britannica, T. Editors of Encyclopaedia (2021, September 22). P2P. Encyclopedia Britannica

Brownworth, A. (n.d.). Blockchain

Hayward, A. (2021, June 12). What is Proof of Work? How The Bitcoin Network Is Maintained. Decrypt.Co

IBM. (2021, April 14). Digital signatures

Nakamoto, S. (2008) Bitcoin: A Peer-to-Peer Electronic Cash System