Chapter 4: Unraveling the Intricacies of the Blockchain

bitcoin blockchain

1. Bitcoin Transactions: Connecting the Dots

The Bitcoin blockchain, a compilation of addresses and their corresponding bitcoin balances, functions through transactions. When bitcoin is moved from one address to another address, we call it a transaction.

Imagine Joe wants to send 1 bitcoin to Mark. To do this, Joe uses Mark’s bitcoin address and sends the transaction via his wallet, signing it with his private key.

Inputs and Outputs: When Joe sends the 1 BTC, he references past transactions, like receiving 0.7 BTC from Bill and 0.5 BTC from Sarah. The inputs are these referenced transactions, while the outputs are 1 BTC to Mark and 0.2 BTC returned to Joe as change. In this way, transactions are connected and the nodes can ensure that a bitcoin is not spent twice.

Node Verification: Nodes validate Joe’s transaction, ensuring his private key signs it correctly and checking his transaction history stored on the blockchain. A bitcoin full node has a copy of the entire blockchain and can therefore consult every transaction from the past.

In the Mempool: Verified transactions enter the mempool, acting as a queue before miners include them in blocks.

Blocks: Blocks, groups of transactions, make up the blockchain. Miners add validated transactions into blocks and, once confirmed, these transactions are removed from the mempool, completing the transaction. At this point, finality has been reached, the settlement of the transaction has been successful. The bitcoins have been irrevocably moved from the sender to the receiver.

The Bitcoin blockchain is a chain of linked blocks. When a new block is created, the nodes first check whether it meets all the rules. Then it is added to the previous blocks, making the chain of blocks longer.

2. Mining: Unraveling the Puzzle

We already know that the blockchain consists of a chain of blocks that are connected to each other. To mine a block, the miner must find a hash that meets specific criteria. Miners use a SHA256 function to generate hashes, aiming for a hash with a predetermined number of leading zeros. This requires changing a ‘nonce’ (a random number) to match the criteria.

Hashing

A hash is the result of a calculation. You take an input, put it into a so-called SHA256 function and a hash comes out on the other side. If you change 1 number or letter in the input, you will get a completely different hash. Mining is built on this principle. A miner takes the hash of the previous block, the contents of the new block and adds a ‘nonce’. The nonce is a random number that is changed to get a correct hash.

The bitcoin network imposes a condition for the hash. Simply put, a hash must start with a certain number of zeros. This is an example of such a hash: ‘0000000000000000000547f2c117dbb5f807c7f5ce9902a9a1fbc067c4c56296’.

Proof-of-Work: Miners present the correct nonce, proving they’ve attempted numerous iterations to find the correct hash. The first miner to solve this puzzle gets to mine the block and is rewarded with new bitcoins.

Mining Process: It’s akin to a guessing game. Miners change the nonce, attempting various numbers to generate different hashes. Superior equipment and extensive electricity usage increase a miner’s chances of winning, leading to the establishment of large mining farms.

Understanding these intricacies demystifies the blockchain’s underlying mechanisms and illuminates the complexities of transactions and the mining process in the Bitcoin network.

2. Exploring Blockchain Dynamics

Confirmations: Securing the Chain

A newly created block signifies the first confirmation, effectively securing its contents. Each subsequent block adds further layers of security, making it advisable to wait for multiple confirmations before considering a transaction settled. Altering an older block necessitates changing subsequent blocks connected through hashes. The more blocks appended post-transaction, the more irreversible and secure the registered transactions become.

The Battle of Blockchains: Longest Chain Triumphs

Occasionally, two miners generate a valid block simultaneously, leading to a split in the blockchain. This eventuates in two divergent Bitcoin blockchains. Miners continue extending either chain, with the longest chain prevailing as the definitive one. The nodes in the network validate the lengthier chain due to the increased Proof-of-Work involved. Transactions from the shorter chain get assimilated into the subsequent blocks of the longer chain.

Difficulty Rate: Navigating Block Production

The Bitcoin blockchain targets a ten-minute block production interval. Miners compete to compute hashes that meet certain conditions. Difficulty adjustments every 2016 blocks (approximately two weeks) regulate the rate of block creation. If blocks arrive faster or slower than the targeted ten-minute mark, the difficulty level is adjusted accordingly. For instance, when China expelled miners in 2021, relocating them led to a decline in the Bitcoin network’s hashrate. With reduced computing power, block production slowed, prompting the network to adjust the difficulty level, striving to maintain the desired ten-minute block creation pace.

Advertising
Advertising