Several Main Algorithms of Block Chain
Core algorithm 1
The story of Byzantium is probably like this: the Byzantine Empire had great wealth and 10 neighbors around it had been around for a long time, but the walls of Byzantium stood high and solid, and no single neighbor could invade successfully. Any single neighbour invading will fail, and at the same time it may be invaded by nine other neighbours. The Byzantine Empire was so defensive that it would be possible to break through if at least half of its ten neighbours attacked at the same time. However, if one or more of the neighbours themselves promised to attack together, but betrayed in the actual process, the invaders might be annihilated. So each side acted cautiously and could not easily trust its neighbours. This is the question of Byzantine generals.
In this distributed network, each general has a real-time message book synchronized with other generals. Every general's signature in the book is verifiable. If there is any inconsistency, you can know which generals are inconsistent. Despite inconsistent information, as long as more than half agreed to attack, the minority subordinated to the majority, consensus reached. Thus, in a distributed system, despite the bad guys, the bad guys can do anything (not restricted by protocols), such as not responding, sending error messages, sending different decisions to different nodes, and combining different error nodes to do bad things. However, as long as most people are good people, it is entirely possible to achieve a decentralized consensus.
Core algorithm 2
Asymmetric Encryption Technology
In the above-mentioned Byzantine agreement, if several of the 10 generals initiate news at the same time, it will inevitably lead to systematic confusion, resulting in different schemes of attack time and inconsistent action. Anyone can send an offensive message, but by whom? In fact, it only needs to add a cost, that is, only one node can transmit information for a period of time. When a node sends a unified attack message, each node must sign and stamp to confirm its identity when it receives the message from the initiator. Now it seems that asymmetric encryption technology can completely solve this signature problem. The encryption and decryption of asymmetric encryption algorithms use two different keys, the "public key" and the "private key" that we often hear. The public key and the private key usually appear in pairs. If the message is encrypted with the public key, the corresponding private key of the public key is needed to decrypt it. Similarly, if the message is encrypted with the private key, the corresponding public key of the private key is needed to decrypt it.
Core algorithm 3
Fault tolerance problem
We assume that in this network, messages may be lost, corrupted, delayed, and sent repeatedly, and the order of acceptance is inconsistent with the order of sending. In addition, the behavior of the node can be arbitrary: it can join or quit the network at any time, it can discard messages, forge messages, stop working, etc., and it may also occur various human or non-human faults. Our algorithm provides fault-tolerant capability for consensus system consisting of consensus nodes. This fault-tolerant capability includes both security and availability, and can be applied to any network environment.
Core algorithm 4
Paxos algorithm (consistency algorithm)
Paxos algorithm solves the problem of how a distributed system agrees on a certain value (resolution). A typical scenario is that in a distributed database system, if the initial state of each node is the same and each node performs the same sequence of operations, then they can finally get a consistent state. To ensure that each node executes the same sequence of commands, it is necessary to implement a "consistency algorithm" on each instruction to ensure that each node sees the same instructions. A general consistency algorithm can be applied in many scenarios and is an important problem in distributed computing. There are two models for node communication: shared memory and message passing. Paxos algorithm is a consistency algorithm based on messaging model.
Core algorithm 5
Block chain consensus algorithm is mainly workload proof and rights proof. In the case of Bitcoin, PoW can be regarded as a reusable Hashcash from a technical point of view, and generating workload proof is a random process in probability. When mining new classified currencies and generating blocks, the miners must obtain the consent of all participants, and the PoW work certificate of all data in the blocks must be obtained. At the same time, miners have to observe the difficulty of adjusting this work from time to time, because the requirement for the network is to generate a block every 10 minutes on average.
Core algorithm 6
Distributed storage is a kind of data storage technology. It uses the disk space on each machine through the network, and forms a virtual storage device with these dispersed storage resources. The data is stored dispersedly in every corner of the network. Therefore, distributed storage technology does not mean that every computer stores complete data, but cuts the data and stores it in different computers. It's like storing 100 eggs, not in the same basket, but separately in different places, adding up to 100 eggs.