The Blockchain

Bitcoin is not tangible like gold or cash, and it’s not a digital file that you can hold on a USB.
So, how do you own Bitcoin?
Bitcoin works by proving ownership on a decentralised public ledger called
the Blockchain.
Transactions are stored in blocks; each block has its own fingerprint and refers to the previous one, thus creating a chain. The fingerprint is created using a function called double SHA-256.
SHA-256 is a one-way hashing function of 256 bits. Given any input data, it will spit out a 64-character output. This process is computationally infeasible to reverse, meaning the original input cannot be derived from the hash.

The Blockchain is immutable.
One of the properties of the blockchain is its eventual immutability. Once something gets recorded on it and confirmed multiple times, it becomes really difficult to change it.
As more blocks are added, that difficulty increases exponentially, until it becomes practically impossible.
Each block has its own unique fingerprint, the result of hashing the block header using double SHA-256.
The block header contains all sorts of information, including the previous block hash.
Being the result of the hashing function SHA-256, if anything changes within the block, that fingerprint will be radically different.

This is the block Hash, it’s unique identifier.
The result of a SHA-256 function is a 64 hexadecimal characters, for this example we will use only 6.
For a block to be valid, it’s imperative to include the previous block hash within the block header.
A miner, attempting to find the new block, will hash the block header trillions of times until it finds a result that meets the current difficulty.For simplicity, the mining difficulty in this example will be one leading zero.

By having each block tied to its parent’s block hash, a chain of blocks is created:

If one block is being tampered with, its hash will drastically change.
For example, if someone tries to tamper with block 056qwe by changing even a single transaction, that block’s hash would change completely.

This would invalidate its proof of work and break the link to the next block, since the next block wouldn’t be containing the correct previous hash anymore.The nodes, which operate independently from the miners, will ignore any block that doesn’t meet the consensus rules, such as the right mining difficulty proof of work or not including the previous block hash.
As a result, all blocks that follow would also become invalid and not be included in the blockchain.

For an entity to get away with this cheat, they would have to re-mine each block to the current mining difficulty, so that the nodes will deem the blocks valid. In theory, it could be possible if a miner had accumulated an enormous amount of computing power (over 51% of the network), and that it was only a few blocks back in time.

The deeper a transaction is buried in the blockchain, the harder it is to change. After about six blocks’ confirmation, a Bitcoin transaction is generally considered final.

After 100 blocks, the Coinbase transaction (the miner reward for winning a block, Tx fees + subsidy) becomes spendable, reflecting the very high level of confidence that the block will not be tampered with.

The blockchain is designed to be decentralised.
When a miner wins a block, it won’t be added to the blockchain unchecked. Once the miner has announced the winning block, thousands of independent computers around the world will verify that it follows the rules.
Nodes independently verify the new block to ensure all transactions and the proof of work follow the protocol rules. If a block is valid, the node adds it to the best valid blockchain it knows about and relays it to its connected peers.This is what makes Bitcoin decentralised; not one person, group, or entity has control over that ledger.Anyone can participate in the Bitcoin protocol, download the entire ledger, and verify it themselves by turning a cheap computer into a node.

While miners have to spend an enormous amount of energy and capital to have the chance to win a block, full nodes are very cheap to acquire and run. This means that if a miner were to cheat, they would have spent all this capital just to have their block refused by the network of nodes.

Bitcoin has a limit on block size of 1Mb (+3Mb with SegWit), which limits the number of transactions per block. The reason behind it is so that those nodes remain cheap to install and run.An old Mac mini from 2012 with 1TB of storage does the job perfectly, and you can find one for $100.
Thousands of computers right now have a full copy of that ledger and are verifying that all the blocks being mined follow the protocol 24/7.
Validity through consensus.
Bitcoin nodes enforce consensus rules, the non-negotiable rules that define what is and is not a valid Bitcoin block or transaction. If a block or transaction violates any of these rules, nodes simply reject it, regardless of who produced it.
When competing chains appear, nodes accept the one with the most cumulative proof-of-work, ensuring that no miner or authority can change Bitcoin’s rules without network-wide agreement.


