Hyperledger Fabric principle (1) Infrastructure

Foreword

Linux Foundation started in December 2015 called "super books" (Hyperledger) open source project, aimed at promoting collaborative parties together to build enterprise-class distributed books based on the underlying technology blocks chain, to build support for business industry applications and platforms.

Super 10 items including books in (project), wherein the block chain framework projects 5: Fabric, Sawtooth, Iroha, Burrow and Indy; block chain tools project 5: Cello, Composer, Explorer, Caliper and Quilt. Which Composer is an application framework that simplifies the creation Fabric applications, deployment and use.

Fabric project goal is to achieve a generic permission block chain (Permissioned Chain) of the underlying frame , for application to different occasions, using a modular architecture provides switchable and expandable components, including consensus algorithm , encryption security , digital assets , intelligence contracts and identity authentication services.

Fabric overcomes the shortcomings of bitcoin chain and other public projects, such as low throughput, transaction disclosed no privacy, no final consensus algorithm uncertainties and inefficiencies and other problems, enabling users to easily develop business applications.

On the other hand, Fabric there are also shortcomings, such as v1.2 consensus algorithm does not yet support BFT type, there are limitations transaction concurrency control, the overall performance to be improved and so on.

Fabric main components

Fabric components include a client (Client), the network node (Peer), CA (Certificate Authority) Sort node and the node (Orderer). Relationship between the various components shown in FIG.

 

Fabric component relationship

The main role of the client is and Fabric interact with the system to achieve the operating system on the block chain. These operations are divided into two classes and management classes chain code. Management including start and stop and configure the network node and the like; chain code operation type is mainly lifecycle management chain code, such as installation, instantiation code, and the call chain. The most common client is a command-line client (CLI), in addition Fabric SDK is used to develop client applications. Fabric system user function by different clients.

The network node (the Peer, the p2p is p) is a block chain decentralized peer nodes in the network , according to the function is divided into endorsement node (Endorser) and verify that the node (the Committer) . Endorsement node main trading plan to verify, simulate and execute endorsement. Verify that the node is responsible for testing the legitimacy of transactions, and update and maintain the block chain data and status books. In actual deployment, the endorsement and confirmation node node can be deployed on the same physical node can be deployed separately.

The main duties of sorting node (Orderer) is sent to each node sort of transaction . In the case of concurrent, each node has the timing of the transaction needs to be determined and agreed upon by sorting node. After the sorting order of the nodes according to certain rules determine the transaction, the transaction sent to each node to persistent books block chain. Sort node supports a plurality of channels separated from each other, so that the transaction is sent only to the relevant node (Peer).

CA node mainly to Fabric network members provide identity information based on the digital certificate , identity certificate can be generated or cancel membership (certificate). In clear on the basis of membership, Fabric can manage access control.

Fabric network components tend to belong to different organizations, such as the formation of a network between the decentralized organization. Each organization usually has its own client, network nodes and CA node, and you can create one or more different types of nodes as necessary. Sort node does not belong to an organization entity , the components belonging to organizations maintenance.

aisle

An important requirement for commercial applications is a private transaction, for Fabric design the channel (Channel) to provide privacy between members. Channel is a communication channel between the independent members of the network, the transaction is sent in the channel only members belonging to the channel to be visible, and therefore can be regarded as a private communication channel, "subnet" Fabric of some members of the network.

Passage by the sequencing service management . In the creation of the channel, to define the organization and its members, the anchor node (anchor peer) nodes and ordering services, and a channel structure corresponding to the chain block generated simultaneously recording the books for the transaction, the initial configuration of the channel Creation block (first block) of information recorded in a block chain. Configure the information channel can be used to add a new configuration to block change.

Each organization may have multiple nodes join the same channel, these nodes can be specified in an anchor node (anchor node for backup or more). The anchor node on behalf of the organization node interactions with other organizations, so as to find all the nodes in the channel. In addition, the node election the same organization or a designated master node (leading the peer) , a leading node is responsible for receiving blocks from ordering service sent, then forwarded to other nodes of the Organization. Master nodes can be selected by a specific algorithm, thus ensuring the stability of the entire network can be maintained in the case of the changing of the number of nodes.

Fabric the network, a plurality of channels may be isolated from each other exist, and each channel contains a private block chain and a private books, the channel may instantiate one or more chain code to the operation of block chain data. Thus, Fabric is a channel-based multi-chain multiple books system .

Distributed books

Fabric in the data stored in the form of books distributed. Books by a series of sequential recording and tamper-resistant composition contains the entire state of the recording data changes. Data items stored books in the form of key-value pairs, books in all key-value pairs constitute the books of the state , also known as the "state of the world" (World State).

Each channel has a unique books, all members together by the channel maintains the books , each acknowledgment on node keeps a copy of the books to which it belongs channels , so it is distributed books. Access to the books of the need to achieve an increase of the books by the key chain code, delete, update and query other .

Books block chain composed of two parts and state database.

Block chain is an ordered set of blocks (data block) can not be changed, a record log of all transactions. Each block contains several data transaction, the transaction number contained in the different blocks may be different. A block association between the hash chain (Hashed-link): Each region contains the block header hash value for all transactions, and on a hash value of the header area. Such a chain architecture ensures that each block of data can not be changed, and the relationship between each block of the order can not be changed. This feature determines the block chain block can only be added at the end of the chain.

State database records the current value of books in all key-value pairs, equivalent to the current transaction log books to do the index. Chain code when performing transactions need to read the books of the current state, you can quickly get the latest status of key values ​​from the state database.

If there is no state database, when you want to get a key, you need to traverse the entire block chain and the key associated with the transaction, the efficiency is very low, therefore, to read the state of the database can be considered quickly locate and access to a key value method. Further, when the failure state of the database can be generated again by traversing books.

Block chain block stored in the form of a file in each node. The state database principle can be a variety of key database, Fabric is used by default LevelDB, also supports CouchDB options. In addition to supporting key data outside CouchDB, a document model also supports JSON format, can do complex queries.

 

https://www.8btc.com/article/283714

"The core technology and application block chain"

"Block chain development actual combat."

Guess you like

Origin www.cnblogs.com/xdyixia/p/11724905.html