A low-cost alliance chain cross-chain method based on Chameleon Hash Tree
Through the chameleon hash tree and hash time lock mechanism, the information authenticity, security and atomicity issues of cross-chain transactions are solved, low-cost cross-chain interoperability and efficient data query are achieved, and the overall performance of the blockchain system is improved.
Patent Information
- Application Number
- CN202310683344.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-09
- Publication Date
- 2025-10-14
- Estimated Expiration
- 2043-06-09
AI Technical Summary
Existing cross-chain technologies have problems such as unreliable information, difficulty in ensuring chain security, difficulty in guaranteeing transaction atomicity, and high maintenance costs of smart contracts, which have led to limited blockchain interoperability and scalability.
A low-cost alliance chain cross-chain method based on the chameleon hash tree is adopted. Fund transactions are realized by using a hash time lock mechanism between the main chain and the side chain, and a chameleon hash tree is built on the side chain to store data. Data filters and root commitments are used for fast verification to achieve cross-chain interoperability and data query.
It realizes fund transactions and transaction queries between the main chain and the side chain, ensures the atomicity of transactions, reduces the maintenance cost of smart contracts, and improves the performance and interoperability of the blockchain system.
Smart Images

Figure CN117149822B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to a low-cost alliance chain cross-chain method based on a chameleon hash tree, and belongs to the technical field of blockchain cross-chain. BACKGROUND
[0002] Blockchain is a technology that can collectively maintain a reliable database in a decentralized and trustless manner. It can store transactions that occur within a period of time in blocks and connect the blocks in chronological order using a cryptographic algorithm to form a data structure similar to a chain. After more than ten years of development, blockchain has formed blockchain networks with different characteristics suitable for different application scenarios. Due to the isolation of blockchain and the high heterogeneity between chains, the flow of data and the transfer of value between blockchains have become a technical bottleneck that hinders the widespread application of blockchain technology. Cross-chain technology of blockchain is an important technical means to realize the interconnection of blockchains, improve the interoperability and scalability of blockchains.
[0003] In recent years, with the rapid expansion of the blockchain community, its user groups and audiences have also been growing. Therefore, only with cross-chain interoperability can users use their preferred platforms without obstacles, speed up communication between blockchains, increase mutual accessibility, reduce learning and familiarization time before use, and thus more easily use blockchain technology as a tool to expand business. Therefore, interoperability can pave the way for the interconnection of such networks and promote the mutual coordination of blockchain-enabled products and services.
[0004] Efficient and versatile cross-chain technology is the key to realizing the interconnection of millions of chains. Cross-chain technology can connect scattered blockchain ecological islands and become a bridge and link for the overall expansion of blockchain. Currently, several difficult problems need to be solved in cross-chain, including: 1. Ensuring the authenticity and credibility of cross-chain information. The transaction information on the original chain is external information for another chain, and it needs to be ensured that the external information is correct when it enters another chain; 2. Ensuring the independent security of the chain. Data interaction between multiple chains in a blockchain system will inevitably affect each other, and the security isolation problem of each chain cannot be avoided, and it is necessary to ensure that if a chain is attacked, its state will not affect the security of other chains in the entire blockchain system; 3. Ensuring the atomicity of the entire cross-chain transaction. If a certain link in the transaction processing stops, the entire transaction can be canceled, and the transaction result must be successful or failed, and there is no case of partial success and partial failure.
[0005] Therefore, in view of the characteristics of the heterogeneity of blockchain underlying platforms, the diversification of application scenarios, and the complexity of cross-chain requirements, an alliance chain cross-chain method supporting interoperability must be designed.
[0006] Generally, cross-chain of blockchain can be realized in the following ways:
[0007] Method 1: Notary mechanism. This method introduces a third-party intermediary to verify and forward cross-chain messages between two chains that are not directly interoperable. It is essentially a mediation method. It does not require complex proof-of-work or proof-of-stake systems and is easy to integrate with existing heterogeneous chains. However, the notary mechanism can only support asset exchange and is subject to overcentralization. The introduction of a third-party notary violates the principle of blockchain decentralization.
[0008] Method 2: Sidechain / Relay Chain Technology. In this technology, nodes from the main blockchain can connect to and be connected to sidechains, and sidechains can also operate independently of the main blockchain. Sidechains utilize a two-way anchoring technique to temporarily lock digital currency in the main blockchain while simultaneously releasing equivalent digital assets on the sidechain. The relay chain acts as a "middleman," integrating and extending the notary and sidechain mechanisms. This technology enables applications such as cross-chain asset transfers, exchanges, cross-contracts, and mortgages, but its operation is technically challenging.
[0009] Method 3: Hash Timelock Contract. Hash lock leverages the unidirectionality and low-collision properties of hash functions and the ability to delay transactions in blockchains. It uses contracts with a hash lock mechanism to lock assets for collateralization, providing a foundation of trust for transactions between different assets. If a transaction fails for various reasons, a timelock allows all parties involved to recover their funds, preventing losses caused by fraud or transaction failure. However, it cannot enable cross-chain asset transfers or so-called cross-chain contracts; it can only enable cross-chain swaps. Summary of the Invention
[0010] The purpose of this invention is to address the shortcomings of the current popular cross-chain methods in different aspects and propose a low-cost alliance chain cross-chain method based on chameleon hash tree.
[0011] In order to achieve the above-mentioned purpose, the present invention adopts the following technical solutions.
[0012] The low-cost alliance chain cross-chain method based on the Chameleon Hash Tree is based on the following definition:
[0013] Definition 1: A consortium chain is a blockchain that is open only to members of a specific group and a limited number of third parties. It specifies multiple pre-selected nodes as bookkeepers, and the generation of each block is jointly determined by all pre-selected nodes. All of these chains belong to a consortium chain.
[0014] Definition 2: A smart contract is a computer protocol that transmits, verifies, or executes contracts in an information-based manner. The sidechain modifies data and sends an update certificate to the smart contract. After successful verification, the smart contract content is modified accordingly, and the main chain modifies the content according to the modification of the smart contract.
[0015] Definition 3: interoperability, the ability of different computer systems, networks, and operating systems and applications to work together and share information, different chains can be able to carry out fund transactions or transaction inquiries;
[0016] Definition 4: vector commitment, mapping a message vector to a fixed size commitment, the commitment allows opening at a specific location, and the correctness of the opening can be verified;
[0017] Definition 5: root commitment, the vector commitment of the root node of each tree, which can be stored separately on the main chain;
[0018] The low-cost alliance chain cross-chain method based on chameleon hash tree includes fund transactions between main chains and key query between main chains and side chains, and specifically includes the following steps:
[0019] Step 1. Fund transaction between two different chains, add time lock and hash lock to the fund to be traded, ensure atomicity while realizing asset transfer, which includes the following sub-steps:
[0020] Step 1.1 One of the main chains generates a random number and calculates its hash value, generates a contract transaction, and locks the token to be traded with time lock and generated transaction;
[0021] Step 1.2 The other main chain uses the received hash value to generate another contract transaction, and locks the token to be traded on this chain in the same way;
[0022] Step 1.3 Within the time range specified by the time lock, the main chain that generates the random number uses the generated random number to unlock the contract transaction on the other chain, obtains the token locked in the transaction, and the random number is exposed;
[0023] Step 1.4 The other chain uses the exposed random number to unlock the contract transaction and obtains the locked token, and the transaction is completed;
[0024] Step 2. Store all data in the form of chameleon hash tree on the side chain, each keyword corresponds to a tree, the main chain stores the root hash value of each tree, and a data filter is constructed for each tree, the content to be queried is input in the form of selection paradigm, and the output result is obtained after query, which includes the following sub-steps:
[0025] Step 2.1 Construct a chameleon hash tree for each keyword on the side chain, construct a data filter for each data object to reduce the cost of subsequent verification operation, and connect the chameleon hash tree according to the value of the leaf node, the root commitment of each hash tree is stored on the main chain;
[0026] Step 2.2: Insert data into the Chameleon hash tree on the sidechain, placing the inserted data on the far right without changing the root commitment of the tree. The sidechain constructs and sends the update proof to the smart contract deployed on the mainchain.
[0027] Step 2.3 removes stop words from the content to be queried and inputs it in the form of keyword disjunctive normal form. The result is queried on the side chain through the connection operation, and the root commitment on the main chain is verified with the member proof obtained on the side chain. If the verification is successful, all the data corresponding to the chameleon hash tree on the side chain is obtained.
[0028] Beneficial effects
[0029] This paper proposes a low-cost alliance chain cross-chain method based on the Chameleon Hash Tree, which has the following advantages compared with the existing technology:
[0030] 1. The method of the present invention achieves blockchain interoperability from two perspectives: specifically, it proposes to implement fund transactions between two main chains and transaction queries between the main chain and the side chain;
[0031] 2. The method of the present invention can ensure the atomicity of funds. Specifically, it proposes a method of using hash time lock between two main chains. The hash lock and time lock can ensure the atomicity of funds while realizing fund transactions;
[0032] 3. The method of the present invention can effectively reduce the maintenance cost of smart contracts and improve the performance of blockchain systems. Specifically, it proposes using a chameleon hash tree to store all data on the side chain, while the main chain only stores the root commitment of each tree. Data can be updated without changing the vector commitment. A data filter is constructed for each data object to quickly verify whether the data is in the tree, reducing the calculation of chameleon commitment verification. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] Figure 1 This is a flow chart of a low-cost alliance chain cross-chain method based on the chameleon hash tree of the present invention. DETAILED DESCRIPTION
[0034] The following describes in detail a low-cost alliance chain cross-chain method based on the chameleon hash tree of the present invention in combination with the accompanying drawings and specific implementation methods.
[0035] Example 1
[0036] The following will be combined with the accompanying drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. The described embodiments are only part of the embodiments of the present invention, rather than all the embodiments. It should be understood that this embodiment is only used to illustrate the present invention and is not intended to limit the present invention.
[0037] Please refer to the instruction manual Figure 1 The present invention provides a technical solution that enables communication between main chains and between main chains and side chains, that is, to conduct fund transactions between chain A and chain B. Time locks and hash locks are added to the funds to be traded. Within the time range specified by the time lock, the contract transaction is unlocked to obtain the locked token. While ensuring the atomicity of funds, asset transfer is achieved. The specific process includes the following:
[0038] Step 1.1 Main chain A randomly generates a random number k, calculates the hash value h=hash(k), and generates a contract transaction To lock the token a that needs to be traded on the main chain A;
[0039] Step 1.2 Main chain A sends the calculated hash value h to main chain B, and main chain B generates a contract transaction with the received hash value To lock the token b that needs to be traded;
[0040] Step 1.3A uses the random number k to unlock the transaction on the main chain B before time t2 Get The token b locked in the game and the random number k are exposed;
[0041] Step 1.4B uses the public random number k to unlock the transaction on the main chain A before time point t1 Get Transaction The locked token a is traded.
[0042] Step 2: Transaction queries are implemented between main chain A and side chain A, and between main chain B and side chain B. All data is stored in the side chain in the form of a chameleon hash tree. Each keyword corresponds to a tree. The main chain stores the root hash value of each tree and constructs a data filter for each tree. The content to be queried is input in the form of a disjunctive normal form and the query outputs the result. Given that the communication between the main chain and the corresponding side chain is very similar, we will now only use main chain A and side chain A as an example to describe step 2 in detail. It specifically includes the following sub-steps:
[0043] Step 2.1 Build a chameleon hash tree for each keyword on sidechain A. Each node corresponds to a data object o and a node position position. Count and assign the nodes in each tree in the order from left to right and from top to bottom. The node vector commitment c positionPredetermined by the constant vector, keyword w, and node position, the smart contract stored on the main chain A only needs to contain the root commitment of each Chameleon hash tree and the total number of objects num. In addition, a data filter is constructed for each object in each Chameleon hash tree to filter out query operations that do not exist in the tree, more effectively proving the non-existence of the object and reducing the verification cost to a certain extent.
[0044] Step 2.2 Insert data into the Chameleon Hash Tree on Sidechain A, using the time transaction stamp as the ID. The object ID is monotonically increasing and is always inserted at the rightmost end. Create a new node for the newly inserted data object and assign it the position of the new node. Calculate the vector commitment c that needs to be determined in advance. position , the user uses the private key sk to find c position , and updates the first element of the object to the hash value h(o) of the object, generating proof π position , used to prove that h(o) is stored in c position The first element in the , locates the parent node n in the Chameleon hash tree par And the corresponding index i, calculate the parent node n par The vector commitment c par , link the newly created node to the parent node, and update the (i+1)th element to c after finding the conflict position , calculate the corresponding proof ρ par,i , used to prove that n position is n par The i-th child node of , in addition, the insertion of the new object o proves <c position ,π position ,ρ par,i >Send to main chain A, and send the updated value of object quantity num to the smart contract deployed on main chain A;
[0045] Step 2.3 Sidechain A constructs an update proof update and sends it to the smart contract deployed on mainchain A to securely update the root hash value stored on mainchain A. The update contains a Merkle proof corresponding to the tree path of the leaf node to be updated. The update is constructed by traversing the tree from the root node in a top-down manner. For each internal node, the hash values of all nodes except the rightmost one are added to the update. The sidechain sends the update proof update to the smart contract. The smart contract reconstructs the root hash from the bottom up based on the verifiable information contained in the update, and matches the calculated root hash with the root hash stored on the mainchain. If the match is successful, the integrity of the update can be proved. For keyword search, the search formula is input in the form of conjunction normal form, and the query requirement is converted into a chameleon hash tree of the query keyword that connects each connected component of the query condition, and the data corresponding to the chameleon hash tree queried from the sidechain is output.
[0046] The above description is only a preferred embodiment of the present invention, and the present invention should not be limited to the contents disclosed in the embodiment and the accompanying drawings. Any equivalent or modification completed without departing from the spirit disclosed in the present invention shall fall within the scope of protection of the present invention.
Claims
1. A low-cost alliance chain cross-chain method based on Chameleon Hash Tree, characterized by: The method includes the following steps: S0, defining a consortium chain, which refers to a blockchain that is only for members of a specific group and limited third parties, including a main chain and side chains, wherein multiple pre-selected nodes are designated as bookkeepers, and the generation of each block is jointly determined by all pre-selected nodes, and each chain belongs to the consortium chain; defining a smart contract, which is a computer protocol for disseminating, verifying or executing a contract in an information-based manner, wherein the side chain modifies data and sends an update certificate to the smart contract. Upon successful verification, the corresponding content of the smart contract is modified, and the main chain modifies the content according to the modification of the smart contract; Define interoperability, which refers to the ability of different computer systems, networks, operating systems, and applications to work together and share information. Allow financial transactions or transaction queries between different chains. Define vector commitments, which map message vectors to fixed-size commitments. Commitments are allowed to be opened at specific locations, and the correctness of the opening can be verified. Define root commitments, which refer to the vector commitments at the root node of each tree and can be stored separately on the main chain. S1: Funds are traded between two different chains. Time locks and hash locks are added to the funds to be traded, ensuring their atomicity and enabling asset transfers. And S2, stores all data in the form of a chameleon hash tree on the side chain, each keyword corresponds to a tree, and the main chain stores the root hash value of each tree.
2. A low-cost alliance chain cross-chain method based on chameleon hash tree according to claim 1, characterized in that: The step S1 comprises: S1.1 One of the main chains generates a random number and calculates its hash value, generates a contract transaction, and locks the token to be traded with a time lock and the generated transaction; S1.2 The other main chain uses the received hash value to generate another contract transaction, and uses the same method to lock the tokens required for the transaction on this chain; S1.3 Within the timeframe specified by the time lock, the main chain that generates the random number uses the generated random number to unlock the contract transaction on the other chain, obtains the token locked in the transaction, and reveals the random number; And S1.4 another chain uses the exposed random number to unlock the contract transaction, obtain the locked token, and the transaction is completed.
3. A low-cost alliance chain cross-chain method based on chameleon hash tree according to claim 1, characterized in that: The step S2 comprises: S2.1 builds a chameleon hash tree for each keyword on the side chain, builds a data filter for each data object, connects the chameleon hash trees based on the values of the leaf nodes, and stores the root commitment of each hash tree on the main chain; S2.2 inserts data into the Chameleon hash tree on the sidechain, placing the inserted data on the far right without changing the root commitment of the tree. The sidechain constructs and sends an update proof to the smart contract deployed on the mainchain. And S2.3 removes stop words from the content to be queried and inputs it in the form of keyword disjunctive normal form. The result is queried on the side chain by a connection operation, and the root commitment on the main chain is verified with the member proof obtained on the side chain. If the verification is successful, all the data corresponding to the chameleon hash tree on the side chain is obtained.
4. A low-cost alliance chain cross-chain method based on chameleon hash tree according to claim 3, characterized in that: In step S2.1, each node in the Chameleon Hash Tree corresponds to a data object and a node position; the node vector commitment is predetermined by a constant vector, a keyword, and a node position; the smart contract only needs to include the root commitment of each Chameleon Hash Tree and the total number of objects; The data filter filters out query operations that do not exist in a certain tree.
5. A low-cost alliance chain cross-chain method based on chameleon hash tree according to claim 3, characterized in that: In step S2.2, the data is inserted in a monotonically increasing manner using the object ID.
6. A low-cost alliance chain cross-chain method based on chameleon hash tree according to claim 3, characterized in that: The update proof in step S2.3 includes a Merkle proof corresponding to the tree path of the leaf node to be updated.
Citation Information
Patent Citations
Medical alliance chain lightweight dynamic autonomous cross-chain interaction method
CN110993044A
Cross-chain transaction method and system based on Hash locking and side chain technology, and storable medium
CN113627906A