What is blockchain?

Blockchain technology
The blockchain is based on a mining algorithm, for example, on Bitcoin, which is called SHA-256, which comes from the «Secure hash algorithm 256 bits» (Secure hash algorithm 256 bits). It accepts input information in any form, down to computer files, and converts it into a hash, which always weighs 256 bits in machine code.
Each input always produces the same result according to a pattern, but if the user changes the input a little, the output will also radically change.
This phenomenon is called a one-way function, in which, if only the output information is available, it is impossible to calculate the input information for sure, only if you do not guess the probability of the input data. This can only succeed with a probability of 1 in 2 ^ 256, therefore, it is almost impossible to guess the input information, consequently, the algorithm is safe.
After learning the basics of using the algorithm, you can move on to the nuances of the work of the blockchain, considering an elementary sample of the transaction.
Kate owes Leo 2 Bitcoins. In order to send these Bitcoins, she sends a message about the planned transaction to all miners on the network, notifying them of Leo’s public address and the number of Bitcoins to be sent, attaching a digital signature made using the private key, as well as the public key. This allows miners to witness a planned transaction from the owner of Bitcoin, as well as the fact that this owner is Kate.
After receiving confirmation of the legitimacy of the transaction, the miners move it to a block containing many other transactions, and start mining, placing it in a block using the SHA-256 algorithm. Output data must start with a specific number of zeros. This is the only way it will be verified. The number of zeros depends on the so-called degree of complexity, which in turn depends on the level of computing power in the network.
In order to create an output hash with the desired number of 0, miners need to add a so-called «nonce number» to the block, i.e., the binary code that is found during PoW mining.), before running through the algorithm. Since even the smallest change in the input information completely changes the output, miners select the output hash by output random” nonce «numbers.
After receiving the block, the miner passes it to others, who check whether it is verified. If the verification is passed, they add it to their copy of the blockchain. This is the end of the transaction. But you need to include the output hash from the previous block in this one in order to connect all the existing blocks. The name block-CHAIN comes from this action. Do not underestimate the importance of this event, as without confirmation of the work of the system will cease to function.
Each miner copies the blockchain with the maximum computing power and the longest chain of blocks. If the transaction changes in the previous block, the output hash for this block, as well as for the subsequent ones, will also change.
The model that enables computers to generate blocks is called Proof-of-Work (PoW). There are also such models as Proof-of-Stake (PoS)(Proof of Ownership), which do not need such a large amount of computing power to operate, therefore, they save electricity.