Blockchain editable method, device and transaction method for electronic money

By constructing a Merkle tree in the electronic currency blockchain and updating the leaf nodes, the problem of difficulty in fine-grained and efficient editing in existing technologies is solved, achieving efficient and accurate blockchain editing.

CN116029706BActive Publication Date: 2026-05-29DATA COMM SCI & TECH RES INST +2

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
DATA COMM SCI & TECH RES INST
Filing Date
2021-10-27
Publication Date
2026-05-29

AI Technical Summary

Technical Problem

Existing blockchain editable methods for electronic currencies are difficult to edit with fine granularity, and have low editing efficiency and high computational complexity.

Method used

The parent node of the leaf node in the Merkle tree within the block is generated by the chameleon hash function, the Merkle tree is constructed, and only the relevant leaf nodes are updated when a transaction is modified, thus completing the editing of the Merkle tree and avoiding affecting other nodes.

Benefits of technology

It enables fine-grained editing of the blockchain, reduces the scope of impact, and improves editing efficiency and computational simplicity.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116029706B_ABST
    Figure CN116029706B_ABST
Patent Text Reader

Abstract

The application relates to a blockchain editable method, device and transaction method for electronic currency, and belongs to the technical field of blockchains. The method solves the problems of the prior art, such as difficulty in fine-grained editing, low editing efficiency and high computing complexity. The method comprises the following steps: generating parent nodes of leaf nodes of a Merkle tree in each block through a chameleon hash function, constructing the Merkle tree in each block, and connecting the blocks to form an electronic currency blockchain; wherein, the leaf nodes of the Merkle tree in each block are generated based on a hash function and electronic currency transaction information; according to a received electronic currency transaction modification instruction, the block of original transaction information to be modified in the blockchain is determined, then the leaf node on the Merkle tree in the block is determined, and finally the editing of the Merkle tree is completed by updating the leaf node.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of blockchain technology, and in particular to a blockchain-editable method, apparatus, and transaction method for electronic currency. Background Technology

[0002] With the continuous development of computer technology and the internet, data security is becoming increasingly important. Blockchain, as a distributed, tamper-proof, and immutable high-security data storage technology, has been applied to all aspects of society. While the immutability and immutability of blockchain are crucial for providing security, they also hinder the modification of content within the blockchain. Currently, major banks have built blockchain transaction platforms and are using them in actual production and transactions. However, the immutability of blockchain means that transactions involving electronic currencies are irreversible during issuance and circulation, making it difficult for electronic currencies to be used in traditional payment methods.

[0003] Currently, methods for making blockchain editable mainly include non-cryptographic methods, decryption algorithms, and cryptographic algorithms. Non-cryptographic methods use hard forks, requiring the entire blockchain to be rebuilt for each transaction modification, which has a significant impact and is difficult to implement. Decryption algorithms use μchain and consensus voting methods, which are overly complex and inefficient. Cryptographic algorithms include editing the entire block and editing individual transactions. Editing the entire block involves replacing the block hash with a chameleon hash function; this method requires changing an entire block for each transaction modification, resulting in a wide impact and lacking precision. Editing individual transactions involves replacing the hash of potentially modified transactions with a chameleon hash function; this method requires anticipating transactions that may need modification in the future, is inefficient, computationally difficult, and impractical.

[0004] Therefore, current blockchain editable methods used for electronic currencies are difficult to edit with fine granularity, and have low editing efficiency and high computational complexity. Summary of the Invention

[0005] Based on the above analysis, the embodiments of the present invention aim to provide a blockchain editable method, apparatus and transaction method for electronic currency, in order to solve the problems of current blockchain editable methods for electronic currency, which are difficult to perform fine-grained editing and have low editing efficiency and high computational complexity.

[0006] This invention provides an editable blockchain method for electronic currency, comprising the following steps:

[0007] The parent node of the Merkle tree leaf node in each block is generated by the chameleon hash function, thereby constructing the Merkle tree in each block and connecting the blocks to form the electronic currency blockchain; among them, the leaf nodes of the Merkle tree in each block are generated based on the hash function and electronic currency transaction information.

[0008] Upon receiving the electronic currency transaction modification instruction, the block in the blockchain containing the original transaction information to be modified is determined, and then the leaf nodes on the Merkle tree within that block are identified. The Merkle tree is then edited by updating the leaf nodes.

[0009] Furthermore, when constructing the Merkle tree within each block, the input to the chameleon hash function includes a public key, a message, and a random number. The message is the hash value calculated based on the hash function after concatenating the hash values ​​of the corresponding two leaf nodes of the Merkle tree. The random number is the XOR value of the hash values ​​of the corresponding two leaf nodes.

[0010] Furthermore, the Merkle tree within each block is constructed in the following manner:

[0011] The electronic currency transaction information within the block is used to calculate the hash value based on the hash function, and each hash value is used as a leaf node on the first level of the Merkle tree;

[0012] After pairing the leaf nodes, calculate the chameleon hash value based on the chameleon hash function, and use each chameleon hash value as the parent node on the second level of the Merkle tree.

[0013] After pairing adjacent parent nodes on the second level, calculate the hash value based on the hash function, and use each hash value as the parent node on the third level of the Merkle tree. Continue in this manner until only one node remains, which is used as the root node of the Merkle tree, thus completing the construction of the Merkle tree.

[0014] The electronic currency information within each block is divided according to the transaction time.

[0015] Furthermore, the construction of the Merkle tree within each block also includes: the leaf node in the Merkle tree includes the electronic currency transaction information corresponding to the hash value in the leaf node, as well as the chameleon hash function message and random number of the parent node of the leaf node.

[0016] Furthermore, the step of determining the block in the blockchain containing the original transaction information to be modified based on the received electronic currency transaction modification instruction, and then determining the position on the Merkle tree within that block, specifically involves:

[0017] The block in the blockchain containing the original transaction information to be modified is determined based on the transaction time in the electronic currency transaction modification instruction;

[0018] The leaf node of the original transaction information to be modified in the Merkle tree is determined based on the hash value in the electronic currency transaction modification instruction.

[0019] Furthermore, if a leaf node under the same parent node on the second level of the Merkle tree needs to modify its transaction information, the leaf node under the parent node is updated in the following way to perform the Merkle edit:

[0020] Get the chameleon hash function message and random number of the parent node before the update on the second layer, and get the private key; where, a leaf node under the parent node before the update is the leaf node where the original transaction information to be modified is located;

[0021] Based on the leaf node where the original transaction information to be modified is located, determine the message of the chameleon hash function of the updated parent node as the hash value of another leaf node under the parent node before the update.

[0022] The first random number is calculated by taking the private key, the message of the parent node's chameleon hash function before the update, the message of the parent node's chameleon hash function after the update, and the message of the parent node's chameleon hash function after the update as inputs to the Forge() algorithm in the chameleon hash function.

[0023] The hash value of the leaf node containing the original transaction information to be modified is updated to the first random number. The original transaction information to be modified in the leaf node is updated to the modified transaction information in the electronic currency transaction modification instruction. The messages in the two leaf nodes are updated to the message of the updated parent node's chameleon hash function, and the random number is updated to the first random number, thus completing the editing of the Merkle tree.

[0024] Furthermore, when the transaction information in two leaf nodes under the same parent node on the second level of the Merkle tree needs to be modified, the leaf nodes under the parent node are updated in the following way to edit the Merkle:

[0025] Obtain the chameleon hash function message and random number of the parent node before the update on the second layer, and obtain the private key; where the two leaf nodes under the parent node before the update are the two leaf nodes where the original transaction information to be modified is located;

[0026] Based on the leaf node where the original transaction information to be modified is located, it is determined that the message of the chameleon hash function of the parent node after the update is empty;

[0027] The private key, the message of the parent node's chameleon hash function before the update, the random number, and the message of the parent node's chameleon hash function after the update are used as inputs to the Forge() algorithm in the chameleon hash function to calculate the second random number.

[0028] Based on the number of bits in the second random number, the second random number is divided into a third random number and a fourth random number;

[0029] The hash values ​​of the two leaf nodes are updated to the third and fourth random numbers, respectively. The original transaction information to be modified in the two leaf nodes is updated to the corresponding modified transaction information in the electronic currency transaction modification instruction. The messages in the two leaf nodes are updated to the message of the updated parent node's chameleon hash function, and the random number is updated to the second random number, thus completing the editing of the Merkle tree.

[0030] Furthermore, based on the number of bits of the second random number, the second random number is divided into a third random number and a fourth random number, specifically as follows:

[0031] Based on the total number of bits N in the second random number, the values ​​in the first N / 2 bits of the second random number are divided into the third random number, and the values ​​in the last N / 2 bits are divided into the fourth random number.

[0032] This invention also provides a blockchain editable device for electronic currency, comprising:

[0033] The blockchain construction module is used to generate the parent node of the Merkle tree leaf node in each block through the chameleon hash function, thereby constructing the Merkle tree in each block and connecting the blocks to form the electronic currency blockchain; among them, the leaf nodes of the Merkle tree in each block are generated based on the hash function and electronic currency transaction information.

[0034] The blockchain editing module is used to determine the block in the blockchain containing the original transaction information to be modified based on the received electronic currency transaction modification instruction, then determine the leaf nodes on the Merkle tree within that block, and finally complete the editing of the Merkle tree by updating the leaf nodes.

[0035] This invention also provides an electronic currency transaction method, including the blockchain editable method described above, and, after completing the editing of the Merkle tree, further including performing blockchain currency transactions based on the edited blockchain.

[0036] Compared with the prior art, the present invention can achieve the following beneficial effects:

[0037] This invention provides an editable blockchain method, apparatus, and transaction method for electronic currency. It constructs the Merkle tree in a block by generating the parent nodes of the leaf nodes in the Merkle tree based on a chameleon hash function. When a transaction is modified, the Merkle tree can be edited simply by changing the leaf nodes, while the parent nodes of the leaf nodes and higher-level parent nodes remain unchanged. Furthermore, when a transaction is modified, only the transactions of the two relevant leaf nodes are affected. This highly targeted approach enables fine-grained editing of the blockchain, significantly reducing the scope of impact. The method is computationally simple and highly efficient.

[0038] In this invention, the above-described technical solutions can be combined with each other to achieve more preferred combinations. Other features and advantages of this invention will be set forth in the following description, and some advantages may become apparent from the description or be learned by practicing the invention. The objects and other advantages of this invention can be realized and obtained from what is particularly pointed out in the description and drawings. Attached Figure Description

[0039] The accompanying drawings are for illustrative purposes only and are not intended to limit the invention. Throughout the drawings, the same reference numerals denote the same parts.

[0040] Figure 1 A flowchart illustrating the editable blockchain method for electronic currency provided for the implementation of this invention;

[0041] Figure 2 The existing Merkle tree structure;

[0042] Figure 3 This is a schematic diagram illustrating how, in the construction phase of this invention, the hash function on the second layer of the Merkle tree is replaced with a chameleon hash function. Detailed Implementation

[0043] Preferred embodiments of the present invention will now be described in detail with reference to the accompanying drawings, which form part of this application and are used together with the embodiments of the present invention to illustrate the principles of the present invention, but are not intended to limit the scope of the present invention.

[0044] Existing non-cryptographic hard fork methods for editing blockchains require reconstructing the entire blockchain to modify just one transaction. Cryptographic methods like μChain and consensus voting are too complex and difficult to apply in centralized cryptocurrencies. Two cryptographic algorithms exist: one edits the entire block by replacing the hash function between blocks with a chameleon hash function. This method changes the hash value of the entire block with each transaction modification, affecting the entire block content and limiting precise editing. The other edits each transaction by replacing the hash function of each transaction in the block with a chameleon hash function. This method allows for more precise editing of individual transactions, but requires pre-determining which transactions might be modified during construction. Transactions that don't need modification are hashed using a standard hash function, while potentially modified transactions are replaced with a policy-based chameleon hash function. This requires attribute-based cryptography, resulting in low efficiency and limited practical application.

[0045] To this end, this application proposes a blockchain editable method, apparatus, and transaction method for electronic currency. By using a chameleon hash function to generate the parent node of the leaf node in the Merkle tree of the block, when a transaction is modified, the modification can be completed by changing only the two leaf nodes under the parent node of the leaf node containing the transaction to be modified, without affecting the content of other nodes in the Merkle tree. It does not require prior judgment of transactions that may be modified, and it can perform fine-grained editing with a small impact range, high efficiency, and low computational difficulty.

[0046] One specific embodiment of the present invention discloses a blockchain editable method for electronic currency, such as... Figure 1 As shown, it includes the following steps:

[0047] Step S1: Generate the parent node of the Merkle tree leaf node in each block using the Chameleon hash function, thereby constructing the Merkle tree in each block and connecting the blocks to form the electronic currency blockchain; wherein, the leaf node of the Merkle tree in each block is generated based on the hash function and electronic currency transaction information.

[0048] During implementation, in step S1, when constructing the Merkle tree within each block, the input to the chameleon hash function includes a public key, a message, and a random number. The message is the hash value calculated based on the hash function after concatenating the hash values ​​of the corresponding two leaf nodes of the Merkle tree. The random number is the XOR value of the hash values ​​of the corresponding two leaf nodes.

[0049] Understandably, concatenating the hash values ​​of the corresponding two leaf nodes in the Merkle tree, then using the hash value calculated based on the hash function as the input message, and using the XOR value of the hash values ​​of the corresponding two leaf nodes as the random number, eliminates the need for additional information, reduces storage content, saves storage space, and the XOR value of the two hash values ​​also satisfies the requirement of randomness. Furthermore, this method simplifies the calculation by easily verifying which transactions have been modified after transaction changes, simply checking if the random number from the chameleon hash function is the XOR value of the hash values ​​of the two leaf nodes.

[0050] During implementation, in step S1, the Merkle tree within each block is constructed in the following manner:

[0051] The electronic currency transaction information within the block is used to calculate the hash value based on the hash function, and each hash value is used as a leaf node on the first level of the Merkle tree;

[0052] After pairing the leaf nodes, calculate the chameleon hash value based on the chameleon hash function, and use each chameleon hash value as the parent node on the second level of the Merkle tree.

[0053] After pairing adjacent parent nodes on the second level, calculate the hash value based on the hash function, and use each hash value as the parent node on the third level of the Merkle tree. Continue in this manner until only one node remains, which is used as the root node of the Merkle tree, thus completing the construction of the Merkle tree.

[0054] The electronic currency information within each block is divided according to the transaction time.

[0055] Understandable, such as Figure 2 As shown, existing Merkle tree construction uses the hash values ​​of transaction information as leaf nodes (HA~HP), and the hash values ​​obtained by concatenating the hash values ​​of the leaf nodes are used as the second level of the Merkle tree (HAB~HOP), and so on, until only one node remains (HABCDEFGHIJKLMNOP), thus obtaining the Merkle tree. However, this embodiment constructs the Merkle tree as follows: Figure 3As shown, only the hash value of the parent node of the Merkle leaf node is replaced with a chameleon hash value. Because the chameleon hash function retains its hash value regardless of input changes, using the chameleon hash function for the parent node of a leaf node allows for editing only the specific transaction during transaction modification, without affecting the parent node of the leaf node or other parent nodes above it, thus not affecting the entire block. Furthermore, there are no restrictions on which leaf node the transaction is located in, making it more versatile. In addition, the Merkle tree constructed in this way is difficult to detect after editing, resulting in better confidentiality. Compared to existing blockchain editable methods that use chameleon hash functions to replace the block hash value, the method in this embodiment has a smaller impact range during transaction modification and allows for more precise editing. Compared to methods that use chameleon hash functions to replace the transaction hash value, the method in this embodiment does not require pre-determining the transaction to be modified, making it simpler and more efficient.

[0056] In specific implementation, the construction of the Merkle tree within each block also includes: leaf nodes in the Merkle tree containing the cryptocurrency transaction information corresponding to the hash value of that leaf node, as well as the chameleon hash function message and random number of the parent node of that leaf node. Specifically, the cryptocurrency transaction information may include the transaction object, transaction rules, transaction records, etc.

[0057] Specifically, in step S1, connecting the blocks to form an electronic currency blockchain involves: calculating the hash value of each block's information based on a hash function; and establishing a sequential connection between blocks through the hash value. In other words, a block on the blockchain includes the hash value of the block information and the block information itself, where the block information includes a Merkle tree constructed based on electronic currency transaction information.

[0058] Step S2: Based on the received electronic currency transaction modification instruction, determine the block in the blockchain containing the original transaction information to be modified, then determine the leaf nodes on the Merkle tree within that block, and then complete the editing of the Merkle tree by updating the leaf nodes.

[0059] In implementation, in step S2, the step of determining the block in the blockchain containing the original transaction information to be modified based on the received electronic currency transaction modification instruction, and then determining the position on the Merkle tree within that block, specifically involves:

[0060] The block in the blockchain containing the original transaction information to be modified is determined based on the transaction time in the electronic currency transaction modification instruction. The electronic currency transaction modification instruction is issued by an entity with editing permissions; for example, for fiat electronic currency, it is issued by the central bank or a bank possessing the private key. The electronic currency transaction modification instruction includes the original transaction information to be modified, the transaction time, the hash value stored in a Merkle tree, and the modified transaction information. Since electronic currency transaction information is divided according to transaction time, the corresponding block in the blockchain containing the original transaction information to be modified can be obtained by acquiring the transaction time in the transaction modification instruction.

[0061] The leaf node of the original transaction information to be modified in the Merkle tree is determined based on the hash value in the electronic currency transaction modification instruction.

[0062] Modifications in the electronic currency process can correspond to changes in transaction information within a single leaf node, or changes in transaction information across multiple leaf nodes. When modifying electronic currency transaction information, for a parent node at the same second level, it's possible that the transaction information in one of its leaf nodes needs modification, or that the transaction information in both of its leaf nodes needs modification. In other words, when modifying transaction information, the transaction to be modified may exist in leaf nodes under multiple parent nodes at the second level. The update method for each leaf node under a parent node at the second level is the same, with two update scenarios: either the transaction information in one leaf node under that parent node needs modification, or the transaction information in both leaf nodes under that parent node needs modification.

[0063] During implementation, if a leaf node under the same parent node on the second level of the Merkle tree needs to modify its transaction information, the leaf node under the parent node is updated in the following way to edit the Merkle tree:

[0064] Retrieve the chameleon hash function message and random number of the parent node before the update on the second layer, and obtain the private key; where a leaf node under the parent node before the update is the leaf node where the original transaction information to be modified is located; it can be understood that the chameleon hash function message and random number of the parent node before the update are stored in the leaf node, so they can be obtained through the leaf node.

[0065] Based on the leaf node where the original transaction information to be modified is located, determine the message of the chameleon hash function of the updated parent node as the hash value of another leaf node under the parent node before the update.

[0066] The first random number is calculated by taking the private key, the message of the parent node's chameleon hash function before the update, the message of the parent node's chameleon hash function after the update, and the Forge() algorithm in the chameleon hash function.

[0067] Update the hash value of the leaf node containing the original transaction information to be modified to the first random number, update the original transaction information to be modified in the leaf node to the modified transaction information in the electronic currency transaction modification instruction, update the messages in the two leaf nodes to the updated parent node's chameleon hash function message, and update the random number to the first random number.

[0068] Specifically, Forge() is represented as Forge(sk,m,r,m'), where sk represents the private key, m represents the message of the parent node's chameleon hash function before the update, r represents the random number of the parent node's chameleon hash function before the update, and m' represents the message of the parent node's chameleon hash function after the update. The updated random number r' is calculated by Forge(sk,m,r,m') and satisfies CH(pk,m,r)=CH(pk,m',r').

[0069] During implementation, if the transaction information in two leaf nodes under the same parent node on the second level of the Merkle tree needs to be modified, the leaf nodes under the parent node are updated in the following way to edit the Merkle tree:

[0070] Obtain the chameleon hash function message and random number of the parent node before the update on the second layer, and obtain the private key; where the two leaf nodes under the parent node before the update are the two leaf nodes where the original transaction information to be modified is located;

[0071] Based on the leaf node where the original transaction information to be modified is located, it is determined that the message of the chameleon hash function of the parent node after the update is empty;

[0072] The private key, the message of the parent node's chameleon hash function before the update, the random number, and the message of the parent node's chameleon hash function after the update are used as inputs to the Forge() algorithm in the chameleon hash function to calculate the second random number.

[0073] Based on the number of bits of the second random number, the second random number is divided into a third random number and a fourth random number; the hash values ​​of the two leaf nodes are updated to the third random number and the fourth random number respectively; the original transaction information to be modified in the two leaf nodes is updated to the corresponding modified transaction information in the electronic currency transaction modification instruction; the messages in the two leaf nodes are updated to the message of the updated parent node chameleon hash function; and the random number is updated to the second random number.

[0074] Understandably, by using the above editing method, the Merkle tree can be modified by only changing the leaf nodes of the Merkle tree. Since the chameleon hash value does not change, the nodes on the Merkle tree are not affected.

[0075] In specific implementation, the second random number is divided into a third random number and a fourth random number based on the number of bits of the second random number, specifically as follows:

[0076] Based on the total number of bits N in the second random number, the values ​​in the first N / 2 bits of the second random number are divided into the third random number, and the values ​​in the last N / 2 bits are divided into the fourth random number.

[0077] It should be noted that typically only entities with editing rights to the electronic currency blockchain possess the public-private key pair. When editing the blockchain, the private key is provided by the entity with editing rights. For example, in legal tender, only the central bank can edit the blocks in the blockchain. When changing legal tender transaction information, the central bank provides the private key.

[0078] Compared with existing technologies, this embodiment provides an editable blockchain method for electronic currency. By generating the parent nodes of the leaf nodes of the Merkle tree in the block based on the Chameleon hash function, the Merkle tree in the block is constructed. When a transaction is modified, the Merkle tree can be edited by only changing the leaf nodes, while the parent nodes of the leaf nodes and above remain unchanged. Moreover, when a transaction is modified, only the transactions of the two relevant leaf nodes are affected. This method is highly targeted, realizes fine-grained editing of the blockchain, greatly reduces the scope of impact, and is computationally simple and highly efficient.

[0079] Another embodiment of the present invention provides a blockchain editable device for electronic currency, comprising:

[0080] The blockchain construction module is used to generate the parent node of the Merkle tree leaf node in each block through the chameleon hash function, thereby constructing the Merkle tree in each block and connecting the blocks to form the electronic currency blockchain; among them, the leaf nodes of the Merkle tree in each block are generated based on the hash function and electronic currency transaction information.

[0081] The blockchain editing module is used to determine the block in the blockchain containing the original transaction information to be modified based on the received electronic currency transaction modification instruction, then determine the leaf nodes on the Merkle tree within that block, and finally complete the editing of the Merkle tree by updating the leaf nodes.

[0082] The specific implementation process of this embodiment can be found in the above method embodiment, and will not be repeated here.

[0083] Since this embodiment is based on the same principle as the above method embodiment, this device also has the corresponding technical effects of the above method embodiment.

[0084] Another embodiment of the present invention provides an electronic currency transaction method, including the above-described blockchain editable method, and, after completing the editing of the Merkle tree, further including performing blockchain currency transactions based on the edited blockchain.

[0085] The specific implementation process of this embodiment can be found in the above method embodiment, and will not be repeated here.

[0086] Since this embodiment is based on the same principle as the above method embodiments, this method also has the corresponding technical effects of the above method embodiments.

[0087] Those skilled in the art will understand that all or part of the processes of the methods described in the above embodiments can be implemented by a computer program instructing related hardware, and the program can be stored in a computer-readable storage medium. The computer-readable storage medium may be a disk, optical disk, read-only memory, or random access memory, etc.

[0088] The above description is only a preferred embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any changes or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in the present invention should be included within the scope of protection of the present invention.

Claims

1. A blockchain-editable method for electronic currency, characterized in that, Includes the following steps: The parent node of the Merkle tree leaf node in each block is generated by the chameleon hash function, thereby constructing the Merkle tree in each block and connecting the blocks to form the electronic currency blockchain; among them, the leaf nodes of the Merkle tree in each block are generated based on the hash function and electronic currency transaction information. Based on the received electronic currency transaction modification instruction, the block in the blockchain containing the original transaction information to be modified is determined, and then the leaf node on the Merkle tree within that block is determined. The Merkle tree is then edited by updating the leaf node. When the transaction information in two leaf nodes under the same parent node on the second level of a Merkle tree needs to be modified, the leaf nodes under the parent node are updated in the following way to perform Merkle editing: Obtain the chameleon hash function message and random number of the parent node before the update on the second layer, and obtain the private key; where the two leaf nodes under the parent node before the update are the two leaf nodes where the original transaction information to be modified is located; Based on the leaf node where the original transaction information to be modified is located, it is determined that the message of the chameleon hash function of the parent node after the update is empty; The private key, the message of the parent node's chameleon hash function before the update, the random number, and the message of the parent node's chameleon hash function after the update are used as inputs to the Forge() algorithm in the chameleon hash function to calculate the second random number. Based on the number of bits of the second random number, the second random number is divided into a third random number and a fourth random number; the hash values ​​of the two leaf nodes are updated to the third random number and the fourth random number respectively; the original transaction information to be modified in the two leaf nodes is updated to the corresponding modified transaction information in the electronic currency transaction modification instruction; the messages in the two leaf nodes are updated to the message of the updated parent node chameleon hash function; and the random number is updated to the second random number.

2. The blockchain editable method for electronic currency according to claim 1, characterized in that, When constructing the Merkle tree within each block, the input to the Chameleon hash function includes a public key, a message, and a random number. The message is the hash value calculated based on the hash function after concatenating the hash values ​​of the corresponding two leaf nodes of the Merkle tree. The random number is the XOR value of the hash values ​​of the corresponding two leaf nodes.

3. The blockchain editable method for electronic currency according to claim 2, characterized in that, The Merkle tree within each block is constructed in the following manner: The electronic currency transaction information within the block is used to calculate the hash value based on the hash function, and each hash value is used as a leaf node on the first level of the Merkle tree; After pairing the leaf nodes, calculate the chameleon hash value based on the chameleon hash function, and use each chameleon hash value as the parent node on the second level of the Merkle tree. After pairing adjacent parent nodes on the second level, calculate the hash value based on the hash function, and use each hash value as the parent node on the third level of the Merkle tree. Continue in this manner until only one node remains, which is used as the root node of the Merkle tree, thus completing the construction of the Merkle tree. The electronic currency information within each block is divided according to the transaction time.

4. The blockchain editable method for electronic currency according to claim 3, characterized in that, The construction of the Merkle tree within each block also includes: leaf nodes in the Merkle tree include electronic currency transaction information corresponding to the hash value in the leaf node, as well as the chameleon hash function message and random number of the parent node of the leaf node.

5. The blockchain editable method for electronic currency according to claim 1, characterized in that, The step of receiving an electronic currency transaction modification instruction, determining the block in the blockchain containing the original transaction information to be modified, and then determining its position on the Merkle tree within that block, specifically involves: The block in the blockchain containing the original transaction information to be modified is determined based on the transaction time in the electronic currency transaction modification instruction; The leaf node of the original transaction information to be modified in the Merkle tree is determined based on the hash value in the electronic currency transaction modification instruction.

6. The blockchain editable method for electronic currency according to claim 1, 4, or 5, characterized in that, If a leaf node under the same parent node on the second level of the Merkle tree needs to modify its transaction information, the leaf node under the parent node is updated in the following way to perform the Merkle edit: Get the chameleon hash function message and random number of the parent node before the update on the second layer, and get the private key; where, a leaf node under the parent node before the update is the leaf node where the original transaction information to be modified is located; Based on the leaf node where the original transaction information to be modified is located, determine the message of the chameleon hash function of the updated parent node as the hash value of another leaf node under the parent node before the update. The first random number is calculated by taking the private key, the message of the parent node's chameleon hash function before the update, the message of the parent node's chameleon hash function after the update, and the message of the parent node's chameleon hash function after the update as inputs to the Forge() algorithm in the chameleon hash function. Update the hash value of the leaf node containing the original transaction information to be modified to the first random number, update the original transaction information to be modified in the leaf node to the modified transaction information in the electronic currency transaction modification instruction, update the messages in the two leaf nodes to the updated parent node's chameleon hash function message, and update the random number to the first random number.

7. The blockchain editable method for electronic currency according to claim 1, characterized in that, The second random number is divided into a third random number and a fourth random number based on the number of bits in the second random number, specifically as follows: Based on the total number of bits N in the second random number, the values ​​in the first N / 2 bits of the second random number are divided into the third random number, and the values ​​in the last N / 2 bits are divided into the fourth random number.

8. A blockchain-editable device for electronic currency, characterized in that, include: The blockchain construction module is used to generate the parent node of the Merkle tree leaf node in each block through the chameleon hash function, thereby constructing the Merkle tree in each block and connecting the blocks to form the electronic currency blockchain; among them, the leaf nodes of the Merkle tree in each block are generated based on the hash function and electronic currency transaction information. The blockchain editing module is used to determine the block in the blockchain containing the original transaction information to be modified based on the received electronic currency transaction modification instruction, and then determine the leaf nodes on the Merkle tree within that block, and then complete the editing of the Merkle tree by updating the leaf nodes; When the transaction information in two leaf nodes under the same parent node on the second level of a Merkle tree needs to be modified, the leaf nodes under the parent node are updated in the following way to perform Merkle editing: Obtain the chameleon hash function message and random number of the parent node before the update on the second layer, and obtain the private key; where the two leaf nodes under the parent node before the update are the two leaf nodes where the original transaction information to be modified is located; Based on the leaf node where the original transaction information to be modified is located, it is determined that the message of the chameleon hash function of the parent node after the update is empty; The private key, the message of the parent node's chameleon hash function before the update, the random number, and the message of the parent node's chameleon hash function after the update are used as inputs to the Forge() algorithm in the chameleon hash function to calculate the second random number. Based on the number of bits of the second random number, the second random number is divided into a third random number and a fourth random number; the hash values ​​of the two leaf nodes are updated to the third random number and the fourth random number respectively; the original transaction information to be modified in the two leaf nodes is updated to the corresponding modified transaction information in the electronic currency transaction modification instruction; the messages in the two leaf nodes are updated to the message of the updated parent node chameleon hash function; and the random number is updated to the second random number.

9. A method for electronic currency transactions, characterized in that, The method includes the blockchain editable method according to any one of claims 1-7, and, after completing the editing of the Merkle tree, also includes conducting blockchain currency transactions of electronic currency based on the edited blockchain.