A cross-chain verification system for PoW blockchain

By adopting a cross-chain verification system for PoW blockchains and employing a hash algorithm library module and an algorithm update module, the high cost and difficulty in updating hash algorithms in existing technologies are solved, enabling cross-chain verification of multiple blockchain systems and system scalability.

CN115687474BActive Publication Date: 2026-04-28BEIHANG UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
BEIHANG UNIV
Filing Date
2022-10-26
Publication Date
2026-04-28

AI Technical Summary

Technical Problem

Existing technologies for cross-chain verification of PoW blockchains suffer from problems such as high operating costs in contracts, inability to adapt to multiple blockchain systems, and difficulty in updating hash algorithms.

Method used

This paper presents a cross-chain verification system for PoW blockchains, which adopts a hash algorithm library module, an algorithm update module, and a data verification module. The hash algorithm is implemented in an object-oriented manner, providing a unified interface and management functions, and supporting the updating, addition, and removal of the algorithm.

Benefits of technology

It reduces the computational cost of cross-chain verification, supports cross-chain verification of multiple PoW blockchain systems, improves the scalability and flexibility of the system, and can update the hash algorithm as needed.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115687474B_ABST
    Figure CN115687474B_ABST
Patent Text Reader

Abstract

The application relates to a cross-chain verification system for a PoW blockchain. The system comprises a hash algorithm library module, an algorithm updating module and a data verification module; the hash algorithm library module is connected with the algorithm updating module and the data verification module; the hash algorithm library module is used for realizing hash algorithms in an object-oriented manner, defining a unified format of the hash algorithms, realizing hash value calculation through a method in a class, and calling different hash algorithms through a unified interface; the data verification module is used for providing verification of data on different blockchains for a cross-chain process; and the algorithm updating module is used for adding, updating, renaming and removing hash algorithms of the hash algorithm library module. The application can manage and update hash algorithms according to actual needs, and has high expansibility.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of cross-chain technology, and in particular to a cross-chain verification system for PoW blockchains. Background Technology

[0002] Cross-chain technology is a crucial technological means to connect different blockchain systems, enabling inter-chain information exchange and maximizing the value of blockchain data. The most critical step in the cross-chain process is cross-chain data verification, which is a prerequisite for realizing functions such as cross-chain asset transfer and cross-chain asset locking.

[0003] Cross-chain data verification requires using corresponding hash algorithms based on the design of different blockchain systems to verify data stored in hash value form. A hash algorithm is a function that maps data of arbitrary length to data of fixed length. The output fixed-length data is called a hash value or message digest, and the input arbitrary-length data is called the preimage of the hash value. Hash algorithms possess one-wayness, collision resistance, and avalanche effect, therefore they are used in blockchains for data storage, verification, and consensus mechanisms.

[0004] Proof-of-Work (PoW) consensus mechanism is one of the main consensus mechanisms used in current blockchain systems. Initially used to combat spam, PoW's core idea is that users must solve a computationally challenging but easily verifiable problem before accessing resources, thus preventing resource abuse. A key design feature of PoW is the difference between the computational and verification difficulties of the problem. For the computer, the problem requires computation, while for the verifier, the result is easily verifiable. This problem involves finding the preimage based on the hash value. Like other consensus blockchains, PoW blockchains use hash values ​​to store data and employ different hash algorithms as a one-way function for calculating the PoW problem, making them representative in cross-chain verification.

[0005] Currently, for cross-chain verification of PoW blockchains, there are solutions that use contracts to write hash algorithms. This solution solves the problem of cross-chain verification requiring different hash functions, but it still has certain limitations.

[0006] Limitation 1: The hash algorithm used in cross-chain verification is written in a contract language. Since each calculation operation consumes gas during actual runtime in the virtual machine environment, and the hash algorithm contains a large amount of loop code and performs numerous substitution and permutation operations on the data, running the hash algorithm in the contract is extremely costly, severely limiting the application of cross-chain verification. Furthermore, there is a possibility that the hash algorithm's computational cost may be too high, making it impossible to implement in the contract.

[0007] Limitation 2: The original solution mainly targets cross-chain operations between two blockchain systems, thus requiring a small number of hash algorithms. However, when faced with cross-chain operations between a large number of blockchain systems, the original solution cannot be well adapted due to contract limitations. Issues include the inability to implement all algorithms in a single contract, and the need to design new contract management schemes when using multiple contracts to implement hash algorithms.

[0008] Limitation 3: Once a contract is deployed on the blockchain, it is difficult to modify. However, there may be a need to change the hash algorithm within the blockchain system. Existing solutions do not handle this situation well; the implemented hash algorithm cannot be changed as needed, requiring the contract to be recreated.

[0009] To address the above issues, there is an urgent need to provide a cross-chain verification system for PoW blockchains. This system would offer a unified interface for cross-chain verification of PoW blockchains, shielding the underlying technical details, enabling algorithm updates, supporting the addition of new algorithms in the future, and improving system scalability. Summary of the Invention

[0010] The purpose of this invention is to provide a cross-chain verification system for PoW blockchains, which provides a unified interface for cross-chain verification of PoW blockchains, shields the underlying technical details, enables algorithm update functions, supports the addition of new algorithms in the future, and improves system scalability.

[0011] To achieve the above objectives, the present invention provides the following solution:

[0012] A cross-chain verification system for PoW blockchains includes: a hash algorithm library module, an algorithm update module, and a data verification module;

[0013] The hash algorithm library module is connected to the algorithm update module and the data verification module respectively; the hash algorithm library module is used to implement hash algorithms in an object-oriented manner, and to define a unified format for hash algorithms. The methods in the class implement hash value calculation, and a unified interface is used to call different hash algorithms.

[0014] The data verification module is used to verify data on different blockchains for the cross-chain process;

[0015] The algorithm update module is used to add, update, rename, and remove hash algorithms from the hash algorithm library module.

[0016] Optionally, the hash algorithm library module includes: a hash algorithm unit, an auxiliary unit, and a testing unit;

[0017] The hash algorithm unit is used to call different hash algorithms using a unified interface and to implement the hash algorithm in an object-oriented manner;

[0018] The auxiliary unit is used to store general utility functions and custom types used in the hash algorithm library module, and to perform common operations in the hash algorithm; the common operations include: byte order conversion, type conversion and reading;

[0019] The test unit is used to perform performance tests on the implemented hash algorithm.

[0020] Optionally, the hash algorithm unit includes: an abstract hash class, a concrete hash algorithm class, and a hash call interface;

[0021] The specific hash algorithm class stores multiple hash algorithms; the specific hash algorithm class is a subclass of the abstract hash class, and overrides the methods in the abstract class to implement different hash calculation processes;

[0022] The hash call interface is used to store the mapping relationship between the unique identifier of the hash algorithm and the specific hash algorithm object, and selects the corresponding hash algorithm object for hash operation according to the mapping relationship and the unique identifier of the hash algorithm, thereby realizing the unified call of different hash algorithms.

[0023] Optionally, the hash algorithm is uniquely identified by its name.

[0024] Optionally, the data verification module includes: a block header data verification unit and a transaction payment verification unit;

[0025] The block header data verification unit is used to perform hash calculation verification on multiple data fields in the block header;

[0026] The transaction payment verification unit is used to recalculate the Merkle root hash based on the transaction and compare the recalculated Merkle root hash with the Merkle root hash stored in the block header.

[0027] Alternatively, transactions in the blockchain are stored in the form of hash values.

[0028] Optionally, the algorithm update module includes: an algorithm addition unit, an algorithm update unit, an algorithm renaming unit, and an algorithm removal unit.

[0029] According to specific embodiments provided by the present invention, the present invention discloses the following technical effects:

[0030] This invention provides a cross-chain verification system for PoW blockchains. Through a data verification module, it provides verification of data across different blockchains during the cross-chain process, simplifying the cross-chain verification operation. By implementing a hash function library module for cross-chain functionality, this invention can provide multiple hash algorithms, supporting cross-chain verification between multiple PoW blockchain systems. This invention provides functions for updating, adding, renaming, and removing hash algorithms, allowing for management and updates as needed. This invention provides a unified interface for the cross-chain verification process of PoW blockchains, shielding underlying technical details, enabling algorithm updates, supporting the addition of new algorithms in the future, and improving system scalability. Attached Figure Description

[0031] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0032] Figure 1 This is a schematic diagram of a cross-chain verification system structure for PoW blockchain provided by the present invention;

[0033] Figure 2 A flowchart illustrating the process of invoking a hash algorithm;

[0034] Figure 3 This is a schematic diagram of the unit test process;

[0035] Figure 4 This is a schematic diagram of the block header verification process;

[0036] Figure 5 This is a diagram illustrating the transaction payment verification process.

[0037] Figure 6 A flowchart illustrating the process of renaming an existing hash algorithm;

[0038] Figure 7 To update the existing hash algorithm flowchart;

[0039] Figure 8 A flowchart illustrating the process of adding a new hash algorithm;

[0040] Figure 9 A schematic diagram illustrating the process of removing an existing hash algorithm. Detailed Implementation

[0041] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0042] The purpose of this invention is to provide a cross-chain verification system for PoW blockchains, which provides a unified interface for cross-chain verification of PoW blockchains, shields the underlying technical details, enables algorithm update functions, supports the addition of new algorithms in the future, and improves system scalability.

[0043] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.

[0044] Figure 1 This is a schematic diagram of a cross-chain verification system architecture for PoW blockchains provided by the present invention, as shown below. Figure 1 As shown, the cross-chain verification system for PoW blockchain provided by the present invention includes: a hash algorithm library module, an algorithm update module, and a data verification module.

[0045] The hash algorithm library module is connected to the algorithm update module and the data verification module respectively; the hash algorithm library module is used to implement hash algorithms in an object-oriented manner, and to define a unified format for hash algorithms. The methods in the class implement hash value calculation, and a unified interface is used to call different hash algorithms.

[0046] The hash algorithm library module forms the underlying cryptographic foundation of the cross-chain verification system. By implementing a unified calling interface, it shields the cross-chain verification process from the details of underlying hash calculations, simplifying the verification operation. Furthermore, the hash algorithms in the library are implemented in an object-oriented manner. An abstract hash class defines a unified format for hash algorithms, and concrete hash classes implement the methods in the abstract class. This ensures unified hash algorithm calls while also providing a degree of extensibility, facilitating the removal, updating, and addition of new algorithms, thus providing a foundation for the implementation of the algorithm update module.

[0047] The data verification module is used to verify data on different blockchains for the cross-chain process.

[0048] The algorithm update module is used to add, update, rename, and remove hash algorithms from the hash algorithm library module.

[0049] like Figure 1 As shown, the hash algorithm library module includes: a hash algorithm unit, an auxiliary unit, and a testing unit;

[0050] The hash algorithm unit is used to call different hash algorithms using a unified interface and to implement the hash algorithm in an object-oriented manner.

[0051] The auxiliary unit stores common utility functions and custom types used in the hash algorithm library module and performs common operations in hash algorithms, including byte order conversion, type conversion, and reading. The auxiliary unit improves code reusability. When updating or adding algorithms, auxiliary functions can be directly called to perform data operations without rewriting code, reducing the cost of algorithm updates and additions. The auxiliary code also includes custom classes and functions used by the test functions.

[0052] The test unit is used to perform performance tests on the implemented hash algorithm.

[0053] The test unit helps compare and analyze the performance and advantages / disadvantages of different hash algorithms. Algorithm performance testing uses randomly generated fixed-length data, performs hash calculations on it, and records the time taken. This process is repeated multiple times, and the average time is calculated to determine the hash algorithm's efficiency. The detailed process for testing algorithm performance is as follows... Figure 3 As shown. Input the hash algorithm name, test data length, and test loop count to obtain the corresponding hash algorithm method. Set a timer, generate random data of the given length in a loop and perform hash operations, record the hash operation time, take the average hash operation time, return the average time, and end the algorithm performance test process.

[0054] The hash algorithm unit includes: an abstract hash class, a concrete hash algorithm class, and a hash call interface.

[0055] The specific hash algorithm class stores multiple hash algorithms; as a subclass of the abstract hash class, the specific hash algorithm class overrides the methods in the abstract class to implement different hash calculation processes.

[0056] The hash algorithm code includes an abstract hash class and concrete hash classes. Unlike existing cryptographic libraries that implement hash algorithms as functions, this invention uses object-oriented principles, encapsulating the hash algorithm into a class, with methods within the class implementing hash value calculations. The common data structures and methods are extracted from the hash algorithms to form an abstract class. Concrete hash algorithms, as subclasses of the abstract hash class, override the methods in the abstract class to implement different hash calculation processes.

[0057] The hash call interface is used to store the mapping relationship between the unique identifier of a hash algorithm and a specific hash algorithm object, and selects the corresponding hash algorithm object for hash operation based on the mapping relationship and the unique identifier of the hash algorithm, thereby realizing the unified invocation of different hash algorithms. The unique identifier of the hash algorithm is the hash algorithm name.

[0058] Because the concrete hash class and the abstract hash class are inherited in the implementation of hash algorithms, dynamic polymorphism is achieved. Therefore, the hash call interface can uniformly call different hash algorithm objects. The process of calling a hash algorithm is as follows: Figure 2 As shown. Input the hash algorithm name and the message to be hashed. The algorithm name is used to look up the hash algorithm mapping. If a corresponding entry exists in the mapping, the corresponding hash algorithm is retrieved, the method is called to perform the hash operation on the message, and the calculated hash value is returned as a string, ending the hash algorithm call process. If no corresponding entry exists in the mapping, an empty string is returned, ending the hash algorithm call process.

[0059] The data verification module includes a block header data verification unit and a transaction payment verification unit. Furthermore, the data verification module also includes a block header verification interface and a transaction verification interface.

[0060] The block header data verification unit is used to perform hash calculation verification on multiple data fields in the block header.

[0061] The block header contains multiple data fields, and the block header data verification process involves performing hash calculations on these fields. The block header includes fields such as version number, previous block hash, Merkle root hash, time, target value, and nonce. During PoW consensus computation, the fields in the block header are serialized into an 80-byte string. This string is parsed to obtain the input data, where each two characters represent a hexadecimal byte (e.g., "1c" represents byte 0x1c). The input data is then processed using a specified hash algorithm to calculate the hash value.

[0062] The block header verification process involves serializing the fields in the block header, recalculating the hash value using the corresponding hash algorithm, and comparing it with the given hash value. The block header data verification process is as follows: Figure 4 As shown, the input includes a hash name, the block header data to be verified, and the block header hash. The system retrieves the corresponding hash algorithm instance based on the hash algorithm name. If the algorithm does not exist, it returns a verification failure and ends the process. The system then performs a hash calculation on the block header data and verifies whether the calculated hash value meets the consensus conditions. If it does, it returns a verification success; otherwise, it returns a verification failure.

[0063] The transaction payment verification unit is used to recalculate the Merkle root hash based on the transaction and compare the recalculated Merkle root hash with the Merkle root hash stored in the block header.

[0064] Transactions in a blockchain are stored as hash values. The block header contains the Merkle root hash of the transactions in that block. Transaction payment is verified by recalculating the Merkle root hash using the transactions contained in that block and comparing it to the Merkle root hash in the block header. The process for verifying transaction payment is as follows: Figure 5 As shown. The Merkle tree hash name, transaction list, and expected Merkle root hash are input into the verification function. The function checks the number of transactions. If there is only one transaction, it directly compares it with the expected Merkle root hash and returns the comparison result; otherwise, it enters the Merkle hash calculation loop. If the number of hashes is odd during the calculation, the last transaction hash in the list is copied to the end of the list. The Merkle hash calculation loop exits when the hash list contains only one hash value; this hash value is the calculated Merkle root hash. The calculation result is compared with the expected Merkle root hash, and the comparison result is returned.

[0065] The algorithm update module includes an algorithm addition unit, an algorithm update unit, an algorithm renaming unit, and an algorithm removal unit. This supports modifications and replacements of hash algorithms used in the blockchain system, adjusts existing hash algorithms in the hash algorithm library, adds new hash algorithms, and removes unused hash algorithms. This enables cross-chain data verification across more blockchain systems and improves scalability.

[0066] The algorithm update module also includes: updating algorithm interfaces, renaming algorithm interfaces, adding algorithm interfaces, and removing algorithm interfaces.

[0067] The process of renaming an existing algorithm is as follows: Figure 6 As shown, after inputting the old and new algorithm names, the system first checks if the corresponding algorithm exists. If it doesn't, it returns a "renaming failed" message and ends the renaming process. If the algorithm exists, it checks if the new algorithm name is available, including whether it conforms to naming rules and whether a corresponding algorithm already exists. If the new name is unavailable, it returns a "renaming failed" message and ends the renaming process. Then, it reads the algorithm name storage file, deletes the existing name mappings, adds the mapping for the new algorithm name, saves the algorithm name storage file, returns a "renaming successful" message, and ends the renaming process.

[0068] The update process of existing algorithms is as follows: Figure 7As shown. First, input the algorithm name, class name, source file, and header file location of the new code in string format. Check if the corresponding algorithm exists; if not, return "Algorithm update failed" and end the process. Check if the algorithm name and class name are available; if not, return "Algorithm update failed" and end the process. Read the source file and header content and save them as strings respectively; if reading fails, return "Algorithm update failed" and end the process. Create a file at the corresponding location in the hash algorithm library, write the string content to the file, and save it; if writing fails, return "Algorithm update failed" and end the process. Insert a reference to the new algorithm into the hash call interface and store the mapping between the algorithm name and the corresponding class in the algorithm name dictionary. Return "Algorithm update successful" and end the algorithm update process.

[0069] The detailed process for adding a new algorithm is as follows: Figure 8 As shown, the input includes the name of the hash algorithm to be added, its class name, and the locations of its source and header files. The algorithm update function reads the file contents and saves them as strings. It then creates a file at the corresponding location in the hash algorithm library, writes the string content to that file, and saves it. Subsequently, the algorithm update function inserts a reference to the new algorithm into the hash call interface and inserts an instance of the new algorithm into the hash class instance. Finally, it returns the result of adding the new algorithm.

[0070] The process of removing an existing algorithm is as follows Figure 9 As shown. First, input the algorithm name to be removed as a string. Check if the corresponding algorithm exists; if not, return "algorithm update failed" and end the process. Check if the algorithm name and class name are available; if not, return "algorithm update failed" and end the process. Read the source file and header content and save them as strings respectively; if reading fails, return "algorithm update failed" and end the process. Create a file at the corresponding location in the hash algorithm library, write the file content in string format and save it; if writing fails, return "algorithm update failed" and end the process. Insert a reference to the new algorithm into the hash call interface and store the mapping between the algorithm name and the corresponding class in the algorithm name dictionary. Return "algorithm removal successful" and end the algorithm removal process.

[0071] This invention provides block header data verification and transaction payment verification functions, simplifying cross-chain verification operations. Through an internally implemented cross-chain-oriented hash function library, the system can provide multiple hash algorithms, supporting cross-chain verification between multiple PoW blockchain systems. The system provides functions for updating, adding, renaming, and removing hash algorithms, enabling management and updates of hash algorithms according to actual needs, and exhibiting high scalability.

[0072] In cross-chain verification for PoW blockchains, compared to solutions that use hash algorithms written in contracts to calculate hash values ​​during the verification process, this invention implements hash algorithms outside the virtual machine, providing a unified interface for verifying block headers and transactions. This effectively reduces the hash calculation cost during verification and avoids the problem of excessive hash algorithm computation leading to implementation failure. Regarding the number of supported blockchain systems, this invention provides a greater number of hash algorithms, enabling cross-chain verification between more blockchain systems compared to existing solutions. When hash algorithms need modification, this invention provides corresponding interfaces to support renaming, updating, adding, and removing hash algorithms, demonstrating high scalability.

[0073] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. The same or similar parts between the various embodiments can be referred to each other.

[0074] This document uses specific examples to illustrate the principles and implementation methods of the present invention. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of the present invention. Furthermore, those skilled in the art will recognize that, based on the ideas of the present invention, there will be changes in the specific implementation methods and application scope. Therefore, the content of this specification should not be construed as a limitation of the present invention.

Claims

1. A cross-chain verification system for PoW blockchains, characterized in that, include: The module includes a hash algorithm library, an algorithm update module, and a data verification module. The hash algorithm library module is connected to the algorithm update module and the data verification module, respectively. The hash algorithm library module is used to implement hash algorithms in an object-oriented manner, and specifies a unified format for hash algorithms. Methods in the class implement hash value calculation, and a unified interface is used to call different hash algorithms. The data verification module is used to verify data on different blockchains for the cross-chain process; The algorithm update module is used to add, update, rename, and remove hash algorithms from the hash algorithm library module; The hash algorithm library module includes: a hash algorithm unit, an auxiliary unit, and a testing unit; The hash algorithm unit is used to call different hash algorithms using a unified interface and to implement the hash algorithm in an object-oriented manner; The auxiliary unit is used to store general utility functions and custom types used in the hash algorithm library module, and to perform common operations in the hash algorithm; the common operations include: byte order conversion, type conversion and reading; The testing unit is used to perform performance testing on the implemented hash algorithm; The hash algorithm unit includes: an abstract hash class, a concrete hash algorithm class, and a hash call interface; The specific hash algorithm class stores multiple hash algorithms; the specific hash algorithm class is a subclass of the abstract hash class, and overrides the methods in the abstract class to implement different hash calculation processes; The hash call interface is used to store the mapping relationship between the unique identifier of the hash algorithm and the specific hash algorithm object, and selects the corresponding hash algorithm object for hash operation according to the mapping relationship and the unique identifier of the hash algorithm, thereby realizing the unified call of different hash algorithms.

2. The cross-chain verification system for PoW blockchains according to claim 1, characterized in that, The hash algorithm is uniquely identified by its name.

3. A cross-chain verification system for PoW blockchains according to claim 1, characterized in that, The data verification module includes: a block header data verification unit and a transaction payment verification unit; The block header data verification unit is used to perform hash calculation verification on multiple data fields in the block header; The transaction payment verification unit is used to recalculate the Merkle root hash based on the transaction and compare the recalculated Merkle root hash with the Merkle root hash stored in the block header.

4. A cross-chain verification system for PoW blockchains according to claim 3 (data verification module), characterized in that, Transactions in a blockchain are stored in the form of hash values.

5. A cross-chain verification system for PoW blockchains according to claim 1, characterized in that, The algorithm update module includes: an algorithm addition unit, an algorithm update unit, an algorithm renaming unit, and an algorithm removal unit.

Citation Information

Patent Citations

  • Digital works issuing method based on block chain smart contract

    CN107622385A

  • Block chain generation method, data verification method, node and system

    CN107657438A