Synchronization on Transformer Chain
Synchronization means the mechanism used to maintain consistency between the contents of two or more databases,files,modules,or threads.Consensus and synchronization are essential sectors in the blockchain. The synchronization process enables all nodes in the entire blockchain network to achieve data consistency, ensuring that the data can be verified throughout the network. At the same time,while not affecting the consensus,it prepares the data required for the consensus in advance,so that the data throughout the network reaches an agreement, and increases the success rate of transactions
The Concept of Synchronization
Synchronization is to enable transactions on the blockchain to reach as many nodes as possible, providing the basis for consensus to package transactions into blocks.Fast and reliable synchronization is the basis for transformers’s ultra-high throughput.Synchronize contains blocks with a large number of transactions,and each block contains more than one transaction. To achieve such efficient and high-quality synchronization requires excellent technical support, such as reliable node discovery, fork management, UTXO verification.
Transformers is a completely decentralized public chain, and uses Byzantine synchronization to achieve data consistency across the network. Generating a block on transformers is a passive behavior,and blocks are only generated when transaction occur,rather than through a scheduled block generation mechanism. Any user can synchronize all data blocks on the main network. Before synchronizing blocks, you need to get preparations as follows: a reliable node connected to the main network.
Why is synchronization used
When running, it will regularly broadcast its highest block height to other nodes.When a node receives the broadcasted block height from another node, it compares it with its own block height. If its block height is behind, the block download process will be started.The download of blocks is completed through a request/response mechanism. The nodes entering the download process will randomly select the nodes that meet the requirements and send the requested block height range to download.The node receiving the download request will respond with the corresponding block according to the request content.
The synchronization of transformers ensures the consistency of data across the network, provides a security basis for consensus, and ensures the security and robustness of transformers network.
Byzantine
Before we get to know synchronization, let's take a look at the Byzantine algorithms that are crucial to synchronization.
The Byzantine Generals Problem is a distributed peer-to-peer network communication fault-tolerant problem proposed by Leslie Lambert and others in their paper 《The Byzantine Generals Problem》. He proved that when the total number of generals is greater than 3f and the number of traitors is less than or equal to f, the loyal generals can achieve consistent commands, that is, the number of traitors is less than half of the number of loyal generals. The algorithm complexity is O (n ^ (f+1)).The fault-tolerant algorithm for the Byzantine general problem solves the problem of consistency when the network communication is reliable but the node may fail.Therefore, this algorithm can hardly be applied in actual distributed systems.
Byzantine fault-tolerant algorithm is a system attribute that can resist a series of faults caused by the Byzantine General problem. In other words, the Byzantine fault-tolerant system can continue to operate even if some nodes fail to communicate or have malicious behavior.There are many ways to create a Byzantine fault-tolerant blockchain, which relates to different types of consensus algorithms.
The Application of Byzantine
In transformers chain, according to the set time interval of one round and the callback calculation of the height synchronized from other nodes, the overall network height (the height with the highest proportion) is compared with its own height. If it is lower than the height of the whole network, synchronization will start. First, multiple staked nodes are obtained, and then their node block header hashes are retrieved. After verification,the actual block data is requested, and a randomly selected block is added to its own chain. When the difference in height is below a certain level, the block needs to be verified.
Synchronization mechanism
The core mechanism of transformers chain synchronization data is designed based on Byzantine fault-tolerant mechanism. A sync request is sent to several randomly selected nodes that meet specific conditions, and the sync responses are analyzed using the Byzantine algorithm to extract a secure and effective data set range. Finally, pull block data from these nodes to achieve correct and consistent data across the entire network.
In different situations, the program will choose different synchronization modes, with a total of three synchronization modes:
Check synchronization
Check synchronization is the main way to synchronize data blocks on the transformers chain. In most cases, nodes on the chain are performing check synchronization.The operation process of check synchronization is as follows:
The synchronization node requests data of a specific height from a designated node through the Byzantine algorithm, verifies the data returned from the request, and writes the data into cache and after passing the verification, and waits for the verified data to be written into the database.
Fast Synchronization
Fast synchronization is mainly used in situations where Byzantine analysis fails during check synchronization.when the nodes in the transformers network do not reach a consensus on certain blocks..To facilitate the rapid consensus of the blockchain network,fast synchronization is designed.The main difference between fast synchronization and check synchronization lies in the handling of data. Fast synchronization directly writes data into the database.
Patch synchronization
Patch synchronization is a supplement to the previous two mechanisms and is used to repair the problem that nodes cannot continue to synchronize due to the missing of block data.
Such problems are manifested as follows:
For a certain block, all nodes in the transformers network have reached an consensus and stored it in the blockchain. However, this node cannot verify the block due to the loss of the previous dependent block.
Patch synchronization sends a synchronization request to the designated node. After receiving the data, write the data into the cache and wait for verification to write to the database.
In summary: Synchronization is an essential link in the blockchain. Transformers integrates multiple synchronization modes to operate in complex network situations through verification synchronization, fast synchronization, block patch synchronization and zero synchronization. which can efficiently and accurately make the data of the entire network consistent, laying the foundation for high-speed transactions on the chain.