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 some, but not all, embodiments of the present 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 the embodiments and features of the embodiments in the present application may be combined with each other without conflict. The present application will be described in detail below with reference to the embodiments with reference to the attached drawings.
Fig. 1 is a schematic diagram of an information processing system based on a block chain according to an embodiment of the present invention.
As shown in fig. 1, the system may include an end node 10, an authentication node 20, a packing node 30, and a blockchain 40. The terminal node 10, the verification node 20, and the packaging node 30 may be electronic devices such as a personal computer, a smart phone, a tablet computer, a personal digital assistant, and a server. These electronic devices may be installed with various messaging client applications, such as instant messaging tools, mailbox clients, social platform software, audio video software, and the like. These electronic devices have memories, logical operation processors, control elements, and the like. The electronic devices can send data requests or receive data requests, and can analyze, verify, store and the like the data.
The terminal node 10 may be, among other things, an initiator of the information to be processed or a recipient of the information. The authentication node 20 may authenticate the information sent by the end node 10. Packing node 30 may pack information verified by verification node 20 in a blockchain. The block chain 40 may include a plurality of blocks, such as block n and block n + 1. Wherein Tx represents information independently transmitted by each node, block n is the current block height block number, the block chain packages the received information into blocks in a certain sequence after verifying the received information, and increases the block chain in a form that the cryptography is not tampered with by using a form of random number-hash value.
It should be understood that the number of devices in fig. 1 is merely illustrative, and that the actual number is not limiting. In addition, cables, interactive machines and other devices can be arranged in the device in fig. 1.
Fig. 2 is a flowchart illustrating an information processing method based on a block chain according to an embodiment of the present invention. The present embodiment can be applied to the terminal node 10 side. The implementation subject of this example may be the end node 10.
As shown in fig. 2, the method comprises the steps of: s210, setting a nonrepeating interactive sequence number nonce within a preset interactive sequence number range for the interactive information to be processed; and S220, sending the interactive information with the interactive sequence number nonce to the block chain.
In some embodiments, the interaction sequence number nonce that does not repeat within the preset interaction sequence number range may be a random number or an index related to the interaction information.
Specifically, the setting rule of the interactive sequence number nonce is no longer limited by the nonce +1 strictly following the latest package information of the user in the block chain. The nonce randomization method can solve the problem that information concurrency cannot be realized due to nonce serialization in the past. Existing nonce sequencing mechanisms want to force the coherence of information through the blockchain to be performed, which results in non-serial information also having to be initiated serially. The Nonce setting manner in this example may be implemented by handing the information continuity to the information originator (e.g., the terminal node 10) outside the blockchain, where the blockchain is only responsible for receiving the information and is not responsible for the context of the information. The blockchain may batch package and then verify the information received during the out-of-block interval (this aspect is described in more detail below). The parallel processing of the information can be realized through the mode.
The block chain records the user transaction method, which means that the information sent by the user is approved by the block chain network and recorded in a certain block.
Fig. 3 is a flowchart illustrating an information processing method based on a block chain according to one or more embodiments of the present invention. The present embodiment can be applied to the terminal node 10 side. The implementation subject of this example may be the end node 10.
As shown in fig. 3, the method comprises the steps of: s310, setting an unrepeated interaction sequence number nonce within a preset interaction sequence number range for the interaction information to be processed; s320, calculating a packing block height threshold value blockLimit for the interactive information based on the current block height number in the block chain; s330, setting a packing block height threshold blockLimit for the interactive information; and S340, signing the interaction information with the interaction sequence number nonce and the packing block height threshold blockLimit, and sending the signed interaction information to the block chain.
In some embodiments, the packing block height threshold blockLimit is: the sum of the current block height blockNumber and the block height offset.
In some embodiments, the block height offset is: the ratio of the preset information timeout waiting time to the block out interval of the block chain. Wherein the preset information timeout waiting time can be 1-3 minutes. Out-of-block is meant to be packed. The block output interval or block output time is a time interval for generating blocks, and is generally a relatively fixed value, for example, the bit currency block output interval is about 10 minutes, and the ether block output time is about 14 seconds. The block height offset is typically 10 to 50 blocks.
Specifically, the newly introduced blockLimit is a convention for timeliness of information, and is a description of the absolute value of the blockNumber (current block height). The description indicates that the packing node can only pack this information into blocks with a block number ≦ block limit. So set, the information originator specifies a blockLimit equal to the current block height plus an offset (e.g., 50) when sending the information. After a period of time, when the information initiator finds that the height of the latest block on the block chain is greater than the block limit defined by the information, the information initiator can affirm the information without worry and then the information can not be packed, and the information initiator can retransmit or modify the information content to retransmit the related information.
The steps of one embodiment in the embodiment of fig. 3 may be the following steps added to the embodiment of fig. 2:
calculating a packing block height threshold value blockLimit for the interactive information based on the current block height number in the block chain;
and setting a packing block height threshold blockLimit for the interactive information, and sending the interactive information with the interactive sequence number nonce and the packing block height threshold blockLimit to the block chain.
The steps of another embodiment in the embodiment of fig. 3 may be the following steps added to the above embodiment: and signing the interaction information with the interaction sequence number nonce and the packing block height threshold blockLimit, and sending the signature to the block chain.
Wherein the signature may be a digital signature of the information using an asymmetric cryptographic algorithm.
The interaction information initiated by the user in the embodiments may be:
Tx=TData+nonce+Sign(TData+nonce,SK) (1)
wherein, TData may be Content of interactive information, Sk may be an account private Key, and Sign (Content, Secret Key) may be a signature algorithm of information interaction.
The interaction information initiated by the user in the above embodiments may also be:
Tx=TData+nonce+blockLimit+Sign(TData+nonce+blockLimit,SK) (2)
therefore, the present embodiment can determine the parallelism of information by Nonce randomization and the certainty of information interaction by blockLimit.
Fig. 4 is a flowchart illustrating an information processing method based on a blockchain according to another embodiment of the present invention. The present embodiment may be applied to the blockchain network side, which may include the verification node 20 and the packing node 30.
As shown in fig. 4, the method comprises the steps of: s410, receiving interactive information; s420, analyzing an interaction sequence number nonce in the interaction information; s430, verifying whether the nonce is repeated in a preset interactive sequence number range; and S440, when the nonce is not repeated within the preset interaction sequence number range, packaging the interaction information in the block chain. Wherein the implementation subject of S410-S430 may be the authentication node 20. The implementation body of S4440 may be the packing node 30.
As a first modified embodiment of the embodiment shown in fig. 4, the following steps can be added to the embodiment shown in fig. 4: analyzing a packing block height threshold blockLimit in the interactive information; verifying whether the packing block height threshold blockLimit is greater than the current block height blockNumber or not; and when the packing block height threshold value blockLimit is greater than the current block height blockNumber, packing the interactive information in the block chain.
In some embodiments, the packing block height threshold blockLimit is: the sum of the current block height blockNumber and the block height offset.
In some embodiments, the block height offset is: the ratio of the preset information timeout waiting time to the block out interval of the block chain.
As a second variant of the embodiment shown in fig. 4, the following steps can be added to the embodiment shown in fig. 4: a packing block height range blockWindow for limiting the packing block height threshold blockLimit is set.
As a third variant of the embodiment shown in fig. 4, the following steps may be added to the second variant of fig. 4:
verifying whether the packing block height threshold blockLimit is smaller than the sum of the current block height blockNumber and the packing block height range blockWindow;
and when the blockLimit is smaller than the sum of the blockNumber and the blockWindow, packaging the interactive information in the block chain.
In particular, considering that the originator may be for subjective or objective reasons (e.g., hope that his information may be present longer on the blockchain network to increase the likelihood of packaging or that the information program is erroneous), the originator may set a very large blockLimit, e.g., the blockLimit equals the block height at the time of origination of the information plus 10000. In this case, information with high real-time requirements may not be given the opportunity to be preferentially packed. For this case, this embodiment introduces a blockWindow (packing range) parameter to be used on the block chain node. Under the parameter definition, one information Tx can only be packed in a block satisfying the following range of block heights:
Tx.blockLimit-blockWindow<blockNumber<Tx.blockLimit (3)
thus, when a message Tx initiated by the message originator sets a very large blockLimit, its message will be saved by the node as pending until the blockchain height reaches near the blockLimit set by the message, and the node will not consider whether or not to pack it.
The introduction of the blockLimit simultaneously solves a problem introduced by nonce randomization, namely a replay attack problem. A replay attack refers to the same information being packed two or more times by the blockchain, resulting in the loss of interest to the information originator. For example, node a sends digital information to node B, the corresponding information being Tx. Under the conventional nonce continuation scheme, the nonce of each piece of information is determined to be incremented, and the blockchain only needs to verify whether the nonce of the packaged information Tx is equal to the current nonce + 1. Since the nonce is smaller than the current nonce, the Tx once packaged cannot be packaged again, and an attacker cannot forge the digital signature of the Tx, and therefore cannot modify the value of the nonce manually. The conventional nonce continuation scheme does not have the replay attack problem. Once the nonce is changed to a random value, the blockchain cannot determine whether the Tx has been packed by a simple nonce increment attribute, and thus it is difficult to prevent replay attack. The introduction of blockLimit solves this problem. Specifically, because of a certain Tx (whether it is packed normally or replayed), it can only be packed inside a block of [ Tx. The blockchain only needs to check whether the information originated by the information originator within the block height is repeated. Beyond the block range, the information is not packetized even if retransmitted.
Therefore, the embodiment overcomes the defects that the traditional block chain information cannot be parallelized and the information result is uncertain through three technical improvements including nonce randomization, block limit block and block window range definition.
As a fourth variant of the embodiment shown in fig. 4, the following steps (before the step of parsing the sequence number nonce in the interworking information) may be added to fig. 4 and its variant: analyzing the signature in the received interactive information; verifying whether the signature is valid.
Fig. 5 is a flowchart illustrating an information processing method based on a blockchain according to another embodiment of the present invention.
Wherein, the left graph is the information assembly and signature issue process of the information initiator (for example, the terminal node 10); the right diagram is the authentication and packaging flow for a blockchain network (comprising authentication node 20 and packaging node 30).
As shown in fig. 5, the method may include the steps of:
s501, start, prepare to process the mutual information.
S502, organizing data of the interactive information to be processed.
S503, setting a non-repeated interactive sequence number value within a preset interactive sequence number range for the interactive information.
S504, calculating a packing block height threshold blockLimit.
blockLimit=blockNumber+N (4)
N=t1/t2 (5)
Where N is the tile height offset, t1 is the preset information timeout waiting time, and t2 is the average tile out interval of the tile chain.
And S505, setting the calculated blockLimit for the interaction information.
S506, digitally signing and sending the interaction information.
And S507, receiving the interactive information.
And S508, verifying whether the signature data is valid. When the signature data is valid, go to step S509, otherwise go to step S513.
S509, verifying whether the packed block height threshold blockLimit is greater than the current block height blockNumber. And when the blockLimit is larger than the blockNumber, the step is switched to the step S510, and the step is switched to the step S513.
And S510, verifying whether the packing block height threshold blockLimit is smaller than the sum of the current block height blockNumber and the packing block height range blockWindow. And (5) when the blockLimit is less than the blockNumber and the blockWindow, turning to the step S511, otherwise, turning to the step S513.
S511, verifying whether the data of the interactive information is legal. When the interactive verification is legal, go to step S512, otherwise go to step S513.
And S512, verifying that the interactive data are packaged in the block chain.
S513, the verification is not passed, and the interaction information is not packaged.
Therefore, the embodiment can correct the overlarge blockLimit problem caused by the blockLimit through the parallelism of information caused by Nonce randomization, the certainty of information interaction caused by the blockLimit block limit, the blockWindow range definition, and the repeated attack problem caused by Nonce randomization through the blockLimit and the blockWindow.
In addition, the embodiment of the invention can be applied to the transaction process, and the payment network which can only be used for experimental property originally is translated into the financial system through simple modification of the block chain protocol, so that the transaction can be reliably submitted to the block chain without worrying about the reliability and instantaneity of the transaction. Without the technology, a trading party is difficult to issue multiple parallel trades simultaneously, which causes performance bottleneck; it is also difficult for the transaction party to determine whether a transaction request can return processing results within a specified time, thereby greatly affecting the immediacy of the transaction. In fact, blockchain networks are difficult to truly use in financial systems without the attributes of parallel processing and instant processing.
It should be noted that the operation contents described in fig. 2 to fig. 5 may be combined and applied to different degrees, and for brevity, implementation manners of various combinations are not described again, and a person skilled in the art may flexibly adjust the sequence of the operation steps described above according to actual needs, or flexibly combine the steps described above, and the like.
Fig. 6 is a schematic structural diagram of an information processing apparatus based on a block chain according to an embodiment of the present invention.
As shown in fig. 6, the block chain-based information processing apparatus 600 may include: a first setting unit 610 and a transmitting unit 620. The first setting unit 610 is configured to set an interaction sequence number nonce that does not repeat within a preset interaction sequence number range for the interaction information to be processed; a sending unit 620, configured to send the interworking information with the interaction sequence number nonce set to the blockchain.
In some embodiments, the interaction sequence number nonce is a random number or an index associated with the interaction information.
It should be noted that the implementation manner of the functional units shown in the present embodiment may be hardware, software, firmware, or a combination thereof. When implemented in hardware, it may be, for example, an electronic circuit, an Application Specific Integrated Circuit (ASIC), suitable firmware, plug-in, function card, or the like. When implemented in software, the elements of the invention are the programs or code segments used to perform the required tasks. The program or code segments may be stored in a machine-readable medium or transmitted by a data signal carried in a carrier wave over a transmission medium or a communication link. A "machine-readable medium" may include any medium that can store or transfer information. Examples of a machine-readable medium include electronic circuits, semiconductor memory devices, ROM, flash memory, Erasable ROM (EROM), floppy disks, CD-ROMs, optical disks, hard disks, fiber optic media, Radio Frequency (RF) links, and so forth. The code segments may be downloaded via computer networks such as the internet, intranet, etc.
As a modified embodiment of the embodiment shown in fig. 6, a calculation unit and a second setting unit may be added on the basis of the embodiment of fig. 6. The calculating unit may calculate a packed block height threshold blockLimit for the interactive information based on a current block height number in the block chain; the second setting unit may be configured to set a packing block height threshold blockLimit for the interaction information, and send the interaction information with the interaction sequence number nonce and the packing block height threshold blockLimit set to the blockchain.
In some embodiments, the packing block height threshold blockLimit is: the sum of the current block height blockNumber and the block height offset.
In some embodiments, the block height offset is: the ratio of the preset information timeout waiting time to the block out interval of the block chain.
As another variation of the embodiment shown in fig. 6, a signature unit may be added on the basis of the embodiment of fig. 6. And the signature unit is used for signing the interaction information with the interaction sequence number nonce and the packing block height threshold blockLimit and sending the signed interaction information to the block chain.
Fig. 7 is a schematic structural diagram of an information processing apparatus based on a block chain according to another embodiment of the present invention.
As shown in fig. 7, the block chain-based information processing apparatus 700 may include: a receiving unit 710, a first parsing unit 720, a first verifying unit 730, and a packing unit 740. The receiving unit 710 may be configured to receive interaction information; the first parsing unit 720 may be configured to parse an interaction sequence number nonce in the interaction information; the first verifying unit 730 may be configured to verify whether the nonce is repeated within a preset interaction sequence number range; the packing unit 740 may be configured to pack the interworking information in the blockchain when the nonce is not repeated within the preset interworking sequence number range.
In some embodiments, the interaction sequence number nonce is a random number or an index associated with the interaction information.
As a first modified embodiment of the embodiment shown in fig. 7, the embodiment of fig. 7 may be added with: a second parsing unit and a second verification unit. The second analysis unit may be configured to analyze a packing block height threshold blockLimit in the interaction information; the second verifying unit may be configured to verify whether the packed block height threshold blockLimit is greater than the current block height blockNumber; and when the packing block height threshold value blockLimit is greater than the current block height blockNumber, packing the interactive information in the block chain.
In some embodiments, the packing block height threshold blockLimit is: the sum of the current block height blockNumber and the block height offset.
In some embodiments, the block height offset is: the ratio of the preset information timeout waiting time to the block out interval of the block chain.
As a second modified embodiment of the embodiment shown in fig. 7, the following may be added to fig. 7 and its modified embodiment: a limiting unit. The limiting unit may be configured to set a packing block height range blockWindow for limiting the packing block height threshold blockLimit.
As a third modified embodiment of the embodiment shown in fig. 7, the following may be added to fig. 7 and its modified embodiment: and a third verification unit. The third verifying unit may be configured to verify whether the packing block height threshold blockLimit is smaller than a sum of the current block height blockNumber and the packing block height range blockWindow; and when the blockLimit is smaller than the sum of the blockNumber and the blockWindow, packaging the interactive information in the block chain.
As a fourth modified embodiment of the embodiment shown in fig. 7, the following may be added to fig. 7 and its modified embodiment: a third parsing unit and a fourth verifying unit. The third parsing unit may be configured to parse a signature in the received interaction information; the fourth verification unit may be adapted to verify whether the signature is valid.
It should be noted that the apparatuses in the foregoing embodiments may be used as execution main bodies in the methods in the foregoing embodiments, and corresponding flows in the methods may be implemented, and the contents in the foregoing embodiments may be referred to and used for each other, and for brevity, the contents are not described again.
The above-described embodiments of the apparatus are merely illustrative, and the units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment. One of ordinary skill in the art can understand and implement it without inventive effort.
Through the above description of the embodiments, those skilled in the art will clearly understand that each embodiment can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware. With this understanding in mind, the above-described technical solutions may be embodied in the form of a software product, which can be stored in a computer-readable storage medium such as ROM/RAM, magnetic disk, optical disk, etc., and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the methods described in the embodiments or some parts of the embodiments.
Finally, it should be noted that: the above examples are only intended to illustrate the technical solution of the present invention, but not to limit it; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.