A data modification method based on alliance chain
The data modification method of the alliance chain is improved through the chameleon hash algorithm and the multi-party secret key negotiation algorithm, solving the problem of large communication and computing overhead, and achieving efficient and secure data modification and editing, ensuring the legality and integrity of the data.
Patent Information
- Application Number
- CN202310673931.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-07
- Publication Date
- 2025-08-22
- Estimated Expiration
- 2043-06-07
AI Technical Summary
The existing data modification method based on alliance chains has problems such as large communication overhead and high computing overhead, and the modification permissions are easily abused, so the system efficiency needs to be improved.
The hash value is generated and encrypted by using the chameleon hash algorithm, and the chameleon hash private key ciphertext is generated by the multi-party secret key negotiation algorithm, which improves the blockchain structure to store the ciphertext, and makes data modifications through voting and permission node review to ensure the legitimacy and security of the modification.
It reduces the communication overhead of the system, improves the efficiency of transaction users to obtain trapped information fragments, avoids the central node's abuse of modification permissions, realizes the secure editing and manipulation of on-chain data, and ensures the legality and integrity of data modification.
Smart Images

Figure CN116737735B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of blockchain technology, and in particular to a data modification method based on an alliance chain. Background Art
[0002] A public blockchain is a fully decentralized blockchain where anyone can participate in transaction confirmation and consensus mechanisms. Leveraging its decentralized and tamper-proof technical characteristics, it establishes trust among distributed nodes, shares a distributed, autonomous ledger system, and enables value transfer. However, due to its complete decentralization, regulation of public blockchains is extremely difficult. Furthermore, due to its immutability, illegal, erroneous, or invalid data may be permanently stored on the blockchain, necessitating the blockchain's invalidation in severe cases. Therefore, given the dual demands of regulation and practical application, there is an urgent need for secure, convenient, and controllable technical means to update critical data on the blockchain and remove harmful data.
[0003] Consortium chains offer inherent advantages in addressing these issues. These blockchains are jointly initiated and maintained by several organizations and are open only to specific members of a group and a limited number of third parties. They balance the decentralization of public chains with the efficiency of private chains. They employ partial decentralization, offer greater controllability, are not publicly disclosed by default, offer fast transactions, and are regulator-friendly. They are currently the technology with the most practical application prospects for building industry digital ecosystems. Unlike public chains, where numerous nodes participate in consensus and data cannot be altered once uploaded, consortium chains have partially authorized nodes, with multiple pre-selected nodes designated as recordkeepers. This makes consortium chains the preferred choice for modifiable blockchains. It's important to note that "modifiability" does not challenge the inherent security of the blockchain; rather, it supplements the limitations imposed by "immutability." Modifications must represent the will and interests of the system, meaning they must be legitimate. Otherwise, the modified block data cannot be verified by the entire network. Therefore, "modifiability" still ensures data security, a feature guaranteed by the trapdoor one-way function and related method design.
[0004] However, the current data modification methods based on consortium chains have the problems of abuse of modification permissions, distribution of private keys, and recovery trapdoors, which all require high communication costs and computing overheads, and the system efficiency needs to be further improved. Summary of the Invention
[0005] In view of the problem of high communication overhead in the current data modification method based on alliance chain, the present invention provides a new data modification method based on alliance chain.
[0006] In a first aspect, the present invention provides a data modification method based on a consortium chain, comprising:
[0007] Step 1: Randomly generate a Chameleon Hash public-private key pair and variable parameters for each transaction, and use the Chameleon Hash algorithm to generate the hash value of the transaction;
[0008] Step 2: For each transaction, each user involved in the transaction is considered a party to the key negotiation. A multi-party key negotiation algorithm is used to encrypt the Chameleon Hash private key corresponding to the transaction using the user public key of each user to generate a Chameleon Hash private key ciphertext.
[0009] Step 3: Each transaction and its corresponding Chameleon Hash private key ciphertext are stored on-chain simultaneously. Specifically, the following steps are performed: adding the Merkle root of the transaction data and the Merkle root of the private key ciphertext to the block header; dividing the block body into a first storage area and a second storage area; storing the transaction data, corresponding Chameleon public keys, and variable parameters of all transaction users participating in the transaction in the first storage area; and storing the Chameleon Hash private key ciphertext in the second storage area; binding the Merkle root of the transaction data to the data stored in the first storage area, and binding the Merkle root of the private key ciphertext to the data stored in the second storage area;
[0010] Step 4: When it is necessary to modify the historical transactions stored on the chain, all transaction users involved in the historical transaction use the multi-party key agreement algorithm to restore the Chameleon Hash private key ciphertext stored on the chain to obtain the Chameleon Hash private key, and perform a hash collision based on the Chameleon Hash private key and the original variable parameters to obtain new variable parameters, thereby modifying the transaction data of the historical transaction.
[0011] Furthermore, step 1 specifically includes:
[0012] Set the security parameter λ, construct large prime numbers p and q that satisfy the security parameter λ; select the multiplication cyclic group The element g of intermediate order q, thus obtaining the common parameter pp = (p, q, g); where p, q satisfy p = kq + 1;
[0013] According to the common parameter pp, in the multiplication cyclic group Randomly select a number x and calculate h=g x , thus obtaining the Chameleon Hash private key HSK=x, Chameleon Hash public key HPK=h;
[0014] In the multiplication cyclic group A number τ is randomly selected as a variable parameter.
[0015] Furthermore, step 2 specifically includes:
[0016] Set the elliptic curve parameters E p , generate a random number r; where r is less than the order of the elliptic curve;
[0017] Initialize an intermediate parameter medium and set its initial value to empty;
[0018] According to the user public key PK of each transaction user i and the latest intermediate parameter medium, perform the following operations in sequence: medium←ECC[PK i + medium]; until all trading users have performed the above operations, the final intermediate parameter medium is obtained; i = 1, 2, 3, ..., n; n represents the total number of trading users participating in the transaction;
[0019] Embed the Chameleon Hash private key in plaintext to convert it into a point on the elliptic curve HSK ec ;
[0020] According to the random number r, the final intermediate parameter medium, point HSK ec and the elliptic curve parameter E p For base point G, do the following: CHSC [1] ←ECC[HSK ec +r*medium],CHSC [2] ←r*G; thus obtaining the Chameleon Hash private key ciphertext CHSC=(CHSC [1] ,CHSC [2] ).
[0021] Furthermore, the step 4 specifically includes: a voting phase and an authority node review and modification phase;
[0022] The voting stage specifically includes:
[0023] Step A1: User P in the consortium chain u Initiate a historical transaction T i Modification request R u And the modification request R u Sign to get the corresponding signature σ u , the modification request R u and the signature σ u Broadcast to all parties in the alliance chain who participated in the historical transaction T i All transaction users T users ;
[0024] Step A2: Any transaction user T user Receive the modification request R u After that, if the modification is agreed, the modification request R u Sign and broadcast;
[0025] Step A3: User P u Collect and participate in the historical transaction Ti All transaction users T users The modification request R u After the signatures are collected, the modification request R u , the signature σ u And all trading users T users The modification request R u The signature is broadcast to the authority node;
[0026] The authority node review and modification stage specifically includes:
[0027] Step B1: The authority node receives the modification request R u , signature σ u And all trading users T users The modification request R u After signing, the modification request R u And all trading users T users The modification request R u The signature is broadcasted to all parties in the alliance chain who participated in the historical transaction T i All transaction users T users ;
[0028] Step B2: Any transaction user T user After receiving the signature, the user uses his own private key to decrypt the Chameleon Hash private key ciphertext to obtain his own corresponding Chameleon Hash trapdoor fragment CHSC piece and CHSC piece Send to the authority node;
[0029] Step B3: The authority node collects all transaction users T users CHSC piece After that, according to all transaction users T users CHSC piece Synthesize the Chameleon hash private key, complete the hash collision, and check the historical transaction T i Make the following modifications: modify the original transaction content m into the new transaction content m′, change the original variable parameter τ into the new variable parameter τ′; and sign the new transaction content m′; the authority node signs the historical transaction T i The modification is broadcast, and the broadcast content includes: signature σ u 、All trading users T users The modification request R u and the signature of the new transaction content m′.
[0030] Furthermore, it also includes: the change confirmation stage; specifically including:
[0031] User P uReceive the authority node's response to the historical transaction T i After the modification is broadcast, all transaction users T before and after the transaction modification are verified users Whether the signatures are the same, R before and after the transaction modification u Whether they are the same and whether the hash values before and after the transaction modification are the same. If they are the same, the verification is passed, the historical transaction information is updated and broadcast.
[0032] Furthermore, in step B2, the user's own private key is used to decrypt the Chameleon Hash private key ciphertext to obtain the Chameleon Hash trapdoor fragment CHSC corresponding to the user's own private key. piece , specifically including:
[0033]
[0034] Among them, SK represents the user private key of the transaction user.
[0035] Furthermore, in step B3, according to all transaction users T users CHSC piece Synthesize the Chameleon hash private key, specifically including:
[0036] Initialize an intermediate parameter medium and set its initial value to empty;
[0037] According to each transaction user T user CHSC piece And the latest intermediate parameter medium, perform the following operations in sequence: Until CHSC of all trading users piece All operations have been performed to obtain the final intermediate parameter medium; i = 1, 2, 3, ..., n; n represents the total number of trading users;
[0038] Calculate HSK based on the final intermediate parameter medium ec ←ECC[medium-(n-1)*CHSC];
[0039] For the HSK ec Perform the inverse plaintext embedding operation to obtain the Chameleon Hash private key HSK.
[0040] Furthermore, in step 4, a hash collision is performed based on the chameleon hash private key and the original variable parameter to obtain a new variable parameter, which specifically includes:
[0041] According to the Chameleon hash public key HPK=h, the original transaction content m of the historical transaction and the original variable parameter τ, the hash value CH1=g is calculated. m h τ ;
[0042] According to the Chameleon hash private key HSK=x, the new transaction content m′ of the historical transaction and the new variable parameter τ′ to be calculated, the hash value CH2=g m′ h τ′ modp;
[0043] It is known that there is an equation CH1=CH2, that is, there is an equation m+xτ=m′+xτ′modq, so we can calculate τ′=(mm′+xτ)·x -1 modq.
[0044] In a second aspect, the present invention provides an electronic device comprising: a memory and a processor, wherein the processor and the memory communicate with each other via a bus; the memory stores program instructions that can be executed by the processor, and the processor can execute any of the above methods by calling the program instructions.
[0045] In a third aspect, the present invention provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program implements any of the above methods when executed by a processor.
[0046] Beneficial effects of the present invention:
[0047] 1. A Chameleon Hash trapdoor information storage method was designed. By improving the Elliptic Curve Diffie-Hellman (ECDH) key exchange algorithm, the trapdoor information is encrypted to generate the Chameleon Hash private key ciphertext. Simultaneously, the traditional blockchain structure is modified by adding a Merkle tree to the original block body to store the Chameleon Hash private key ciphertext. This completes the on-chain encrypted storage of the trapdoor information, eliminating the system overhead required to distribute the secret key and improving the efficiency of transaction users in obtaining their trapdoor information fragments.
[0048] 2. By performing consistency verification on the Merkle root of the Chameleon hash private key ciphertext, it can be ensured that the voting rights of transaction users on the modification method are not damaged.
[0049] 3. For the alliance chain, a transaction-granularity ledger modification method is designed based on the new block structure. The method of distributed collaborative decision-making by multiple transaction users is adopted to realize the editing and control of on-chain data, avoid the abuse of modification permissions by central nodes, and effectively resist centralized attacks.
[0050] 4. Performance testing was conducted on the proposed ledger modification method. The main focus was on analyzing and testing the execution rate, additional storage space, and security of key processes (such as the process of generating Chameleon Hash private key ciphertext, the process of transaction users decrypting and generating their own private key ciphertext fragments, the process of synthesizing Chameleon Hash private keys based on private key ciphertext fragments, and the process of modifying transactions). Among them, the execution rate of key processes as a whole reached milliseconds and had provable security. BRIEF DESCRIPTION OF THE DRAWINGS
[0051] Figure 1 A flowchart of a data modification method based on a consortium chain provided by an embodiment of the present invention;
[0052] Figure 2 A schematic diagram of an improved block structure provided by an embodiment of the present invention;
[0053] Figure 3 A schematic diagram of a process for generating a Chameleon Hash private key ciphertext CHSC provided in an embodiment of the present invention;
[0054] Figure 4 A schematic diagram of the process of decrypting CHSC to obtain a Chameleon Hash private key provided by an embodiment of the present invention;
[0055] Figure 5 A schematic structural diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0056] To make the objectives, technical solutions, and advantages of the present invention more clear, the technical solutions in the embodiments of the present invention will be clearly described below in conjunction with the accompanying drawings. Obviously, the described embodiments are only 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 making creative efforts are within the scope of protection of the present invention.
[0057] Example 1
[0058] like Figure 1 As shown, an embodiment of the present invention provides a data modification method based on a consortium chain, comprising the following steps:
[0059] S101: Randomly generate a Chameleon Hash public-private key pair and variable parameters for each transaction, and use the Chameleon Hash algorithm to generate the hash value of the transaction;
[0060] Specifically, set the security parameter λ, construct large prime numbers p,q that satisfy the security parameter λ; select the multiplication cyclic group The element g of intermediate order q, thus obtaining the common parameter pp = (p, q, g); where p, q satisfy p = kq + 1;
[0061] According to the common parameter pp, in the multiplication cyclic group Randomly select a number x and calculate h=g x , thus obtaining the Chameleon Hash private key HSK=x, Chameleon Hash public key HPK=h;
[0062] In the multiplication cyclic group A number τ is randomly selected as a variable parameter.
[0063] According to the Chameleon hash public key HPK=h, transaction content m and variable parameter τ, the hash value of the transaction CH=g is calculated m h τ , also known as the summary of the transaction. When the transaction content is subsequently changed, the hash value needs to remain unchanged.
[0064] S102: For each transaction, each user participating in the transaction is treated as a party to the key negotiation. A multi-party key negotiation algorithm is used to encrypt the Chameleon Hash private key corresponding to the transaction using the user public key of each user to generate a Chameleon Hash private key ciphertext.
[0065] Specifically, in this embodiment, each user included in a transaction is referred to as a transaction user.
[0066] S103: Each transaction and its corresponding Chameleon Hash private key ciphertext are stored on-chain simultaneously, specifically including: adding the Merkle root of the transaction data and the Merkle root of the private key ciphertext to the block header, dividing the block body into a first storage area and a second storage area, storing the transaction data, corresponding Chameleon public keys and variable parameters of all transaction users participating in the transaction in the first storage area, and storing the Chameleon Hash private key ciphertext in the second storage area; binding the Merkle root of the transaction data to the data stored in the first storage area, and binding the Merkle root of the private key ciphertext to the data stored in the second storage area;
[0067] Specifically, the original block structure is improved in this embodiment. Figure 2 shown.
[0068] S104: When it is necessary to modify the historical transaction stored on the chain, all transaction users participating in the historical transaction use the multi-party key agreement algorithm to restore the Chameleon Hash private key ciphertext stored on the chain to obtain the Chameleon Hash private key, and perform hash collision based on the Chameleon Hash private key and the original variable parameters to obtain new variable parameters, thereby modifying the transaction data of the historical transaction.
[0069] The data modification method based on the alliance chain provided by the embodiment of the present invention has the following advantages:
[0070] (1) In the improved new block structure, the block body consists of two parts: one is transaction data, and the other is private key ciphertext data. In the block, the Chameleon Hash private key ciphertext, Chameleon Hash variable parameters, and Chameleon Hash public key correspond one-to-one with the transactions in the block. The existence and integrity of the block data can be quickly summarized and verified through the binary Merkle tree.
[0071] (2) In the improved new block structure, the Merkle root of the private key ciphertext is added to the block header. Each transaction is bound to its initial transaction user through the Merkle root of the private key ciphertext, effectively ensuring that the transaction user and their partial trapdoor information decryption capabilities remain unchanged before and after the ledger transaction is modified. If the authority node acts maliciously when modifying the ledger and grants the trapdoor information decryption permission to non-initial transaction users, the Merkle root of the private key ciphertext will be changed, and the block will fail integrity verification.
[0072] (3) Based on the improved new block structure, the Chameleon hash private key ciphertext is stored on the chain, which ensures the efficiency of transaction users to directly decrypt and obtain relevant trapdoor information fragments from the chain, thereby reducing the communication overhead of the system.
[0073] (4) Chameleon hash is used as the hash value construction method to ensure the security and applicability of the hash function; Chameleon hash is used to replace the inner hash in the blockchain to implement integrity verification after the blockchain is modified. At the same time, when modifying transaction data, it is only necessary to reforge the variable parameters related to the transaction hash to complete the hash collision. After the transaction data is changed, the hash value of the transaction does not change, thereby meeting the verifiability of the blockchain. This chameleon hash function still meets the collision resistance for users without trapdoor information.
[0074] Example 2
[0075] Based on the above embodiment 1, in this embodiment of the present invention, the multi-party key agreement algorithm is obtained by improving the ECDH algorithm so that it can be extended to multi-user key agreement. The above step S102 specifically includes the following steps:
[0076] S201: Set elliptic curve parameters E p , generate a random number r; where r is less than the order of the elliptic curve;
[0077] S202: Initialize an intermediate parameter medium and set its initial value to be empty;
[0078] S203: Based on the public key PK of each transaction user i and the latest intermediate parameter medium, perform the following operations in sequence: medium←ECC[PK i + medium]; until all trading users have performed the above operations, the final intermediate parameter medium is obtained; i = 1, 2, 3, ..., n; n represents the total number of trading users participating in the transaction;
[0079] S204: embed the Chameleon Hash private key in plain text to convert it into a point HSK on the elliptic curve ec ;
[0080] S205: Based on the random number r, the final intermediate parameter medium, point HSK ec and the elliptic curve parameter E p For base point G, do the following: CHSC [1] ←ECC[HSK ec +r*medium],CHSC [2] ←r*G; thus obtaining the Chameleon Hash private key ciphertext CHSC=(CHSC [1] ,CHSC [2] ).
[0081] The data modification method based on the alliance chain provided by the embodiment of the present invention randomly generates a chameleon hash private key corresponding to the transaction for each transaction, and the private key generates a chameleon hash private key ciphertext through the improved ECDH algorithm, and adopts the same elliptic curve encryption standard as that for generating the user's public and private keys to complete the encryption and chaining. Figure 3 The figure shows the process of generating the Chameleon Hash private key ciphertext when there are two transaction users. It should be noted that the embodiment of the present invention is also applicable when there are three or more transaction users.
[0082] Example 3
[0083] Based on the above embodiments, when it is necessary to modify historical transactions stored on the chain, the modification process mainly includes the following three stages: voting stage, authority node review and modification stage, and change confirmation stage.
[0084] The voting stage specifically includes:
[0085] Step A1: User P in the consortium chain u Initiate a historical transaction T i Modification request R u And the modification request R u Sign to get the corresponding signature σ u , the modification request R u and the signature σ u Broadcast to all parties in the alliance chain who participated in the historical transaction T i All transaction users T users ;
[0086] Step A2: Any transaction user T user Receive the modification request R u After that, if the modification is agreed, the modification request R u Sign and broadcast;
[0087] Step A3: User P u Collect and participate in the historical transaction Ti All transaction users T users The modification request R u After the signatures are collected, the modification request R u , the signature σ u And all trading users T users The modification request R u The signature is broadcast to the authority node;
[0088] The authority node review and modification stage specifically includes:
[0089] Step B1: The authority node receives the modification request R u , signature σ u And all trading users T users The modification request R u After signing, the modification request R u And all trading users T users The modification request R u The signature is broadcasted to all parties in the alliance chain who participated in the historical transaction T i All transaction users T users ;
[0090] Step B2: Any transaction user T user After receiving the signature, the user uses his own private key to decrypt the Chameleon Hash private key ciphertext to obtain his own corresponding Chameleon Hash trapdoor fragment CHSC piece and CHSC piece Send to the authority node;
[0091]
[0092] Among them, SK represents the user private key of the transaction user.
[0093] Step B3: The authority node collects all transaction users T users CHSC piece After that, according to all transaction users T users CHSC piece Synthesize Chameleon hash private key (such as Figure 4 As shown), complete the hash collision, and the historical transaction T i Make the following modifications: modify the original transaction content m into the new transaction content m′, change the original variable parameter τ into the new variable parameter τ′; and sign the new transaction content m′; the authority node signs the historical transaction T i The modification is broadcast, and the broadcast content includes: signature σ u 、All trading users T users The modification request R uand the signature of the new transaction content m′.
[0094] Specifically, the process of synthesizing the Chameleon Hash private key is as follows: initialize an intermediate parameter medium and set its initial value to be empty; according to each transaction user T user CHSC piece And the latest intermediate parameter medium, perform the following operations in sequence: Until CHSC of all trading users piece The above operations have been performed to obtain the final intermediate parameter medium; i = 1, 2, 3, ..., n; n represents the total number of trading users; based on the final intermediate parameter medium, calculate HSK ec ←ECC[medium-(n-1)*CHSC]; for the HSK ec Perform the inverse plaintext embedding operation to obtain the Chameleon Hash private key HSK;
[0095] After obtaining the Chameleon Hash private key HSK, the process of reforging the variable parameters is as follows: Based on the Chameleon Hash public key HPK=h, the original transaction content m of the historical transaction and the original variable parameter τ, the hash value CH1=g is calculated. m h τ ; According to the Chameleon hash private key HSK = x, the new transaction content m' of the historical transaction and the new variable parameter τ' to be calculated, the hash value CH2 = g m′ h τ′ modp; It is known that there is an equation CH1=CH2, that is, there is an equation m+xτ=m′+xτ′mod q, so we can calculate τ′=(mm′+xτ)·x -1 modq. m,τ,m′ are all Elements in .
[0096] The change confirmation stage specifically includes:
[0097] User P u Receive the authority node's response to the historical transaction T i After the modification is broadcast, all transaction users T before and after the transaction modification are verified users Whether the signatures are the same, R before and after the transaction modification u Whether they are the same and whether the hash values before and after the transaction modification are the same. If they are the same, the verification is passed, the historical transaction information is updated and broadcast.
[0098] In the data modification method based on the alliance chain provided by the embodiment of the present invention, transaction users respectively have the right to vote on the modification method of the transaction and the ability to decrypt part of the chameleon hash trapdoor information. A transaction user can only decrypt part of the ciphertext information using his or her own user private key. Only when all transaction users decrypt the ciphertext together can the chameleon hash trapdoor information be obtained. Therefore, the security of the blockchain system can be ensured and the abuse of modification permissions can be avoided.
[0099] Example 4
[0100] Figure 5 This is a structural block diagram of an electronic device provided by an embodiment of the present invention. Figure 5 As shown, the electronic device includes: a memory 502 and a processor 501, and the processor 501 and the memory 502 communicate with each other through a bus 503; the memory 502 stores program instructions that can be executed by the processor, and the processor 501 calls the program instructions to execute the following method, for example, including: randomly generating a chameleon hash public-private key pair and variable parameters for each transaction, and using the chameleon hash algorithm to generate a hash value of the transaction; for each transaction, each transaction user participating in the transaction is regarded as a party to the secret key negotiation, and a multi-party secret key negotiation algorithm is used to encrypt the chameleon hash private key corresponding to the transaction according to the user public key of each transaction user to generate a chameleon hash private key ciphertext; each transaction and its corresponding chameleon hash private key ciphertext are stored on the chain at the same time, specifically The method includes: adding the Merkle root of transaction data and the Merkle root of private key ciphertext to the block header, dividing the block body into a first storage area and a second storage area, storing the transaction data, corresponding chameleon public keys and variable parameters of all transaction users participating in the transaction in the first storage area, and storing the chameleon hash private key ciphertext in the second storage area; binding the Merkle root of transaction data to the data stored in the first storage area, and binding the Merkle root of private key ciphertext to the data stored in the second storage area; when it is necessary to modify the historical transactions stored on the chain, all transaction users participating in the historical transaction use a multi-party secret key agreement algorithm to restore the chameleon hash private key ciphertext stored on the chain to obtain the chameleon hash private key, perform hash collision according to the chameleon hash private key and the original variable parameter, obtain a new variable parameter, and thereby modify the transaction data of the historical transaction.
[0101] An embodiment of the present invention further provides a computer program product, comprising a computer program stored on a non-transitory computer-readable storage medium, the computer program comprising program instructions. When the program instructions are executed by a computer, the computer can perform the methods provided by the above-mentioned method embodiments, for example, including: randomly generating a chameleon hash public-private key pair and variable parameters for each transaction, and generating a hash value of the transaction using a chameleon hash algorithm; for each transaction, treating each transaction user participating in the transaction as a party to a secret key negotiation, using a multi-party secret key negotiation algorithm to encrypt the chameleon hash private key corresponding to the transaction according to the user public key of each transaction user to generate a chameleon hash private key ciphertext; and storing each transaction and its corresponding chameleon hash private key ciphertext on a chain at the same time, specifically including: The Merkle root of transaction data and the Merkle root of private key ciphertext are added to the block header, and the block body is divided into a first storage area and a second storage area. The transaction data, corresponding chameleon public key and variable parameters of all transaction users participating in the transaction are stored in the first storage area, and the chameleon hash private key ciphertext is stored in the second storage area; the Merkle root of transaction data is bound to the data stored in the first storage area, and the Merkle root of private key ciphertext is bound to the data stored in the second storage area; when it is necessary to modify the historical transactions stored on the chain, all transaction users participating in the historical transaction use a multi-party secret key agreement algorithm to restore the chameleon hash private key ciphertext stored on the chain to obtain the chameleon hash private key, and perform hash collision based on the chameleon hash private key and the original variable parameter to obtain a new variable parameter, thereby modifying the transaction data of the historical transaction.
[0102] An embodiment of the present invention further provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer instructions, wherein the computer instructions enable the computer to execute the methods provided by the above-mentioned method embodiments, for example, including: randomly generating a chameleon hash public-private key pair and variable parameters for each transaction, and using the chameleon hash algorithm to generate a hash value of the transaction; for each transaction, each transaction user participating in the transaction is regarded as a party to the secret key negotiation, and a multi-party secret key negotiation algorithm is used to encrypt the chameleon hash private key corresponding to the transaction according to the user public key of each transaction user to generate a chameleon hash private key ciphertext; each transaction and its corresponding chameleon hash private key ciphertext are stored on the chain at the same time, specifically including: adding the Merkle root and The Merkle root of the private key ciphertext divides the block body into a first storage area and a second storage area, wherein the transaction data, the corresponding chameleon public key and the variable parameters of all transaction users participating in the transaction are stored in the first storage area, and the chameleon hash private key ciphertext is stored in the second storage area; the Merkle root of the transaction data is bound to the data stored in the first storage area, and the Merkle root of the private key ciphertext is bound to the data stored in the second storage area; when it is necessary to modify the historical transactions stored on the chain, all transaction users participating in the historical transaction use a multi-party secret key agreement algorithm to restore the chameleon hash private key ciphertext stored on the chain to obtain the chameleon hash private key, perform a hash collision based on the chameleon hash private key and the original variable parameters, and obtain new variable parameters, thereby modifying the transaction data of the historical transaction.
[0103] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the various embodiments of the present invention.
Claims
1. A data modification method based on alliance chain, characterized in that: include: Step 1: Randomly generate a Chameleon Hash public-private key pair and variable parameters for each transaction, and use the Chameleon Hash algorithm to generate the hash value of the transaction; Step 2: For each transaction, each user involved in the transaction is considered a party to the key negotiation. A multi-party key negotiation algorithm is used to encrypt the Chameleon Hash private key corresponding to the transaction using the user public key of each user to generate a Chameleon Hash private key ciphertext. Step 3: Each transaction and its corresponding Chameleon Hash private key ciphertext are stored on-chain simultaneously. Specifically, the following steps are performed: adding the Merkle root of the transaction data and the Merkle root of the private key ciphertext to the block header; dividing the block body into a first storage area and a second storage area; storing the transaction data, corresponding Chameleon public keys, and variable parameters of all transaction users participating in the transaction in the first storage area; and storing the Chameleon Hash private key ciphertext in the second storage area; binding the Merkle root of the transaction data to the data stored in the first storage area, and binding the Merkle root of the private key ciphertext to the data stored in the second storage area; Step 4: When it is necessary to modify the historical transactions stored on the chain, all transaction users involved in the historical transaction use the multi-party key agreement algorithm to restore the Chameleon Hash private key ciphertext stored on the chain to obtain the Chameleon Hash private key, and perform a hash collision based on the Chameleon Hash private key and the original variable parameters to obtain new variable parameters, thereby modifying the transaction data of the historical transaction.
2. A data modification method based on alliance chain according to claim 1, characterized in that: Step 1 specifically includes: Set the security parameter λ, construct large prime numbers p and q that satisfy the security parameter λ; select the multiplication cyclic group The element g of intermediate order q, thus obtaining the common parameter pp = (p, q, g); where p, q satisfy p = kq + 1; According to the common parameter pp, in the multiplication cyclic group Randomly select a number x and calculate h=g x , thus obtaining the Chameleon Hash private key HSK=x, Chameleon Hash public key HPK=h; In the multiplication cyclic group A number τ is randomly selected as a variable parameter.
3. A data modification method based on alliance chain according to claim 2, characterized in that: Step 2 specifically includes: Set the elliptic curve parameters E p , generate a random number r; where r is less than the order of the elliptic curve; Initialize an intermediate parameter medium and set its initial value to empty; According to the user public key PK of each transaction user i and the latest intermediate parameter medium, perform the following operations in sequence: medium←ECC[PK i + medium]; until all trading users have performed the above operations, the final intermediate parameter medium is obtained; i = 1, 2, 3, ..., n; n represents the total number of trading users participating in the transaction; Embed the Chameleon Hash private key in plaintext to convert it into a point on the elliptic curve HSK ec ; According to the random number r, the final intermediate parameter medium, point HSK ec and the elliptic curve parameter E p For base point G, do the following: CHSC [1] ←ECC[HSK ec +r*medium],CHSC [2] ←r*G; thus obtaining the Chameleon Hash private key ciphertext CHSC=(CHSC [1] ,CHSC [2] ).
4. A data modification method based on alliance chain according to claim 3, characterized in that: The step 4 specifically includes: a voting phase and an authority node review and modification phase; The voting stage specifically includes: Step A1: User P in the consortium chain u Initiate a historical transaction T i Modification request R u And the modification request R u Sign to get the corresponding signature σ u , the modification request R u and the signature σ u Broadcast to all parties in the alliance chain who participated in the historical transaction T i All transaction users T users ; Step A2: Any transaction user T user Receive the modification request R u After that, if the modification is agreed, the modification request R u Sign and broadcast; Step A3: User P u Collect and participate in the historical transaction T i All transaction users T users The modification request R u After the signatures are collected, the modification request R u , the signature σ u And all trading users T users The modification request R u The signature is broadcast to the authority node; The authority node review and modification stage specifically includes: Step B1: The authority node receives the modification request R u , signature σ u And all trading users T users The modification request R u After signing, the modification request R u And all trading users T users The modification request R u The signature is broadcasted to all parties in the alliance chain who participated in the historical transaction T i All transaction users T users ; Step B2: Any transaction user T user After receiving the signature, the user uses his own private key to decrypt the Chameleon Hash private key ciphertext to obtain his own corresponding Chameleon Hash trapdoor fragment CHSC piece and CHSC piece Send to the authority node; Step B3: The authority node collects all transaction users T users CHSC piece After that, according to all transaction users T users CHSC piece Synthesize the Chameleon hash private key, complete the hash collision, and check the historical transaction T i Make the following modifications: modify the original transaction content m into the new transaction content m′, change the original variable parameter τ into the new variable parameter τ′; and sign the new transaction content m′; the authority node signs the historical transaction T i The modification is broadcast, and the broadcast content includes: signature σ u 、All trading users T users The modification request R u and the signature of the new transaction content m′.
5. A data modification method based on alliance chain according to claim 4, characterized in that: Also includes: Change confirmation phase; Specifically include: User P u Receive the authority node's response to the historical transaction T i After the modification is broadcast, all transaction users T before and after the transaction modification are verified users Whether the signatures are the same, R before and after the transaction modification u Whether they are the same and whether the hash values before and after the transaction modification are the same. If they are the same, the verification is passed, the historical transaction information is updated and broadcast.
6. A data modification method based on alliance chain according to claim 4, characterized in that: In step B2, the user uses his own private key to decrypt the Chameleon Hash private key ciphertext to obtain the corresponding Chameleon Hash trapdoor fragment CHSC piece , specifically including: Among them, SK represents the user private key of the transaction user.
7. A data modification method based on alliance chain according to claim 6, characterized in that: In step B3, according to all transaction users T users CHSC piece Synthesize the Chameleon hash private key, specifically including: Initialize an intermediate parameter medium and set its initial value to empty; According to each transaction user T user CHSC piece And the latest intermediate parameter medium, perform the following operations in sequence: Until CHSC of all trading users piece All operations have been performed to obtain the final intermediate parameter medium; i = 1, 2, 3, ..., n; n represents the total number of trading users; Calculate HSK based on the final intermediate parameter medium ec ←ECC[medium-(n-1)*CHSC]; For the HSK ec Perform the inverse plaintext embedding operation to obtain the Chameleon Hash private key HSK.
8. A data modification method based on alliance chain according to claim 7, characterized in that: In step 4, a hash collision is performed based on the Chameleon Hash private key and the original variable parameter to obtain a new variable parameter, which specifically includes: According to the Chameleon hash public key HPK=h, the original transaction content m of the historical transaction and the original variable parameter τ, the hash value CH1=g is calculated. m h τ ; According to the Chameleon hash private key HSK=x, the new transaction content m′ of the historical transaction and the new variable parameter τ′ to be calculated, the hash value CH2=g m′ h τ′ mod p; It is known that there is an equation CH1=CH2, that is, there is an equation m+xτ=m′+xτ′mod q, so we can calculate τ′=(mm′+xτ)·x -1 mod q.
9. An electronic device, characterized in that: include: A memory and a processor, wherein the processor and the memory communicate with each other via a bus; The memory stores program instructions that can be executed by the processor, and the processor can execute the method according to any one of claims 1 to 8 by calling the program instructions.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 8 is implemented.