Multi-channel implementation method based on alliance chainTechnical Field
The invention relates to the technical field of block chains, in particular to a multi-channel realization method based on a alliance chain.
Background
In a public chain, all nodes belong to the same chain, all nodes can synchronize the same data, each node can synchronize and store some unnecessary data along with the increase of the data volume, the pressure of each node is increased, meanwhile, the nodes in the network can read all data, some sensitive data can be distributed to nodes which should not access the data, and potential safety hazards can be brought.
Furthermore, all public chains have a fatal vulnerability that each node must participate in each transaction and protect the system by keeping a copy of the transaction, which limits the number of transactions that the blockchain can handle, resulting in low throughput and increasing the need for node storage, bandwidth and computing as the volume of transactions in the blockchain increases.
There are many common chain solutions such as fragmentation, calculation under chain, DAG, etc., and the fragmentation technique reduces the pressure on each node by distributing storage and calculation by dividing all the contents of the blockchain into different fragments, each fragment being stored and processed by a different node in the network. Or to chain down computations in a secure and verifiable manner, improving throughput, trueBit based etherhouse is a good example. The DAG-based data structure is used for maintaining the system in a starting stage, large-scale popularization is not achieved, and application scenes of the DAG-based data structure are carefully selected before the final theory is perfected.
Hyperhedge Fabric is a basic core platform of a block chain, aims to become a distributed account book platform of enterprise-oriented development application and solution, innovatively introduces authority management support, is pluggable and extensible in design, is the first open source project facing a alliance chain scene, is also the top level project added into the Hyperhedge project at the earliest, is submitted to a community by enterprises such as IBM and DAH in the end of 2015, and provides a multichannel technology of the alliance chain, which means that independent communication channels are provided among part of network members, and only the members belonging to the channels can see transactions sent in the channels, so the channels can be regarded as private communication subnets of part of the network members. A plurality of different organizations under the alliance establish a channel, each channel has an independent account book, and only channel member organizations can share the account book. In practical applications, it often carries sensitive data such as assets and transactions, so security and privacy protection are two very important issues.
However, although the existing public chain can solve the problem of node expandability, privacy is limited, and after key service data is uploaded to the blockchain, a hacker, a competitor or other unauthorized parties can check the information on the blockchain, which is unwilling to do so for most companies. Privacy is a bottom line for individuals, organizations, and industries concerned about privacy and personal interests. Many blockchains and custodians of cryptocurrency have common promises and it is desirable to be able to build a trust-free, unchecked system that allows everyone to participate in billing. Paradoxically, we use a common, easily tracked ledger. The lack of formal contract validation for the public chain remains an unsolved problem, and above all, smart contracts are immutable, meaning that once they are dropped onto the ethernet host network, they cannot be updated and repaired. In addition, the content of the smart contracts is public, anyone can view the smart contracts, and anyone can call the public algorithm of the smart contracts, and although the public algorithm provides the public and the transparency, the smart contracts are also the targets of hackers, in fact, the smart contracts are difficult to be perfectly flawless no matter how many precautionary measures are taken, and in any case, formal verification is a powerful method for reducing errors and attacks. It ensures higher security than conventional methods (e.g., testing, peer review, etc.). There is a pressing need for better solutions. The Hyperlenger Fabric is a representative in the existing alliance chain, a read-write set is adopted to conduct on-chain transaction operation, although the security is good, the concurrency is poor, if only one block is successfully updated for multiple times, the subsequent transaction fails, the transaction can only be resubmitted to be executed, the experience is poor, the consistency is only ensured, but the usability is not met, and the actual application scene is not met. The HyperLegendre Fabric multi-channel technology lacks a global sequence, so that the HyperLegendre Fabric multi-channel technology cannot well support an economic model, cross-link calling and the like.
Disclosure of Invention
In order to solve the technical problems described in the background art, the invention provides a multi-channel implementation method based on a federation chain. Aiming at a multichannel alliance chain, recording unique hash values of all blocks by establishing a sorting chain, namely recording an index value of each block at the current moment, adding block information into the sorting chain when a new block is generated on the chain in the channel, if the chain-crossing operation is not particularly frequent, performing batch operation recording on the blocks at intervals, and when the chain-crossing operation is performed, acquiring the related blocks related to the current operation by accessing the sorting chain by a main chain, and then acquiring the block content on the corresponding chain by the block information. The block sequence of different channels can be determined by introducing the sequencing chain, the sequencing chain is not required to be connected with the endorsement node, when a plurality of transactions operate on the same block, the transactions can be queued for execution, and other transactions cannot fail.
The technical scheme adopted by the invention for solving the technical problem is as follows:
a multi-channel realization method based on alliance chain includes the following steps:
a) A federation chain creates channels with or without tokens;
b) The transaction occurs within a token-bearing channel or a token-free channel created by a federation chain; or closing the channel in a channel with or without the token created by the alliance chain; or cross-chain transactions.
Specifically, in the step a), the specific steps of creating a channel with tokens by the alliance chain are as follows: and when a new channel is created, performing authority control through a digital certificate, starting to create the channel when identity verification passes, otherwise, failing to create the channel and quitting, writing an initial token value so as to perform account transaction subsequently, configuring information, generating a configuration information block and writing the configuration information block into a system channel chain, and finally generating block information in the new channel and packaging hash information and writing the block information into the chain, wherein the channel is successfully created.
Specifically, in step a), the specific steps of the alliance chain creating a token-free channel are as follows: and when the client side starts to create a new channel, performing authority control through a digital certificate, when the identity verification passes, starting to create the channel, otherwise, failing to create the channel and quitting, then writing the configuration information of the channel, generating a configuration information block and writing the configuration information block into a system channel chain, and finally generating block information in the new channel according to the configuration information and packaging the block information in a hash writing chain, wherein the channel creation is successful.
Specifically, in the step b), the specific steps of the transaction occurring in the token-containing channel or the token-free channel created in the alliance chain are as follows: when a client side carries out transaction, right control is carried out through a digital certificate, when identity verification passes, the transaction starts, otherwise, the transaction fails and exits, whether the transaction carries token information or not is detected, if the transaction carries the token information, the system processes the account token according to transaction block information, if the transaction does not carry the token information, the system does not process the transaction, then block information is generated by packaging according to the sorting result of the order node, the block information is broadcasted to other nodes of an organization and the transaction is executed, and finally the transaction result is returned to the client side, and the transaction is completed.
Specifically, in the step b), the specific step of closing the channel in the token-containing channel or the token-free channel created in the alliance chain is as follows: when a client needs to close a channel, a system firstly authenticates the identity through a digital certificate, if the authentication is successful, the action of closing the channel is started, otherwise, the channel is failed to close and quit; if the channel has a token, finally writing the token value of the client into the account chain, and returning the result to the client; if the token is not involved, the channel is directly closed, and the transaction is stopped.
Specifically, in step b), the specific steps of the cross-chain transaction are as follows: when a new chunk is generated in a channel, the hash value of the chunk is written into the global ordering chain. When cross-chain operation is needed at a certain moment, the global sequencing chain is directly accessed, and the block information of the time node is obtained.
The invention has the beneficial effects that: the invention provides a multichannel realization method based on a union link.A Hyperlenger Fabric needs to simulate a transaction through an endorsement node to generate a reading and writing set when the transaction occurs, then returns a result to a client, and when a cross-link operation is needed, the endorsement node returns a corresponding result set operation by sending information to the endorsement node. Aiming at a multichannel alliance chain, recording unique hash values of all blocks by establishing a sorting chain, namely recording an index value of each block at the current moment, adding block information into the sorting chain when a new block is generated on the chain in the channel, if the chain-crossing operation is not particularly frequent, performing batch operation recording on the blocks at intervals, and when the chain-crossing operation is performed, acquiring the related blocks related to the current operation by accessing the sorting chain by a main chain, and then acquiring the block content on the corresponding chain by the block information. The block sequence of different channels can be determined by introducing the sequencing chain, the sequencing chain is not required to be connected with the endorsement node, when a plurality of transactions operate on the same block, the transactions can be queued for execution, and other transactions cannot fail.
Drawings
The invention is further described with reference to the following figures and examples.
FIG. 1 is a flow diagram of the federation chain of the present invention creating a channel with tokens;
FIG. 2 is a flow diagram of the federation chain of the present invention creating a token-free channel;
FIG. 3 is a flow chart of the invention for transactions occurring within a token-bearing channel or a token-free channel created by a federation chain;
FIG. 4 is a flow chart of the present invention for closing a channel within a token-bearing channel or a token-free channel created by a federation chain;
FIG. 5 is a flow diagram of a cross-chain transaction of the present invention;
Detailed Description
The invention will now be described in further detail with reference to the accompanying drawings. These drawings are simplified schematic diagrams illustrating only the basic structure of the invention in a schematic manner, and thus show only the constitution related to the invention.
Fig. 1 is a flow chart of the alliance chain of the present invention creating a channel with tokens, fig. 2 is a flow chart of the alliance chain of the present invention creating a channel without tokens, fig. 3 is a flow chart of the present invention taking place within a channel with tokens or a channel without tokens created by the alliance chain, fig. 4 is a flow chart of the present invention closing a channel within a channel with tokens or a channel without tokens created by the alliance chain, and fig. 5 is a flow chart of a cross-chain transaction of the present invention.
The channel creation of the alliance chain is divided into tokens and non-tokens, which need to be created when an account transaction is involved.
As shown in figure 1, when a league chain creates a channel with tokens:
1) And when a new channel is created, performing authority control through a digital certificate, starting to create the channel when the identity verification passes, otherwise, failing to create the channel and exiting.
2) Writing the initial token value for subsequent account transactions.
3) And generating the configuration information and writing the configuration information into the system channel chain.
4) And generating block information in the new channel by the information, and packaging the block information into a hash write-in chain, wherein the channel is successfully established.
As shown in fig. 2, when a league chain creates a channel without tokens:
1) When the client side starts to create a new channel, the authority control is carried out through the digital certificate, when the identity verification is passed, the channel is created, otherwise, the channel creation is failed and quitting is carried out.
2) Writing the configuration information of the channel, and generating a configuration information block to write in the system channel chain.
3) And generating block information in the new channel according to the configuration information, and packaging the block information in a hash write-in chain, wherein the channel is successfully established.
As shown in fig. 3, transactions occur within a token-bearing or token-free channel created by a federation chain:
1) When the client side conducts transaction, authority control is conducted through the digital certificate, when identity verification is passed, the transaction starts, and otherwise, the transaction fails and quits.
2) And detecting whether the transaction carries token information, if so, processing the account token by the system according to the transaction block information, and if not, not processing.
3) And packing and generating block information according to the sorting result of the order node, broadcasting the block information to other nodes of the organization and executing transaction.
4) And finally, returning the transaction result to the client, and completing the transaction.
As shown in fig. 4, the channel is closed within a token-bearing channel or token-free channel created by the federation chain:
1) When the client needs to close the channel, the system firstly authenticates the identity through the digital certificate, if the authentication is successful, the action of closing the channel is started, otherwise, the channel is failed to close and quit.
2) If the channel has a token, finally writing the token value of the client into the account chain, and returning the result to the client; if the token is not involved, the channel is directly closed, and the transaction is stopped.
As shown in FIG. 5, a cross-chain transaction:
when a new chunk is generated in a channel, the hash value of the chunk is written into the global ordering chain. When cross-chain operation is needed at a certain moment, the global sequencing chain is directly accessed to obtain the block information of the time node, and even if the number of the blocks is increased subsequently, the consistency of the block operation at the current moment cannot be influenced.
Global ordering chain: when a new block is generated in the channel, the hash values of all blocks are recorded in sequence.
In light of the foregoing description of preferred embodiments according to the invention, many modifications and variations can be made by the worker skilled in the art without departing from the scope of the invention. The technical scope of the present invention is not limited to the content of the specification, and must be determined according to the scope of the claims.