You must have heard of the blockchain principle which was conceptualized by the creator(s) of Bitcoin. But do you know more precisely what blockchain is? We are going to detail all this so that blockchains have no more secrets for you.
This article is part of the file “Cryptocurrencies, the big folder”
Purpose of a blockchain
A blockchain is a chain of blocks in French. Once we’ve said that, we’re not much further along in understanding the thing.
Already, the purpose of the blockchain is to store network transactions in a permanent and tamper-proof manner. It is a public and distributed registry.
Public, because it is accessible to everyone.
One can easily search for a transaction. Distributed, because it is a decentralized system. The registry is copied to all nodes in the network.
It is also one of the mechanisms that ensures the security of the whole, because the changes are recorded and validated by the majority. The only risk in this case is an attack from the 51s .
In the context of Bitcoin, the power deployed should be enormous, but in the context of smaller cryptocurrencies it is a risk that may exist.
It also helps to avoid double spending . This therefore allows people who do not know each other to be able to carry out transactions without a trusted third party. Any business model is based on trust, and in the case of cryptocurrencies it is the blockchain that provides it.
Composition of a blockchain
Let’s take the Bitcoin blockchain in a simplified diagram as an example.
Several elements make up a block:
- A header (with the hash of the previous block, the proof of work and the hash of the current block resulting from the proof of work)
- A list of transactions
If you don’t know what a hash is, it is a fixed-length character string resulting from a one-way mathematical function. In input of a hash function, there can be text, a file, … and in output, after application of an algorithm you have a character string resembling this:
f2d81a260dea8a100dd517984e53c56a7523d96942a834b9cdc249bd4e8c7aa9
For Bitcoin, the algorithm used is SHA256 .
The hash of the previous block makes it possible to create this famous chain by linking the blocks together. Once a transaction is entered in a validated block (we will come back to this), it becomes confirmed. As new blocks are added behind, it becomes more and more difficult to modify the transaction. This is one of the elements that makes the blockchain tamper-proof.
Validate a block in proof of work
To validate a block, a certain number of operations must be carried out in order to generate a hash. It thus becomes the hash of the block and is formed from the data contained, in particular the transactions as well as the hash of the previous block.
But beware, what makes the operation complicated is that the result must be below a defined target.
This forces the hash to have a certain number of 0s at the start of the chain. Since it is not possible to predict the hash that will be generated, the operation must be repeated a large number of times to obtain a result corresponding to expectations. It could be like the Loto, we start the processing without knowing what the result will be, and then we see if we have the right numbers. Generating a block is therefore artificially made difficult so that it takes a certain amount of time. The idea is to tend towards 10 minutes to validate a block, so the more people there are who calculate, the more the difficulty increases. Once the hash is set, it is validated by the majority of other nodes.
This difficulty adds security to the blockchain.
It also makes it possible to bring stability to the latter, by avoiding concurrent validations as much as possible. These concurrent validations (two people validating the block at the same time) can happen. In this case, it creates two branches of the blockchain. These branches live their life, but after a while one branch will be bigger than the other. And the mechanism of the blockchain means that the choice will be made on the longest branch, and that the other(s) will be abandoned. On the other hand, it induces a great energy expenditure, which sometimes causes Bitcoin to be singled out. And this also induces to slow down the creation of blocks. Doing this proof of work is also called “ mining ”.
To deepen the notion of blockchain and proof of work in the context of Bitcoin, I recommend this excellent article on the Cryptoast site .
And a popular video on the subject (in french) with which you should understand everything:
Other blockchain validation methods
Proof of Stake (PoS)
Proof of stake requires users to prove possession of a certain number of tokens in order to be able to validate blocks. The validation mechanism will look for a user at random. Knowing that chance depends on the amount deposited. Thus, the more funds the user blocks, the more likely he is to be selected to validate (and receive the reward). The random part prevents the “richest” user from being chosen each time.
The advantage of this solution is that it consumes much less power than proof of work. One of the disadvantages is that the algorithms are much more complex, and that they must take into account in particular the problem of “ nothing at stake ”.
Note that Ethereum (the most popular cryptocurrency behind Bitcoin) has planned to switch from Proof-of-Work to Proof-of-Stake in version 2.0. There will therefore be no more Ethereum mining in the more or less near future.
Proof of capacity, or Proof of Capacity (PoC)
Proof of capacity is not based on the ability to perform calculations, but on the ability to store data. So, instead of allocating CPU or GPU power, you have to allocate storage space. The advantage is that it consumes less energy, for a normally similar result.
Other methods
I have given you the main methods, but there are many others. Most derive from one or another of the models. I invite you to discover more on the cryptoast or on briefcrypto .