CN113094436B - Transaction storage method, parallel chain block generation method, device and storage medium - Google Patents

Transaction storage method, parallel chain block generation method, device and storage medium Download PDF

Info

Publication number
CN113094436B
CN113094436B CN202110385372.0A CN202110385372A CN113094436B CN 113094436 B CN113094436 B CN 113094436B CN 202110385372 A CN202110385372 A CN 202110385372A CN 113094436 B CN113094436 B CN 113094436B
Authority
CN
China
Prior art keywords
parallel chain
block
transaction
remainder
data
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202110385372.0A
Other languages
Chinese (zh)
Other versions
CN113094436A (en
Inventor
马登极
王志文
吴思进
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hangzhou Fuzamei Technology Co Ltd
Original Assignee
Hangzhou Fuzamei Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hangzhou Fuzamei Technology Co Ltd filed Critical Hangzhou Fuzamei Technology Co Ltd
Priority to CN202110385372.0A priority Critical patent/CN113094436B/en
Publication of CN113094436A publication Critical patent/CN113094436A/en
Application granted granted Critical
Publication of CN113094436B publication Critical patent/CN113094436B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q20/00Payment architectures, schemes or protocols
    • G06Q20/38Payment protocols; Details thereof
    • G06Q20/382Payment protocols; Details thereof insuring higher security of transaction

Abstract

The invention provides a transaction storage method, a parallel chain block generation method, equipment and a storage medium, wherein the method comprises the following steps: generating first encrypted data according to the first verification private key, the held first private key and the first data to be encrypted; and generating a first parallel chain transaction comprising first encrypted data and sending the first parallel chain transaction to the main chain so as to verify the first encrypted data according to the first verification public key and a first public key corresponding to the first private key, and storing the first parallel chain transaction into the memory pool when the first encrypted data is successfully verified. The application provides a convenient parallel chain admission mechanism.

Description

Transaction storage method, parallel chain block generation method, device and storage medium
Technical Field
The application relates to the technical field of parallel chains, in particular to a transaction storage method, a parallel chain block generation method, parallel chain block generation equipment and a storage medium.
Background
In the prior art, the admission limitation of the parallel chain mostly adopts a scheme of super account group. But the scheme admission limit of the super account group is too much and is not convenient.
Disclosure of Invention
In view of the above-mentioned drawbacks and deficiencies of the prior art, it is desirable to provide a transaction storage method, a parallel chain block generation method, a device and a storage medium which are convenient.
In a first aspect, the present invention provides a transaction storage method suitable for parallel chain nodes, where K is K × G, K is a first verification public key, and K is a first verification private key, where the method includes:
generating first encrypted data according to the first verification private key, the held first private key and the first data to be encrypted;
and generating a first parallel chain transaction comprising first encrypted data and sending the first parallel chain transaction to the main chain so as to verify the first encrypted data according to the first verification public key and a first public key corresponding to the first private key, and storing the first parallel chain transaction into the memory pool when the first encrypted data is successfully verified.
In a second aspect, the present invention provides a method for generating a parallel chain block suitable for a main chain node, where the block chain is configured with a channel and a time slot parameter, each parallel chain registers a time slot of a corresponding channel on the main chain, and a memory pool of the main chain node stores transactions stored according to the transaction storage method of the first aspect, where the method includes:
in response to obtaining the packaging right of the first block with the first block height, pulling a plurality of first transactions from the memory pool, and executing the following steps for each first transaction respectively:
when the first transaction is a parallel chain transaction, calculating a first remainder and a first quotient of the first block height and the total number of the channels;
inquiring the total number of second time slots of a second channel with the channel number being the first remainder;
calculating a second remainder of the first quotient and the total number of the second time slots;
judging whether a second parallel chain to which the first transaction belongs corresponds to a second time slot with the number of a second remainder in a second channel:
if not, the first transaction is stored in the memory pool again;
if yes, packaging the first transaction into a first block;
wherein the first block height is for parallel chain nodes of each parallel chain:
calculating a first remainder, a first quotient, and a second remainder;
judging whether the parallel chain corresponds to a second time slot:
if yes, generating a first parallel chain block according to the first block;
otherwise, the first block head of the first block is synchronized.
In a third aspect, the present invention provides a parallel chain block generating method suitable for parallel chain nodes, where a block chain is configured with channel and time slot parameters, each parallel chain registers a time slot of a corresponding channel on a main chain, and a memory pool of the main chain node stores transactions stored according to the transaction storing method in the first aspect, where the method includes:
obtaining a first block of a main chain; the first block is packed with a plurality of first transactions, the packed first transactions comprise a plurality of first transactions pulled from a memory pool in response to the main chain node obtaining the packing right of the first block with the first block height, the packed first transactions are parallel chain transactions, a second parallel chain to which the packed first transactions belong corresponds to a second time slot with a second remainder in a second channel, the second channel is a channel with a first quotient, the channel number is a channel number, the first quotient is a quotient of the first block height and the total number of the channels, the second remainder is the remainder of the first quotient and the total number of the second time slot, the total number of the second time slot is the total number of the time slot of the second channel with the first remainder, and the first remainder is the remainder of the first block height and the total number of the channels;
calculating a first remainder, a first quotient, and a second remainder;
judging whether the current parallel chain corresponds to a second time slot:
if yes, generating a first parallel chain block according to the first block;
otherwise, the first block head of the first block is synchronized.
In a fourth aspect, the present invention also provides an apparatus comprising one or more processors and a memory, wherein the memory contains instructions executable by the one or more processors to cause the one or more processors to perform a transaction storage method and a parallel chain block generation method provided according to embodiments of the present invention.
In a fifth aspect, the present invention also provides a storage medium storing a computer program, the computer program causing a computer to execute the transaction storage method and the parallel chain block generation method provided according to the embodiments of the present invention.
In the transaction storage method, the parallel chain block generation method, the device and the storage medium provided by the embodiments of the present invention, first encrypted data is generated by using a first private key held by a first verification private key and first data to be encrypted; and generating a first parallel chain transaction comprising first encrypted data and sending the first parallel chain transaction to the main chain so as to verify the first encrypted data according to the first verification public key and the first public key corresponding to the first private key, and storing the first parallel chain transaction into a memory pool when the first encrypted data is successfully verified, so that the parallel chain is more convenient to access.
Drawings
Other features, objects and advantages of the present application will become more apparent upon reading of the following detailed description of non-limiting embodiments thereof, made with reference to the accompanying drawings in which:
fig. 1 is a flowchart of a transaction storage method according to an embodiment of the present invention.
Fig. 2 is a flowchart of a parallel chain block generation method according to an embodiment of the present invention.
Fig. 3 is a flowchart of another parallel chain block generation method according to an embodiment of the present invention.
Fig. 4 is a schematic structural diagram of a computer device according to an embodiment of the present invention.
Detailed Description
The present application will be described in further detail with reference to the following drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the relevant invention and not restrictive of the invention. It should be noted that, for convenience of description, only the portions related to the present invention are shown in the drawings.
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 accompanying drawings in conjunction with embodiments.
Fig. 1 is a flowchart of a transaction storage method according to an embodiment of the present invention. As shown in fig. 1, in this embodiment, the present invention provides a transaction storage method suitable for parallel chain nodes, where K is K × G, K is a first verification public key, and K is a first verification private key, where the method includes:
s12: generating first encrypted data according to the first verification private key, the held first private key and the first data to be encrypted;
s14: and generating a first parallel chain transaction comprising first encrypted data and sending the first parallel chain transaction to the main chain so as to verify the first encrypted data according to the first verification public key and a first public key corresponding to the first private key, and storing the first parallel chain transaction into the memory pool when the first encrypted data is successfully verified.
Specifically, P is P × G, P is a first public key, and P is a first private key; s12 includes generating a first random number and a second random number; wherein, R is R G, R is a first random number, and R is a second random number; generating first encrypted data according to a fourth formula; where the fourth formula is S ═ k + r + pm1, where S is the first encrypted data, m1 is the first hash value of the first data, and S14 includes "calculating the fourth data according to the fifth formula; wherein, the fifth formula is m4 ═ s × G, and m4 is the fourth data; calculating fifth data according to a sixth formula; wherein the sixth formula is m5 ═ K + R + mP, and m5 is the fifth data; store the first parallel chain transaction in the memory pool when the fourth data is the same as the fifth data, for example;
the parallel link node executes step S12 to generate R and R, and generates encrypted data S, S ═ k + R + pm 1;
the parallel chain node executes the step S14, generates a parallel chain transaction including S and sends the transaction to the main chain;
the main chain node receives the parallel chain transaction;
calculating s G by the main chain node;
calculating K + R + mP by using a main chain node;
judging whether s G is equal to K + R + mP or not by the main chain node;
and when the s G is equal to K + R + mP, storing the parallel chain transaction into a memory pool.
In more embodiments, m1 may also be configured as the first data or compressed data of the first data according to actual needs, which may achieve the same technical effect, but when configured as the first data, the computation amount is large, which wastes system computation resources;
in further embodiments, P is P × G, P is a first public key, P is a first private key, and the first private key and the first public key are a one-time public and private key pair, S12 may be further configured to "generate the first encrypted data according to the first formula according to actual needs; wherein the first formula is s ═ k + pm1, where s is the first encrypted data and m1 is the first hash value of the first data; ", accordingly, S14 would be configured to" calculate second data according to a second formula; wherein, the second formula is m2 ═ s × G, and m2 is the second data; calculating third data according to a third formula; wherein, the third formula is m3 ═ K + mP, and m3 is the third data; when the second data is the same as the third data, storing the first parallel chain transaction into a memory pool; the same technical effect can be realized;
specifically, the parallel link node executes step S12 to generate encrypted data S, S — k + pm 1;
the parallel chain node executes the step S14, generates a parallel chain transaction including S and sends the transaction to the main chain;
the main chain node receives the parallel chain transaction;
calculating s G by the main chain node;
calculating K + mP by a main chain node;
judging whether s G is equal to K + mP or not by the main chain node;
and when s G + mP, storing the parallel chain transaction into a memory pool.
In further embodiments, other public and private key pairs on the same curve may also be introduced according to actual requirements, for example, if a is a G, then the encrypted data generated by the parallel chain node is s ═ k + r + a + pm, or s ═ k + a + pm (p is a one-time private key); correspondingly, when the backbone node verifies that s × G ═ K + R + a + mP, the parallel chain transaction is stored in the memory pool.
This embodiment makes the admission of parallel chain more convenient.
Preferably, before generating the first encrypted data according to the first verification private key, the held first private key and the first data to be encrypted, the method further includes:
when the current node is a management node, generating a first verification public key and a first verification private key;
generating a first registration transaction of the first verification public key and sending the first registration transaction to the main chain node for recording the first verification public key;
and when the first registration transaction is successfully executed, sending the first verification private key to a plurality of trusted first parallel chain nodes of the current parallel chain.
In more embodiments, the roles of the first verification public key and the first verification private key may also be configured according to actual requirements, for example, if the roles are configured as consensus nodes of parallel chains, the main chain may record the first verification public key generated by the consensus node of each parallel chain, and each parallel chain node may perform consensus on each first verification public key; the parallel chain nodes also receive the first verification private keys generated by the consensus nodes of the parallel chains, each parallel chain node performs consensus on each first verification private key, the parallel chain nodes judge whether the consensus first verification private key is matched with the consensus first verification public key, and when the consensus first verification private key is matched with the consensus first verification public key, the held first private key and the first data to be encrypted generate first encrypted data.
Preferably, P is P × G, P is a first public key, P is a first private key, and the first private key and the first public key are a one-time public and private key pair;
according to the first verification private key, the generation of the first encrypted data by the held first private key and the first data to be encrypted comprises the following steps:
generating first encrypted data according to a first formula; wherein the first formula is s ═ k + pm1, where s is the first encrypted data and m1 is the first hash value of the first data;
verifying the first encrypted data according to the first verification public key and a first public key corresponding to the first private key, and when the first encrypted data is successfully verified, storing the first parallel chain transaction into a memory pool comprises:
calculating second data according to a second formula; wherein, the second formula is m2 ═ s × G, and m2 is the second data;
calculating third data according to a third formula; wherein, the third formula is m3 ═ K + mP, and m3 is the third data;
and when the second data is the same as the third data, storing the first parallel chain transaction into a memory pool.
The transaction storage principle of the above embodiment can refer to the method shown in fig. 1, and is not described herein again.
Preferably, P is P G, P is the first public key, and P is the first private key;
according to the first verification private key, the generation of the first encrypted data by the held first private key and the first data to be encrypted comprises the following steps:
generating a first random number and a second random number; wherein, R is R G, R is a first random number, and R is a second random number;
generating first encrypted data according to a fourth formula; wherein the fourth formula is s ═ k + r + pm1, where s is the first encrypted data and m1 is the first hash value of the first data;
verifying the first encrypted data according to the first verification public key and a first public key corresponding to the first private key, and when the first encrypted data is successfully verified, storing the first parallel chain transaction into a memory pool comprises:
calculating fourth data according to a fifth formula; wherein, the fifth formula is m4 ═ s × G, and m4 is the fourth data;
calculating fifth data according to a sixth formula; wherein the sixth formula is m5 ═ K + R + mP, and m5 is the fifth data;
and when the fourth data is the same as the fifth data, storing the first parallel chain transaction into a memory pool.
The transaction storage principle of the above embodiment can refer to the method shown in fig. 1, and is not described herein again.
Fig. 2 is a flowchart of a parallel chain block generation method according to an embodiment of the present invention. As shown in fig. 2, in this embodiment, the present invention provides a parallel chain block generation method suitable for a main chain node, where a block chain is configured with channel and timeslot parameters, each parallel chain registers a timeslot of a corresponding channel on the main chain, the timeslots of the channels registered by each parallel chain are different, and a memory pool of the main chain node stores transactions stored according to the transaction storage method in accordance with each preferred embodiment shown in fig. 1 and fig. 1, where the method includes:
s21: in response to obtaining the packaging right of the first block with the first block height, pulling a plurality of first transactions from the memory pool, and respectively executing the following first transactions:
s221: when the first transaction is a parallel chain transaction, calculating a first remainder and a first quotient of the first block height and the total number of the channels;
s222: inquiring the total number of second time slots of a second channel with the channel number being the first remainder;
s223: calculating a second remainder of the first quotient and the total number of the second time slots;
s2241: judging whether a second parallel chain to which the first transaction belongs corresponds to a second time slot with the number of a second remainder in a second channel:
otherwise, step S2242 is executed: the first transaction is stored in the memory pool again;
if yes, go to step S2243: packaging the first transaction into a first block;
wherein the first block height is for parallel chain nodes of each parallel chain:
calculating a first remainder, a first quotient, and a second remainder;
judging whether the parallel chain corresponds to a second time slot:
if yes, generating a first parallel chain block according to the first block;
otherwise, the first block head of the first block is synchronized.
Specifically, the total number of timeslots is taken as a non-fixed value as an example; assuming the total number of channels is 100; the block chain in the time zone comprises a main chain maincalin, a parallel chain parachain 1-30 (the name of the parallel chain is pc 1-pc 30); the pc1 is registered with channel 1 time slot 0, the pc2 is registered with channel 2 time slot 0 … …, the pc29 is registered with channel 29 time slot 0, and the pc30 is registered with channel 1 time slot 1;
the main chain node responds to the packaging right of the block (1001), and executes the step S21, and the transactions tx11 to tx20 are pulled from the memory pool (the transactions tx11 to tx15 are pc1, and the transactions tx16 to tx20 are pc 2);
the main chain nodes respectively execute the following steps on tx11 to tx 20:
tx 11-tx 15 are trades of pc1, here as tx 11:
the main chain node executes step S221, and calculates a first remainder and a first quotient of 1001 and 100 because tx11 is a parallel chain transaction, where the first remainder is 1 and the first quotient is 10;
the main chain node executes step S222, and inquires the total number of time slots of channel 1, where the total number of time slots of channel 1 is 2;
the main chain node executes step S223, and calculates a second remainder of the first quotient 10 and the total number of time slots 2, where the second remainder is 0;
the main-chain node performs step S2241 to determine whether the parallel chain pc1 corresponding to tx11 corresponds to the channel 1 slot 0:
if so, executing step S2243 to pack tx11 into block (1001);
tx 12-tx 15 are the same as tx11, and are not described herein;
tx 16-tx 20 are trades of pc2, here as tx 16:
the execution principle of S221 to S223 is the same as that of tx11, and the description is omitted here;
the main chain node executes step S2241 to determine whether the parallel chain pc2 corresponding to tx16 corresponds to the channel 1 slot 0:
if not, step S1742 is executed to restore tx16 to the memory pool;
tx 17-tx 20 are the same as tx16 and are not described herein;
the final block (1001) is packaged with tx 11-tx 15;
calculating a first remainder 1, a first quotient 10 and a second remainder 0 by parallel chain nodes pc 1-pc 30;
if the parallel chain link point of the pc1 judges that the pc1 corresponds to the channel 1 time slot 0, a parallel chain block is generated according to the block (1001); those skilled in the art will appreciate that since block (1001) is packed with tx 11-tx 15, the parallel-chain node of pc1 should generate a parallel-chain block from tx 11-tx 15, and if no parallel-chain transaction of pc1 is packed in block (1001), the parallel-chain node of pc1 should generate an empty block;
and (3) if the parallel chain nodes of pc 2-pc 30 judge that the corresponding parallel chains do not correspond to the channel 1 time slot 0, synchronizing the blockheader (1001).
The main chain node responds to the packaging right of the block (1101) and executes the step S15, and transactions tx21 to tx30 (transaction tx21 to tx25 are pc30 transactions, and transaction tx26 to tx30 are pc1 transactions) are pulled from the memory pool;
the main chain nodes respectively execute the following steps on tx21 to tx 30:
tx 21-tx 25 are trades of pc30, here as tx 21:
the main chain node executes step S221, and calculates 1101 and 100 a first remainder and a first quotient number because tx21 is a parallel chain transaction, where the first remainder is 1 and the first quotient number is 11;
the main chain node executes step S222, and inquires the total number of time slots of channel 1, where the total number of time slots of channel 1 is 2;
the main chain node executes step S223, and calculates a second remainder of the first quotient 11 and the total number of time slots 2, where the second remainder is 1;
the main chain node executes step S2241 to determine whether the parallel chain pc1 corresponding to tx21 corresponds to the channel 1 slot 1:
if so, executing step S2243 to pack tx21 into block (1101);
tx 22-tx 25 are the same as tx21, and are not described herein;
tx 26-tx 30 are trades of pc1, here as tx 26:
the execution principle of S221 to S223 is the same as that of tx21, and the description is omitted here;
the main chain node executes step S2241 to determine whether the parallel chain pc1 corresponding to tx26 corresponds to the channel 1 slot 0:
if not, executing step S2242 to restore tx26 to the memory pool;
tx 27-tx 30 are the same as tx26, and are not described herein;
the final block (1101) is packaged with tx 21-tx 25;
calculating a first remainder 1, a first quotient 11 and a second remainder 1 by parallel chain nodes pc 1-pc 30;
if the parallel link point of pc30 judges that pc30 corresponds to channel 1 time slot 1, a parallel chain block is generated according to block (1101);
and (3) judging that the parallel chain node of the pc 1-pc 30 does not correspond to the channel 1 time slot 1, and synchronizing the blockheader (1101).
In further embodiments, the total number of timeslots may be configured to be a fixed value according to actual requirements, for example, the total number of timeslots of all channels is configured to be 5, or the total number of timeslots of different channels is configured to be different fixed values, for example, the total number of timeslots of channel 1 is configured to be 5, and the total number of timeslots of channel 2 is configured to be 10 … …, which may achieve the same technical effect.
In more embodiments, the total number of channels may also be configured according to actual requirements, and if a shorter transaction period of a single parallel chain is desired, the total number of channels is configured to be smaller, for example, to be 50, and if a longer transaction period of a single parallel chain is desired, the total number of channels is configured to be smaller, for example, to be 150, and the same technical effect can be achieved.
It should be understood by those skilled in the art that if all parallel chains occupy one channel, i.e., the total number of timeslots of all channels is 1, the technical effects of suppressing the congestion of the transaction peak and reducing the commission fee can be achieved. However, if only one parallel chain is registered in each channel, as the block chain network ecology develops, more and more parallel chains are added, the total number of channels becomes larger and the transaction period of a single parallel chain becomes longer. The method and the device can not prolong the transaction period of part of parallel chains on the basis of realizing the suppression of the exchange peak and reducing the handling fee, and support more parallel chains to participate in the construction of the block chain network.
It should be understood by those skilled in the art that when the method shown in the present embodiment is configured, the time slot is counted from 0, and a suitable modification may be made, for example, if the time slot needs to be counted from 1, S1741 should be configured as: and judging whether the second parallel chain to which the first transaction belongs corresponds to a second time slot with the number of the second remainder plus one in the second channel.
In the prior art, if a large amount of parallel chain transactions of pc1 are generated within a period of time, the packaging resources of the main chain transaction can be squeezed by the parallel chain transaction peak of pc1, and further the packaging congestion of the main chain transaction is caused; the embodiment can disperse the transaction of the parallel chain to different blocks, and can effectively stabilize the crowding of the transaction peak.
In the prior art, when the packing congestion situation occurs, the problem of improvement of transaction commission charge is caused; additional transaction fee costs may be incurred for some parallel chain transactions that are not particularly urgent for the uplink (e.g., parallel chain consensus transactions); the embodiment can reduce the commission cost while stabilizing the exchange peak.
Preferably, the total number of slots of each channel is a non-fixed value.
The parallel chain block generation principle of the above embodiment can refer to the method shown in fig. 2, and is not described herein again.
Preferably, the method further comprises:
receiving first request information which is sent by a third parallel chain node of a third parallel chain and requests first block data;
calculating a third remainder and a second quotient of the second block height of the main chain block where the first block data is located and the total number of the channels;
inquiring the total number of the third time slots of a third channel with the channel number as a third remainder;
calculating a fourth remainder of the second quotient and the total number of the third time slots;
judging whether the third parallel chain corresponds to a third time slot with a fourth remainder in the third channel:
if not, returning error information;
if yes, the first block data is returned.
In the prior art, since the same main chain block can have parallel chain transactions of different parallel chains, the parallel chain link point of pc1 can obtain transaction information of parallel chain transactions of other parallel chains through the main chain block;
the above-described embodiments ensure data unshared between different parallel chains.
Fig. 3 is a flowchart of another parallel chain block generation method according to an embodiment of the present invention. As shown in fig. 3, fig. 3 is a method applied to parallel chain nodes corresponding to fig. 2, and as shown in fig. 3, in this embodiment, the present invention provides a parallel chain block generation method applied to parallel chain nodes, where a block chain is configured with channel and timeslot parameters, each parallel chain registers a timeslot of a corresponding channel on a main chain, and a memory pool of the main chain node stores transactions stored according to the transaction storage method according to the first aspect, where the method includes:
s31: obtaining a first block of a main chain; the first block is packed with a plurality of first transactions, the packed first transactions comprise a plurality of first transactions pulled from a memory pool in response to the main chain node obtaining the packing right of the first block with the first block height, the packed first transactions are parallel chain transactions, a second parallel chain to which the packed first transactions belong corresponds to a second time slot with a second remainder in a second channel, the second channel is a channel with a first quotient, the channel number is a channel number, the first quotient is a quotient of the first block height and the total number of the channels, the second remainder is the remainder of the first quotient and the total number of the second time slot, the total number of the second time slot is the total number of the time slot of the second channel with the first remainder, and the first remainder is the remainder of the first block height and the total number of the channels;
s32: calculating a first remainder, a first quotient, and a second remainder;
s331: judging whether the current parallel chain corresponds to a second time slot:
if yes, go to step S332: generating a first parallel chain block according to the first block;
otherwise, step S333 is executed: the first block header of the first block is synchronized.
The parallel chain block generation principle of the above embodiment can refer to the method shown in fig. 2, and is not described herein again.
Fig. 4 is a schematic structural diagram of a computer device according to an embodiment of the present invention.
As shown in fig. 4, as another aspect, the present application also provides a computer apparatus including one or more Central Processing Units (CPUs) 401 that can perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM)402 or a program loaded from a storage section 408 into a Random Access Memory (RAM) 403. In the RAM403, various programs and data necessary for the operation of the computer apparatus are also stored. The CPU401, ROM402, and RAM403 are connected to each other via a bus 404. An input/output (I/O) interface 405 is also connected to bus 404.
The following components are connected to the I/O interface 405: an input section 406 including a keyboard, a mouse, and the like; an output section 407 including a display device such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker; a storage section 408 including a hard disk and the like; and a communication section 409 including a network interface card such as a LAN card, a modem, or the like. The communication section 409 performs communication processing via a network such as the internet. A driver 410 is also connected to the I/O interface 405 as needed. A removable medium 411 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 410 as necessary, so that a computer program read out therefrom is mounted into the storage section 408 as necessary.
In particular, according to an embodiment of the present disclosure, the method described in any of the above embodiments may be implemented as a computer software program. For example, embodiments of the present disclosure include a computer program product comprising a computer program tangibly embodied on a machine-readable medium, the computer program comprising program code for performing any of the methods described above. In such an embodiment, the computer program may be downloaded and installed from a network through the communication section 409, and/or installed from the removable medium 411.
As yet another aspect, the present application also provides a computer-readable storage medium, which may be the computer-readable storage medium included in the apparatus of the above-described embodiment; or it may be a computer-readable storage medium that exists separately and is not assembled into a computer device. The computer readable storage medium stores one or more programs for use by one or more processors in performing the methods described in the present application.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, 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.
The units or modules described in the embodiments of the present application may be implemented by software or hardware. The described units or modules may also be provided in a processor, for example, each of the described units may be a software program provided in a computer or a mobile intelligent device, or may be a separately configured hardware device. Wherein the designation of a unit or module does not in some way constitute a limitation of the unit or module itself.
The foregoing description is only exemplary of the preferred embodiments of the application and is illustrative of the principles of the technology employed. It will be appreciated by those skilled in the art that the scope of the invention herein disclosed is not limited to the particular combination of features described above, but also encompasses other arrangements formed by any combination of the above features or their equivalents without departing from the spirit of the present application. For example, the above features may be replaced with (but not limited to) features having similar functions disclosed in the present application.

Claims (8)

1. A transaction storage method, wherein K = K × G, K is a first verification public key, K is a first verification private key, P = P × G, P is a held first private key, and P is a first public key corresponding to the first private key, the method is applied to parallel chain nodes, and the method includes:
generating first encrypted data according to the first verification private key, the first private key and first data to be encrypted;
generating a first parallel chain transaction comprising the first encrypted data and sending the first parallel chain transaction to a main chain so as to verify the first encrypted data according to the first verification public key and the first public key, and storing the first parallel chain transaction into a memory pool when the first encrypted data is successfully verified;
when the first private key and the first public key are a one-time public-private key pair:
the generating of the first encrypted data according to the first private key for verification and the first data to be encrypted comprises:
generating first encrypted data according to a first formula; wherein the first formula is s = k + pm1, where s is the first encrypted data and m1 is a first hash value of the first data;
the verifying the first encrypted data according to the first verification public key and the first public key, and when the first encrypted data is successfully verified, storing the first parallel chain transaction into a memory pool comprises:
calculating second data according to a second formula; wherein the second formula is m2= s × G, and m2 is the second data;
calculating third data according to a third formula; wherein the third formula is m3= K + Pm1, and m3 is the third data;
when the second data is the same as the third data, storing the first parallel chain transaction into a memory pool;
when the first private key and the first public key are not a one-time public-private key pair:
the generating of the first encrypted data according to the first private key for verification and the first data to be encrypted comprises:
generating a first random number and a second random number; wherein R = R × G, R is the first random number, and R is the second random number;
generating first encrypted data according to a fourth formula; wherein the fourth formula is s = k + r + pm1, where s is the first encrypted data and m1 is a first hash value of the first data;
the verifying the first encrypted data according to the first verification public key and the first public key, and when the first encrypted data is successfully verified, storing the first parallel chain transaction into a memory pool comprises:
calculating fourth data according to a fifth formula; wherein the fifth formula is m4= s × G, and m4 is the fourth data;
calculating fifth data according to a sixth formula; wherein the sixth formula is m5= K + R + Pm1, and m5 is the fifth data;
and when the fourth data is the same as the fifth data, storing the first parallel chain transaction into a memory pool.
2. The method according to claim 1, wherein before generating the first encrypted data from the first verification private key, the first private key and the first data to be encrypted, further comprising:
when the current node is a management node, generating the first verification public key and the first verification private key;
generating a first registration transaction of the first verification public key and sending the first registration transaction to a main chain node for recording the first verification public key;
and when the first registration transaction is successfully executed, the first verification private key is sent to a plurality of trusted first parallel chain nodes of the current parallel chain.
3. A method for generating parallel chain blocks, wherein channel and timeslot parameters are configured on a block chain, each parallel chain registers a timeslot of a corresponding channel on a main chain, and a memory pool of a main chain node stores transactions stored according to the transaction storage method of any one of claims 1-2, the method being applied to the main chain node, the method comprising:
in response to obtaining the packaging right of the first block with the first block height, pulling a plurality of first transactions from the memory pool, and respectively executing the following steps on each first transaction:
when the first transaction is a parallel chain transaction, calculating a first remainder and a first quotient of the first block height and the total number of channels;
inquiring the total number of second time slots of a second channel with the channel number as the first remainder;
calculating a second remainder of the first quotient and the second time slot total number;
judging whether a second parallel chain to which the first transaction belongs corresponds to a second time slot numbered as the second remainder in the second channel:
if not, the first transaction is stored in the memory pool again;
if yes, packaging the first transaction into the first block;
wherein the first block height is for parallel chain nodes of each parallel chain:
calculating the first remainder, first quotient number and second remainder;
judging whether the parallel chain corresponds to the second time slot:
if yes, generating a first parallel chain block according to the first block;
otherwise, synchronizing the first block head of the first block.
4. The method of claim 3, wherein the total number of timeslots for each channel is a non-fixed value.
5. The method of claim 3 or 4, further comprising:
receiving first request information which is sent by a third parallel chain node of a third parallel chain and requests first block data;
calculating a third remainder and a second quotient of a second block height of a main chain block where the first block data is located and the total number of the channels;
inquiring the total number of the third time slots of a third channel with the channel number as the third remainder;
calculating a fourth remainder of the second quotient and the total number of the third time slots;
judging whether the third parallel chain corresponds to a third time slot with the number of the fourth remainder in the third channel:
if not, returning error information;
if yes, returning the first block data.
6. A method for generating parallel chain blocks, wherein channel and timeslot parameters are configured on a block chain, each parallel chain registers a timeslot of a corresponding channel on a main chain, and a memory pool of a main chain node stores transactions stored according to the transaction storage method of any one of claims 1-2, the method being applied to the parallel chain nodes, the method comprising:
obtaining a first block of a main chain; the first block is packed with a plurality of first transactions, the packed first transactions comprise a plurality of first transactions pulled from a memory pool in response to a main chain node obtaining a packing right of the first block with a first block height, the packed first transactions are parallel chain transactions, a second parallel chain to which the packed first transactions belong corresponds to a second time slot with a second remainder in a second channel, the second channel is a channel with a channel number of a first quotient, the first quotient is a quotient of the first block height and a total number of channels, the second remainder is a remainder of the first quotient and a total number of second time slots, the total number of the second time slots is a total number of time slots of the second channel with a channel number of a first remainder, and the first remainder is a remainder of the first block height and a total number of channels;
calculating the first remainder, first quotient number and second remainder;
judging whether the current parallel chain corresponds to the second time slot:
if yes, generating a first parallel chain block according to the first block;
otherwise, synchronizing the first block head of the first block.
7. A computer device, the device comprising:
one or more processors;
a memory for storing one or more programs,
the one or more programs, when executed by the one or more processors, cause the one or more processors to perform the method recited in any of claims 1-6.
8. A storage medium storing a computer program, characterized in that the program, when executed by a processor, implements the method according to any one of claims 1-6.
CN202110385372.0A 2021-04-09 2021-04-09 Transaction storage method, parallel chain block generation method, device and storage medium Active CN113094436B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110385372.0A CN113094436B (en) 2021-04-09 2021-04-09 Transaction storage method, parallel chain block generation method, device and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110385372.0A CN113094436B (en) 2021-04-09 2021-04-09 Transaction storage method, parallel chain block generation method, device and storage medium

Publications (2)

Publication Number Publication Date
CN113094436A CN113094436A (en) 2021-07-09
CN113094436B true CN113094436B (en) 2022-05-24

Family

ID=76676664

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110385372.0A Active CN113094436B (en) 2021-04-09 2021-04-09 Transaction storage method, parallel chain block generation method, device and storage medium

Country Status (1)

Country Link
CN (1) CN113094436B (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
GB2538052A (en) * 2015-04-27 2016-11-09 Gurulogic Microsystems Oy Encoder, decoder, encryption system, encryption key wallet and method
CN106296138A (en) * 2016-08-09 2017-01-04 西安电子科技大学 Bit coin payment system based on Partial Blind Signature technology and method thereof
CN108985100A (en) * 2018-08-15 2018-12-11 百度在线网络技术(北京)有限公司 Element Security Proof method, apparatus, equipment and medium based on block chain
CN111080294A (en) * 2019-12-04 2020-04-28 杭州复杂美科技有限公司 Parallel chain transaction encryption method, device and storage medium

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
GB2538052A (en) * 2015-04-27 2016-11-09 Gurulogic Microsystems Oy Encoder, decoder, encryption system, encryption key wallet and method
CN106296138A (en) * 2016-08-09 2017-01-04 西安电子科技大学 Bit coin payment system based on Partial Blind Signature technology and method thereof
CN108985100A (en) * 2018-08-15 2018-12-11 百度在线网络技术(北京)有限公司 Element Security Proof method, apparatus, equipment and medium based on block chain
CN111080294A (en) * 2019-12-04 2020-04-28 杭州复杂美科技有限公司 Parallel chain transaction encryption method, device and storage medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
车联网中基于区块链的信用体系研究;李凤祥等;《通信技术》;20191210(第12期);全文 *

Also Published As

Publication number Publication date
CN113094436A (en) 2021-07-09

Similar Documents

Publication Publication Date Title
CN109410045B (en) Parallel chain consensus method, equipment and storage medium
CN110083745B (en) Data query method, device and storage medium
CN112600664B (en) Delayed transaction generation method, delayed transaction execution device and storage medium
CN113094436B (en) Transaction storage method, parallel chain block generation method, device and storage medium
CN110187831A (en) The block data storage system and method for block chain alliance chain
CN111008249A (en) Parallel chain block synchronization method, device and storage medium
CN106022936B (en) Community structure-based influence maximization algorithm applicable to thesis cooperative network
CN110347645A (en) A kind of electronic document deposits card method and device
CN112511570B (en) Internet of things data integrity checking system and method based on special chip
US20240039727A1 (en) Blockchain-based data processing method and apparatus, device, and readable storage medium
CN112435123A (en) Transaction method, system and storage medium based on isomorphic multi-chain system
CN111523896A (en) Anti-attack method, device and storage medium
CN110351152A (en) Message packet processing unit and method
CN111524010B (en) Parallel chain consensus method, apparatus and storage medium
CN111798239A (en) Parallel chain consensus method, device and storage medium
CN103139168A (en) Method of improving success rate of capacity call and open platform
CN114661477A (en) Low-energy-consumption block resource proving method and device and electronic equipment
CN112948496B (en) Parallel chain block generation method, computer device and storage medium
CN112948495B (en) Parallel chain constant block output method, computer device and storage medium
CN112948497A (en) Parallel chain block generation method, computer device, and storage medium
CN111432027B (en) Parallel chain block synchronization method, device and storage medium
CN112804322B (en) Block generation method, computer device and storage medium
US9344118B2 (en) Apparatus and method for generating interleaver index
CN114490008A (en) Service scheduling method, device and system and edge computing node
CN112733202A (en) Parallel chain supervision consensus method, computer device and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant