Data processing method and system of block chain and electronic equipment

Through stateless verification technology and RSA accumulator, the problem of large communication overhead of multi-shatter collaboration verification in blockchain sharding technology is solved, efficient transaction verification and witness extraction are achieved, and communication and storage overhead between shards is reduced.

CN119273347APending Publication Date: 2025-01-07BEIJING UNIV OF POSTS & TELECOMM
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311802107.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-12-26
Publication Date
2025-01-07

AI Technical Summary

Technical Problem

The existing blockchain sharding technology has high communication overhead during multi-shatter collaborative verification, relies on reliable coordinators and high storage overhead, making it difficult to effectively handle massive nodes and transactions.

Method used

Using stateless verification technology, through the RSA accumulator and PoKCR protocol, each shard only maintains the state commitment of the shard, quickly verify the legitimacy of cross-shash transactions, reduces inter-shash communication, and reduces bandwidth and storage overhead.

Benefits of technology

It realizes transaction verification and witness extraction without storing other shard state data, reduces inter-shaft communication, reduces system bandwidth and storage overhead, and improves transaction confirmation speed.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119273347A_ABST
    Figure CN119273347A_ABST
Patent Text Reader

Abstract

The invention provides a data processing method and system of a block chain and electronic equipment. The method comprises the following steps: initiating a target transaction; determining a target fragment according to the target transaction input, generating a target transaction witness according to the target transaction and the target fragment, and broadcasting the target transaction and the target transaction witness to the block chain; when the target fragment receives a target transaction and a target transaction witness, a target block chain node in the target fragment verifies the target transaction witness to extract a corresponding target subset witness, updates a corresponding target state commitment value according to the target subset witness, and packages the target transaction into a new block; and receiving the new block and verifying the updated target state commitment value. Through the stateless verification technology, under the condition that the fragmentation block chain does not need to store other fragmentation state data, transaction verification and witness extraction are carried out at the same time, communication between all the fragments except broadcast transaction does not need to be carried out, communication between the fragments is reduced, and the bandwidth overhead and the storage overhead of the system are reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of blockchain technology, and in particular to a blockchain data processing method, system and electronic device. Background Art

[0002] In recent years, blockchain technology research has been in full swing, and related applications have been extended to many fields such as digital finance, Internet of Things, supply chain management, government transparency, and public welfare, empowering and improving the efficiency of various industries. In order to improve the ability of blockchain to carry massive nodes and transactions, the academic community refers to the idea of ​​database sharding and proposes to introduce sharding technology into the blockchain, dividing the nodes, status data, and transactions in the network into different shards, providing the blockchain with the ability to process more transactions at the same time.

[0003] In a sharded blockchain, a transaction may involve changes in the state data of multiple shards, requiring collaborative verification and processing by multiple shards. The prior art uses a sharded blockchain transaction processing method based on relay transactions. In the two-phase commit-based method, a coordinator is responsible for collecting availability proofs of transaction inputs and transmitting them between the relevant participating shards. However, this type of method relies on a reliable coordinator and requires multiple calls to the BFT (Byzantine Fault Tolerance) algorithm, resulting in high communication overhead. Summary of the invention

[0004] In view of this, an object of the present invention is to provide a blockchain data processing method, system and electronic device, so as to reduce the communication between shards, and further reduce the bandwidth overhead and storage overhead of the system.

[0005] In a first aspect, an embodiment of the present invention provides a blockchain data processing method, comprising: initiating a target transaction; the target transaction includes a target transaction input and a target transaction output; determining a target shard according to the target transaction input, generating a target transaction witness according to the target transaction and the target shard, and broadcasting the target transaction and the target transaction witness to the blockchain; when the target shard receives the target transaction and the target transaction witness, the target blockchain node in the target shard verifies the target transaction witness, and extracts the target subset witness corresponding to the target shard, updates the target state commitment value corresponding to the target shard according to the target subset witness, and packages the target transaction into a new block; receiving the new block, and verifying the updated target state commitment value.

[0006] Furthermore, before the step of initiating the target transaction, the method also includes: dividing the blockchain into multiple shards; generating an RSA group corresponding to the blockchain; the RSA group includes multiple generators; and constructing a corresponding RSA accumulator according to different generators through each shard.

[0007] Furthermore, the step of generating a target transaction witness according to the target transaction and the target shard includes: obtaining a member witness corresponding to the UTXO of each target transaction input; aggregating the member witnesses of all target transaction inputs in the same target shard into a sub-witness set; aggregating all subset witnesses to generate a target transaction witness.

[0008] Furthermore, the target transaction witness is calculated according to the following formula: Where W is the target transaction witness; l is the number of target shards used as input for the target transaction; si is the shard index of the target shard; w si Witness the subset corresponding to the target shard with shard index si; N is the RSA group modulus.

[0009] Furthermore, the target blockchain node in the target shard verifies the target transaction witness, extracts the target subset witness corresponding to the target shard, updates the target state commitment value corresponding to the target shard according to the target subset witness, and packages the target transaction into a new block, including: the target blockchain node verifies the transaction witness and extracts the target subset witness corresponding to the target shard; the target blockchain node stores the target transaction, target transaction witness and subset witness corresponding to the target shard in the memory pool of the target shard after verification; the target blockchain node extracts the target transaction, target transaction witness and subset witness corresponding to the target shard from the memory pool in a preset order; the target blockchain node updates the RSA accumulator corresponding to the target shard according to the subset witness corresponding to the target shard; wherein the update of the RSA accumulator includes removing the spent historical transaction output and adding the newly generated target transaction output; the value of the RSA accumulator corresponds to the state commitment value; the target blockchain node determines whether the update of the RSA accumulator is correct, and if so, determines that the state commitment value of the target shard is updated successfully; the target transaction is packaged into a new block, and the new block is added to the target shard.

[0010] Furthermore, the target blockchain node determines whether the update of the RSA accumulator is correct. If so, after determining that the state commitment value of the target shard is updated successfully, the method also includes: the target blockchain node updates the transaction witnesses corresponding to the historical transactions in the memory pool that have passed verification but have not been packaged into new blocks according to the updated state commitment value.

[0011] In a second aspect, an embodiment of the present invention provides a blockchain data processing system, including: a target transaction initiation module, used to initiate a target transaction; the target transaction includes a target transaction input and a target transaction output; a transaction witness broadcasting module, used to determine the target shard according to the target transaction input, generate a target transaction witness according to the target transaction and the target shard, and then broadcast the target transaction and the target transaction witness to the blockchain; a transaction witness verification module, used to verify the target transaction witness when the target shard receives the target transaction and the target transaction witness, and after extracting the target subset witness corresponding to the target shard, update the target state commitment value corresponding to the target shard according to the target subset witness, and package the target transaction into a new block; a state commitment value verification module, used to receive the new block and verify the updated target state commitment value.

[0012] Furthermore, the data processing system also includes: an accumulator construction module; an accumulator construction module, used to divide the blockchain into multiple shards; generate an RSA group corresponding to the blockchain; the RSA group includes multiple generators; and construct a corresponding RSA accumulator according to different generators through each shard.

[0013] In a third aspect, an embodiment of the present invention provides an electronic device, including a memory and a processor, wherein the memory stores a computer program executable on the processor, and the processor implements the method described above when executing the computer program.

[0014] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, on which a computer program is stored, and the program code enables the processor to execute the method as described above.

[0015] The embodiment of the present invention provides a data processing method, system and electronic device of a blockchain, including: an initiated target transaction; the target transaction includes a target transaction input and a target transaction output; the target shard is determined according to the target transaction input, and after the target transaction witness is generated according to the target transaction and the target shard, the target transaction and the target transaction witness are broadcast to the blockchain; when the target shard receives the target transaction and the target transaction witness, the target blockchain node in the target shard verifies the target transaction witness, and after extracting the target subset witness corresponding to the target shard, the target state commitment value corresponding to the target shard is updated according to the target subset witness, and the target transaction is packaged into a new block; the new block is received, and the updated target state commitment value is verified. In this method, the stateless verification technology is used to enable the sharded blockchain to perform transaction verification and witness extraction at the same time without storing other shard state data, and no inter-shard communication is required between the shards except for broadcasting transactions, thereby reducing the communication between shards, and further reducing the bandwidth overhead and storage overhead of the system.

[0016] Other features and advantages of the present invention will be described in the following description, and partly become apparent from the description, or understood by practicing the present invention. The purpose and other advantages of the present invention are realized and obtained by the structures particularly pointed out in the description, claims and drawings.

[0017] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, preferred embodiments are given below and described in detail with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0019] Figure 1 A flowchart of a blockchain data processing method provided in Embodiment 1 of the present invention;

[0020] Figure 2 A schematic diagram of data processing for blockchain transaction participants provided in Embodiment 1 of the present invention;

[0021] Figure 3 A flowchart of a method for constructing an RSA accumulator provided in Embodiment 1 of the present invention;

[0022] Figure 4 A flowchart of a method for generating a target transaction witness provided in Embodiment 1 of the present invention;

[0023] Figure 5 A schematic diagram of a method for aggregating witnesses in an accumulator provided in Embodiment 1 of the present invention;

[0024] Figure 6 A flowchart of a method for operating a target blockchain node in a target shard provided in Embodiment 2 of the present invention;

[0025] Figure 7 A schematic diagram of a blockchain data processing system provided in Embodiment 2 of the present invention.

[0026] Icons: 1-target transaction initiation module; 2-transaction witness broadcast module; 3-transaction witness verification module; 4-state commitment value verification module; 5-accumulator construction module. DETAILED DESCRIPTION

[0027] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the accompanying drawings. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0028] To facilitate understanding of this embodiment, the embodiment of the present invention is described in detail below.

[0029] Embodiment 1:

[0030] Figure 1 This is a flow chart of the data processing method of the blockchain provided in Example 1 of the present invention.

[0031] Figure 2 A schematic diagram of data processing for blockchain transaction participants provided in Example 1 of the present invention.

[0032] Reference Figure 1 , blockchain data processing methods include:

[0033] Step S101, initiating a target transaction; the target transaction includes a target transaction input and a target transaction output.

[0034] Here, refer to Figure 2 Blockchain data processing includes users and blockchain nodes. Users construct transactions, generate transaction witnesses, broadcast transactions and transaction witnesses; blockchain nodes verify transaction witnesses and extract subset witnesses, build new blocks and update the state commitment value within the shard, broadcast new blocks, and update the subset witnesses of transactions that have not yet been packaged; users receive new blocks, verify the correctness of the state commitment value update, and update the state commitment value and member witnesses of unspent transaction outputs.

[0035] In one embodiment, referring to Figure 3 Before the step of initiating the target transaction in step S101, the method further includes:

[0036] Step S301, dividing the blockchain into multiple shards.

[0037] Step S302, generate an RSA group corresponding to the blockchain; the RSA group includes multiple generators.

[0038] Step S303, constructing a corresponding RSA accumulator according to different generators through each shard.

[0039] Here, compared with ordinary blockchains, blockchains that use sharding technology are expected to be used in large-scale application scenarios because of their good scalability. Although nodes in sharded blockchains only need to store the blockchain status within the shard, a lot of communication is still required between shards when multiple shards collaborate to verify cross-shard transactions. The use of stateless verification technology in sharded blockchains allows each node to only maintain the state commitment of its shard, track changes in the state commitments of other shards, and maintain its spendable proof while holding unspent transaction outputs for use in constructing transactions. With the help of the state commitments of each shard and the relevant proofs of transaction inputs, each shard can quickly verify the legitimacy of cross-shard transactions.

[0040] Divide the blockchain into k shards, use collision-resistant hash functions to shard the blockchain state, and construct the function H shard All transaction outputs are assigned to corresponding shards for management, as shown in formula (1). The first log2k bits of the hash value of the transaction output are converted into a decimal integer and then added with 1 to obtain a shard index starting from 1 (shard index: save the transaction to the corresponding shard blockchain).

[0041]

[0042] Among them, H(txo) is the constructor corresponding to the parameter txo. h[:log2 k] means taking the first log2 k bits of the hash value of the transaction output. bin2dec means converting a binary number to decimal. index: is the shard index starting from 1.

[0043] Generate an RSA group for the entire sharded blockchain. Each shard selects a different generator from the RSA group to construct an RSA accumulator for committing to its own state shard.

[0044] The RSA accumulator is a universal cryptographic accumulator based on the strong RSA assumption. It can generate a concise commitment to a dynamically changing set of prime numbers through modular exponentiation. Based on this commitment, a member witness can be generated for one or more elements in the set, and a non-member witness can be generated for one or more elements outside the set. Here, the RSA accumulator is used to construct the state sharding commitment in the sharded UTXO model blockchain. The construction process of the RSA accumulator is as follows: First, according to the security level, a sufficiently large modulus N for the modular exponentiation operation is selected. The modulus can be decomposed into two strong prime numbers p and q, that is, N=pq. Next, a randomly selected integer f that is greater than 1 and less than N and is coprime with N is used to calculate the generator g=f 2 mod N. The modulus N and the generator g constitute the public parameters of the RSA accumulator, and g is the initial value of the accumulator.

[0045] For a prime number set S = {x1, x2, ..., xn}, the commitment of the RSA accumulator to generate the set S is shown in formula (2):

[0046]

[0047] Among them, x * =∏ i∈{1,...,n} x i , which represents the product of all elements in the collection.

[0048] Step S102, determine the target shard according to the target transaction input, generate the target transaction witness according to the target transaction and the target shard, and then broadcast the target transaction and the target transaction witness to the blockchain.

[0049] In one embodiment, referring to Figure 4 In step S102, the step of generating a target transaction witness according to the target transaction and the target shard includes:

[0050] Step S401, obtain the member witness corresponding to the UTXO of each target transaction input.

[0051] For a prime number set S = {x1, x2, ..., x n}, element x in the set in the RSA accumulator i The member witness is as shown in formula (3):

[0052]

[0053] The verification method of member witness is shown in formula (4):

[0054]

[0055] in, Indicates the desire to be equal or conditionally equal.

[0056] For the element y outside the set, since it is coprime with all the elements in the set, according to Pei Shu's theorem, the extended Euclidean algorithm can be used to obtain x * and the Pei Shu coefficient of y (x * is the norm of x, a method used to measure the length or size of a vector, representing the distance norm in Euclidean space), that is, integers a and b satisfy ax * +by=1. Let B=g b mod N, the non-member witness of y is (a, B). The verification method of non-member witness is shown in formula (5):

[0057]

[0058] Add element x to the collection n+1After that, the update formulas (6) and (7) of commitment and member witness are shown as follows:

[0059]

[0060]

[0061] The update of non-member witnesses needs to first calculate a'x n+1 +b'y=1, the updated non-member witness is (aa',A ab 'B).

[0062] After the collection deletes an element, the promised update is shown in formula (8):

[0063]

[0064] The update of member witnesses needs to first calculate ax j +bx i = 1, and the updated member witness is as shown in formula (9):

[0065]

[0066] The update of the non-member witness is (ax j ,B).

[0067] When each shard commits to the UTXO set it manages, it needs to use the collision-resistant hash function constructor H prime The transaction output is mapped to different prime numbers. The specific method is as follows: First, the random number is initialized to 0, and formula (10) and formula (11) are executed repeatedly until the decimal integer corresponding to the bit string output by formula (11) is a prime number (through Pocklington prime number detection).

[0068]

[0069] p=bin2dec(H(txo||nonce)) (11)

[0070] The RSA accumulator in the shard will accumulate the prime number set corresponding to all UTXOs in the shard according to formula (2). The value A of the accumulator of the i-th shard i It is the state commitment value of the shard.

[0071] Step S402, aggregate the member witnesses of all target transaction inputs in the same target shard into a sub-witness set.

[0072] Step S403, aggregate all subset witnesses to generate a target transaction witness.

[0073] Specifically, stateless verification requires that the transaction be accompanied by an unspent witness of the transaction input, that is, a member proof of the commitment of the transaction output spent in the transaction to the state of the shard in which it is located. The construction process of the transaction witness is as follows:

[0074] The user collects the unspent transaction outputs and corresponding member witnesses as transaction inputs, and aggregates the witnesses of multiple transaction inputs belonging to the same target shard into a subset witness. Let {x1,x2,...,x n} and {w1,w2,...,w n} respectively represent the prime numbers and witnesses corresponding to multiple transaction inputs belonging to this shard. Figure 5 , multiple witnesses are aggregated using binary search. For the aggregation of two witnesses (taking w1 and w2 as an example), since the prime numbers x1 and x2 corresponding to the two transaction inputs are different, the extended Euclidean algorithm can be used to calculate the Pei Shu coefficients a and b of the two to satisfy ax1+bx2=1. The subset witnesses of the two transaction outputs can be obtained by calculating formula (12). This two-by-two combination method also supports parallel computing, and can quickly obtain subset witnesses of multiple transaction outputs.

[0075] w 1,2 =w1 b w2 a mod N (12)

[0076] Let l represent the number of shards involved in the transaction input. The set {s1,s2,...,s l} represents the index of all involved shards. After completing the witness aggregation of transaction inputs in each shard, the witness set that users can obtain is The corresponding set of prime products is

[0077] In order to improve the verification efficiency of commitment updates and reduce communication overhead, the RSA group is equipped with a PoKCR (Proof of Knowledge of Co-prime Roots) proof protocol. The proof protocol involves two parties: the prover and the verifier. The prover proves to the verifier that certain parameters satisfy a certain relationship.

[0078] PoKCR is a proof protocol for the following formula (13), that is, to prove that for multiple group elements on the RSA group and n coprime prime numbers There are n mutually prime roots Satisfies that for all i∈{1,...,n}, correctness.

[0079]

[0080] in, represents the RSA group, Represents a set of integers.

[0081] If the proof contains all coprime roots The size of the proof is proportional to n, which will lead to a large communication overhead between the prover and the verifier. In order to reduce the communication overhead of the proof protocol, the prover multiplies all coprime roots and sends only one group element Correspondingly, all the equations to be proved First convert to Multiply n equations to get the final equation to be proved

[0082] Specifically, the prover calculates the product W of all coprime roots and sends it to the verifier, referring to formula (14):

[0083]

[0084] The verifier first calculates the product X of all prime numbers according to formula (15):

[0085]

[0086] Then calculate formula (16):

[0087]

[0088] By checking the equality of the following formula (17), we can determine whether the prover has n mutually prime roots:

[0089] Make

[0090]

[0091] According to the prover formula (18) in the above PoKCR protocol, the target transaction witness is calculated:

[0092]

[0093] Where W is the target transaction witness; l is the number of target shards used as input for the target transaction; si is the shard index of the target shard; Witness the subset corresponding to the target shard with shard index si; N is the RSA group modulus. i is used to traverse the target shards of all the target transaction inputs.

[0094] The user attaches the target transaction witness W to the target transaction and broadcasts it to the blockchain network along with the target transaction. All target shards related to the target transaction can determine the legitimacy of the transaction by verifying the correctness of W.

[0095] Step S103, when the target shard receives the target transaction and the target transaction witness, the target blockchain node in the target shard verifies the target transaction witness, extracts the target subset witness corresponding to the target shard, updates the target state commitment value corresponding to the target shard according to the target subset witness, and packages the target transaction into a new block.

[0096] Here, refer to Figure 2 ,The relevant data processing process on the sharded blockchain is performed by the blockchain nodes. ,The target blockchain node verifies the target transaction witness and extracts the target subset witness ,corresponding to the target shard, builds a new block and updates the state commitment value ,in the target shard, broadcasts the new block, and updates the subset witness of ,the transactions that have not been packaged.

[0097] In one embodiment, referring to Figure 6 The steps of step S103 include:

[0098] Step S601, the target blockchain node verifies the transaction witness and extracts the target subset witness corresponding to the target shard.

[0099] Here, if the target transaction input and the set of unspent transaction outputs managed by the target shard have an intersection, in order to update the state commitment of the target shard during the transaction packaging process, the committee member responsible for generating blocks in the target shard also needs to extract the target member witness related to the spent transaction output in the target shard from the target transaction witness. By embedding the witness extraction algorithm in the PoKCR protocol verifier part, the transaction processing efficiency of the sharded blockchain is improved.

[0100] Specifically, the transaction verifier first calculates the index set {s1,s2,...,s l}, calculate the prime product of each slice according to formula (10) and formula (11)

[0101] Assume that the shard index of the transaction validator is s j ∈{s1,s2,...,s l}, the verifier removes {s1,s2,...,s l}and The s j Calculate formula (16) and formula (17) under the condition of term, and get x * '=∏ i∈{1,...,l}\{j} p si and

[0102] Validator calculation examine Since formula (19) is equivalent to (17), the check on the PoKCR verifier part is completed. If both sides of the equation are not equal, the verification and extraction process of the transaction witness is terminated.

[0103]

[0104] The verifier calculates u=vy' -1 . Because x *′ and are mutually prime, and So by calculating of The root of the order is of Step root.

[0105] The verifier calculates x *' and The Pei Shu coefficients a and b satisfy Then the member witness corresponding to the transaction input of the shard where the validator is located is

[0106] According to the above method, the target blockchain node in the target shard related to the target transaction can verify the legitimacy of the target transaction through a target transaction witness and a target state commitment, and extract the target member witness about the transaction input in the target shard from the target transaction witness, without the need for complex inter-shard collaborative verification with other shards, thereby reducing the system's communication overhead and speeding up transaction confirmation.

[0107] In step S602, the target blockchain node stores the target transaction corresponding to the verified transaction witness, the target transaction witness, and the subset witness corresponding to the target shard into the memory pool of the target shard.

[0108] Step S603: The target blockchain node extracts the target transaction, the target transaction witness, and the subset witness corresponding to the target shard from the memory pool in a preset order.

[0109] Here, the preset order is preset according to actual conditions.

[0110] Step S604, the target blockchain node updates the RSA accumulator corresponding to the target shard according to the subset witness corresponding to the target shard; wherein the update of the RSA accumulator includes removing the spent historical transaction outputs and adding the newly generated target transaction outputs; the value of the RSA accumulator corresponds to the state commitment value.

[0111] Here, updating the RSA accumulator corresponding to the target shard includes removing the spent transaction output from the accumulator, adding the newly generated transaction output to the accumulator, and proving the computational correctness of these two processes.

[0112] Specifically, collect all target transaction inputs and corresponding target member witnesses related to the target shard, and calculate the prime number corresponding to the transaction input according to formula (10) and formula (11). Figure 2 The witness aggregation method shown calculates the accumulator value A after removing the transaction inputs. i '.

[0113] Based on the accumulator value A of the previous block i,,t-1 Remove, the product of prime numbers corresponding to the target transaction input p d , the accumulator value A after removing the transaction input i ', according to the calculation of the prover part in the NIPoE (Non-Interactive Proof of Exponentiation, non-interactive exponential proof) protocol, we can get the calculation about A i 'Proof of computational correctness Q1.

[0114] The NIPoE proof protocol is a proof protocol on the RSA group. The design motivation of the NIPoE protocol is that the computation time of large integer power operations on the RSA group is proportional to the binary length of the large integer x. In order to improve the verification efficiency of the power operation results, the NIPoE protocol is proposed.

[0115] NIPoE is a proof protocol for the following formula (20), that is, to prove that for two RSA groups Elements in and a large integer Satisfy w=u x .

[0116]

[0117] Among them, ⊥ represents empty.

[0118] Since the computational cost of exponentiation on the RSA group is proportional to the number of bits in the exponent, the computational complexity of verifying the exponentiation of a large integer by direct calculation is high. In order to improve the verification efficiency, the proof protocol introduces a prime number challenge l with a binary number much smaller than x, decomposing the large integer x into x = ql + r, where 0 ≤ r ≤ l, and the relationship to be proved is transformed into w = u ql+r =(u q ) l ·u r mod N. When the prover provides Q = u q After mod N, since l and r are small integers compared to x, Q l and u r The computational complexity is low, so the verification efficiency will be greatly improved.

[0119] Specifically, as shown in formula (21), the prover uses a hash function H whose value range is a prime number prime , taking u, w, x as input, we get a prime number challenge l.

[0120] l=H prime (u,w,x) (21)

[0121] Then, the quotient of x divided by l is obtained by using truncated division, referring to formula (22):

[0122] q=[x / l] (22)

[0123] According to formula (23), the RSA group element with u as base and q as exponent is calculated and sent to the verifier:

[0124] Q=u q mod N (23)

[0125] According to formula (24), the verifier receives u, w, x, Q from the prover, calculates the prime challenge l according to formula (21), and calculates the remainder according to formula (24):

[0126] r=x mod l (24)

[0127] By checking whether the equality of formula (25) holds, we can determine whether u, w, and x satisfy the relationship

[0128]

[0129] Furthermore, the following equations (21), (22) and (23) are used to calculate the value of A: i ′Proof of computational correctness Q1.

[0130] According to formula (10) and formula (11), calculate the prime number corresponding to the newly generated transaction output, and execute formula (6) for each prime number. i 'Add the newly generated transaction output to get the state commitment A of the new block i,t .

[0131] Step S605, the target blockchain node determines whether the update of the RSA accumulator is correct, and if so, determines that the state commitment value of the target shard is updated successfully.

[0132] Specifically, the target blockchain node is based on the accumulator value A after removing the target transaction input. i '、State commitment of the new block A i,t , the product of the prime numbers corresponding to the newly added transaction output p aAccording to the formula (21), formula (22) and formula (23) of the prover part in the NIPoE protocol, we can calculate the value of A i,t Proof of computational correctness Q2.

[0133] Step S606: Pack the target transaction into a new block, and add the new block to the target shard.

[0134] Specifically, the target blockchain node will update the state commitment value A i,t And the relevant calculation correctness proof (A i ',Q1,Q2) is included in the new block and broadcast to the blockchain after consensus by the committee in the target shard.

[0135] In one embodiment, after step S605, the method further includes:

[0136] The target blockchain node updates the transaction witnesses corresponding to the historical transactions in the memory pool that have been verified but not packaged into new blocks according to the updated state commitment value.

[0137] Specifically, after the target transaction is packaged into a new block and the commitment in the target shard is updated, there are still some transactions in the memory pool of the target blockchain node that have been verified but have not been packaged due to network transmission delay or block size limit. The witnesses of these transactions have expired and can no longer be broadcast to other related shards for processing. The witnesses of these transactions need to be updated in batches.

[0138] Collect unpackaged transaction witnesses {w1,w t-1 ,...,w n,t-1}、Transaction input within the shard and corresponding in-shard member witness {w1,w t-1 ,...,w n,t-1} According to formula (10) and formula (11), the prime product {p1,...,p n}.

[0139] Calculate the commitment A of these unpackaged transaction inputs to the previous state i,t-1 The subset witness w m,t-1 and the corresponding prime product

[0140] Since the transaction inputs of the target shard included in the new block do not intersect with the unpackaged transaction inputs in the memory pool, p d With p m By calculating p d With p m The Pei Shu coefficients a and b satisfy ap d +bpm =1, we can get Thus, the transaction input of the target shard contained in the new block is sent from the witness w m,t-1 Removed.

[0141] Add the newly generated transaction outputs contained in the new block to w m 'In, that is Get a subset of witnesses about the current state commitment value of the unpackaged transaction input.

[0142] Witness w, a subset of the commitment values ​​in the current state m,t Based on , we calculate the in-slice member witnesses of all transactions. Specifically, we convert {p1,p2,...,p n} is divided into two subsets, and the subset witness of the left subset is The subset witness of the right subset is Based on these two subsets and the corresponding subset witnesses, we can gradually subdivide until we calculate the member witnesses of all elements {w 1,t ,...,w n,t}.

[0143] For all transaction witnesses {w1,w t-1 ,...,w n,t-1}, these unpackaged transaction witnesses can be updated by dividing by the original in-slice witness and multiplying by the new in-slice witness, w 1,t =w 1,t-1 / w 1,t-1 *w i,t .

[0144] The target blockchain node's efficient update of the unpackaged transaction witness in the memory pool can avoid the transaction initiator from resubmitting the transaction witness of the unpackaged transaction, saving a lot of bandwidth overhead for the sharded blockchain.

[0145] Step S104, receiving a new block and verifying the updated target state commitment value.

[0146] Here, the user receives a new block by simply calculating the prime product p corresponding to the target transaction input and the target transaction output. d and p a After that, respectively for (A i ',A i,t-1 ,p d ,Q1) and (A i ',A i,t ,p a ,Q2) Execute formula (21), formula (24) and formula (25) to verify the legitimacy of the target transaction in the block and the correctness of the target state commitment update.

[0147] The embodiment of the present invention provides a data processing method of a blockchain, including: initiating a target transaction; the target transaction includes a target transaction input and a target transaction output; determining a target shard according to the target transaction input, generating a target transaction witness according to the target transaction and the target shard, and broadcasting the target transaction and the target transaction witness to the blockchain; when the target shard receives the target transaction and the target transaction witness, the target blockchain node in the target shard verifies the target transaction witness, extracts the target subset witness corresponding to the target shard, updates the target state commitment value corresponding to the target shard according to the target subset witness, and packages the target transaction into a new block; receives the new block, and verifies the updated target state commitment value. In this method, the stateless verification technology enables the sharded blockchain to perform transaction verification and witness extraction at the same time without storing other shard state data. There is no need for any inter-shard communication between the shards except for broadcasting transactions, which reduces the storage overhead of nodes in the sharded blockchain, simplifies the communication process of inter-shard collaborative verification of cross-shard transactions, and an efficient transaction witness update algorithm can avoid the additional communication overhead caused by stateless verification.

[0148] Embodiment 2:

[0149] Figure 7 A schematic diagram of a blockchain data processing system provided in Embodiment 2 of the present invention.

[0150] Reference Figure 7 , the data processing system of blockchain includes:

[0151] The target transaction initiating module 1 is used to initiate a target transaction; the target transaction includes a target transaction input and a target transaction output.

[0152] The transaction witness broadcast module 2 is used to determine the target shard according to the target transaction input, generate the target transaction witness according to the target transaction and the target shard, and then broadcast the target transaction and the target transaction witness to the blockchain.

[0153] The transaction witness verification module 3 is used for the target blockchain node in the target shard to verify the target transaction witness when the target shard receives the target transaction and the target transaction witness, and after extracting the target subset witness corresponding to the target shard, it updates the target state commitment value corresponding to the target shard according to the target subset witness, and packages the target transaction into a new block.

[0154] The state commitment value verification module 4 is used to receive a new block and verify the updated target state commitment value.

[0155] Further, see Figure 7 , the data processing system also includes: an accumulator building module 5.

[0156] The accumulator construction module 5 is used to divide the blockchain into multiple shards; generate an RSA group corresponding to the blockchain; the RSA group includes multiple generators; and construct a corresponding RSA accumulator according to different generators through each shard.

[0157] The embodiment of the present invention provides a data processing system for blockchain, in which the stateless verification technology is used to enable the sharded blockchain to perform transaction verification and witness extraction at the same time without storing other sharded state data. Except for broadcasting transactions, no inter-shard communication is required between the shards, thereby reducing inter-shard communication and further reducing the bandwidth overhead and storage overhead of the system. At the same time, the RSA accumulator is used, and the security of the RSA accumulator ensures that the system can resist double-spending attacks on blockchain transactions.

[0158] An embodiment of the present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the steps of the blockchain data processing method provided in the above embodiment are implemented.

[0159] An embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the blockchain data processing method of the above embodiment are executed.

[0160] The computer program product provided in the embodiment of the present invention includes a computer-readable storage medium storing program code. The instructions included in the program code can be used to execute the method described in the previous method embodiment. The specific implementation can be found in the method embodiment and will not be repeated here.

[0161] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the system and device described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.

[0162] In addition, in the description of the embodiments of the present invention, unless otherwise clearly specified and limited, the terms "installed", "connected", and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection or an indirect connection through an intermediate medium, or it can be the internal communication of two components. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.

[0163] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc., which can store program codes.

[0164] In the description of the present invention, it should be noted that the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc., indicating the orientation or positional relationship, are based on the orientation or positional relationship shown in the drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as limiting the present invention. In addition, the terms "first", "second", and "third" are used for descriptive purposes only, and cannot be understood as indicating or implying relative importance.

[0165] Finally, it should be noted that the above-described embodiments are only specific implementations of the present invention, which are used to illustrate the technical solutions of the present invention, rather than to limit them. The protection scope of the present invention is not limited thereto. Although the present invention is described in detail with reference to the above-described embodiments, ordinary technicians in the field should understand that any technician familiar with the technical field can still modify the technical solutions recorded in the above-described embodiments within the technical scope disclosed by the present invention, or can easily think of changes, or make equivalent replacements for some of the technical features therein; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be based on the protection scope of the claims.

Claims

1. A data processing method of blockchain, characterized in that: include: The target transaction initiated; the target transaction includes a target transaction input and a target transaction output; Determine a target shard according to the target transaction input, generate a target transaction witness according to the target transaction and the target shard, and then broadcast the target transaction and the target transaction witness to the blockchain; When the target shard receives the target transaction and the target transaction witness, the target blockchain node in the target shard verifies the target transaction witness, extracts the target subset witness corresponding to the target shard, updates the target state commitment value corresponding to the target shard according to the target subset witness, and packages the target transaction into a new block; The new block is received, and the updated target state commitment value is verified.

2. The data processing method of blockchain according to claim 1 is characterized in that: Before the step of initiating the target transaction, the method further includes: Dividing the blockchain into a plurality of shards; Generate an RSA group corresponding to the blockchain; the RSA group includes multiple generators; A corresponding RSA accumulator is constructed through each of the shards according to different generators.

3. The data processing method of blockchain according to claim 1 is characterized in that: The step of generating a target transaction witness according to the target transaction and the target shard comprises: Obtain member witnesses corresponding to the UTXO of each target transaction input; Aggregate the member witnesses of all the target transaction inputs in the same target shard into a sub-witness set; Aggregate all the subset witnesses to generate the target transaction witness.

4. The data processing method of blockchain according to claim 3 is characterized in that: The target transaction witness is calculated according to the following formula: Wherein, W is the target transaction witness; l is the number of the target shards used as the input of the target transaction; si is the shard index of the target shard; Witness the subset corresponding to the target shard with shard index si; N is the RSA group modulus.

5. The data processing method of blockchain according to claim 2 is characterized in that: The target blockchain node in the target shard verifies the target transaction witness, extracts the target subset witness corresponding to the target shard, updates the target state commitment value corresponding to the target shard according to the target subset witness, and packages the target transaction into a new block, including: The target blockchain node verifies the transaction witness and extracts the target subset witness corresponding to the target shard; The target blockchain node stores the target transaction corresponding to the verified transaction witness, the target transaction witness, and the subset witness corresponding to the target shard in the memory pool of the target shard; The target blockchain node extracts the target transaction, the target transaction witness, and the subset witness corresponding to the target shard from the memory pool in a preset order; The target blockchain node updates the RSA accumulator corresponding to the target shard according to the subset witness corresponding to the target shard; wherein the updating of the RSA accumulator includes removing the spent historical transaction output and adding the newly generated target transaction output; the value of the RSA accumulator corresponds to the state commitment value; The target blockchain node determines whether the update of the RSA accumulator is correct, and if so, determines that the state commitment value of the target shard is updated successfully; The target transaction is packaged into a new block, and the new block is added to the target shard.

6. The data processing method of blockchain according to claim 5 is characterized in that: The target blockchain node determines whether the update of the RSA accumulator is correct. If so, after determining that the state commitment value of the target shard is successfully updated, the method further includes: The target blockchain node updates the transaction witness corresponding to the historical transactions in the memory pool that have passed the verification but have not been packaged into the new block according to the updated state commitment value.

7. A blockchain data processing system, characterized in that: include: A target transaction initiating module, used for initiating a target transaction; the target transaction includes a target transaction input and a target transaction output; A transaction witness broadcasting module, configured to determine a target shard according to the target transaction input, generate a target transaction witness according to the target transaction and the target shard, and then broadcast the target transaction and the target transaction witness to the blockchain; A transaction witness verification module, which is used for, when the target shard receives the target transaction and the target transaction witness, the target blockchain node in the target shard verifies the target transaction witness, extracts the target subset witness corresponding to the target shard, updates the target state commitment value corresponding to the target shard according to the target subset witness, and packages the target transaction into a new block; The state commitment value verification module is used to receive the new block and verify the updated target state commitment value.

8. The blockchain data processing system according to claim 7, characterized in that: The data processing system further comprises: an accumulator construction module; The accumulator construction module is used to divide the blockchain into multiple shards; generate an RSA group corresponding to the blockchain; the RSA group includes multiple generators; and construct a corresponding RSA accumulator through each shard according to different generators.

9. An electronic device comprising a memory and a processor, wherein the memory stores a computer program that can be run on the processor, wherein: When the processor executes the computer program, the blockchain data processing method described in any one of claims 1 to 6 is implemented.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and when the computer instructions are executed by the processor, the blockchain transaction method according to any one of claims 1 to 6 is implemented.