1 month ago By Chiamaka Muodumogu
Bitcoin is a decentralized digital currency that allows for peer-to-peer transactions without the need for intermediaries. By providing access to a permissionless payment network for anyone in the world, it challenges the traditional financial system.
This article explains the technical details of Bitcoin and its underlying blockchain technology, including terms and concepts that may not be immediately relevant for everyday use, but may be helpful to understand in the future.
Known as the Blockchain- the distributed ledger system designed by Satoshi Nakamoto, the creator of Bitcoin, allows for every participant in the network to verify and inspect every transaction.
Let us use the popular Nigerian game of Ludo as an analogy to explain the Bitcoin ledger.
In Ludo, each player has their own game piece and they roll the dice to determine their next move. The game board serves as a record of the progress of each player's game piece. In a similar way, the Bitcoin ledger is a digital record of all the transactions made using Bitcoin.
Just like in Ludo, where each player's move is recorded on the game board, every Bitcoin transaction is recorded on the ledger as a block. Each block contains a list of all the transactions made during a set period of time.
And just like how all players in a Ludo game can see the progress of each other's game pieces on the game board, all users on the Bitcoin network have access to the ledger and can see all the transactions that have taken place on the network.
Also, in Ludo, a player can only move their game piece if they have the correct number on their dice roll. Similarly, in the Bitcoin network, a transaction can only be added to the ledger if it is verified that the sender has enough balance to carry out such transactions and confirmed by the network using algorithms.
A completed Ludo game is a record of all the moves made by all players, the Bitcoin ledger is a permanent and unalterable record of all the transactions that have ever taken place on the network.
The Bitcoin ledger is basically like a digital version of the Ludo game board, serving as a record of all the transactions made on the network and allowing all users to have a clear view of the progress of the network.
Getting lost? Don’t. Let us try to understand how the blockchain works.
Blockchain is quite literally blocks and chains. It can directly be perceived as chained blocks- remember that each block carries information of a transaction, with the chains being hash functions.
What is a hash function? A hash function is a mathematical function that takes an input (or 'message') and returns a fixed-length string of characters, which is usually a hexadecimal number.
The same input will always produce the same output, but even a small change to the input will produce a very different output. Hash functions are also called one-way functions, because it is computationally infeasible to determine the input from its output.
This makes SHA-256 and other hash functions useful for verifying the integrity of data and ensuring that it has not been tampered with, as any changes to the input will result in a different output hash.
Hash functions are widely used in cryptography and computer science for a variety of purposes, including data integrity verification, password storage, and indexing data in hash tables.
They are also used in blockchain technology, such as in Bitcoin, to generate a unique digital fingerprint of a block of transaction data that serves as a proof of its authenticity.
In the case of Bitcoin, the SHA-256 hashing algorithm is used to generate a hash of each block of transactions, which forms the basis of the blockchain, a decentralized and secure public ledger of all Bitcoin transactions.
Block is the other piece of a Blockchain and it is of 2 parts- Block Header and Block Body.
Where the Block Header is a summary of the entire block, the Block Body contains the record of all transactions in the block.
Block Header being the summary of an entire block contains the following details:
Hash of the previous block’s header
Hash of all transactions of the current block
Version – Bitcoin software version
Block difficulty target
Note that the last four are like “identification” documents of each block.
The blockchain technology is utilized effectively in the Bitcoin ledger, which is a globally distributed database of transactions that is transparent and protected against tampering through the use of cryptographic hashing functions.
We have discussed the components/structure of a blockchain, but there are still important details, key questions yet to be answered like;
What is preventing someone from creating a new version of the entire Bitcoin ledger and distributing it as the legitimate one?
The decentralized nature of the blockchain network, where multiple copies of the ledger are maintained and updated by different participants, makes it difficult for a single entity to manipulate or corrupt the ledger. Additionally, the use of consensus algorithms such as proof-of-work in the case of Bitcoin, ensures that the version of the ledger with the most computational power behind it is considered the valid one.
What is stopping someone from printing more bitcoin?
The fixed supply of bitcoins that can be mined, as determined by the Bitcoin protocol, prevents anyone from printing more bitcoins. Additionally, the use of digital signatures and public key cryptography ensures that only the owner of a particular bitcoin address can authorize a transaction and transfer ownership of the bitcoins.
How is the consensus reached among all participants on a specific version of the Bitcoin ledger at any given time?
Participants in the Bitcoin network reach consensus on the current state of the ledger through the use of consensus algorithms such as proof-of-work. Miners compete to solve complex mathematical problems in order to add new blocks to the blockchain, and the version of the ledger with the most computational power behind it is considered the valid one.
How are disputes resolved when there are conflicting versions of the Bitcoin ledger?
Conflicts in the event of multiple different versions of the Bitcoin ledger can be resolved through the use of the longest chain rule, where the version of the ledger with the most blocks is considered the valid one. Additionally, the use of consensus algorithms such as proof-of-work ensures that any conflicting version of the ledger with less computational power behind it will be eventually discarded.
For a better insight on issues of consensus and dispute/conflict, let's look into mining and miners.
Mining on the blockchain refers to the process of verifying transactions on a blockchain network by solving complex mathematical problems.
Miners use specialized hardware to perform these calculations, and in return, they are rewarded with newly minted cryptocurrency. This process is what allows for the decentralized and secure nature of blockchain technology.
Miners participate in the Bitcoin mining process primarily to earn the block reward, which is given to the miner who produces the next block.
Remember Player C in our Monopoly game? Did you wonder where the 50 BTC reward came from? The reward given to miners for adding blocks to the Bitcoin blockchain is basically a fee paid to secure the network. This method helps prevent tampering with the Bitcoin blockchain.
A miner's role in the Bitcoin network is to compete with other miners to find the correct solution to a complex mathematical puzzle through repeated calculations using the SHA-256 algorithm.
This process, known as Proof of Work, is used to add new blocks to the Bitcoin blockchain.
To add a new block to the Bitcoin blockchain, a miner must find a specific output hash by guessing a nonce value. The equation for this process is:
Hash output = Hash of (previous block header + Merkle Root hash + nonce)
Where the previous block header and Merkle Root hash are already known, Miners are effectively trying different nonce values to find the one that will result in the correct output hash that meets the requirement of having a certain number of leading zeros (mining difficulty).
The mining process can be computationally expensive due to the need for multiple iterations to arrive at a solution. However, the use of hashing allows for easy verification of the solution once the input parameters are known.
This is similar to solving a Sudoku puzzle, which may be challenging, but can be easily verified as correct once completed.
The more miners that join the network, the greater the chances that the network will collectively solve the puzzle and find a new block more quickly than the 10-minute average.
Bitcoin mining difficulty is a measure of how difficult it is to find a new block in the Bitcoin network. It is adjusted every 2016 block (approximately every 2 weeks) based on the time it took to find the previous 2016 blocks.
The difficulty is adjusted to ensure that blocks are found roughly every 10 minutes, regardless of the total hashrate of the network.
As more miners join the network and the total hashrate increases, the difficulty will increase to make it harder for miners to find new blocks and maintain the 10-minute block time. This mechanism helps to keep the rate at which new bitcoins are created steady and predictable.
If two miners solve the puzzle and find a new block at the same time, there will be a temporary fork in the blockchain, as both miners will broadcast their newly mined block to the network.
Other miners and nodes will then choose which of the two blocks to extend and build upon, and the other block will be discarded.
Eventually, one of the two branches will become longer and more "difficult" to extend, and the network will converge on that branch as the valid one. The discarded branch is known as an orphan block.
Double spending is one of the problems of digital currencies and one unique to it, impossible with fiat currencies.
Double-spending is a situation where a malicious user attempts to spend the same bitcoin multiple times by sending it to multiple recipients simultaneously. This happens when the same input is used for multiple transactions and both transactions are broadcasted to the Bitcoin network at the same time.
Bitcoin prevents double-spending by using a decentralized, distributed ledger called the blockchain. Each transaction is recorded on the blockchain and added to a block of other transactions. Once a block is added to the blockchain, it cannot be altered or deleted.
In order for a transaction to be valid, it must be included in a block and be verified by a network of computers on the blockchain. This ensures that a bitcoin can only be spent once, as any subsequent attempt to spend the same bitcoin will be rejected by the network. Additionally, bitcoin also uses a process called mining, which further confirms the authenticity of transactions and blocks.
If miners collude to double-spend, it would be considered a 51% attack, as it would require a majority of the miners to be dishonest.
In this scenario, the group of miners would have control over more than 50% of the total mining power on the Bitcoin network. With this much control, they would have the ability to manipulate the order of transactions and potentially exclude certain transactions, allowing them to double-spend bitcoins. This would undermine the integrity and security of the Bitcoin network and would be a serious threat to the stability of the system.
However, it is worth noting that such a situation is highly unlikely as it requires a significant amount of hash power, and also it is not profitable for miners as it will harm the overall value of the network.
One way to mitigate the risk of a 51% attack is to require multiple confirmations before a transaction is considered valid. By requiring multiple confirmations, merchants can ensure that the transaction is included in multiple blocks and is therefore more difficult to reverse. Each block mined on top of the existing blockchain represents one confirmation, and the more blocks that have been mined, the higher the likelihood that the transaction is irreversible.
As long as a majority of miners are honest, it will be impossible for any single entity to control 51% of the hashrate and execute a double-spend attack. Bitcoin's network is decentralized, meaning that no single entity controls a majority of the mining power. This makes it much more difficult for any group to gain control of the network and execute a 51% attack.
Hopefully, this article has helped us understand the Anatomy of Bitcoin. From the ledger to structure, functions and activities (mining). If you have any questions, feel absolutely free to use the comment box and don't forget to share this article.
Here are some terms used in the article and their meaning:
Consensus- In blockchain, consensus refers to the agreement among participants in the network about the current state of the blockchain.
Nonce- A nonce is a number used only once in a cryptographic communication. It is added to the data being hashed in order to produce a unique hash value.
Merkle Root Hash- The merkle root is the hash of all the hashes of all the transactions in a block. In each block, there can be thousands of transactions, the Merkle Root is the hash of all these transactions.
Hash rate- Hash rate is a measure of the computational power on a blockchain network, determined by how many guesses made per second. The overall hash rate helps determine the security and mining difficulty of a blockchain network.
Nodes- Blockchain nodes are network stakeholders and their devices are authorized to keep track of the distributed ledger and serve as communication hubs for various network tasks. Primary job is to confirm the legality of each block.
Fork- A blockchain fork is a split of the blockchain into two separate chains.