Summary of the invention
Generally, embodiment of the disclosure provides the method, apparatus communicated in block chain and computer-readable
Storage medium is at least to be partially solved the above and other potential problems of the prior art.
The first aspect of the embodiment of the present disclosure provides a kind of method communicated in block chain.This method comprises:
A. using specified signature algorithm, the signing messages for the data information is generated based on private key and data information, wherein
The private key is generated according to the signature algorithm;B. at least one node into block chain network sends first message, with
So that at least one described node is able to verify that the first message, the first message include the data information, the label
Name information and type information, wherein the type information indicates the specified signature algorithm.
The second aspect of the embodiment of the present disclosure provides a kind of device communicated in block chain.The device includes:
Memory, for storing instruction;And processor, it is coupled to the memory, makes institute when executed
State processor and execute following operation: A. is generated based on private key and data information and is believed for data using specified signature algorithm
The signing messages of breath, wherein the private key is generated according to the signature algorithm;B. it is saved at least one of block chain network
Point sends first message, so that at least one described node is able to verify that the first message, the first message include institute
State data information, the signing messages and type information, wherein the type information indicates the specified signature algorithm.
It, can be with before step (operation) A in an example of the method and apparatus of above-mentioned first, second aspect
It include: that the specified signature algorithm is determined based on application demand.
In an example of the method and apparatus of above-mentioned first, second aspect, the finger is determined based on application demand
Fixed signature algorithm may include: based on business feature, safety, computation complexity and to execute at least one in speed come really
The fixed specified signature algorithm.
One example of the method and apparatus of above-mentioned first, second aspect can also include: at least one described node
Send public key corresponding with the private key, wherein the public key is generated according to the signature algorithm.
The third aspect of the embodiment of the present disclosure provides a kind of method communicated in block chain.This method comprises:
The first message of at least one node in block chain network is received, the first message includes data information, for institute
State the signing messages and type information of data information, wherein the type information instruction is associated with the signing messages
Signature algorithm;Based on the type information, the signature algorithm is determined;Using the public key of the signature algorithm to the A.L.S.
Breath is verified.
The fourth aspect of the embodiment of the present disclosure provides a kind of device communicated in block chain.The device includes:
Memory, for storing instruction;And processor, it is coupled to the memory, makes institute when executed
It states processor and executes following operation: receiving the first message of at least one node in block chain network, described first disappears
Breath includes data information, signing messages and type information for the data information, wherein type information instruction with
The associated signature algorithm of signing messages;Based on the type information, the signature algorithm is determined;It is calculated using the signature
The public key of method verifies the signing messages.
In above-mentioned third, an example of the method and apparatus of fourth aspect, be based on the type information, determine described in
Signature algorithm may include: that the signature algorithm is selected from multiple signature algorithms based on the type information.
In above-mentioned third, an example of the method and apparatus of fourth aspect, the public key is and the signing messages
Together received from least one node.
5th aspect of the disclosure provides a kind of computer readable storage medium.The computer-readable recording medium storage
There are instruction, the method that described instruction is used to execute the description of first according to the disclosure, third aspect.
Embodiment of the disclosure provides the scheme communicated in block chain, and the program can be compatible with multiple signatures and calculate
Method carries out signature and sign test so that in the design and exploitation of block catenary system can expanded application scene, compatible other systems
Demand to signature and sign test, and easily design the block catenary system for meeting specific cryptosystem requirement.
Specific embodiment
Now embodiment of the disclosure is specifically described in conjunction with attached drawing.It should be noted that similar in attached drawing
Component or functional unit may use same number mark.Appended attached drawing is intended only to illustrate embodiment of the disclosure.
The reality that those skilled in the art can be substituted from the description below on the basis of without departing from disclosure spirit and scope
Apply mode.
Term as used herein "include", "comprise" and similar terms are understood to open term, i.e.,
" including/including but not limited to ", expression can also include other contents.Term "based" is " being based at least partially on ".Term
" one embodiment " expression " at least one embodiment ";Term " another embodiment " expression " at least one other embodiment ",
Etc..Word " exemplary " expression " serving as example, example or illustration " is used herein.Described herein as " exemplary "
Any embodiment be all not necessarily construed to for other embodiments be preferred or advantageous.
Technology, method and apparatus known to person of ordinary skill in the relevant may be not discussed in detail, but suitable
In the case of, the technology, method and apparatus should be considered as part of specification.For between each unit in attached drawing
Line, it is only for convenient for explanation, indicate that the unit at least line both ends is in communication with each other, it is not intended that limitation does not connect
It can not be communicated between the unit of line.
As previously mentioned, needing to protect the data of inter-node communication using signature algorithm in the normal operation of block chain.
Digital signature (Digital Signature) is a kind of similar common physical signature (handwritten signature) write on paper, still
The technology in public key encryption field has been used to realize, also known as public key digital signature, for identifying digital information, so that signature is not
It can forge and non-repudiation.Signature algorithm usually defines the complementary operation of the two, and one is used to sign, another is for verifying.
Digital signature uses rivest, shamir, adelman, for example including RSA, DSA, ECDSA (Elliptic Curve Digital
Signature Algorithm, elliptic curve digital signature algorithm) etc..Rivest, shamir, adelman uses public private key pair, works as signature
When algorithm works, data are signed using private key to obtain signing messages, signing messages is verified using public key later.
For example, usually using ECDSA as signature algorithm, common ellipse curve signature algorithm has in the designing and developing of block chain
Close (the domestic cryptographic algorithm that Guo Miji State Commercial Cryptography Administration is assert) the SM2 algorithm of ED25519, Secp256k1 and state, these algorithms
The specific elliptic curve function of a certain item is used, corresponding signature private key and public key can be generated.However, in existing block
In chain technology, a kind of specific signature algorithm is generallyd use when being communicated in block chain and carries out signature and sign test, for example,
Tendermint uses ED25519, and ether mill uses Secp256k1, this makes the design and development of block chain
Lack scalability in terms of sign test of signing.
In view of this, embodiment of the disclosure provides what a kind of a variety of signature algorithms compatible in block chain were communicated
Solution.According to the difference of block chain participant, block chain is typically divided into three type of publicly-owned chain, alliance's chain and privately owned chain
Type.Publicly-owned chain opening, user can access block chain network and block data without any authorization, initiate various friendships
Easily.Alliance's chain limits the member in only alliance and could participate in, the correlation that the operating right on block chain is customized according to alliance
Rule determines.Privately owned chain generally uses inside private organization, the operating right on block chain according to private organization voluntarily
Regulation executes.Embodiment of the disclosure can be adapted for above-mentioned various types of block chains.
Fig. 1 is shown in which that the schematic diagram of the exemplary block chain network 100 of embodiment of the disclosure may be implemented.Block
Chain network 100 includes multiple block chain nodes 101,102,103,104.Since block chain technology has decentralization, distribution
Characteristic, each block chain node can intercourse information by various communication medias.Each area in block chain node 101-104
Block chain node is based on signature algorithm when sending data and is signed using private key to data, and the block chain node of data is received
The signature of data is verified using the public key of signature algorithm, to prevent data from maliciously being forged and being distorted.User can be with
Transaction is initiated in block chain network 100.It should be appreciated that the data transmitted between node may include Client-initiated transaction or section
Any other data communicated between point.
Fig. 2 shows the flow charts of the method 200 according to an embodiment of the present disclosure communicated in block chain.It can be with
Implementation method 200 at block chain node in block chain network 100 shown in Fig. 1.Method 200 the following steps are included:
Step 201: using specified signature algorithm, the label for the data information are generated based on private key and data information
Name information, wherein the private key is generated according to the signature algorithm.In this step, node uses the private generated by signature algorithm
Key signs to obtain signing messages to data information.For example, making at the node 101 in the block chain network 100 of Fig. 1
With the ED25519 signature algorithm in ECDSA, signed based on the private key generated by ED25519 signature algorithm to data information
To obtain corresponding signing messages.
Step 202: at least one node into block chain network sends first message, so that at least one node
It is able to verify that first message, first message include the data information, the signing messages and type information, wherein the type letter
Breath indicates the specified signature algorithm.In this step, compared with prior art, in the message transmitted between node, in addition to packet
It includes except data information and signing messages, which further comprises the message for being used to indicate signature algorithm.For example, in Fig. 1
Node 101 at, at least one node (for example, node 102) into block chain network 100 sends (or broadcast) first and disappears
Breath, first message include data information, signing messages and type information, and the instruction of the type information, which generates the signing messages, to be made
Signature algorithm, such as ED25519 signature algorithm.For example, type information can be indicator corresponding with signature algorithm,
If indicator is 1 byte length, it can serve to indicate that up to 256 kinds of signature algorithms.
Optionally, in one embodiment, before step 201, method 200 can also include: based on application demand come
Determine the specified signature algorithm.For example, node 101 can determine a label for application demand from multiple signature algorithms
Name algorithm signs to data information.
Optionally, in one embodiment, determine that the specified signature algorithm may include: to be based on based on application demand
Business feature, safety, computation complexity and execute in speed at least one of determine the specified signature algorithm.Different
Signature algorithm is likely to be suited for different business, and there is different safeties, computation complexity and execute speed etc., therefore
It, can be based on one or more factors in business feature, safety, computation complexity and execution speed etc. under different scenes
To determine used signature algorithm.It may include key formation speed, encrypting and decrypting speed, sign and test for example, executing speed
Sign speed etc..
Optionally, in one embodiment, method 200 can also include: to send and private key phase at least one node
Corresponding public key, wherein the public key is generated according to the signature algorithm.Signature algorithm is generated public private key pair and is generated using private key
Signing messages verifies the signing messages received to be able to use public key at receiving node, and sending node can will be public
Key is sent to receiving node.For example, public key can be sent jointly to receiving node in company with signing messages.
By embodiment of the disclosure described in Fig. 2, provides compatible multiple signature algorithms in block chain and signed
The communication solution of name so that in the design and exploitation of block chain can expanded application scene, compatible various signature algorithms
Demand to signature, and easily design and meet the block chain of specific cryptosystem requirement and (such as signed using the close SM2 of state
Name) system.
Fig. 3 shows the flow chart of the method 300 according to an embodiment of the present disclosure communicated in block chain.It can be with
Implementation method 300 at block chain node in block chain network 100 shown in Fig. 1.Method 300 the following steps are included:
Step 301: receiving the first message of at least one node in block chain network, first message includes data
Information, signing messages and type information for the data information, wherein the instruction of the type information is related to the signing messages
The signature algorithm of connection.For example, the first message sent by node 101 is received at the node 102 of the block chain network of Fig. 1, the
One message includes data information, signing messages and message for the data information, and the type message is indicated and generated
The associated signature algorithm of signing messages.For example, the type message can be indicator corresponding with signature algorithm, if referred to
Show that symbol is 1 byte length, then can serve to indicate that up to 256 kinds of signature algorithms.
Step 302: being based on the type information, determine the signature algorithm.For example, node 102 can pass through the type information
It is that any signature algorithm has been used to sign data information to determine.
Step 303: the signing messages being verified using the public key of the signature algorithm.In this step, receiving node
It is verified using the public key of signature algorithm to based on the signing messages that private key obtains.
Optionally, in one embodiment, it is based on the type information, determines that the signature algorithm may include: based on such
Type information selects the signature algorithm from multiple signature algorithms.For example, if block chain network 120 support ED25519,
Secp256k1, the close SM2 signature algorithm of state, and the type information instruction ED25519 signature algorithm that node 102 receives, then save
Point 102 can select from ED25519, Secp256k1, the close SM2 signature algorithm of state ED25519 signature algorithm for verify signature
Information.
Optionally, in one embodiment, which is together with the signing messages received from least one node.
As described in the method 200 above for Fig. 2, sending node can send public key corresponding with private key to receiving node.
Correspondingly, at receiving node, it can receive the public key that the companion signing messages from sending node is sent together.
By embodiment of the disclosure described in Fig. 3, provides compatible multiple signature algorithms in block chain and tested
The communication solution of label so that in the design and exploitation of block chain can expanded application scene, compatible various signature algorithms
Demand to sign test, and easily design and meet the block chain of specific cryptosystem requirement and (such as tested using the close SM2 of state
Label) system.
Fig. 4 shows the schematic diagram of the device 400 according to an embodiment of the present disclosure that signature is verified in block chain.Device
400 may include: memory 401 and the processor 402 for being coupled to memory 401.Memory 401 for storing instruction, is handled
Device 402 is configured as the instruction stored based on memory 401 realize device 400 for method described in Fig. 2 and Fig. 3
One or more of any step in step.
As shown in figure 4, device 400 can also include communication interface 403, for carrying out information exchange with other equipment.This
Outside, device 400 can also include bus 404, and memory 401, processor 402 and communication interface 403 are by bus 404 come each other
It is communicated.
Memory 401 may include volatile memory, also may include nonvolatile memory.Processor 402 can be with
It is central processing unit (CPU), microcontroller, specific integrated circuit (ASIC), digital signal processor (DSP), field-programmable
Gate array (FPGA) or other programmable logic device or the one or more collection for being configured as realization the embodiment of the present invention
At circuit.
In addition, alternatively, the above-mentioned method for verifying signature in block chain can have by computer program product
The computer readable storage medium of shape embodies.Computer program product may include computer readable storage medium, upload
There are the computer-readable program instructions for executing various aspects of the disclosure.Computer readable storage medium, which can be, to be protected
Hold and store the tangible device of the instruction used by instruction execution equipment.Computer readable storage medium for example can be but unlimited
In storage device electric, magnetic storage apparatus, light storage device, electric magnetic storage apparatus, semiconductor memory apparatus or above-mentioned any
Suitable combination.The more specific example (non exhaustive list) of computer readable storage medium include: portable computer diskette,
Hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read only memory (EPROM or flash memory),
Static random access memory (SRAM), Portable compressed disk read-only memory (CD-ROM), digital versatile disc (DVD), note
Recall stick, floppy disk, mechanical coding equipment, the punch card for being for example stored thereon with instruction or groove internal projection structure and above-mentioned
Any appropriate combination.Computer readable storage medium used herein above is not interpreted instantaneous signal itself, such as wirelessly
The electromagnetic wave of electric wave or other Free propagations, the electromagnetic wave propagated by waveguide or other transmission mediums are (for example, pass through optical fiber
The light pulse of cable) or pass through electric wire transmit electric signal.
The foregoing is merely the alternative embodiments of the disclosure, are not limited to embodiment of the disclosure, for this field
Technical staff for, embodiment of the disclosure can have various modifications and variations.It is all embodiment of the disclosure spirit and
Within principle, made any modification, equivalence replacement, improvement etc., should be included in embodiment of the disclosure protection scope it
It is interior.In addition, although may about one in several embodiments come disclose embodiment special characteristic or in terms of, can be with
One or more of the other features or aspect of this features or aspect and other embodiment are combined, this is because its is right
It is expectation for any given or specific application and advantageous.
Although describing embodiment of the disclosure by reference to several specific embodiments, it should be appreciated that, the disclosure
Embodiment is not limited to disclosed specific embodiment.Embodiment of the disclosure be intended to cover appended claims spirit and
Included various modifications and equivalent arrangements in range.Scope of the following claims is to be accorded the broadest interpretation, thus comprising
All such modifications and equivalent structure and function.