Data resource collaborative management method and system based on blockchain

By performing structural analysis of smart contract logic and simplifying the interactive network map, identifying and optimizing the circular dependency problem in smart contracts, the problems of slow identification speed and complexity of computing power in the existing technology are solved, and more efficient identification and Optimize the effect.

CN119293047BActive Publication Date: 2025-02-25贵州装备制造职业学院
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411833601.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-12-13
Publication Date
2025-02-25
Estimated Expiration
2044-12-13

AI Technical Summary

Technical Problem

The existing technology has limitations in identifying and optimizing the circular dependency problem in smart contracts, especially when dealing with large and complex smart contracts, the computing power is more complex and the recognition speed is slow, making it difficult to meet the needs of practical applications.

Method used

By performing structural analysis of the smart contract logic, an interactive network map is generated, and the map is simplified, and the circular dependencies in the interactive path of the operating unit are identified.

Benefits of technology

The computing power complexity of circular dependency recognition is reduced, the recognition speed is improved, and the recognition and optimization process is more efficient and accurate.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119293047B_ABST
    Figure CN119293047B_ABST
Patent Text Reader

Abstract

The present application provides a data resource collaborative management method and system based on blockchain, by obtaining the smart contract logic to be identified of the smart contract, and performing structural analysis on the smart contract logic to be identified, obtaining the structural analysis information corresponding to the smart contract logic to be identified, and generating the interactive network map corresponding to the smart contract logic to be identified; obtaining the number of connections of each logical network vertex in the interactive network map, and simplifying the interactive network map according to the number of connections of each logical network vertex, obtaining the target interactive network map, performing circular dependency identification on the target interactive network map, obtaining the interactive path of the operation unit in the smart contract logic to be identified, and the origin operation unit and the end operation unit in the interactive path of the operation unit are the same operation unit. The present application can reduce the computing power complexity of circular dependency identification and improve the identification speed of circular dependency identification.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the fields of data processing and blockchain technology, and in particular to a blockchain-based data resource collaborative management method and system. Background Art

[0002] With the rapid development of blockchain technology, smart contracts, as a computer program that automatically executes, controls or records events and actions, have been widely used in many fields. The writing and execution of smart contracts rely on complex logical structures, which usually contain multiple operation units and interaction paths between them. However, the complexity of smart contract logic also brings challenges in circular dependency identification and optimization. In the traditional smart contract development and deployment process, developers often rely on manual review to identify potential circular dependency issues. This approach is not only time-consuming and labor-intensive, but also prone to errors, especially when faced with large and complex smart contracts. In addition, since the execution environment of smart contracts is blockchain, its decentralized and tamper-proof characteristics require that the logic of smart contracts must be highly accurate and reliable. Any circular dependency or logical error may lead to serious consequences, such as loss of funds, system crash or trust crisis.

[0003] In order to solve the above problems, the industry has begun to explore automated circular dependency identification and optimization methods. However, most existing methods are based on static checking and have limitations when dealing with smart contract logic. For example, they can often only identify explicit circular dependencies, while ignoring implicit dependencies or state changes that depend on the external environment. In addition, when dealing with large and complex smart contracts, existing methods have high computing complexity and slow identification speed, which makes it difficult to meet the needs of practical applications. Summary of the invention

[0004] In view of this, the present application provides a data resource collaborative management method and system based on blockchain. The technical solution of the present application is implemented as follows:

[0005] On the one hand, the present application provides a data resource collaborative management method based on blockchain, the method comprising: obtaining the smart contract logic to be identified of the smart contract, and performing structural analysis on the smart contract logic to be identified to obtain structural analysis information corresponding to the smart contract logic to be identified; wherein the structural analysis information includes each operation unit in the smart contract logic to be identified, and the interaction path between each operation unit; using the operation unit in the structural analysis information as a logical network vertex and the interaction path as a logical network connection line to generate an interaction network graph corresponding to the smart contract logic to be identified; obtaining the number of connections of each logical network vertex in the interaction network graph, and simplifying the interaction network graph according to the number of connections of each logical network vertex to obtain a target interaction network graph, wherein the number of connections of each logical network vertex in the target interaction network graph is at least one; performing circular dependency identification on the target interaction network graph to obtain the interaction path of the operation unit in the smart contract logic to be identified, wherein the origin operation unit and the end operation unit in the interaction path of the operation unit are the same operation unit.

[0006] On the other hand, the present application provides a computer system, including a memory and a processor, wherein the memory stores a computer program executable on the processor, and the processor implements the steps in the above method when executing the program.

[0007] The technical effect of the present application is as follows: the embodiment of the present application is based on structural analysis of the smart contract logic to be identified, obtaining structural analysis information, generating an interactive network graph corresponding to the smart contract logic to be identified based on the structural analysis information, and simplifying the interactive network graph to obtain a target interactive network graph, performing circular dependency identification on the target interactive network graph, and obtaining the interactive path of the operation unit in the smart contract logic to be identified. In this way, based on converting the smart contract logic to be identified into an interactive network graph, there is no need to focus on the operation instructions during circular dependency identification, which reduces the computing power complexity of circular dependency identification and makes the circular dependency identification faster. In addition, based on the simplification of the interactive network graph, the target interactive network graph is more concise, further reducing the computing power complexity of circular dependency identification, and the speed of circular dependency identification is further improved.

[0008] It should be understood that the above general description and the following detailed description are merely exemplary and explanatory, and are not intended to limit the technical solutions of the present application. BRIEF DESCRIPTION OF THE DRAWINGS

[0009] The drawings herein are incorporated into the specification and constitute a part of the specification. These drawings illustrate embodiments consistent with the present application and are used together with the specification to illustrate the technical solution of the present application.

[0010] Figure 1 A schematic diagram of the implementation process of a blockchain-based data resource collaborative management method provided in an embodiment of the present application.

[0011] Figure 2 A hardware entity diagram of a computer system provided in an embodiment of the present application. DETAILED DESCRIPTION

[0012] In order to make the purpose, technical solutions and advantages of the present application clearer, the technical solutions of the present application are further elaborated in detail below in conjunction with the drawings and embodiments. The described embodiments should not be regarded as limiting the present application. All other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of the present application.

[0013] In the following description, reference is made to "some embodiments", which describe a subset of all possible embodiments, but it is understood that "some embodiments" may be the same subset or different subsets of all possible embodiments, and may be combined with each other without conflict. The terms "first / second / third" involved are merely used to distinguish similar objects and do not represent a specific order for the objects. It is understood that "first / second / third" may be interchanged in a specific order or sequence where permitted, so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein.

[0014] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein are only for the purpose of describing this application and are not intended to limit this application.

[0015] The embodiment of the present application provides a data resource collaborative management method based on blockchain, which can be executed by a processor of a computer system. The computer system can refer to a device with data processing capabilities such as a server, a laptop, a tablet computer, and a desktop computer.

[0016] Figure 1 A schematic diagram of the implementation process of a blockchain-based data resource collaborative management method provided in an embodiment of the present application is shown in FIG. Figure 1 As shown, the method comprises the following steps:

[0017] Step S100: Obtain the smart contract logic to be identified of the smart contract, and perform structural analysis on the smart contract logic to be identified to obtain structural analysis information corresponding to the smart contract logic to be identified; wherein the structural analysis information includes each operation unit in the smart contract logic to be identified, and the interaction path between each operation unit.

[0018] In step S100, the computer system obtains the smart contract logic to be identified of the smart contract. A smart contract is a computer program that automatically executes, controls or records events and actions, usually deployed on a blockchain. The smart contract logic to be identified refers to the smart contract logic structure that the computer system will analyze and process. This step can load the smart contract file that has been downloaded or uploaded from the storage system.

[0019] Take a simple smart contract as an example, assuming it is used to manage the transfer process of a cryptocurrency. This smart contract may contain multiple operation units, such as verifying whether the sender's balance is sufficient, deducting the sender's balance, increasing the receiver's balance, recording transaction events, etc. These operation units constitute the core logic of the smart contract.

[0020] After obtaining the smart contract logic to be identified, the computer system then performs structural analysis. The purpose of structural analysis is to decompose the smart contract logic into smaller, manageable parts and understand the relationship between these parts. This step involves, for example, static analysis of smart contract instructions to identify the operation units and the interaction paths between these operation units.

[0021] During the structural analysis process, the computer system identifies the operation units in the smart contract. The operation unit can be a specific processing module defined within the smart contract, or a specific transaction instruction. Taking the previous cryptocurrency transfer smart contract as an example, the operation unit may include:

[0022] checkBalance: A unit that verifies whether the sender's balance is sufficient.

[0023] deductBalance: The unit in which the transfer amount is deducted from the sender's balance.

[0024] addBalance: A unit that adds the transfer amount to the receiver's balance.

[0025] recordTransaction: A unit for recording transaction events.

[0026] These operation units are the basic building blocks of smart contract logic, and together they complete the function of cryptocurrency transfer.

[0027] In addition to identifying the operation units, the computer system also needs to determine the interaction paths between these operation units. The interaction path describes the execution order and dependencies between the operation units. In a smart contract, the output of one operation unit may serve as the input of another operation unit, thus forming an execution chain.

[0028] Continuing with the example of a cryptocurrency transfer smart contract, possible interaction paths include:

[0029] checkBalance ->deductBalance ->addBalance ->recordTransaction: This is a typical transfer process, which first verifies the balance, then deducts the sender's balance, then increases the receiver's balance, and finally records the transaction event.

[0030] checkBalance ->abortTransaction: If the sender's balance is insufficient, the transaction may be terminated directly.

[0031] These interaction paths demonstrate the dynamic nature of smart contract logic, i.e., the execution order and dependencies of operation units can change under different conditions.

[0032] After identifying the operation units and interaction paths, the computer system integrates this information into structural parsing information. Structural parsing information is a detailed data structure that contains all the operation units in the smart contract logic and the interaction paths between these operation units. This data structure is usually a graph or tree structure, where nodes represent operation units and edges represent interaction paths.

[0033] Taking the graph structure as an example, each operation unit can be regarded as a node, and the lines between nodes represent the interaction path. In this graph, you can clearly see the location of each operation unit, its connection relationship with other operation units, and the structure of the entire smart contract logic.

[0034] For a cryptocurrency transfer smart contract, its structure parsing information may be as follows:

[0035] Node 1 (checkBalance): Checks whether the sender’s balance is sufficient.

[0036] Node 2 (deductBalance): deducts the transfer amount from the sender’s balance.

[0037] Node 3 (addBalance): Add the transfer amount to the receiver’s balance.

[0038] Node 4 (recordTransaction): records transaction events.

[0039] Node 5 (abortTransaction): Terminate the transaction.

[0040] Edge 1: Node 1 -> Node 2 (if balance is sufficient).

[0041] Edge 2: Node 1 -> Node 5 (if insufficient balance).

[0042] Edge 3: Node 2 -> Node 3.

[0043] Edge 4: Node 3 -> Node 4.

[0044] This structural analysis information provides a solid foundation for subsequent steps. Through it, the computer system can clearly understand the structure and dynamic characteristics of the smart contract logic, thereby providing strong support for generating interactive network graphs, identifying circular dependencies, and optimizing smart contract logic.

[0045] In the process of structural parsing, the computer system can use a variety of techniques to ensure accuracy and efficiency. For example, it can use regular expressions or syntax analyzers to identify the operation units and interaction paths in smart contracts. For more complex smart contracts, it can use machine learning models to assist the parsing process. These models can learn the characteristics and patterns of smart contracts through training, so as to more accurately identify the operation units and interaction paths.

[0046] In addition, to ensure the accuracy and completeness of the structure analysis information, the computer system can perform multiple iterations and verifications. For example, it can generate a preliminary structure analysis information and then compare it with the source instructions of the smart contract to ensure that there are no omissions or errors. If inconsistencies are found, it can return to the structure analysis stage for adjustments and corrections.

[0047] Step S200: Use the operation units in the structure analysis information as the logical network vertices and the interaction paths as the logical network connection lines to generate an interaction network graph corresponding to the smart contract logic to be identified.

[0048] In step S100, the computer system has performed structural analysis on the smart contract logic to be identified, and obtained structural analysis information. This information includes the various operation units in the smart contract logic and the interaction paths between these operation units. In step S200, the computer system will use this information to generate an interactive network map.

[0049] First, the computer system uses the operation units in the structure parsing information as logical network vertices. Logical network vertices represent the basic processing units in the smart contract logic. They can be specific processing modules defined within the smart contract or specific transaction instructions. These vertices form the basic framework of the interactive network graph.

[0050] Take a simple smart contract as an example, assuming it is used to manage the voting process of a voting system. This smart contract may contain the following operation units:

[0051] verifyVoter: A unit that verifies the identity of the voter.

[0052] castVote: The unit of voting.

[0053] tallyVotes: A unit for counting voting results.

[0054] announceWinner: The unit that announces the winner.

[0055] In the interaction network graph, these operation units will be represented as logical network vertices.

[0056] Next, the computer system uses the interaction paths in the structure analysis information as logical network connection lines. The logical network connection lines represent the execution order and dependency between the operation units. They connect the logical network vertices in the graph to form a complete network structure.

[0057] Continuing with the voting system smart contract as an example, possible interaction paths include:

[0058] verifyVoter ->castVote: After verifying the identity of the voter, allow him to vote.

[0059] castVote ->tallyVotes: Update the vote tally after each vote.

[0060] tallyVotes ->announceWinner: After all votes are cast, tally the results and announce the winner.

[0061] In the interaction network graph, these interaction paths will be represented as logical network lines, which connect the four logical network vertices of verifyVoter, castVote, tallyVotes and announceWinner.

[0062] By connecting the logical network vertices and logical network connection lines, the computer system generates an interactive network graph corresponding to the intended identification of the smart contract logic. This graph is an intuitive network structure that shows the execution order and dependency relationship between the operation units in the smart contract logic.

[0063] In the process of generating the interactive network graph, the computer system can use graph theory algorithms to ensure the accuracy and effectiveness of the graph. For example, it can use depth-first search (DFS) or breadth-first search (BFS) algorithms to traverse the logical network vertices and connecting lines to ensure that the graph does not contain isolated vertices or loops.

[0064] In addition, in order to improve the readability and analysis efficiency of the graph, the computer system can visualize the graph. For example, it can use a graphics drawing library to generate an image file of the graph, or embed the graph into an interactive graphical interface so that users can intuitively view and analyze the structure of the smart contract logic.

[0065] In the interactive network graph, each logical network vertex represents an operation unit, and each logical network connection line represents an interaction path. By viewing the graph, you can clearly understand the structure and dynamic characteristics of the smart contract logic. For example, in the graph of the voting system smart contract, you can see the execution order and dependencies between the four operation units of verifyVoter, castVote, tallyVotes, and announceWinner, so as to understand the working principle of the entire voting process.

[0066] The step of generating an interaction network graph is crucial for the subsequent identification and optimization of circular dependencies. Through the graph, the computer system can more easily identify circular dependency problems in the smart contract logic and take corresponding measures to optimize it. For example, it can use the ring detection algorithm in graph theory to find rings in the graph to determine which operation units have circular dependencies. Then, it can adjust and optimize the smart contract logic based on these dependencies to ensure its correctness and efficiency.

[0067] Step S300: Obtain the number of connections of each logical network vertex in the interactive network graph, and simplify the interactive network graph according to the number of connections of each logical network vertex to obtain a target interactive network graph, wherein the number of connections of each logical network vertex in the target interactive network graph is at least one.

[0068] Step S300 simplifies the interaction network graph to generate a more concise and effective target interaction network graph. The purpose of this step is to remove redundant information in the interaction network graph, retain the core logical network vertices and interaction paths, and provide more valuable data support for the identification and optimization of circular dependencies in subsequent steps.

[0069] In step S200, the computer system has generated an interactive network graph based on the structural analysis information. This graph contains all the operation units (logical network vertices) in the smart contract logic and the interaction paths (logical network connection lines) between these operation units. However, in the actual smart contract logic, there may be some redundant or unnecessary operation units and interaction paths, which are not very helpful for understanding the core logic of the smart contract. Therefore, in step S300, the computer system will simplify the interactive network graph to remove this redundant information.

[0070] First, the computer system obtains the number of connections of each logical network vertex in the interactive network graph. The number of connections, also known as degree, refers to the number of logical network connection lines directly connected to a logical network vertex, which reflects the importance and activity of the vertex in the graph. In the interactive network graph, logical network vertices with higher connection numbers usually represent core processing units in the smart contract logic, while vertices with lower or zero connection numbers may represent redundant or unnecessary operation units.

[0071] Take a simple voting system smart contract as an example, assuming that its interactive network graph contains the following logical network vertices:

[0072] Vertex A (verifyVoter): The unit that verifies the identity of the voter.

[0073] Vertex B (castVote): The voting unit.

[0074] Vertex C (tallyVotes): The unit that counts voting results.

[0075] Vertex D (announceWinner): The unit that announces the winner.

[0076] Vertex E(logVote): The unit that records the voting log (assuming this is a redundant operation unit).

[0077] In this example, vertices A, B, C, and D may all have high connections because they are the core processing units in the voting process. Vertex E (logVote) may have low or zero connections because it may only be called under certain conditions or its functionality can be replaced by other vertices.

[0078] After obtaining the number of connections of each logical network vertex, the computer system will then simplify the interactive network graph based on these connection numbers. The principle of simplification is to remove logical network vertices with zero connection numbers and the logical network connection lines connected to them, because these vertices and connection lines have no actual interaction in the graph and are redundant information. At the same time, for vertices with low connection numbers but not completely redundant, the computer system can also consider retaining or merging them according to specific circumstances.

[0079] Continuing with the voting system smart contract as an example, assume that the number of connections of vertex E (logVote) is zero, which means that it is not directly connected to any other vertex. In this case, the computer system removes vertex E and its connected logical network connection lines from the interactive network graph. After removal, the graph will become more concise while retaining the core logic of the voting process.

[0080] During the simplification process, the computer system can adopt a variety of strategies to ensure the effectiveness and accuracy of the simplification. For example, it can use the connected component algorithm in graph theory to identify and remove isolated logical network vertices; or, it can evaluate the importance of each vertex according to the business logic and actual needs of the smart contract, and decide whether to retain or merge certain vertices accordingly.

[0081] In addition, in order to ensure that the simplified results meet expectations, the computer system can also verify and test the simplified interactive network graph. For example, it can check whether the core processing units and key interactive paths of the smart contract logic are still retained in the graph; or it can verify whether the simplified logic is still correct and effective by simulating the execution of the smart contract.

[0082] After simplification, the computer system obtains the target interactive network graph, which retains the core information of the smart contract logic while removing redundant and unnecessary operation units and interactive paths, making the identification and optimization of circular dependencies in subsequent steps more efficient and accurate.

[0083] In the target interaction network graph, each logical network vertex has at least one connection, which means that each vertex has a direct interaction with at least one other vertex. This structure makes the graph more compact and connected, which helps computer systems better understand and analyze the structure and dynamic characteristics of smart contract logic.

[0084] By simplifying the interactive network graph, the computer system can remove redundant information, retain the core logic, and provide more valuable data support for the identification and optimization of circular dependencies in subsequent steps. This not only improves the efficiency of data processing, but also ensures the accuracy and reliability of the analysis results.

[0085] Step S400: Perform circular dependency identification on the target interaction network graph to obtain the operation unit interaction path in the smart contract logic to be identified, where the origin operation unit and the destination operation unit in the operation unit interaction path are the same operation unit.

[0086] Step S400 identifies circular dependencies on the target interaction network graph to find the interaction paths of the operation units in the smart contract logic to be identified, especially those paths where the origin operation unit and the destination operation unit are the same. The purpose of this step is to identify possible circular dependency problems in the smart contract logic and provide a basis for subsequent optimization work.

[0087] In step S300, the computer system has simplified the interaction network graph to obtain the target interaction network graph. This graph retains the core information of the smart contract logic while removing redundant and unnecessary operation units and interaction paths, making the graph more concise and effective. In step S400, the computer system will perform circular dependency identification based on this target interaction network graph.

[0088] Circular dependency refers to a system or process in which two or more elements are interdependent, forming a closed loop. In smart contract logic, circular dependencies may cause the contract to fail to execute correctly or fall into an infinite loop, so they need to be identified and handled in a timely manner. In the target interaction network graph, circular dependencies are manifested as the origin and end point operation units in the interaction path of the operation unit being the same.

[0089] In order to identify circular dependencies, the computer system first needs to traverse the target interaction network graph to find all possible interaction paths of the operation units. These paths represent the execution order and dependencies between the operation units in the smart contract logic. During the traversal process, the computer system can use graph theory algorithms such as depth-first search (DFS) or breadth-first search (BFS) to ensure that all paths in the graph can be found.

[0090] Take a simple voting system smart contract as an example, assuming that its target interaction network graph contains the following logical network vertices:

[0091] Vertex A (verifyVoter): The unit that verifies the identity of the voter.

[0092] Vertex B (castVote): The voting unit.

[0093] Vertex C (tallyVotes): The unit that counts voting results.

[0094] Vertex D (announceWinner): The unit that announces the winner.

[0095] When traversing the graph, the computer system can find the following operation unit interaction paths:

[0096] Path 1: A -> B -> C -> D

[0097] Path 2: A -> B -> D (assuming that under certain conditions, the winner is announced directly after voting)

[0098] However, if there are circular dependencies in the graph, the computer system needs to further identify these dependencies. For example, suppose vertex C (tallyVotes) needs to call vertex A (verifyVoter) to verify the identity of the new voter when counting the voting results (this may not be common in actual applications, but is used to illustrate the concept of circular dependencies). In this case, a circular dependency path is formed: A -> B -> C -> A.

[0099] In order to identify this kind of circular dependency path, the computer system records the access status of each operation unit during the traversal process. When an operation unit that has been visited is encountered as a new path end point, it means that a circular dependency path has been found. In the above example, when the computer system traverses along the path A -> B -> C, if vertex A is encountered again as the next access point, it can be determined that there is a circular dependency.

[0100] After identifying the circular dependency paths, the computer system also analyzes and evaluates these paths. Circular dependencies may lead to inefficient contract execution or errors. Therefore, the computer system determines whether these circular dependencies are acceptable based on the business logic and actual needs of the smart contract, and takes corresponding measures to optimize them.

[0101] Methods for optimizing circular dependencies may include refactoring smart contract logic, adjusting the execution order of operation units, using additional state variables to track execution progress, etc. The specific method to be adopted depends on the specific situation of circular dependencies and the specific needs of smart contracts.

[0102] By identifying circular dependencies on the target interactive network graph, the computer system can discover possible circular dependency problems in the smart contract logic, providing a basis for subsequent optimization work. This not only helps to improve the execution efficiency and correctness of smart contracts, but also helps to reduce potential risks and errors.

[0103] As an implementation mode, in step S100, the structure of the smart contract logic to be identified is analyzed to obtain the structure analysis information corresponding to the smart contract logic to be identified, including:

[0104] Step S110: performing logical structure analysis on the smart contract logic to be identified, and obtaining structural representation information of the smart contract logic to be identified; wherein the structural representation information is used to indicate the operation declaration and external dependency information of each operation unit within the smart contract;

[0105] Step S120: Generate a logical hierarchical representation structure corresponding to the smart contract logic to be identified based on the structural representation information; wherein the logical hierarchical representation structure includes a first logical network vertex corresponding to the operation logic of each operation unit, and a second logical network vertex corresponding to the external dependency information of each operation unit, and the first logical network vertex is the upper logical network vertex of the second logical network vertex;

[0106] Step S130: Determine the structural analysis information corresponding to the smart contract logic to be identified based on the logical hierarchy representation structure.

[0107] Step S110 is the starting point of structural analysis. The computer system performs logical structural analysis on the logic of the smart contract to be identified. The goal of this step is to extract the operation declarations of each operation unit within the smart contract and the dependency information between these operation units and the external environment, thereby generating structural representation information. The structural representation information is an abstract representation of the logical structure of the smart contract, which provides the necessary basic data for subsequent steps.

[0108] Take a simple smart contract as an example, assuming that the contract is used to manage the transfer process of a cryptocurrency. In this contract, the following operation units may be included:

[0109] checkBalance: Checks whether the sender's account balance is sufficient.

[0110] deductBalance: The transfer amount is deducted from the sender's account.

[0111] addBalance: Add the transfer amount to the recipient's account.

[0112] recordTransaction: record transfer transaction information.

[0113] In step S110, the computer system will parse the instructions of these operation units and extract the operation declaration of each operation unit, such as the unit name, parameters and return value, etc. At the same time, it will also analyze the dependency of these operation units on the external environment, such as whether they call units of other smart contracts, or whether they depend on specific states on the blockchain (such as block height, timestamp, etc.).

[0114] Through this step, the computer system can generate a structural representation information that describes in detail the operation declarations of each operation unit within the smart contract and their dependencies with the external environment. For example, for the checkBalance operation unit, its structural representation information may include:

[0115] Operation declaration: function checkBalance(address sender, uint amount) returns(bool).

[0116] External dependencies: None (assuming this operation unit does not depend on other smart contracts or blockchain state).

[0117] In step S120, the computer system further generates a logical hierarchical representation structure corresponding to the smart contract logic to be identified based on the structural representation information generated in step S110. The logical hierarchical representation structure is a higher-level abstract representation that not only includes the operation logic of the operation unit, but also reveals the hierarchical relationship and dependency relationship between these operation units.

[0118] The logical hierarchical representation structure consists of two types of logical network vertices: the first logical network vertex and the second logical network vertex. The first logical network vertex corresponds to the operation logic of each operation unit inside the smart contract, while the second logical network vertex corresponds to the external dependency information of these operation units. In the logical hierarchical representation structure, the first logical network vertex is located above the second logical network vertex, which means that the operation logic is higher than its external dependency in the logical level.

[0119] Continuing with the example of the cryptocurrency transfer smart contract, assume that the checkBalance operation unit depends on the current block height on the blockchain to verify whether the transaction is valid (although this is rare in actual applications, it is used here to illustrate the concept). In the logical hierarchical representation structure, the checkBalance operation unit will be represented as a first logical network vertex, and its dependence on the block height will be represented as a second logical network vertex. There will be a directed edge between the two vertices, from the first logical network vertex to the second logical network vertex, indicating that the checkBalance operation unit depends on the block height information.

[0120] Through this step, the computer system is able to generate a clear logical hierarchical representation structure, which not only shows the operation logic of each operation unit within the smart contract, but also reveals the hierarchical relationship and dependency relationship between them. This is crucial for the identification and optimization of circular dependencies in subsequent steps.

[0121] In step S130, the computer system finally determines the structural parsing information corresponding to the smart contract logic to be identified based on the logical hierarchical representation structure generated in step S120. The structural parsing information is a comprehensive description of the logical structure of the smart contract, which includes the operation logic of the operation unit, external dependency information, and the interaction between these elements.

[0122] In order to determine the structural parsing information, the computer system traverses and analyzes the logical hierarchical representation structure. Specifically, it sequentially accesses each logical network vertex in the logical hierarchical representation structure and performs corresponding operations according to the type of the vertex (first logical network vertex or second logical network vertex).

[0123] For the first logical network vertex (i.e., the operation logic of the operation unit), the computer system will extract its operation declaration, parameters, return value and other information, and determine the role and position of the operation unit in the smart contract logic. At the same time, it will also analyze the interaction between the operation unit and other operation units, such as the calling relationship and the called relationship.

[0124] For the second logical network vertex (i.e., the external dependency information of the operation unit), the computer system will extract the specific content of its dependencies (such as blockchain status, units of other smart contracts, etc.) and determine the impact of these dependencies on the execution of the operation unit. For example, if an operation unit depends on the current timestamp on the blockchain to execute specific logic, the computer system will record this dependency and consider its role in the smart contract logic.

[0125] In the process of traversing and analyzing the logical hierarchical representation structure, the computer system will also build a data structure of structural parsing information. This data structure may be a graph or tree structure, in which the nodes represent the logical network vertices (i.e. the operation logic or external dependency information of the operation unit) and the edges represent the interaction relationship between the vertices. By building such a data structure, the computer system can clearly display the structure and dynamic characteristics of the smart contract logic.

[0126] Finally, when the traversal and analysis process is completed, the computer system obtains the structural analysis information corresponding to the smart contract logic to be identified. This information not only contains the operation logic and external dependency information of each operation unit within the smart contract, but also reveals the interaction relationship and hierarchical structure between these elements. This provides a solid foundation for the generation of interactive network graphs, circular dependency identification and optimization in subsequent steps.

[0127] As an implementation method, step S130, based on the logical hierarchical representation structure, determines the structural parsing information corresponding to the smart contract logic to be identified, including:

[0128] Step S131: sequentially walk the first logic network vertex in the logic hierarchy representation structure to obtain the operation logic of each operation unit, and determine the transaction instruction of each operation unit according to each operation logic;

[0129] Step S132: Analyze the transaction instructions of each operation unit to obtain a first analysis result, where the first analysis result is used to characterize whether the operation logic of the operation unit depends on other operation units in the smart contract logic to be identified;

[0130] Step S133: Determine the structural parsing information corresponding to the smart contract logic to be identified based on the first analysis result.

[0131] Step S131 is the first step in determining the structural analysis information. The computer system begins to walk through the first logical network vertex in the logical hierarchical representation structure. The first logical network vertex represents the operation logic of each operation unit in the smart contract. Therefore, the purpose of this step is to traverse all operation units, extract their operation logic, and further determine the transaction instructions corresponding to each operation unit.

[0132] During the traversal process, the computer system will traverse downwards layer by layer starting from the top vertex according to the hierarchical relationship of the logical hierarchical representation structure. For each first logical network vertex, the computer system will extract the operation logic of the operation unit it represents, which usually includes the name, parameters, return value, and specific logic of execution of the operation unit. At the same time, the computer system will also determine the transaction instructions corresponding to the operation unit based on the content of the operation logic. Transaction instructions are specific operations performed by smart contracts on the blockchain, such as transfers, data storage, event triggering, etc.

[0133] Take a simple smart contract as an example, assuming that the contract is used to manage a voting system. In this contract, the following operation units may be included:

[0134] verifyVoter: An operation unit that verifies the identity of a voter.

[0135] castVote: The unit of operation for voting.

[0136] tallyVotes: The operation unit for counting voting results.

[0137] announceWinner: The unit that announces the winner.

[0138] In step S131, the computer system will traverse these operation units in sequence. For the verifyVoter operation unit, it can extract the following operation logic and transaction instructions:

[0139] Operation logic: Check whether the voter's address is in the list of registered voters.

[0140] Transaction instruction: Returns true if the voter address is in the list, otherwise returns false.

[0141] Similarly, for the castVote, tallyVotes and announceWinner operation units, the computer system will also extract their respective operation logics and transaction instructions.

[0142] In step S132, the computer system analyzes the transaction instructions of each operation unit extracted in step S131 to identify the dependencies between these operation units. The purpose of this step is to determine whether the operation logic of each operation unit depends on the remaining operation units in the smart contract logic to be identified.

[0143] Dependency identification is a key step in determining structural parsing information. In smart contracts, there may be complex dependencies between operation units, such as calling relationships, called relationships, shared state dependencies, etc. These dependencies are crucial for understanding the logical structure of smart contracts, identifying potential circular dependency issues, and optimizing smart contract performance.

[0144] In order to identify dependencies, the computer system will conduct an in-depth analysis of the transaction instructions of each operation unit. It can check whether the transaction instructions call units of other operation units, whether shared state variables are accessed, whether other events are triggered, etc. Through these analyses, the computer system can build a dependency graph that shows the dependencies between the various operation units within the smart contract.

[0145] Continuing with the voting system smart contract as an example, assume that the castVote operation unit needs to call the verifyVoter operation unit to verify the identity of the voter when voting. In this case, the castVote operation unit depends on the verifyVoter operation unit. In step S132, the computer system can identify this dependency by analyzing the transaction instructions of the castVote operation unit and record it in the dependency graph.

[0146] In addition, the computer system will generate the first analysis result for the transaction instructions of each operation unit. This analysis result is a binary value (such as true or false) that is used to characterize whether the operation logic of the operation unit depends on the other operation units in the smart contract logic to be identified. If it depends on other operation units, the analysis result is true; otherwise, it is false.

[0147] In step S133, the computer system finally determines the structural analysis information corresponding to the smart contract logic to be identified based on the first analysis result generated in step S132. The purpose of this step is to integrate the identified dependencies into the structural analysis information so that subsequent steps can use this information to generate interactive network graphs, identify and optimize circular dependencies, etc.

[0148] When dealing with dependencies, the computer system will adopt different strategies according to the different situations of the first analysis results. If the operation logic of a certain operation unit does not depend on other operation units (that is, the first analysis result is false), the computer system will regard it as an independent logic unit and directly record its operation logic and transaction instructions in the structure parsing information.

[0149] However, if the operation logic of a certain operation unit depends on other operation units (i.e., the first analysis result is true), the computer system further processes this dependency. It can build a dependency chain or dependency tree to clearly show the dependency between the operation unit and other operation units. At the same time, it will also record these dependencies in the structure parsing information so that the subsequent steps can accurately understand the logical structure of the smart contract.

[0150] After processing the dependencies of all operation units, the computer system obtains the complete structural analysis information corresponding to the smart contract logic to be identified. This information not only contains the operation logic and transaction instructions of each operation unit, but also reveals the dependencies between them. This provides basic data support for the generation of interactive network graphs in subsequent steps.

[0151] In addition, it is worth noting that when dealing with dependencies, the computer system also needs to consider some special cases. For example, if there is a circular dependency problem in the smart contract (that is, two or more operating units depend on each other), the computer system can identify this situation and take appropriate measures to deal with it. Circular dependencies may cause the smart contract to fail to execute correctly or fall into an infinite loop, so they must be identified and resolved in a timely manner.

[0152] In order to deal with circular dependency problems, computer systems can use the ring detection algorithm in graph theory to find rings in the dependency graph. Once the existence of a ring is detected, the computer system will trigger an early warning mechanism to remind developers to pay attention to potential circular dependency problems. At the same time, it will also provide corresponding optimization suggestions, such as refactoring the smart contract logic, adjusting the execution order of operation units, etc., to help developers solve circular dependency problems.

[0153] As an implementation mode, step S133, based on the first analysis result, determines the structural parsing information corresponding to the smart contract logic to be identified, including:

[0154] Step S1331: if the first analysis result indicates that the operation logic of the operation unit depends on the other operation units, then determining the structure analysis information according to the operation unit and the other operation units;

[0155] Step S1332: If the first analysis result indicates that the operation logic of the operation unit does not depend on other operation units, starting from the first logic network vertex, the second logic network vertex in the logic hierarchy representation structure is sequentially walked to obtain external dependency information, and the structural parsing information is determined based on the external dependency information.

[0156] Step S1331 is to process the situation where there is a dependency relationship between the operation units. When the first analysis result shows that the operation logic of a certain operation unit (called the dependent operation unit) depends on the remaining operation units in the smart contract logic to be identified, the computer system will execute step S1331.

[0157] In this sub-step, the computer system first identifies the remaining operation units that the dependent operation unit depends on (called dependent operation units). This is usually done by analyzing the transaction instructions of the dependent operation unit, which may contain calls to the dependent operation unit, access to shared state variables, etc., all of which indicate the existence of dependency relationships.

[0158] Next, the computer system determines the specific dependency relationship between the dependent operation unit and the dependent operation unit. This may include a call relationship, a data transfer relationship, a state update relationship, etc. In order to clearly represent these dependency relationships, the computer system can construct a dependency graph, in which nodes represent operation units and edges represent dependency relationships. In the dependency graph, the edge from the dependent operation unit to the dependent operation unit represents the direction of the dependency relationship.

[0159] After determining the dependencies, the computer system integrates this information into the structure parsing information. The structure parsing information is a comprehensive data structure that contains all the operation units in the smart contract logic, the dependencies between them, and the operation logic and transaction instructions of each operation unit. In step S1331, the computer system adds new nodes and edges to the structure parsing information to represent the dependent operation units and the dependent operation units and the dependencies between them.

[0160] Take a simple smart contract as an example. Assume that the contract is used to manage the transfer process of a cryptocurrency. In this contract, there is a deductBalance operation unit, which is used to deduct the transfer amount from the sender's account balance. If the deductBalance operation unit needs to call the checkBalance operation unit to verify whether the sender's account balance is sufficient before execution, then deductBalance depends on checkBalance. In this case, the computer system will add two nodes, deductBalance and checkBalance, to the structure parsing information, and add an edge from deductBalance to checkBalance between them to indicate this dependency.

[0161] Step S1332 is to process the situation where there is no dependency between the operation units. When the first analysis result indicates that the operation logic of a certain operation unit (referred to as an independent operation unit) does not depend on the remaining operation units in the smart contract logic to be identified, the computer system will execute step S1332.

[0162] In this sub-step, the computer system pays attention to the external dependency information of the independent operation unit. External dependency information refers to the information that the independent operation unit may rely on in the external environment or external system during execution. This information may include the current state on the blockchain (such as block height, timestamp), the state or unit of other smart contracts, the response of external API, etc.

[0163] In order to obtain the external dependency information of the independent operation unit, the computer system starts from the second logic network vertex in the logical hierarchy representation structure and walks through the logic network vertices in sequence. The second logic network vertex represents the external dependency information of the operation unit, so by walking through these vertices, the computer system can discover all external dependencies of the independent operation unit.

[0164] During the walk, the computer system records the external dependency information represented by each second logic network vertex and associates it with the independent operation unit. This is usually done by adding new nodes and edges in the structure parsing information, where nodes represent external dependencies and edges represent the dependency relationship between independent operation units and external dependencies.

[0165] In addition to recording external dependency information, the computer system also needs to analyze the impact of this dependency information on the execution of independent operation units. For example, if an independent operation unit depends on the current timestamp on the blockchain, it may need to wait for the blockchain to generate a new block to obtain the latest timestamp. This dependency can affect the performance and response time of the smart contract, so the computer system clearly represents it in the structure parsing information.

[0166] Continuing with the example of a cryptocurrency transfer smart contract, assume that the recordTransaction operation unit is used to record the transfer transaction information on the blockchain. This operation unit may not depend on other operation units within the contract, but it may depend on the current state of the blockchain (such as block height) to generate a unique transaction ID. In this case, the computer system will add an external dependency node representing the block height to the structure parsing information, and add an edge between the recordTransaction operation unit and the node to represent this dependency.

[0167] Through the processing of steps S1331 and S1332, the computer system can comprehensively and accurately determine the structural parsing information corresponding to the smart contract logic to be identified. This information not only includes the dependencies between the various operating units within the smart contract, but also includes the dependencies between the operating units and the external environment. This provides a solid foundation for the generation of interactive network graphs, circular dependency identification and optimization in subsequent steps. At the same time, by clearly representing dependency relationships and external dependency information, the computer system can also help developers better understand the logical structure of smart contracts, thereby improving development efficiency and instruction quality.

[0168] As an implementation mode, the logical network vertex of the logical hierarchical representation structure also includes a third logical network vertex corresponding to the shared state parameter in the operation unit, the first logical network vertex is the upper logical network vertex of the third logical network vertex, and the second logical network vertex is the same-level logical network vertex of the third logical network vertex.

[0169] Based on this, in step S1332, the structural analysis information is determined according to the external dependency information, including:

[0170] Step S13321: Analyze the transaction instruction of the external dependency information to obtain a second analysis result;

[0171] Step S13322: if the second analysis result indicates that the operation logic of the transaction instruction of the external dependency information depends on other operation units, then determine the structure parsing information according to the operation unit and other operation units;

[0172] Step S13323: If the second analysis result represents that the operation logic of the transaction instruction of the external dependency information does not depend on the other operation units, starting from the first logical network vertex, the third logical network vertex in the logical hierarchy representation structure is sequentially walked through the logical network vertices to obtain the shared state parameters, and the structural parsing information is determined based on the shared state parameters.

[0173] Step S13321 is the starting point for processing external dependency information. In this sub-step, the computer system analyzes the transaction instructions of the external dependency information of the independent operation unit to obtain a second analysis result. The second analysis result is used to characterize whether the transaction instructions of the external dependency information are dependent on the remaining operation units in the smart contract logic to be identified.

[0174] Transaction instructions with external dependency information may involve multiple types of data and logic, including but not limited to blockchain status, external API responses, status or units of other smart contracts, etc. The computer system carefully analyzes these transaction instructions to determine whether they call other operation units inside the smart contract or whether they rely on shared state parameters inside the smart contract.

[0175] For example, suppose there is a smart contract that manages the lending function in a decentralized finance (DeFi) application. In this contract, there is a borrow operation unit that allows users to borrow from a pool of funds. Before executing the borrow operation, the operation unit may need to check the user's credit score (which may be an external dependency information because the credit score may be provided by another smart contract or external service). If the transaction instructions of the borrow operation unit contain logic to call another smart contract unit to obtain the credit score, then this constitutes a dependency on external dependency information.

[0176] In step S13321, the computer system will analyze the transaction instruction of the borrow operation unit to check whether it contains calls to other smart contract units, or whether it depends on specific states on the blockchain (such as block height, timestamp, etc.). If the analysis result shows that the transaction instruction does depend on other operation units or specific states, the computer system will generate a second analysis result indicating the existence of the dependency.

[0177] If the second analysis result of step S13321 indicates that the transaction instruction of the external dependency information depends on the other operation units in the smart contract logic to be identified, then the computer system will execute step S13322. In this sub-step, the computer system will determine the structural parsing information based on the dependency relationship between the operation unit and the other operation units.

[0178] Processing the operation logic dependency of external dependency information involves multiple steps such as identifying dependency chains, building dependency graphs, and updating structural parsing information. First, the computer system determines which specific operation units the external dependency information depends on and identifies the dependencies between these operation units. Then, it can use algorithms in graph theory (such as depth-first search DFS or breadth-first search BFS) to build a dependency graph to clearly display the dependency chain and dependency hierarchy.

[0179] Continuing with the DeFi lending smart contract as an example, assume that the borrow operation unit depends on another smart contract named getCreditScore to obtain the user's credit score. In this case, the borrow operation unit depends on an operation unit in the getCreditScore smart contract (assuming it is calculateScore). In step S13322, the computer system will identify this dependency and add corresponding nodes and edges in the structure parsing information to indicate the borrow operation unit's dependency on the calculateScore operation unit.

[0180] In addition, the computer system also needs to consider the directionality and transitivity of dependencies. For example, if the calculateScore operation unit depends on another operation unit to obtain additional data, then this dependency should also be recorded and reflected in the structure analysis information.

[0181] If the second analysis result of step S13321 indicates that the transaction instruction of the external dependency information does not depend on the other operation units in the logic of the smart contract to be identified, but may depend on the shared state parameters inside the smart contract, then the computer system will execute step S13323. In this sub-step, the computer system will start from the first logic network vertex (representing the operation logic of the operation unit) and walk the third logic network vertex (representing the shared state parameter) in the logic hierarchy representation structure in sequence to obtain the shared state parameter, and determine the structure parsing information accordingly.

[0182] Shared state parameters are variables defined within a smart contract that can be accessed throughout the contract. They are used to save contract state information, such as balance, ownership, configuration parameters, etc. During the execution of a smart contract, an operating unit can read or modify these shared state parameters, thereby forming a dependency on them.

[0183] In step S13323, the computer system first identifies the shared state parameters that the independent operation unit may rely on. This is usually done by analyzing the transaction instructions and logical hierarchical representation structure of the operation unit. Then, the computer system will walk through these shared state parameters in turn to obtain their complete information (such as name, type, value, etc.) and their dependencies with other operation units.

[0184] Continuing with the DeFi lending smart contract as an example, assume that the borrow operation unit needs to check the available balance of the fund pool during execution (this is a shared state parameter). In step S13323, the computer system will identify the borrow operation unit's dependence on the available balance of the fund pool, and add a corresponding node in the structure parsing information to represent this shared state parameter. At the same time, it will also check whether the available balance of the fund pool is updated or modified by other operation units, and build a complete dependency graph based on this.

[0185] When dealing with dependencies on shared state parameters, the computer system also needs to consider concurrency and consistency issues. Since smart contracts run on the blockchain, multiple operating units can try to access or modify the same shared state parameter at the same time. Therefore, the computer system ensures that this concurrency is accurately reflected in the structure analysis information and provides sufficient information support for subsequent optimization and verification work.

[0186] In summary, the three sub-steps in step S1332 together constitute the complete process of processing external dependency information and shared state parameter dependencies. Through this process, the computer system can comprehensively and accurately determine the structural parsing information corresponding to the smart contract logic to be identified. This information not only includes the dependencies between the various operating units within the smart contract, but also includes the dependencies between the operating units and the external environment and shared state parameters. This provides a solid foundation for the generation of interactive network graphs, circular dependency identification and optimization in subsequent steps.

[0187] As an implementation manner, step S13322, determining structure analysis information according to the operation unit and other operation units, includes:

[0188] Step S133221: Obtain interaction paths between the operation unit and the remaining operation units, and perform the following operations on the remaining operation units: determine the interaction paths between the operation unit and the remaining operation units, and between the operation unit and the remaining operation units, as reference structure parsing information of the remaining operation units;

[0189] Step S133222: Determine the reference structural analysis information of the remaining operating units as the structural analysis information of the operating unit.

[0190] Step S133221 is the starting point for processing dependencies between operation units. In this sub-step, the computer system first obtains the interaction path between the operation unit and the remaining operation units. The interaction path refers to the call relationship or data transfer relationship between the operation unit and other operation units during the execution process, which constitutes part of the smart contract logic.

[0191] In order to obtain the interaction path, the computer system traverses the logical hierarchical representation structure to find the connection relationship between the operation unit and the other operation units. These connection relationships may include unit calls, state variable access, event triggering, etc. By traversing, the computer system can build an interaction path graph that shows all possible interaction paths between the operation unit and the other operation units.

[0192] Next, for each remaining operation unit, the computer system performs the following operations: the operation unit, the remaining operation units, and the interaction paths between them are combined to form a reference structure resolution information. The reference structure resolution information is a temporary data structure used to record the dependency relationship and interaction path between the operation unit and the specific remaining operation units.

[0193] Take a smart contract as an example, assuming that the contract is used to manage the trading process in a decentralized exchange (DEX). In this contract, there is an executeTrade operation unit, which is used to execute the transaction between the buyer and the seller. Before executing the transaction, the executeTrade operation unit may need to call the validateOrder operation unit to verify the validity of the order, and the updateBalances operation unit to update the balances of the two parties to the transaction.

[0194] In step S133221, the computer system obtains the interaction path between the executeTrade operation unit and the validateOrder and updateBalances operation units. For the validateOrder operation unit, the computer system generates a reference structure parsing information, which includes the executeTrade operation unit, the validateOrder operation unit, and the interaction path between them (for example, executeTrade ->validateOrder). Similarly, for the updateBalances operation unit, the computer system also generates a reference structure parsing information including executeTrade, updateBalances, and the interaction path between them.

[0195] In step S133222, the computer system integrates the reference structure analysis information of each remaining operation unit generated in step S133221 to determine the structure analysis information of the operation unit. The integration process involves merging multiple reference structure analysis information into a comprehensive structure analysis information, which includes the dependency relationship and interaction path between the operation unit and all other operation units.

[0196] During the integration process, the computer system can use a variety of strategies to ensure the accuracy and completeness of the information. For example, it can check whether there are conflicts or duplications between the reference structure interpretation information and adjust or merge them accordingly. In addition, in order to maintain the clarity and readability of the information, the computer system can use a hierarchical or structured approach to represent the integrated structure interpretation information.

[0197] Continuing with the DEX trading smart contract as an example, in step S133222, the computer system will integrate the reference structure analysis information between the executeTrade operation unit and the validateOrder and updateBalances operation units. The integrated structure analysis information will contain the following information:

[0198] The operation logic and trading instructions of the executeTrade operation unit.

[0199] The dependency of the executeTrade operation unit on the validateOrder operation unit and the interaction path between them (executeTrade ->validateOrder).

[0200] The dependency of the executeTrade operation unit on the updateBalances operation unit and the interaction path between them (executeTrade ->updateBalances).

[0201] In addition, the integrated structural analysis information may also contain other relevant information, such as the state variables of the operation unit, event triggering conditions, etc. These information together constitute the complete representation of the operation unit in the smart contract logic.

[0202] Through the processing of steps S133221 and S133222, the computer system can comprehensively and accurately determine the structural parsing information of the operation unit. This information not only includes the operation logic and transaction instructions of the operation unit itself, but also includes the dependencies and interaction paths between it and the remaining operation units. This provides a solid foundation for the generation of interactive network graphs, circular dependency identification and optimization in subsequent steps. At the same time, by clearly representing dependencies and interaction paths, the computer system can also help developers better understand the logical structure of smart contracts, thereby improving development efficiency.

[0203] As an implementation mode, in step S300, the interactive network graph is simplified according to the number of connections of each logical network vertex to obtain a target interactive network graph, including:

[0204] Step S310: determining the logical network vertices in the interactive network graph whose connection number is equal to 0 according to the connection number of each logical network vertex in the interactive network graph;

[0205] Step S320: Acquire the associated logical network connection line connected to the logical network vertex with a connection number equal to 0;

[0206] Step S330: remove the logical network vertices with a connection number equal to 0 and the associated logical network connection lines connected to the logical network vertices with a connection number equal to 0 from the interactive network graph to obtain a target interactive network graph.

[0207] Step S310 is the first step of the simplified processing. The computer system first traverses all logical network vertices in the interactive network graph, calculates the number of connections for each vertex, and determines the vertices with a connection number equal to 0. The connection number refers to the number of logical network connection lines directly connected to a vertex, which reflects the importance and activity of the vertex in the graph. Vertices with a connection number equal to 0 mean that they are not directly connected to any other vertex, so they can be regarded as isolated vertices or redundant vertices.

[0208] Take a simple voting system smart contract as an example, assuming that its interactive network graph contains the following logical network vertices:

[0209] Vertex A (verifyVoter): The unit that verifies the identity of the voter.

[0210] Vertex B (castVote): The voting unit.

[0211] Vertex C (tallyVotes): The unit that counts voting results.

[0212] Vertex D (announceWinner): The unit that announces the winner.

[0213] Vertex E (logVote): A unit that records voting logs (assumed to be rarely called in practical applications).

[0214] After traversing the graph and counting the number of connections, the computer system finds that the number of connections for vertex E is 0 because it is not directly connected to any other vertex. This means that vertex E is isolated in the graph and may be a redundant vertex.

[0215] Step S320 is the second step of the simplified processing. The computer system obtains the associated logical network connection lines connected to the logical network vertex whose connection number is equal to 0 determined in step S310. Although these connection lines connect the isolated vertices, since the isolated vertices themselves are not connected to other vertices, these connection lines have lost their meaning of existence and can be regarded as redundant connection lines.

[0216] Continuing with the voting system smart contract as an example, in step S310, the computer system has determined that vertex E is a vertex with a connection number equal to 0. In step S320, the computer system further checks the graph and finds that there is no logical network connection line connecting vertex E and other vertices. However, in order to maintain the consistency of the steps, it can be assumed that there is a hypothetical connection line (which may not exist in actual situations) that starts from vertex E, but because it has no end point, it is also redundant.

[0217] It should be noted that, in actual situations, since vertex E itself is isolated, there is usually no actual connection line connecting it. The hypothetical connection line here is only used to illustrate the execution process of step S320.

[0218] Step S330 is the last step of the simplification process and is also the most critical step. In this step, the computer system removes the logical network vertices with a connection number equal to 0 determined in step S310 and the associated logical network connection lines obtained in step S320 from the interactive network map. By removing these isolated vertices and redundant connection lines, the computer system can generate a more concise and clear target interactive network map.

[0219] Continuing with the voting system smart contract as an example, in step S330, the computer system removes vertex E and its hypothetical connection line (if any) from the graph. After removal, the graph will only contain vertices A, B, C and D and the connection lines between them, which represent the core logic and interaction path of the voting system smart contract.

[0220] The process of removing isolated vertices and redundant links not only simplifies the graph, but also improves the efficiency of subsequent analysis and optimization. For example, in the circular dependency identification step, the computer system can more quickly traverse and check the vertices and links in the target interaction network graph to find potential circular dependency problems.

[0221] In addition, removing isolated vertices and redundant connections can also help improve the readability and maintainability of smart contracts. A concise and clear interactive network diagram can help developers better understand the logical structure of smart contracts, making it easier to review, debug, and optimize.

[0222] It is worth noting that in the process of removing isolated vertices and redundant connections, the computer system ensures that important logical network vertices and connections will not be deleted by mistake. Therefore, before performing this step, the computer system may need to perform additional verification and testing on the graph to ensure that the removal operation does not affect the correctness and functional integrity of the smart contract.

[0223] In summary, the three sub-steps S310, S320 and S330 in step S300 together constitute a complete process of simplifying the interactive network map. Through this process, the computer system can generate a more concise and clear target interactive network map, providing strong support for subsequent analysis and optimization work.

[0224] As an implementation method, step S400, performing circular dependency identification on the target interaction network graph to obtain the interaction path of the operation unit in the smart contract logic to be identified, includes:

[0225] Step S410: If there are x operation unit interaction paths in the target interaction network graph, the target interaction network graph is firstly subjected to circular dependency identification to obtain a first operation unit interaction path;

[0226] Step S420: in the target interaction network graph, marking the logical network vertices and logical network connection lines in the interaction path of the first operation unit to obtain a first marked logical network corresponding to the target interaction network graph;

[0227] Step S430: determining the logical network consisting of the unmarked logical network vertices and logical network connection lines in the first marked logical network as the first reference logical network;

[0228] Step S440: performing the sth circular dependency identification on the rth reference logic network to obtain the sth operation unit interaction path, wherein r=s-1, s is an integer greater than 1 and not greater than x, and x is the number of times the circular dependency identification is performed;

[0229] Step S450: taking values ​​of s in sequence and executing them to obtain x-1 operation unit interaction paths.

[0230] Step S410 is the starting point of circular dependency identification. The computer system first checks whether there are multiple operation unit interaction paths in the target interaction network graph. An operation unit interaction path refers to a path that starts from a certain logical network vertex, passes through a series of logical network connection lines, and finally returns to the starting point or another logical network vertex. If there are x such paths in the graph (x≥1), the computer system starts the first circular dependency identification.

[0231] The goal of first cycle dependency identification is to find the shortest or most significant first operation unit interaction path in the graph. This is usually done by traversing all paths in the graph and calculating their length or complexity. During the traversal process, the computer system can use depth-first search (DFS), breadth-first search (BFS) or other algorithms in graph theory to ensure the completeness and accuracy of the path.

[0232] Suppose there is a simple smart contract for managing a voting system on a blockchain. In this contract, the target interaction network graph may contain the following logical network vertices:

[0233] Vertex A (verifyVoter): The unit that verifies the identity of the voter.

[0234] Vertex B (castVote): The voting unit.

[0235] Vertex C (tallyVotes): The unit that counts voting results.

[0236] Vertex D (announceWinner): The unit that announces the winner.

[0237] If there are multiple interaction paths in the graph, such as A->B->C->D and A->B->D, the computer system will select one of them as the first operation unit interaction path in the first circular dependency identification. Assume that A->B->C->D is selected because this path covers more logical network vertices and connection lines and may be more representative.

[0238] In step S420, the computer system marks the logical network vertices and logical network connection lines in the first operation unit interaction path found in step S410. The purpose of marking is to distinguish the processed and unprocessed path parts in the subsequent steps, so as to avoid repeated identification or omission.

[0239] The marking operation usually involves setting specific flags or attribute values ​​for the corresponding vertices and links in the graph data structure. For example, a Boolean array can be used to record the marking status of each vertex and link, and the corresponding positions of the marked vertices and links are set to true.

[0240] Continuing with the voting system smart contract as an example, in step S420, the computer system marks the vertices A, B, C, D and the connecting lines between them in the path A->B->C->D as processed. After marking, this part of the path in the graph will be regarded as the first marked logical network, which represents the result of the first circular dependency identification.

[0241] Step S430 is performed on the basis of step S420. In this step, the computer system excludes the marked logic network vertices and connecting lines from the first marked logic network, and the remaining parts constitute the first reference logic network. The first reference logic network contains other paths and vertices that have not been processed by the first circular dependency identification, which will be the focus of subsequent circular dependency identification.

[0242] The process of determining the first reference logical network is actually a segmentation of the graph. By excluding the marked parts, the computer system can more clearly see which paths and vertices in the graph need to be further analyzed. This helps to improve the efficiency and accuracy of circular dependency identification.

[0243] Continuing with the voting system smart contract as an example, in step S430, the computer system regards the graph portion after excluding the path A->B->C->D as the first reference logical network. This portion of the network may contain other paths starting from vertex A or vertex D, such as A->B->D or D->(other possible paths).

[0244] Step S440 is one of the core steps of circular dependency identification. In this step, the computer system performs the sth circular dependency identification (s>1) on the first reference logic network to find the sth operation unit interaction path. This process will be repeated until all possible operation unit interaction paths are identified.

[0245] Each cycle dependency identification follows similar steps as the first identification: traversing the paths in the reference logic network, calculating the path length or complexity, and selecting the shortest or most significant path as the current operation unit interaction path. Then, the vertices and connecting lines in this path are marked, and a new reference logic network is generated for the next identification.

[0246] In the example of the voting system smart contract, assume that the first reference logic network contains the path A->B->D. In the second circular dependency identification, the computer system can select this path as the second operation unit interaction path and mark it. Then, it will continue to process the remaining network parts to find other possible paths.

[0247] In step S450, the computer system traverses s (s starts from 2 until it equals x, which is the total number of operation unit interaction paths in the graph), and repeats the cyclic dependency identification process in step S440. Each time a new operation unit interaction path is identified, it is added to the operation unit interaction path set.

[0248] After the traversal is completed, the computer system will obtain a set of all identified interaction paths of operation units. This set fully reflects the circular dependencies in the smart contract logic and provides an important basis for subsequent optimization work.

[0249] Continuing with the voting system smart contract as an example, assume that during the traversal process, the computer system finds other possible paths (if any) in addition to the two paths A->B->C->D and A->B->D. At the end of step S450, it will have a set containing all these paths, which is the final result of circular dependency identification.

[0250] In summary, the five sub-steps S410, S420, S430, S440 and S450 in step S400 together constitute the complete process of circular dependency identification of the target interaction network graph. Through this process, the computer system can comprehensively and accurately identify the interaction paths of the operation units and potential circular dependency problems in the smart contract logic. This provides strong support for subsequent optimization work and helps to ensure the correctness and performance of the smart contract.

[0251] As an implementation mode, step S410, performing the first circular dependency identification on the target interaction network graph to obtain the first operation unit interaction path, includes:

[0252] Step S411: determining any logical network vertex among the logical network vertices of the target interactive network graph as a target interactive network graph vertex;

[0253] Step S412: in the target interaction network graph, determining one or more target interaction paths with the target interaction network graph vertex as the starting logical network vertex and the ending logical network vertex;

[0254] Step S413: determining the shortest target interaction path among the one or more target interaction paths as the first operation unit interaction path.

[0255] In step S411, the computer system selects one of the logical network vertices of the target interaction network graph as the target interaction network graph vertex. This vertex will serve as the starting point and end point of the interaction path search in subsequent steps, which is crucial for identifying circular dependencies.

[0256] The process of selecting the target interaction network graph vertex is usually based on certain strategies or rules. For example, the computer system can select the vertex with the highest number of connections because it may have the most interactions with other vertices and is more likely to form a circular dependency. Alternatively, the computer system can select vertices that represent core operating units because these vertices play a key role in the smart contract logic.

[0257] Take a simple smart contract as an example, assuming that the contract is used to manage the lending function in a decentralized finance (DeFi) application. In this contract, the target interaction network graph may contain the following logical network vertices:

[0258] Vertex A (borrow): borrowing unit.

[0259] Vertex B (repay): repayment unit.

[0260] Vertex C (updateCollateral): updates the collateral unit.

[0261] Vertex D (liquidate): liquidation unit.

[0262] In step S411, the computer system may select vertex A as the target interaction network graph vertex because it represents one of the core operations of the lending function.

[0263] Step S412 is performed based on step S411. In this step, the computer system searches the target interaction network graph for one or more target interaction paths with the target interaction network graph vertex (the vertex determined in step S411) as the starting logical network vertex and the ending logical network vertex.

[0264] The target interaction path refers to the path starting from the vertex of the target interaction network graph, passing through a series of logical network connections, and finally returning to the vertex. These paths may represent circular dependencies in the smart contract logic, that is, a certain operation unit directly or indirectly calls itself during execution.

[0265] In order to determine the target interaction path, computer systems usually use algorithms in graph theory, such as depth-first search (DFS), breadth-first search (BFS), or iterative deepening depth-first search (IDDFS), etc. These algorithms can traverse all paths in the graph and find the target interaction path that meets the conditions.

[0266] Continuing with the DeFi lending smart contract as an example, in step S412, the computer system can use the DFS algorithm to start from vertex A and search for all paths back to vertex A. Assume that the following paths are found during the search:

[0267] Path 1: A -> B -> C -> A (indicates repayment after borrowing and updating collateral, and finally returns to the borrowing unit)

[0268] Path 2: A -> D -> A (indicates that liquidation is triggered directly after borrowing and eventually returns to the borrowing unit)

[0269] These paths are all possible target interaction paths because they all start from vertex A and eventually return to vertex A.

[0270] Step S413 is the last step performed on the basis of step S412. In this step, the computer system selects the shortest one from the one or more target interaction paths found in step S412 as the first operation unit interaction path.

[0271] The purpose of selecting the shortest target interaction path is to simplify the process of circular dependency identification and prioritize the most representative paths. The shortest path usually means fewer logical network vertices and connecting lines, so it is easier to analyze and optimize.

[0272] When selecting the shortest path, the computer system can use various metrics to measure the length or complexity of the path. For example, it can use the number of logical network vertices in the path, the number of connecting lines, or the number of "hops" of the path (i.e., the number of direct connections between vertices) as a metric. It then compares the metric values ​​of all target interaction paths and selects the smallest one as the first operation unit interaction path.

[0273] Continuing with the DeFi lending smart contract as an example, in step S413, the computer system may compare the lengths of path 1 and path 2. Assume that path 1 contains 3 logical network vertices (A, B, C) and 2 connecting lines, while path 2 contains only 2 logical network vertices (A, D) and 1 connecting line. Therefore, based on the metrics of the number of vertices and the number of connecting lines, path 2 will be considered a shorter path and will be selected as the first operation unit interaction path.

[0274] In summary, the three sub-steps S411, S412 and S413 in step S410 together constitute the complete process of first circular dependency identification. Through this process, the computer system can find the first operation unit interaction path in the target interaction network map, providing an important basis for subsequent analysis and optimization work.

[0275] As an implementation mode, in step S400, after performing cyclic dependency identification on the target interaction network graph and obtaining the interaction path of the operation unit in the smart contract logic to be identified, the method further includes:

[0276] Step S500: obtaining each past interaction path in the past interaction path set;

[0277] Step S600: for each operation unit interaction path in the smart contract logic to be identified, the operation unit interaction path is compared with each past interaction path in the past interaction path set to obtain a comparison result;

[0278] Step S700: Determine the interaction path of the operation unit to be optimized in the smart contract logic to be identified based on the comparison result;

[0279] Step S800: displaying a risk warning, where the risk warning is used to prompt the user to optimize the interaction path of the operation unit to be optimized.

[0280] Step S500 is the basis for the subsequent steps. The computer system first obtains a set of past interaction paths. The set of past interaction paths refers to the set of interaction paths of the operation units in the smart contract logic that have been previously identified and stored. These paths may come from the previous circular dependency identification process, or from other sources, such as the audit report or development documentation of the smart contract.

[0281] The method of obtaining the past interaction path set may vary depending on the actual situation. For example, the computer system can retrieve these paths from a local database or a remote storage system. If the past interaction path set is large or needs to be updated frequently, the computer system can implement an efficient retrieval and cache mechanism to improve data access speed.

[0282] The purpose of obtaining a set of past interaction paths is to compare them with the currently identified interaction paths of the operating units, so as to discover potential optimization opportunities or risk points. Through comparison, the computer system can understand the historical evolution and current status of the smart contract logic, providing a reference for subsequent optimization work.

[0283] Step S600 is the core of the subsequent steps. The computer system compares each operation unit interaction path in the smart contract logic to be identified with each past interaction path in the past interaction path set. The purpose of the comparison is to find out the differences and similarities between the current path and the past path, so as to determine which paths may need to be optimized.

[0284] The comparison process may involve a variety of comparison indicators and methods. For example, the computer system can compare the length of the path (i.e., the number of logical network vertices and connecting lines contained), the complexity of the path (such as the number of loops, the number of conditional branches, etc.), the execution efficiency of the path (such as execution time, resource consumption, etc.), and the functional characteristics of the path (such as whether it involves sensitive operations, whether there are security vulnerabilities, etc.).

[0285] To make the comparison, the computer system can employ algorithms from graph theory to match and compare paths. For example, it can use a subgraph isomorphism algorithm to check whether the current path is a subset or superset of the previous path, or it can use an edit distance algorithm to calculate the degree of difference between the current path and the previous path.

[0286] Continuing with the DeFi lending smart contract as an example, assume that in step S400, the computer system identifies the following operation unit interaction paths:

[0287] Path A: borrow ->updateCollateral ->borrow (indicates updating collateral after borrowing, and then borrowing again)

[0288] In step S600, the computer system compares path A with each path in the past interaction path set. Assume that the past interaction path set includes the following paths:

[0289] Path B: borrow ->repay ->borrow (borrowing, repaying, and then borrowing again)

[0290] Path C: borrow -> liquidate (indicates that liquidation is triggered directly after borrowing)

[0291] By comparison, the computer system can find that Path A is similar to Path B in structure, but different in the operations of updating collateral and repaying loans. This difference may indicate that Path A is more complex in logic or has potential for optimization. At the same time, the computer system may also find that Path A is completely different from Path C in function, which helps to further understand the characteristics and uses of Path A.

[0292] Step S700 is to determine which operation unit interaction paths need to be optimized based on the comparison result of step S600. The process of determining the paths to be optimized may involve multiple strategies and rules.

[0293] One strategy is to determine the path to be optimized based on the degree of difference in the comparison results. For example, if the current path is significantly different from the previous path in length, complexity, or execution efficiency, it may indicate that there is room for optimization in the current path. Another strategy is to determine the path to be optimized based on the functional characteristics and business logic of the path. For example, if the current path involves sensitive operations or has security vulnerabilities, it may need to be optimized first.

[0294] When determining the paths to be optimized, the computer system may also consider other factors, such as the frequency of use of the paths, the impact on the overall performance of the smart contract, and the feasibility and cost of optimization. By comprehensively considering these factors, the computer system can more accurately determine which paths are the focus of optimization.

[0295] Continuing with the DeFi lending smart contract as an example, in step S700, the computer system may determine whether path A needs to be optimized based on the comparison result of step S600. If the comparison result shows that path A is similar to path B in structure but different in operation, and such difference may result in performance degradation or increased logical complexity, the computer system may regard path A as a path to be optimized. On the other hand, if path A has unique functional characteristics and has no significant impact on the overall performance of the smart contract, the computer system may consider that path A does not need to be optimized immediately.

[0296] In step S800, the computer system displays a risk warning to prompt the developer to optimize the interaction path of the operation unit to be optimized. The risk warning is usually presented in a visual way, such as a pop-up window, log message or dashboard. It contains detailed information of the path to be optimized, optimization suggestions, and possible risk impacts.

[0297] The purpose of risk warning is to increase the vigilance of developers and promote the optimization work. By providing clear and accurate information and suggestions, the computer system can help developers quickly understand the problems of the path to be optimized and take appropriate measures to repair and improve it.

[0298] Continuing with the example of the DeFi lending smart contract, in step S800, if the computer system determines path A as the path to be optimized, it can display a risk warning, pointing out the potential problems of path A (such as performance degradation, increased logic complexity, etc.) and recommended optimization measures (such as simplifying the path structure, optimizing the order of operations, etc.). Developers can evaluate the severity of the problem and the urgency of optimization based on the information in the risk warning, and formulate corresponding optimization plans.

[0299] In summary, steps S500 to S800 constitute a complete subsequent optimization process, which aims to discover potential optimization opportunities and risk points by comparing the currently identified operation unit interaction path with the past interaction path set, and prompt developers to perform corresponding optimization work by displaying risk warnings. This process not only helps to improve the performance and security of smart contracts, but also helps to promote the continuous improvement and optimization of smart contracts.

[0300] As an implementation mode, step S700, based on the comparison result, determines the interaction path of the operation unit to be optimized in the smart contract logic to be identified, including:

[0301] Step S710: If the comparison result indicates that the smart contract logic to be identified does not have an operation unit interaction path that is the same as the previous interaction path, each operation unit interaction path in the smart contract logic to be identified is determined as the operation unit interaction path to be optimized in the smart contract logic to be identified;

[0302] Step S720: If the comparison result indicates that the to-be-identified smart contract logic has an operation unit interaction path that is the same as the past interaction path and also has an operation unit interaction path that is different from the past interaction path, then the to-be-identified smart contract logic's to-be-identified operation unit interaction path that is different from the past interaction path is determined as the to-be-identified smart contract logic's to-be-identified operation unit interaction path to be optimized.

[0303] Step S710 deals with the situation where the comparison result indicates that there is no operation unit interaction path in the smart contract logic to be identified that is exactly the same as the previous interaction path. In this case, the computer system regards all operation unit interaction paths in the smart contract logic to be identified as paths to be optimized.

[0304] This processing strategy is based on an assumption: if a new operation unit interaction path cannot find a match in the past interaction path set, then it may represent a new feature or new requirement in the smart contract logic. Since this new path has not been fully tested and verified, there may be performance issues, logical errors, or security risks. In order to ensure the correctness and reliability of smart contracts, the computer system treats these new paths as objects to be optimized for further review and optimization.

[0305] Take a simple smart contract as an example, assuming that the contract is used to manage trading orders in a decentralized exchange (DEX). In the latest version of the contract, a new operation unit interaction path is introduced to process cross-chain trading orders. Since this new path does not have a match in the past interaction path set, according to step S710, the computer system regards it as a path to be optimized. This means that developers need to carefully review the logic of this new path to ensure that it can correctly process cross-chain trading orders and will not have a negative impact on the overall performance and security of the DEX.

[0306] Step S720 deals with the situation that the comparison result indicates that there are both operation unit interaction paths that are the same as the past interaction paths and operation unit interaction paths that are different from the past interaction paths in the smart contract logic. In this case, the computer system regards those operation unit interaction paths that are different from the past interaction paths as paths to be optimized.

[0307] This processing strategy is based on an observation: even if most of the logic of a smart contract remains unchanged, some minor changes or newly added interaction paths of operation units may lead to performance degradation, logic errors or security risks. Therefore, the computer system pays special attention to those paths that are different from past interaction paths, because they may represent change points or risk points in the logic of the smart contract.

[0308] Continuing with the DEX smart contract as an example, assume that in the latest version of the contract, in addition to introducing the cross-chain transaction order processing path, the original order matching logic has been fine-tuned. This fine-tuning may have led to the emergence of some new operation unit interaction paths, which differ in details from the past interaction paths. According to step S720, the computer system regards these paths that are different from the past interaction paths as paths to be optimized. Developers need to carefully check the logical changes of these paths to ensure that they do not adversely affect the transaction matching efficiency and accuracy of DEX.

[0309] When determining the path to be optimized, the computer system can use a variety of strategies and methods to assist in decision-making. For example, it can calculate the complexity index of the operation unit interaction path (such as path length, number of cycles, number of conditional branches, etc.), and regard the path with higher complexity as the object to be optimized. In addition, the computer system can also use machine learning models to predict the performance and potential risks of the operation unit interaction path, thereby providing data support for optimization decisions.

[0310] Steps S710 and S720 are not mutually exclusive. In some cases, a smart contract may contain both a completely new path and a path that is different from the past path. In this case, the computer system will apply these two sub-steps simultaneously to determine the path to be optimized.

[0311] The two sub-steps S710 and S720 in step S700 together constitute the complete process of determining the interaction path of the operation unit to be optimized. Through this process, the computer system can accurately identify the possible problem points and optimization space in the smart contract logic, providing strong support for subsequent optimization work. At the same time, this process also reflects the accuracy and flexibility of the computer system in processing complex smart contract logic.

[0312] Figure 2 A hardware entity diagram of a computer system provided in an embodiment of the present application is shown in FIG. Figure 2 As shown, the hardware entity of the computer system 1000 includes: a processor 1001 and a memory 1002, wherein the memory 1002 stores a computer program that can be run on the processor 1001, and the processor 1001 implements the steps in the method of any of the above embodiments when executing the program.

[0313] It should be understood that the "one embodiment" or "one embodiment" mentioned throughout the specification means that the specific features, structures or characteristics related to the embodiment are included in at least one embodiment of the present application. Therefore, "in one embodiment" or "in one embodiment" appearing in various places throughout the specification may not necessarily refer to the same embodiment. In addition, these specific features, structures or characteristics can be combined in one or more embodiments in any suitable manner. It should be understood that in various embodiments of the present application, the size of the sequence number of each step / process mentioned above does not mean the order of execution, and the execution order of each step / process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiment of the present application. The above-mentioned sequence number of the embodiment of the present application is only for description and does not represent the advantages and disadvantages of the embodiment. It should be noted that, in this article, the term "include", "comprise" or any other variant thereof is intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements includes not only those elements, but also includes other elements that are not explicitly listed, or also includes elements inherent to such process, method, article or device. Without more constraints, an element defined by the phrase "comprising a..." does not exclude the existence of other identical elements in the process, method, article or apparatus comprising the element.

[0314] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as: multiple units or components can be combined, or can be integrated into another system, or some features can be ignored or not executed. In addition, the coupling, direct coupling, or communication connection between the components shown or discussed can be through some interfaces, and the indirect coupling or communication connection of the devices or units can be electrical, mechanical or other forms.

[0315] The units described above as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units; they may be located in one place or distributed on multiple network units; some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.

[0316] In addition, all functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may be a separate unit, or two or more units may be integrated into one unit; the above-mentioned integrated units may be implemented in the form of hardware or in the form of hardware plus software functional units.

[0317] A person skilled in the art can understand that all or part of the steps of implementing the above method embodiment can be completed by hardware related to program instructions, and the aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it executes the steps of the above method embodiment; and the aforementioned storage medium includes: mobile storage devices, read-only memories (ROM), magnetic disks or optical disks, etc., various media that can store program codes.

[0318] Alternatively, if the above-mentioned integrated unit of the present application is implemented in the form of a software function module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application can essentially or in other words, the part that contributes to the relevant technology can be embodied in the form of a software product, which is stored in a storage medium and includes a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the methods described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as mobile storage devices, ROMs, magnetic disks, or optical disks.

[0319] The above is only an implementation method of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application.

Claims

1. A data resource collaborative management method based on blockchain, characterized in that: The method comprises: Acquire the smart contract logic to be identified of the smart contract, and perform structural analysis on the smart contract logic to be identified to obtain structural analysis information corresponding to the smart contract logic to be identified; wherein the structural analysis information includes each operation unit in the smart contract logic to be identified, and the interaction path between each of the operation units; Using the operation units in the structure analysis information as logic network vertices and the interaction paths as logic network connection lines, generating an interaction network graph corresponding to the smart contract logic to be identified; Obtaining the number of connections of each of the logical network vertices in the interactive network graph, and simplifying the interactive network graph according to the number of connections of each of the logical network vertices to obtain a target interactive network graph, wherein the number of connections of each of the logical network vertices in the target interactive network graph is at least one; Performing circular dependency identification on the target interaction network graph to obtain an operation unit interaction path in the smart contract logic to be identified, wherein the origin operation unit and the destination operation unit in the operation unit interaction path are the same operation unit; The step of performing structural analysis on the smart contract logic to be identified to obtain structural analysis information corresponding to the smart contract logic to be identified includes: Performing logical structure analysis on the smart contract logic to be identified to obtain structural representation information of the smart contract logic to be identified; wherein the structural representation information is used to indicate the operation declaration and external dependency information of each operation unit within the smart contract; Generate a logical hierarchical representation structure corresponding to the smart contract logic to be identified according to the structural representation information; wherein the logical hierarchical representation structure includes a first logical network vertex corresponding to the operation logic of each of the operation units, and a second logical network vertex corresponding to the external dependency information of each of the operation units, and the first logical network vertex is the upper logical network vertex of the second logical network vertex; According to the logical hierarchical representation structure, the structural parsing information corresponding to the smart contract logic to be identified is determined.

2. The method according to claim 1, characterized in that Determining the structural parsing information corresponding to the smart contract logic to be identified based on the logical hierarchical representation structure includes: The first logic network vertices in the logic hierarchy representation structure are sequentially walked through to obtain the operation logic of each operation unit, and the transaction instructions of each operation unit are determined according to each operation logic; Analyze the transaction instructions of each of the operation units to obtain a first analysis result, where the first analysis result is used to characterize whether the operation logic of the operation unit depends on other operation units in the smart contract logic to be identified; Based on the first analysis result, determine the structural parsing information corresponding to the smart contract logic to be identified.

3. The method according to claim 2, characterized in that Determining the structural parsing information corresponding to the smart contract logic to be identified based on the first analysis result includes: If the first analysis result indicates that the operation logic of the operation unit depends on the other operation units, determining the structure analysis information according to the operation unit and the other operation units; If the first analysis result represents that the operation logic of the operation unit does not depend on the other operation units, then starting from the first logical network vertex, the second logical network vertex in the logical hierarchy representation structure is walked through the logical network vertices in sequence to obtain the external dependency information, and based on the external dependency information, the structural parsing information is determined.

4. The method according to claim 3, characterized in that The logical network vertex of the logical hierarchical representation structure further includes a third logical network vertex corresponding to the shared state parameter in the operation unit, the first logical network vertex is an upper-level logical network vertex of the third logical network vertex, and the second logical network vertex is a sibling logical network vertex of the third logical network vertex; Determining the structural analysis information according to the external dependency information includes: Analyzing the transaction instruction of the external dependency information to obtain a second analysis result; If the second analysis result indicates that the operation logic of the transaction instruction of the external dependency information depends on the remaining operation units, determining the structure parsing information according to the operation unit and the remaining operation units; If the second analysis result represents that the operation logic of the transaction instruction of the external dependency information does not depend on the remaining operation units, then starting from the first logical network vertex, the third logical network vertex in the logical hierarchy representation structure is walked through the logical network vertices in sequence to obtain the shared state parameters, and based on the shared state parameters, the structural parsing information is determined.

5. The method according to claim 3 or 4, characterized in that: The step of determining the structural analysis information based on the operation unit and the remaining operation units includes: Acquire the interaction path between the operation unit and each of the remaining operation units, and perform the following operations on each of the remaining operation units: determine the interaction path between the operation unit and the remaining operation units, and between the operation unit and the remaining operation units, as reference structure parsing information of the remaining operation units; The reference structural analysis information of each of the remaining operating units is determined as the structural analysis information of the operating unit.

6. The method according to claim 1, characterized in that The step of simplifying the interactive network graph according to the number of connections of each of the logical network vertices to obtain a target interactive network graph includes: According to the number of connections of each of the logical network vertices in the interactive network graph, determining the logical network vertices in the interactive network graph whose number of connections is equal to 0; Obtaining an associated logical network connection line connected to the logical network vertex whose connection number is equal to 0; The logical network vertices with a connection number equal to 0 and the associated logical network connection lines connected to the logical network vertices with a connection number equal to 0 are removed from the interactive network graph to obtain the target interactive network graph; The step of identifying circular dependencies on the target interaction network graph to obtain an interaction path of the operation unit in the smart contract logic to be identified includes: If the target interaction network graph has x interaction paths of the operation units, then the target interaction network graph is subjected to a first circular dependency identification to obtain a first interaction path of the operation unit; In the target interaction network graph, the logical network vertices and logical network connection lines in the interaction path of the first operation unit are marked to obtain a first marked logical network corresponding to the target interaction network graph; Determine a logical network consisting of the unmarked logical network vertices and the logical network connection lines in the first marked logical network as a first reference logical network; Performing the sth circular dependency identification on the rth reference logic network to obtain the sth operation unit interaction path, wherein r=s-1, s is an integer greater than 1 and not greater than x, and x is the number of times the circular dependency identification is performed; The s are taken and executed in sequence to obtain x-1 interaction paths of the operation units.

7. The method according to claim 6, characterized in that The first cycle dependency identification is performed on the target interaction network graph to obtain a first operation unit interaction path, including: Among the logical network vertices of the target interactive network graph, determining any logical network vertex as a target interactive network graph vertex; In the target interaction network graph, determining one or more target interaction paths with the target interaction network graph vertices as starting logical network vertices and terminating logical network vertices; The shortest target interaction path among the one or more target interaction paths is determined as the first operation unit interaction path.

8. The method according to claim 1, characterized in that After the target interaction network graph is subjected to circular dependency identification to obtain the interaction path of the operation unit in the smart contract logic to be identified, the method further includes: Obtain each past interaction path in the past interaction path set; For each of the operation unit interaction paths in the smart contract logic to be identified, the operation unit interaction path is compared with each of the past interaction paths in the past interaction path set to obtain a comparison result; Determine, based on the comparison result, an interaction path of the operation unit to be optimized in the smart contract logic to be identified; A risk warning is displayed, where the risk warning is used to prompt the optimization of the interaction path of the operation unit to be optimized.

9. The method according to claim 8, characterized in that Determining the interaction path of the operation unit to be optimized in the smart contract logic to be identified based on the comparison result includes: If the comparison result indicates that the smart contract logic to be identified does not have the same operation unit interaction path as the past interaction path, then each of the operation unit interaction paths in the smart contract logic to be identified is determined as the operation unit interaction path to be optimized in the smart contract logic to be identified; If the comparison result indicates that the smart contract logic to be identified has the same operation unit interaction path as the past interaction path, and at the same time has an operation unit interaction path different from the past interaction path, then the operation unit interaction path in the smart contract logic to be identified that is different from the past interaction path is determined as the operation unit interaction path to be optimized in the smart contract logic to be identified.

10. A computer system comprising a memory and a processor, wherein the memory stores a computer program executable on the processor, wherein: When the processor executes the program, the steps in the method according to any one of claims 1 to 9 are implemented.

Citation Information

Patent Citations

  • Construction method of an intelligent contract system, and intelligent contract system

    CN109615518A

  • A block chain smart contract logic verification method and device and a computer storage medium

    CN109684189A