Jiedao jdon 2021-04-07 04:47:21 阅读数:799
Hyperledger Fabric It's a distributed blockchain network , Shared ledger replicas that multiple of these components keep themselves , The history of all transactions . When a new deal happens , They have to be published online , Synchronize all replicas of the ledger to consistent data .
At a higher level , The process is as follows ：
1. New deals are submitted to the sequencer （orderer, Also known as sorting service ）.
2. The sequencer creates a new block on the blockchain （ Include new deals ）.
3. The sorter publishes the new block to a peer peer.
The last step , Submit is take goosip agreement . Even in blockchain networks with relatively few members , There may still be a large number of peers peer. for example , A lot of use IoT（ The Internet of things ） The network of the device may require many peer nodes to connect the device to the network . Besides , Sometimes some peer nodes may have intermittent connections - Some peers may not always be able to get access from the sorter . For the sequencer , Having to submit new block data to each peer adds unnecessary pressure , In some cases it may not even be possible to complete .
stay Hyperledger Fabric What's actually happening is , The sorter only submits new blocks to a peer in the organization - That is to say leader peer Leading peer nodes . Through a goosip The process of , Peer nodes propagate the replica themselves ：
1. A peer has messages that need to be distributed to all other peers . for example , Leading peer nodes have new blocks of blockchain .
2. The peer node sends messages to a predetermined number of （ Randomly selected ） Other peers .
3. Each of these peers forwards a message to a predetermined number of other peers .
4. And so on , Until everyone gets the message .
The above process is called broadcasting ,Fabric Of gossip The system uses this strategy to distribute multiple messages to all peers .
Goosip The key component of the agreement is : Each peer is randomly selected to forward messages to other peers in the network . This means that each peer knows which peers in the network , So you can choose between them .
stay Fabric in , Each peer periodically broadcasts a message , Indicates that it is still active and connected to the network . Each peer maintains a list of all peers in its own network - those “ Alive ” Their counterparts and those “ die ” The equivalent of .
1. When the peer A Received from peer B Of “ Alive ” When the news of the , It will be equivalent to B Marked as “ It works ”. For peers A Come on , peers B It's part of the network .
2. If after a while , peers A No peer received B Of “ Alive ” news , It will be equivalent to B Marked as “ Death ”. For peers A Come on , peers B No longer part of the network .
In order to prevent the peer from B Actually dead , peers A Try to connect dead peers on a regular basis , See if they're really alive , Because other problems such as network problems or failures may prevent peers B Of “ Alive ” The message arrives at the peer A. When the peer A Can communicate directly with peers B When contacting , It can reconfirm the peer B It does still exist .
The above process only works in this case ： When a peer has a list of other peers , Peers need to send “ Alive ” There is no need to be like this . therefore , Each entity has a set of bootloader to start to the blockchain network .
byzantine fault tolerance
Peers mark their “ Alive ” news , This means that bad people can't cheat the network by creating messages , All it can do is not forward a companion's message “ Alive ” news . As long as other people still forward “ Alive ” news , Individual non forwarding is not a big threat .
Data dissemination Goosip
As mentioned earlier , The basis of data dissemination is simple . Each peer forwards new data to a randomly selected subset of pairs it knows . This process is called broadcasting , It's a push based approach , Transmitting information over the Internet .
however , If the peer is disconnected from the network and reconnects later , Then it will miss the broadcast process . To catch up with the rest of the network , It needs a pull based mechanism to request its lost data .
stay Hyperledger Fabric in , Peers exchange membership data with each other on a regular basis （ List of peers , Activity and death ） And ledger data （ Transaction block ）. This allows peers to stay up to date , Even if they miss “ Alive ” Broadcast of messages or new transaction blocks .
Hyperledger Fabric Use the... Between peers Goosip As a fault tolerant and scalable mechanism , To keep all copies of the blockchain ledger synchronized . It reduces the burden on the sorter to distribute , Just provide a new block for a peer in each organization , And it allows peers to “ catch up with ” current state .
版权声明：本文为[Jiedao jdon]所创，转载请带上原文链接，感谢。 https://netfreeman.com/2021/04/20210407042447118i.html