Often presented as a revolutionary “technology”, Bitcoin’s blockchain is first and foremost the time-stamped accounting record of all transactions that have been carried out on the network since its creation. In the original Bitcoin whitepaper, Satoshi Nakamoto does not talk about a blockchain but rather about a timestamp server. The term blockchain appeared later, probably for its more visual, more meaningful side: a chain of blocks containing transactions. However, timestamping is essential to understand how Bitcoin makes it possible to do without a central control body in order to secure the network, and in particular to avoid double spending.
Understanding how this decentralized registry works is a good starting point in order to understand the hundreds of crypto money systems that have taken over this system.
Objectives of the Bitcoin blockchain
When Satoshi Nakamoto created Bitcoin in 2008, his goal was both simple and very ambitious. He wanted to build a digital “cash” system, working peer-to-peer, like cash.
The function of Bitcoin’s blockchain is to keep track of the transactions carried out on the network, while being impossible to falsify, and preventing double spending (spending twice the funds present at the same address). The only solution that existed until then to avoid double spending within a digital payment network was to centralize the bookkeeping through a trusted third party (a bank for example). Bitcoin’s blockchain eliminates the need for a central control body to validate transactions.
To do this, this digital ledger is replicated on all the nodes of the Bitcoin network – known as distributed register technology – and is in the form of blocks that are linked together using a cryptographic process.
The problem of Byzantine generals
In order to decentralize the maintenance of the accounting register and the creation of the Bitcoin network currency units, Satoshi Nakamoto sought a robust solution to the famous problem of the Byzantine generals.
This is a historical analogy to describe a classic algorithmic problem: how to keep the integrity of information and ensure its transmission within a network with malicious actors?
Let us imagine a city under siege by several army corps, led by their respective generals. The latter can only communicate through messengers, moving on horseback (or rather on camelback), and must agree on the time and modalities of the final attack: it will only succeed if the troops are in perfect agreement and attack in a coordinated manner. The problem is that within the generals, as well as among their messengers, there are traitors, unidentified, who will try to falsify information.
In computer science, it is a question of ensuring that within a network of machines, a sufficient majority continue to follow the correct operating protocol despite the possible presence of defective elements. A formal solution was proposed in 1982 by Leslie Lamport, Robert Shostak and Marshall Pease.
As you will have understood, in the case of the Bitcoin network, it is a matter of ensuring that all nodes maintain the system’s monetary accounting by following a common set of rules (consensus), while protecting themselves from various attacks or breakdowns.
The proof of work
This is where a technological brick essential to the functioning of the Bitcoin blockchain comes into play: the proof of work (also called “Nakamoto’s consensus algorithm”).
This algorithm is quite simply the best solution that has been found to the problem of the Byzantine generals. It ensures that the Bitcoin network will maintain a consensus around its reference accounting, even in the presence of 50% of malicious actors (compared to 33% for classical protocols).
This is where Satoshi Nakamoto’s genius lies: in order to best solve this problem, in addition to pure mathematics, he introduced a new variable, a natural human tendency: greed. Thanks to a clever set of economic incentives, attacking the network becomes so expensive that it is much more profitable to secure it.
To learn more about the problem of Byzantine generals, you can read this article by Ludovic Lars.
Mining on Bitcoin
Mining is both the process of money creation on the Bitcoin network, but also the economic incentive mechanism that secures the network.
There is a reward, the Bitcoins “created” each time a block is added to the chain, which will be randomly distributed to a miner (or a subset of miners) who has proven to the entire network that he has spent enough energy (and therefore value, quantifiable in money) to keep it running and safe. This is known as a “Coinbase transaction”: the reward in bitcoins appears directly on the address of the winning minor. It is divided by two every four years, creating a deflationary monetary issue model that mimics the extraction of a precious metal such as gold.
Symmetrical cryptography is a principle of encryption as old as the world: a message is encrypted thanks to a secret key held by the sender and the receiver. To decipher the message, it is enough to know this key.
Asymmetric cryptography works thanks to two keys: a public key and a private key. The public key is the encryption key: anyone who has it can encrypt a message, but only the owner of the associated private key can then decrypt it. In the case of Bitcoin, the sender of a transaction signs it with his private key, and once it is broadcast on the network, anyone can verify that the signature is valid with the sender’s public key.
Structure of a block
A block on the Bitcoin network is like a table with data organized in a specific way. Some is determined by the users of the network, such as the amount of transactions, the addresses of the recipients and the sending methods, and others by the protocol itself, such as the number of the block, the version of the Bitcoin software used, and so on.
The maximum size of a block on the Bitcoin network was initially set to 1 MB. To give an order of magnitude, this corresponds to a few thousand “standard” transactions (in case of multiple input and/or output addresses, the size of a transaction increases). These are transcribed using Bitcoin’s scripting language as signed messages: a transaction request to minors consists of modifying the balance of several send and receive addresses. This request is signed using the private key of the owner of the public input address(es). The network nodes will make sure that the transaction is valid before broadcasting it to their peers, one by one.
Relevance of the algorithm
The advantage of this method is that it is then very easy for the network nodes to verify that the solution is valid. Indeed, any node can very quickly compute the hash of the header of the proposed block and verify that it respects the target. Once the header of the block proposed by a miner is suitable for the whole network, the mined block is definitively added to the chain and the lucky miner gets his reward (in the case of a group of miners, the reward will be distributed in proportion to the power allocated by each miner).
How does this mechanism make the transaction log (the blockchain) immutable? Since the header of each new block depends on the previous ones, if an attacker wishes to rewrite a transaction, he will have to recalculate all the blocks chronologically before the one he wishes to modify, which is technically impossible.
Block timestamping also prevents a malicious actor from making a double expenditure: if it is perfectly possible to broadcast on the network two transactions spending the same bitcoins to two different addresses, only the first transaction written on the blockchain will be valid. Thanks to the timestamp, the entire network will be able to see that the second transaction (the double-spend attempt) is invalid.
To illustrate the above, you can go to a block explorer and browse the Bitcoin blockchain: you will see that each block has a hash starting with a number of zeros.
The best way to bring these concepts to life is to download the Bitcoin Core client software and mount a complete Bitcoin node, with the entire blockchain, to help secure the network!
If you want to go further, don’t hesitate to reserve your place for a face-to-face training on Bitcoin with our team!