What is a Blockchain and does it work?
Table of content:
- What is the reason for this crazy hype?
- Block structure
- Cryptographic keys
- Key mining
What is a Blockchain? Blockchain is (not difficult to guess from the name) a chain of data blocks, where each block is associated with the previous one. The block contains a set of records. And new blocks are always added strictly to the end of the chain.
What is the reason for this crazy hype?
All these tricks give a lot of buns for the users of the system. Participants in the transaction cannot deceive each other. It does not need intermediaries like a bank. There is no central node in it, destroying which you can knock down the entire system. All operations are transparent for its participants since all data is entered into one database.
However, this is a very complicated chain, which is built on three very important principles:
All users of blockchain form a network of computers, each of which contains a copy of the data blockchain. Usually this is a complete copy of all the blocks, but, in principle, you can store only the data you need on a particular computer.
Due to this, it is almost impossible to turn off or break the blockchain, because for this it is necessary to turn off or break all the computers. While there is at least one user, blockchain exists. Each new user extends and strengthens this network. And all computers are equal, there are no organizers, moderators, controllers and managers. Everyone is responsible for himself.
All the data blockchain – blocks and their contents – are always open for everyone. You can easily read any block and see all the records in this block. You can watch the chain and track the change of information. Thus, all data in the blockchain is easily verifiable, which means that you do not need to trust other network members, because you can always check them and get a guaranteed reliable answer.
To protect data and users in blockchain, encryption is widely used. Due to this you simultaneously get seemingly incompatible – openness and reliability with complete distrust to other participants and, possibly, even their malicious intent.
Simply put, in a blockchain, anyone can see that someone has a million. But who exactly he is – this one can not find out until the owner of a million will give him a special key, thereby confirming that he has a million.
The block in the blockchain consists of a header and a body.
The body of the block is just a list of records. In the meantime, pay attention to the title, because the main secrets are stored here. Blocks in the blockchain are associated with keys, since the key of the previous block is stored in the header of each block. This is a very important and at the same time a technically elegant solution that ensures the security and non-crushing of the blockchain.
First, the key of each block is calculated on the data of the whole block and the key of the previous block. And this means that not only records of this block are coded in the key of any block, but all previous blocks as well. Any, even the most insignificant, change of data in any block causes a complete change of its key, which in turn will require changing the keys of all subsequent blocks.
Thus, seeing the entire blockchain and keys, you can easily verify the correctness of any data, in particular, to make sure whether the sequence of blocks is correct, whether the block is missing – or, perhaps, a new block is inserted in the middle of the chain, and also whether the key block of the data stored in it. Simply put, you can easily make sure that you are not deceived without difficulty.
Secondly, the key of the block must satisfy the important security rules that establish the level of network security, which, by the way, can change with the growth of the network For example, in bitcoin the keys of the first blocks started with ten zeros – and this establishes the complexity of creating a new block: as a counterfeit block, and a completely correct new block.
However, as you remember, for every data set there is always strictly one – and only one – key. How then can one require that the key start with zeros if it starts, for example, with “23786485 …”?
Thus, we smoothly approached the process of mining or mining of keys.
The reliability and security of the blockchain is held by cryptographic keys, with which you can easily verify the validity and correctness of the data.
In fact, the key is just a number. Big number. A very large number. For example: 117316195423570985008687907853269984665640564039457584007913129639935.
It is calculated using a special algorithm called a hash function. The trick is that for a given dataset, the hash function gives a strictly one key that has two very important properties:
- With the key, you can not learn the source data set;
- It is almost impossible to find another data set that gives the same key.
Simply put, having only a key, you do not know anything and can not do any harm. But, after seeing the initial data, you can easily verify that it correspond to the given key. Here you have openness and security in one bottle.
There is one more important feature of the keys that should be mentioned. Even with a minimal change in the source data, the key changes completely.
Miner is the same user of the blockchain network as everyone else. But, in addition to checking and disseminating data, he is also working on the creation of new blocks.
Having received new entries from other network members, the miner collects them together, forms the title of the future block and calculates the key of the block. Suppose, after the first calculation, the key turned out to be like this: “3117316195423570985008687907853269984665640589182146373136582”. However, according to the rules, the key must begin with ten zeros. To change the key, you must change the original data. To do this, a special field called a nonce is provided in the header of the block. In the first calculation, it is 0. Therefore, the miner changes the value to 1 and again calculates the key. Now it has completely changed and is equal to “6879078532698231173161098500814698466564058913731365829542357”. That is, it starts again not with zeros. Then the miner increases the nonce to 2 and recalculates the key. To find the appropriate key value, the miners have to make billions and trillions of recalculations. And when a suitable key is found, the miner saves the block and sends it to other network members. Now all the records in the block are confirmed and protected with a key that is very difficult to forge. And, as you remember, the key of the previous block is also encoded in the key of the block, which is now simply impossible to forge.
The trick of key mining is also that this process has no progress. Simply put, it does not matter when you started looking for a key, how many records are included in the block, how long you have already counted how many keys you’ve already sorted out – the probability of finding a key on any iteration is always the same. And this means that you can not make a prescale, you can not buy keys, you can not create a warehouse of keys – all this is meaningless, and all participants are equal. And each miner has only one opportunity to get a suitable key – this is counting, counting and counting.
That’s what the miners are doing. For each block created, they receive a fee. Who first found the key, he created the unit and earned. The rest did not receive anything. Then they are all taken together for a key search for a new block.
Thus, the intricate key calculation procedure, of course, complicates the creation of the block, but it further complicates the creation of counterfeit blocks, making it almost impossible
Now you know what is a Blockchain. This reliable and open technology will soon change our life. For example, when the issuance of bank loans will be recorded in the blockchain, then no one will face credit fraud. Yes, and “holes” in the bank balance sheets will also be visually visible, so large bankruptcies will be avoided. As a result, scams with mortgage apartments and credit cars will be simply impossible – and many people can avoid problems and money losses. Even government services related to the execution of documents, the issuance and confirmation of rights and certificates, can be implemented as a convenient and open registry based on blockchain.