Disclosure of Invention
In view of this, the present invention provides a federation chain signature generation method and apparatus, which can effectively avoid the occurrence of a "chain dropping" phenomenon of a federation chain.
The embodiment of the invention provides a federation chain signature generation method applied to a server, which comprises the following steps:
acquiring block information of each block in a alliance chain;
and aiming at each block, generating a multiple signature of the block according to the acquired information of each block, and storing the multiple signature to the block.
Optionally, the step of generating, for each block, a multiple signature of the block according to the obtained information of each block includes:
aiming at each block, generating a normalized signature, a first signature and a second signature of the block according to the acquired information of each block;
the normalized signature, the first signature, and the second signature are combined to obtain a multiple signature for the block.
Optionally, the normalized signature is obtained by:
and generating a normalized signature of the alliance chain according to the acquired information of each block.
Optionally, the first signature is obtained by:
and for each block, generating a first signature of the block according to other block information except the block information of the block in the alliance chain.
Optionally, the second signature is obtained by:
and generating a second signature of the block according to the block information of the block aiming at each block.
The embodiment of the invention also provides a federation chain signature generation device, which is applied to a server side and comprises:
the block information acquisition module is used for acquiring the block information of each block in the alliance chain;
and the multiple signature generating module is used for generating a multiple signature of each block according to the acquired information of each block and storing the multiple signature to the block.
Optionally, the multiple signature generating module generates, for each block, a multiple signature of the block according to the obtained information of each block by:
aiming at each block, generating a normalized signature, a first signature and a second signature of the block according to the acquired information of each block;
the normalized signature, the first signature, and the second signature are combined to obtain a multiple signature for the block.
Optionally, the multiple signature generation module obtains the normalized signature by:
and generating a normalized signature of the alliance chain according to the acquired information of each block.
Optionally, the multiple signature generation module obtains the first signature by:
and for each block, generating a first signature of the block according to other block information except the block information of the block in the alliance chain.
Optionally, the multiple signature generation module obtains the second signature by:
for each block, generating a second signature of the block according to the block information of the block
The embodiment of the present invention further provides a server, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, where the processor implements the federation chain signature generation method when executing the computer program.
The embodiment of the present invention further provides a computer-readable storage medium, where the computer-readable storage medium includes a computer program, and when the computer program runs, the computer program controls a server where the computer-readable storage medium is located to execute the above federation chain signature generation method.
Advantageous effects
The federation chain signature generation method provided by the embodiment of the invention can generate corresponding multiple signatures for each block in a federation chain, further efficiently and safely determine the identity of each block, and can avoid 'chain disconnection' of the block caused by undefined identity when the federation chain is expanded or forked.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. The components of embodiments of the present invention generally described and illustrated in the figures herein may be arranged and designed in a wide variety of different configurations.
Thus, the following detailed description of the embodiments of the present invention, presented in the figures, is not intended to limit the scope of the invention, as claimed, but is merely representative of selected embodiments of the invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
It should be noted that: like reference numbers and letters refer to like items in the following figures, and thus, once an item is defined in one figure, it need not be further defined and explained in subsequent figures.
The inventor has found that, in addition to satisfying the consensus mechanism, the generation of each block in the federation chain adds a lot of additional information, such as hash values, signatures, and indexes. Each piece of additional information is formed through a complex algorithm, but the signature of each block is generated by itself, when a federation chain expands or diverges in an actual application scenario, the signature of each block may not serve as an identification standard of the block, which may cause the block to be "out-of-chain", and in addition, the block hash value serving as one of important identification standards of the block may be lost in some specific scenarios, and at this time, it is difficult to determine the identity of the block by means of the signature generated by itself of the block, which may also cause the block to be "out-of-chain".
The above prior art solutions have shortcomings which are the results of practical and careful study of the inventor, and therefore, the discovery process of the above problems and the solutions proposed by the following embodiments of the present invention to the above problems should be the contribution of the inventor to the present invention in the course of the present invention.
Based on the above research, embodiments of the present invention provide a federation chain signature generation method and apparatus, which can generate a corresponding multiple signature for each block in a federation chain, and further efficiently and safely determine an identity of each block, and when a federation chain expands or diverges, can avoid "delinking" of a block due to an ambiguous identity.
Fig. 1 is a block diagram illustrating aserver 10 according to an embodiment of the present invention. Theserver 10 in the embodiment of the present invention has data storage, transmission, and processing functions, and as shown in fig. 1, theserver 10 includes: memory 11,processor 12,network module 13 and federation chain signature generation means 20.
The memory 11, theprocessor 12 and thenetwork module 13 are electrically connected directly or indirectly to realize data transmission or interaction. For example, the components may be electrically connected to each other via one or more communication buses or signal lines. The storage 11 stores a federation chainsignature generation apparatus 20, the federation chainsignature generation apparatus 20 includes at least one software functional module which can be stored in the storage 11 in the form of software or firmware (firmware), and theprocessor 12 executes various functional applications and data processing by running software programs and modules stored in the storage 11, such as the federation chainsignature generation apparatus 20 in the embodiment of the present invention, so as to implement the federation chain signature generation method in the embodiment of the present invention.
The Memory 11 may be, but is not limited to, a Random Access Memory (RAM), a Read Only Memory (ROM), a Programmable Read-Only Memory (PROM), an Erasable Read-Only Memory (EPROM), an electrically Erasable Read-Only Memory (EEPROM), and the like. The memory 11 is used for storing a program, and theprocessor 12 executes the program after receiving an execution instruction.
Theprocessor 12 may be an integrated circuit chip having data processing capabilities. TheProcessor 12 may be a general-purpose Processor including a Central Processing Unit (CPU), a Network Processor (NP), and the like. The various methods, steps and logic blocks disclosed in embodiments of the present invention may be implemented or performed. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
Thenetwork module 13 is used for establishing communication connection between theserver 10 and other communication terminal devices through a network, and implementing transceiving operation of network signals and data. The network signal may include a wireless signal or a wired signal.
It is understood that the configuration shown in fig. 1 is merely illustrative, and that theserver 10 may include more or fewer components than shown in fig. 1, or have a different configuration than shown in fig. 1. The components shown in fig. 1 may be implemented in hardware, software, or a combination thereof.
An embodiment of the present invention also provides a computer-readable storage medium, which includes a computer program. The computer program controls theserver 10 on which the readable storage medium is located to execute the following federation chain signature generation method when running.
Fig. 2 shows a flowchart of a federation chain signature generation method according to an embodiment of the present invention. The method steps defined by the flow related to the method are applied to theserver 10 and can be implemented by theprocessor 12. The specific process shown in FIG. 2 will be described in detail below:
in step S21, chunk information of each chunk in the federation chain is obtained.
For example, federation chain a includes 3 blocks: block1、Block2And Block3。
Each block includes various block information such as hash value and index.
Theserver 10 will obtain Block1、Block2And Block3The block information in (1).
In step S22, for each tile, a multiple signature of the tile is generated according to the obtained information of each tile, and the multiple signature is stored in the tile.
It can be understood that most of common block signatures are generated by a block, the recognition degree is low, and when the hash value of the block is lost, the identity of the block is difficult to identify by the block signature alone, which may cause the block to be "out of chain".
In this embodiment, multiple signatures are generated for each block in the federation chain based on global and local pairs, thereby ensuring that the identity of each block can be identified efficiently, safely, and accurately.
In this embodiment, the multiple signatures include three types of signatures: the normalized signature, the first signature, and the second signature.
The normalized signature is emphasized on the whole, the first signature and the second signature are emphasized on the local, and therefore the whole and the local are combined to form a firm signature authentication network, and the block is effectively prevented from being out of link due to the fact that the identity is difficult to identify.
Referring to fig. 3 and fig. 4, in the present embodiment, one implementation manner of the step S22 is illustrated by the steps S221, S222, and S223.
And step S221, generating a normalized signature of the alliance chain according to the acquired information of each block.
The normalized signature of federation chain a is calculated from block information of all blocks on federation chain a, and in this embodiment, the normalized signature is signA。
In step S222, for each block, a first signature of the block is generated according to other block information except the block information of the block in the federation chain.
It will be appreciated that the first signature is for a tableCharacterizing relationships between blocks and other blocks in a federation chain, e.g., Block1First signature sign23Can pass through Block2And Block3The Block information is calculated, and similarly, the Block can be calculated2First signature sign13And Block3First signature sign12。
It should be understood that the generation manner of the second signature may be adjusted according to actual situations, and is not limited herein as long as the relationship between the blocks can be embodied.
In step S223, for each block, a second signature of the block is generated according to the block information of the block.
The second signature being used to characterize the information of the Block itself, e.g. Block1Second signature sign1Can pass through Block1The block information of (2) is calculated.
Further, the normalized signature, the first signature, and the second signature are combined and then stored into the corresponding tile.
Please continue to refer to FIG. 4, using Block1For example, even if federation chain A blocks in the expansion process1The hash value of (2) is lost or can pass through signA、sign23And sign1Determining Block1Further, even signA、sign23And sign1If any one signature is lost or is in error, the Block can be determined by the remaining two signatures1The identity of the block can be effectively and safely ensured, and the block can be prevented from being out of link.
On the basis, as shown in fig. 5, an embodiment of the present invention provides a federation chainsignature generation apparatus 20, where the federation chainsignature generation apparatus 20 includes: a blockinformation acquisition module 21 and a multiplesignature generation module 22.
A blockinformation obtaining module 21, configured to obtain block information of each block in the federation chain.
Since the blockinformation obtaining module 21 is similar to the implementation principle of step S21 in fig. 2, it will not be further described here.
And a multiplesignature generating module 22, configured to generate, for each block, a multiple signature of the block according to the obtained information of each block, and store the multiple signature in the block.
Since the multiplesignature generating module 22 is similar to the implementation principle of step S22 in fig. 2, it will not be further described here.
In summary, the federation chain signature generation method and apparatus provided in the embodiments of the present invention can generate a corresponding multiple signature for each block in a federation chain, and further efficiently and safely determine the identity of each block, and when the federation chain expands or diverges, it can avoid that the block is "out of chain" due to an ambiguous identity.
In the embodiments provided in the present invention, it should be understood that the disclosed apparatus and method can be implemented in other ways. The apparatus and method embodiments described above are illustrative only, as the flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
In addition, the functional modules in the embodiments of the present invention may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.
The functions, if implemented in the form of software functional modules and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention or a part of the technical solution that substantially contributes to the prior art may be embodied in the form of a software product stored in a storage medium and including instructions for causing a computer device (which may be a personal computer, aserver 10, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes. It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention, and various modifications and changes may be made by those skilled in the art. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.