By Paolo Léonard

People often see blockchain technology as black boxes that might make them money. While this might be true, they are also technologically intriguing and are worth taking the time to understand how they function. In a nutshell, a blockchain is a decentralised, distributed ledger used to record transactions across a network of computers. It provides a secure, transparent way to record and verify transactions without requiring a central authority or middleman. This article will explore how the blockchain works, from key concepts such as blocks, and transactions to the proof-of-work algorithm. The purpose of this article is to present these concepts as clearly as possible without going too much into technical details. However, this article covers only the proof-of-work consensus algorithm. Other articles will explore additional consensus mechanisms.

At its most basic level, the blockchain is a series of blocks linked together to form a chain. Each block contains a list of transactions that have been validated by the network and added to the blockchain. The blocks connect in a specific order, with each block containing a reference to the previous block in the chain.

A rudimentary chain of blocks, each referencing its previous block.

When a new transaction is made on the blockchain, it is broadcasted to the network and collected into a block. The network then validates the block, which consists of a group of computers known as nodes or miners. Each node in the network has a copy of the blockchain, and they work together to validate transactions and add new blocks to the chain.

https://www.craiyon.com/
craiyon.com representation of an interconnected network of nodes.

Typically, each block can only contain up to a certain amount of transactions. For example, Bitcoin blocks can only have 1 MB of information, which is about 2000 transactions. With a current rate of one block of transactions every 10 min, the Bitcoin blockchain can process three transactions per second (before the segwit update). When a large number of users try to submit new transactions simultaneously, it results in problems related to scalability. Now, this article will not go into the details of the scalability trilemma, but it is difficult to increase the performance of a blockchain without impacting the decentralization or the security aspect of it.

Scalability/Blockchain Trilemma
Data Storage in the Decentralized World: Blockchain and Derivatives - Scientific Figure on ResearchGate. Available from: https://www.researchgate.net/figure/Scalability-Blockchain-Trilemma_fig5_347444005 [accessed 28 Feb, 2023]

One of the key components of the blockchain is the consensus algorithm, which ensures the security and integrity of the network. This article only covers the proof-of-work consensus algorithm, which involves solving a complex mathematical puzzle to add a block to the chain. The puzzle requires a significant amount of computing power to solve, and it serves as a way to ensure that the blockchain only adds legitimate transactions. More and more blockchains are moving towards other algorithms like proof-of-stake or proof-of-authority, which don't require as many resources as the proof-of-work algorithm.

The concept of nonce constitutes the basis of the work in the proof-of-work. A nonce is a random number added to the block data before producing a hash value. The hash value is a fixed-size string of characters generated by applying a mathematical function to the block data and the nonce. For the block to be considered valid, the hash value must meet a set of requirements, such as having a certain number of leading zeros. This video snippet starting at 2'18'' illustrates the concept very well:

Because the data in the block is fixed, the only way to produce a valid hash value is to try different nonce values and see if the resulting hash meets the requirements. This process can be computationally intensive and requires a significant amount of computing power to solve. Once a miner finds a valid nonce and generates the correct hash, they can broadcast the puzzle's solution to the network, and the other miners can verify it relatively quickly.

The use of the proof-of-work algorithm in the blockchain serves several purposes. It makes it difficult for an attacker to manipulate the blockchain because they would need to be able to solve the hash puzzle consistently to add fraudulent blocks to the chain. This process is also called the 51% attack. It also ensures that only the first miner to find a solution can add a block to the blockchain, preventing double-spending and other forms of fraud. Finally, it serves as a way to distribute new units of the cryptocurrency, as miners are rewarded for their efforts with a certain number of units for each block they add to the chain.

One of the main advantages of the blockchain is its transparency and immutability. Once the blockchain adds a transaction, it cannot be altered or deleted. This provides a high level of security and eliminates the need for a trusted intermediary, such as a bank or government, to oversee transactions.

To ensure the security of users on the blockchain, many cryptocurrencies use a system of public and private keys to protect user assets. A public key is a unique identifier visible to other users on the network, while a private key is a secret code used to access the user's digital assets and sign transactions. This ensures that only the owner of the private key can access and control their assets.

The benefit of public and private keys is to help protect user privacy on the blockchain, but it also means that users must be careful to keep their private keys secure. If a user's private key is lost or stolen, they can lose access to their digital assets forever.

Illustration of the usage of a private and public key. Available from: https://www.tutorialspoint.com/blockchain/blockchain_public_key_cryptography.htm [accessed 28 Feb, 2023]

In addition to cryptocurrencies, the blockchain has many other potential applications, including supply chain management, voting systems, and digital identity management. The transparent and secure nature of the blockchain makes it well-suited for any application that requires trusted transactions or data storage.

Despite its many benefits, the blockchain is not without its challenges. The proof-of-work algorithm, while effective at securing the network, consumes a significant amount of energy, which has led to concerns about its environmental impact. Moreover, the blockchain trilemma is still an unsolved issue. In response, many developers are exploring alternative consensus mechanisms, such as proof-of-stake, that are less energy-intensive.

Overall, the blockchain is a powerful technology with the potential to transform the way we think about digital transactions and data storage. By using a decentralised, distributed ledger to record and verify transactions, the blockchain provides a level of security and transparency that is unmatched by traditional systems. As the technology continues to evolve, we can expect to see more industries and applications adopt the blockchain, driving innovation and creating new opportunities for businesses and individuals alike.

Thanks for reading this bit. I hope you enjoyed it as much as I enjoyed writing it!