Smart contract processing method and device, equipment, medium and product

By using the contract analysis model in the blockchain network to analyze and supplement the error information of smart contracts, the problem of difficulty in error detection during the call of smart contracts is solved, and the error understanding and processing capabilities of contract users are improved.

CN119441341APending Publication Date: 2025-02-14TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310980076.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-08-04
Publication Date
2025-02-14

AI Technical Summary

Technical Problem

In blockchain networks, unknown errors often occur during the call of smart contracts, which leads to difficult and expensive contract usage and error checks between nodes and terminals.

Method used

Provide a smart contract processing method, which obtains the error information of the target smart contract by executing the transaction request of the contract user, and uses the contract analysis model to analyze the error information, generates supplementary information, and finally sends the response information to the contract user. To get a more comprehensive understanding of the error.

Benefits of technology

The contract user does not need to work hard to troubleshoot errors, and can understand the errors more comprehensively, which will help improve the contract user's understanding and handling ability of the errors.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119441341A_ABST
    Figure CN119441341A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses an intelligent contract processing method and device, equipment, a medium and a product, and the method comprises the steps that a block chain node executes a transaction request which is sent by a contract user and is used for calling a target intelligent contract, and the transaction request comprises contract parameters of the target intelligent contract; if the transaction request fails to be executed, obtaining error information returned by the target smart contract; according to contract parameters corresponding to the target smart contract, calling a contract analysis model to analyze the error information to obtain error supplementary information; and generating response information according to the error information and the error supplementary information, and sending the response information to the contract user. According to the technical scheme provided by the embodiment of the invention, the error can be more comprehensively known, the understanding of the contract user on the error can be improved, and the error can be better processed.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of blockchain technology, and more specifically, to a smart contract processing method, a smart contract processing device, an electronic device, a computer-readable storage medium, and a computer program product. Background Art

[0002] In the related technology, a smart contract is an automatically executed program in a blockchain network, which can be called by nodes on the chain and terminals off the chain; however, in the calling process, unexplained errors are often received, which brings great difficulties and costs to the contract use and error troubleshooting of nodes and terminals. Summary of the invention

[0003] In order to solve the above technical problems, the embodiments of the present application provide a smart contract processing method, a smart contract processing device, an electronic device, a computer-readable storage medium and a computer program product. The contract user who calls the contract does not need to go through the trouble of troubleshooting errors, but can have a more comprehensive understanding of the errors, which helps to improve the contract user's understanding of the errors and better handle the errors.

[0004] Other features and advantages of the present application will become apparent from the following detailed description, or may be learned in part by the practice of the present application.

[0005] According to one aspect of an embodiment of the present application, a smart contract processing method is provided, including: executing a transaction request sent by a contract user for calling a target smart contract, the transaction request including contract parameters of the target smart contract; if the transaction request fails to be executed, obtaining error information returned by the target smart contract; based on the contract parameters corresponding to the target smart contract, calling a contract analysis model to analyze the error information to obtain error supplementary information; generating response information based on the error information and the error supplementary information, and sending the response information to the contract user.

[0006] According to one aspect of an embodiment of the present application, a smart contract processing device is provided, the device comprising: an execution module, used to execute a transaction request sent by a contract user for calling a target smart contract, the transaction request comprising contract parameters of the target smart contract; an acquisition module, used to obtain error information returned by the target smart contract if the transaction request fails to be executed; an analysis module, used to call a contract analysis model to analyze the error information according to the contract parameters corresponding to the target smart contract, and obtain error supplementary information; a response module, used to generate response information according to the error information and the error supplementary information, and send the response information to the contract user.

[0007] In one embodiment of the present application, the contract parameters include the contract information of the target smart contract and the input parameters input into the target smart contract; the analysis module is further used to call the contract analysis model corresponding to the target smart contract according to the contract information of the target smart contract to obtain the contract call branch in the contract analysis model, and the contract call branch is used to provide source code context information of the target smart contract; the error information and the input parameters are input into the contract call branch to obtain relevant context information of the error information provided by the contract call branch; error analysis is performed according to the relevant context information of the error information to obtain the cause of the error; and the error supplementary information is generated according to the error cause.

[0008] In one embodiment of the present application, the analysis module is further used to classify the error information according to relevant context information of the error information to determine the error type of the error information; if the error type is a target error type, the cause of the error is determined based on the error description corresponding to the target error type.

[0009] In one embodiment of the present application, the analysis module is further used to determine the key information corresponding to the error information based on the relevant context information of the error information if the error type is not the target error type; determine the triggering condition of the error information based on the key information, and determine the cause of the error based on the triggering condition of the error information.

[0010] In one embodiment of the present application, the analysis module is further used to determine key information corresponding to the error information based on relevant context information of the error information; determine a solution for the error information based on the key information and the error cause; and generate the error supplementary information based on the error cause and the solution.

[0011] In one embodiment of the present application, the execution module is further used to obtain the certificate corresponding to the contract user and the public key corresponding to the certificate, and verify the certificate based on the public key; if the verification of the certificate is passed, the authority information of the contract user in the certificate is extracted; if it is determined according to the authority information that the contract user has the authority to call the target smart contract, the transaction request is executed.

[0012] In one embodiment of the present application, the device also includes an optimization module for obtaining an optimization request sent by the contract user, the optimization request including feedback information obtained by the contract user based on the response information; associating the feedback information with the error supplementary information to obtain update information; and optimizing the contract analysis model according to the update information.

[0013] In one embodiment of the present application, the device also includes a deployment module, which is used to receive a contract deployment request, and the contract deployment request includes the source code of the target smart contract and the parameters of the contract initialization method; when the verification of the contract deployment request is passed, the source code of the target smart contract is checked for correctness; if the correctness check of the source code of the target smart contract is passed, the initialization method of the target smart contract is executed according to the parameters of the contract initialization method, and a contract analysis model corresponding to the target smart contract is newly created according to the source code of the initialized target smart contract.

[0014] In one embodiment of the present application, the deployment module is further used to initialize the analysis model, and input the source code of the target smart contract into the analysis model to analyze the source code logic of the target smart contract; load the target smart contract into the corresponding contract address on the blockchain network; associate the analysis model with the contract address to obtain the contract analysis model.

[0015] In one embodiment of the present application, the acquisition module is also used to receive an acquisition request sent by the contract user, the acquisition request including an information acquisition requirement for the target smart contract; matching the information acquisition requirement with a hot spot requirement, wherein the hot spot requirement is generated based on the request frequency of each historical information acquisition requirement and the similarity of each historical information acquisition requirement; if the information acquisition requirement belongs to the hot spot requirement, obtaining a response result for the information acquisition requirement based on the hot spot requirement; the response module is also used to send the response result for the information acquisition requirement to the contract user.

[0016] In one embodiment of the present application, the acquisition module is also used to obtain the information response branch in the contract analysis model if the information acquisition requirement does not belong to the hot demand, and the information response branch is used to provide information related to the target smart contract based on the context information of the target smart contract; the information acquisition requirement is input into the information response branch to obtain the response result provided by the information response branch for the information acquisition requirement.

[0017] In one embodiment of the present application, the device also includes a cache module for caching the information acquisition request to a message queue; obtaining the priority of each acquisition request in the message queue and the cache order of each acquisition request cached to the message queue; and extracting the information acquisition request from the message queue according to the priority and the cache order.

[0018] According to one aspect of an embodiment of the present application, there is provided an electronic device, comprising one or more processors; and a storage device for storing one or more computer programs, wherein when the one or more computer programs are executed by the one or more processors, the electronic device implements the smart contract processing method as described above.

[0019] According to one aspect of an embodiment of the present application, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor of an electronic device, the electronic device executes the smart contract processing method as described above.

[0020] According to one aspect of an embodiment of the present application, a computer program product is provided, including a computer program, wherein the computer program is stored in a computer-readable storage medium, and a processor of an electronic device reads and executes the computer program from the computer-readable storage medium, so that the electronic device executes the smart contract processing method as described above.

[0021] In the technical solution provided in the embodiments of the present application, the blockchain node executes a transaction request sent by the contract user for calling the target smart contract, and the transaction request includes the contract parameters of the target smart contract; if the transaction request fails to execute, the error information returned by the target smart contract is obtained, that is, the basic error information defined by the target smart contract; and then, according to the contract parameters corresponding to the target smart contract, the contract analysis model is called to analyze the error information to obtain error supplementary information, so as to provide more comprehensive and detailed error information through the contract analysis model, and then generate response information based on the error information and the error supplementary information, and send the response information to the contract user. For the contract user, there is no need to troubleshoot the error, and a more comprehensive understanding of the error can be obtained, which helps to improve the contract user's understanding of the error and better handle the error.

[0022] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS

[0023] The drawings herein are incorporated into the specification and constitute a part of the specification, showing embodiments consistent with the present application, and together with the specification, are used to explain the principles of the present application. Obviously, the drawings described below are only some embodiments of the present application, and for those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative work. In the drawings:

[0024] Figure 1 It is a schematic diagram of the structure of the blockchain network;

[0025] Figure 2 It is a schematic diagram of an implementation environment involved in this application;

[0026] Figure 3 It is a schematic diagram of an implementation environment involved in this application;

[0027] Figure 4 is a flow chart of a smart contract processing method shown in an exemplary embodiment of the present application;

[0028] Figure 5 is a flow chart of a smart contract processing method shown in an exemplary embodiment of the present application;

[0029] Figure 6 is a flow chart of a smart contract processing method shown in an exemplary embodiment of the present application;

[0030] Figure 7 is a flow chart of a smart contract processing method shown in an exemplary embodiment of the present application;

[0031] Figure 8 is a flow chart of a smart contract processing method shown in an exemplary embodiment of the present application;

[0032] Fig. 9 is a flow chart of a smart contract processing method shown in an exemplary embodiment of the present application;

[0033] Fig.10 is a flow chart of a smart contract processing method shown in an exemplary embodiment of the present application;

[0034] Fig.11 is a flow chart of a smart contract processing method shown in an exemplary embodiment of the present application;

[0035] Fig.12 is a flow chart of a smart contract processing method shown in an exemplary embodiment of the present application;

[0036] Fig.13 is a flow chart of a smart contract processing method shown in an exemplary embodiment of the present application;

[0037] Fig.14 is a flow chart of a smart contract processing method shown in an exemplary embodiment of the present application;

[0038] Fig.15 is a schematic diagram of a blockchain node framework shown in another exemplary embodiment of the present application;

[0039] Fig.16 is a flowchart of deploying a smart contract shown in another exemplary embodiment of the present application;

[0040] Fig.17is a schematic diagram of calling a smart contract shown in another exemplary embodiment of the present application;

[0041] Fig.18 is a flowchart of obtaining contract information shown in another exemplary embodiment of the present application;

[0042] Fig.19 is a structural block diagram of a smart contract processing device shown in an exemplary embodiment of the present application;

[0043] Fig. 20 A schematic diagram of the structure of a computer system suitable for implementing an electronic device of an embodiment of the present application is shown. DETAILED DESCRIPTION

[0044] Here, exemplary embodiments will be described in detail, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are only examples of devices and methods consistent with some aspects of the present application as detailed in the attached claims.

[0045] The block diagrams shown in the accompanying drawings are merely functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities may be implemented in software form, or in one or more hardware modules or integrated circuits, or in different networks and / or processor devices and / or microcontroller devices.

[0046] The flowcharts shown in the accompanying drawings are only exemplary and do not necessarily include all the contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps can be decomposed, and some operations / steps can be combined or partially combined, so the actual execution order may change according to actual conditions.

[0047] It should also be noted that the "multiple" mentioned in this application refers to two or more than two. "And / or" describes the association relationship of the associated objects, indicating that there can be three relationships. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the previous and next associated objects are in an "or" relationship.

[0048] The technical solution of the embodiment of the present application relates to the field of blockchain technology. Before introducing the technical solution of the embodiment of the present application, a brief introduction to blockchain technology is first given.

[0049] Blockchain is a new application model of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanism, encryption algorithm, etc. Blockchain is essentially a decentralized database, a string of data blocks (i.e. blocks) generated by cryptographic methods. Each data block contains a batch of network transaction information, which is used to verify the validity of its information (anti-counterfeiting) and generate the next block. Blockchain can include the underlying blockchain platform, platform product service layer, and application service layer.

[0050] As mentioned above, blockchain is essentially a decentralized database, and the blockchain is maintained by the nodes in the blockchain network. Figure 1 ,exist Figure 1 The blockchain network shown may include multiple nodes 101, and the multiple nodes 101 may be various servers and terminals forming the blockchain network. Each node 101 may receive input information during normal operation, and maintain the shared data in the blockchain network based on the received input information. In order to ensure the information intercommunication within the blockchain network, there may be an information connection between each node in the blockchain network, and the nodes may transmit information through the above information connection. For example, when any node in the blockchain network receives input information, other nodes in the blockchain network obtain the input information according to the consensus algorithm, and store the input information as shared data, so that the data stored on all nodes in the blockchain network are consistent.

[0051] Each node in the blockchain network has a corresponding node identifier, and each node in the blockchain network can store the node identifiers of other nodes, so that the generated blocks can be broadcast to other nodes in the blockchain network according to the node identifiers of other nodes. A node identifier list can be maintained in each node, and the node name and node identifier are stored in the node identifier list accordingly. The node identifier can be an IP (Internet Protocol, a protocol for interconnecting networks) address or any other information that can be used to identify the node.

[0052] See also Figure 1 The functions of each node in the blockchain network shown include:

[0053] 1) Routing: a basic function of a node, used to support communication between nodes.

[0054] 2) Applications are deployed in the blockchain to implement specific businesses based on actual business needs, record data related to the implementation of functions to form record data, carry digital signatures in the record data to indicate the source of the task data, and send the record data to other nodes in the blockchain system for other nodes to add the record data to a temporary block when they successfully verify the source and integrity of the record data.

[0055] Among them, the businesses implemented by the application include: smart contracts. Smart contracts are a computerized protocol that can execute the terms of a contract. They are implemented through codes deployed on a shared ledger for execution when certain conditions are met. The codes are used to complete automated transactions according to actual business needs. Of course, smart contracts are not limited to executing contracts for transactions, but can also execute contracts for processing received data. Smart contracts allow trusted transactions without a third party, and these transactions are traceable and irreversible.

[0056] It is understandable that each node in the blockchain network can be a server or a terminal. The server can be an independent physical server, a server cluster or a distributed system composed of multiple physical servers, or a cloud server that provides cloud services, cloud databases, cloud computing (Cloud Computing), cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN (Content Delivery Network), and basic cloud computing services such as big data and intelligent platforms. The terminal can be a smart phone, a tablet computer, a laptop, a desktop computer, a smart speaker, a smart watch, a terminal used in a car, an aircraft, etc., but is not limited to this. Each node can be directly or indirectly connected by wired or wireless communication, and this application is not limited here.

[0057] The technical solution of the embodiment of the present application specifically relates to blockchain technology. The technical solution of the embodiment of the present application is described in detail below:

[0058] See also Figure 2 , Figure 2 It is a schematic diagram of an implementation environment involved in this application. The implementation environment mainly includes a contract user 201 and a blockchain node 101 in a blockchain network; in an example, the contract user can be a terminal or server under the blockchain chain, or a node on the blockchain chain.

[0059] Among them, multiple smart contracts are deployed in the blockchain node 101; the contract user 201 can call the target smart contract in the blockchain node, and the contract user 201 can send a transaction request to the blockchain node, which is used to call the target smart contract.

[0060] Blockchain node 101 is used to execute the transaction request sent by the contract user, and the transaction request includes the contract parameters of the target smart contract; if the transaction request fails to be executed, the error information returned by the target smart contract is obtained; then, according to the contract parameters corresponding to the target smart contract, the contract analysis model is called to analyze the error information to obtain error supplementary information; finally, response information is generated according to the error information and the error supplementary information, and the response information is sent to the contract user.

[0061] The contract user 201 performs corresponding processing based on the response information fed back by the blockchain node.

[0062] It should be noted that in the specific implementation of this application, if the smart contract involves objects, when the embodiments of this application are applied to specific products or technologies, it is necessary to obtain the permission or consent of the object, and the collection, use and processing of relevant data need to comply with the relevant regulations and standards of relevant countries and regions.

[0063] The following is a detailed description of various implementation details of the technical solution of the embodiment of the present application:

[0064] like Figure 3 As shown, Figure 3 is a flowchart of a smart contract processing method shown in an embodiment of the present application, which can be applied to Figure 2 In the implementation environment shown, the method can be implemented by Figure 2 The smart contract processing method may include steps S310 to S340, which are described in detail as follows:

[0065] S310: Execute a transaction request sent by the contract user for calling the target smart contract, where the transaction request includes contract parameters of the target smart contract.

[0066] In the embodiment of the present application, the target smart contract refers to a program code running on a node that can perform arbitrary calculations and implement complex logic. The program code indicates the execution process and processing logic of the target smart contract, such as input, output, intermediate conversion logic, etc.

[0067] In one example, the target smart contract is obtained through development and compilation, for example, through an application programming interface (API) to develop a smart contract and use the API to implement business functions. Since the target smart contract runs in a virtual machine of a blockchain network and the target smart contract is in bytecode form on the blockchain, after the target smart contract file in a compiled programming language is developed, the target smart contract file needs to be compiled to obtain the target smart contract.

[0068] The target smart contract may be any smart contract in a blockchain node, or may be a smart contract specified by a contract user. For example, the target smart contract may be a smart contract for implementing resource transactions.

[0069] When the contract user needs to call the target smart contract, it will send a transaction request to the blockchain node where the target smart contract is deployed; the contract user can be other blockchain nodes in the blockchain network, or a terminal or server under the blockchain network, which is not limited here.

[0070] The blockchain node receives a transaction request, which includes the contract parameters of the target smart contract. The contract parameters include parameters related to the target smart contract, such as contract information, including but not limited to the contract name, contract address and contract ABI (Application Binary Interface), etc. The blockchain node can find the corresponding target smart contract through the contract parameters and execute the transaction request so that the contract user can call the target smart contract.

[0071] The contract parameters also include relevant parameters used by the contract user to call the target smart contract, such as input parameters input to the target smart contract; for example, if the target smart contract includes multiple contract methods to implement multiple logics, the contract parameters also include the method name of the target smart contract that needs to be used; and then the blockchain node can execute the transaction request through the contract parameters.

[0072] S320. If the transaction request fails to execute, the error information returned by the target smart contract is obtained.

[0073] In the embodiments of the present application, there are cases where the transaction request fails to execute, such as when the call fails during the process of calling the target smart contract; or when the target smart contract is successfully called, an error occurs during the execution of the target smart contract. If the transaction request fails to execute, the target smart contract returns the corresponding error information, and the blockchain node can obtain the error information.

[0074] The error information is the error information defined in the program code in the target smart contract. The error information is a predefined error code, including two types of error codes, one is error, indicating a regular error; the other is panic, indicating that there is no problem with the code, but an internal error has occurred.

[0075] S330. According to the contract parameters corresponding to the target smart contract, the contract analysis model is called to analyze the error information to obtain error supplementary information.

[0076] Since the error message is only the error message defined in the program code, the contract user needs to know more about the error message in order to carry out corresponding processing later. In the embodiment of the present application, a contract analysis model is deployed in the blockchain node, which is pre-trained, and the contract analysis model can analyze the target smart contract, such as analyzing the source code logic and context information of the target smart contract, and the contract parameters can reflect the contract method and input parameters used. Then, according to the contract parameters corresponding to the target smart contract, the contract analysis model can be called to analyze the error message, that is, to supplement other information besides the error message and obtain error supplement information, such as the error supplement information including the cause of the error, the solution to solve the error, etc.

[0077] In one example, the contract parameters and the error information returned by the contract may be input into the contract analysis model, and the error supplementary information may be output through the contract analysis model.

[0078] In one example, the contract analysis model may be a model corresponding to the target smart contract, that is, the contract analysis model is only used to analyze the target smart contract; in another example, the contract analysis model may be a model corresponding to any smart contract, which can be used to analyze all smart contracts in the blockchain network.

[0079] S340. Generate response information based on the error information and error supplementary information, and send the response information to the contract user.

[0080] In an embodiment of the present application, the blockchain node encapsulates the error information and the error compensation information to generate response information, and sends the response information to the contract user.

[0081] In one example, if the blockchain node is currently in a busy state, it generates response information, caches the response information, and sends the response information to the contract user at an appropriate time, where the appropriate time may be when the blockchain node is in a balanced state, or when the information is sent in the cache order to achieve the sequence of the response information.

[0082] In an embodiment of the present application, a blockchain node executes a transaction request sent by a contract user for calling a target smart contract, where the transaction request includes contract parameters of the target smart contract; if the transaction request fails to execute, the error information returned by the target smart contract is obtained, that is, the basic error information defined by the target smart contract; the error information is then analyzed according to the contract analysis model and contract parameters corresponding to the target smart contract to obtain error supplementary information to provide more comprehensive and detailed error information, and response information is generated based on the error information and the error supplementary information, and the response information is sent to the contract user. For the contract user, a more comprehensive understanding of the error can be obtained without the effort of troubleshooting the error, which helps to improve the contract user's understanding of the error and better handle the error.

[0083] In one embodiment of the present application, another smart contract processing method is provided, which can be applied to Figure 2 In the implementation environment shown, the method can be implemented by Figure 2 The blockchain nodes shown in are executed, such as Figure 4 As shown in Figure 3 On the basis of , S330 is expanded to S410~S440. Among them, the contract parameters in S310 include the contract information of the target smart contract and the input parameters input to the target smart contract; steps S410~S440 are described in detail as follows:

[0084] S410. Call a contract analysis model corresponding to the target smart contract according to the contract information of the target smart contract to obtain a contract call branch in the contract analysis model, where the contract call branch is used to provide source code context information of the target smart contract.

[0085] In an embodiment of the present application, the contract analysis model corresponds to the target smart contract. The contract analysis model corresponding to the target smart contract can be called through the contract information of the target smart contract. For example, the contract address of the target smart contract can be determined through the contract information of the target smart contract, and the target smart contract can be determined based on the contract address of the target smart contract, and the target smart contract can be called.

[0086] The contract analysis model can have multiple branches, and each branch implements different functions, but each branch has the basic functions that the contract analysis model can implement; in one example, a branch is obtained by copying the model structure of the contract analysis model, and the branch parameters of each branch are different.

[0087] Since the contract analysis model has multiple branches, the contract call branch is first extracted from the multiple branches in the contract analysis model. For example, the corresponding contract analysis model is first determined based on the contract address of the target smart contract in the contract parameters. Since the transaction request for calling the target smart contract fails to execute, the contract call branch is directly extracted. The contract call branch is used to provide source code context information of the target smart contract, that is, the contract call branch can understand the source code logic of the target smart contract and provide context information in combination with the source code logic.

[0088] S420. Input the error information and input parameters into the contract call branch to obtain relevant context information of the error information provided by the contract call branch.

[0089] In an embodiment of the present application, the error message and input parameters are input into a contract call branch, which can provide relevant context information of the error message based on the source code context information and input parameters of the target smart contract to help understand the context environment of the error, wherein the relevant context information includes the contract code snippet where the error occurs, the code logic around the error message, transaction data related to the error message, the call chain where the error occurs, etc., wherein the transaction data includes the contents of variables and / or input parameters.

[0090] S430: Perform error analysis based on relevant context information of the error information to obtain the cause of the error.

[0091] In an embodiment of the present application, after obtaining relevant context information of the error information, the cause of the error can be determined in combination with the relevant context information. The cause of the error refers to the root cause of the error, that is, the specific cause or condition that causes the error.

[0092] In one example, error analysis can be performed based on the contract code snippet where the error occurs. For example, first determine whether the contract code snippet where the error occurs complies with the grammatical specification. If it does not comply with the grammatical specification, the cause of the error can be directly determined to be a grammatical error in the contract code.

[0093] In one example, if the contract code snippet conforms to the grammatical specifications, the code logic surrounding the error message can be compared with the transaction data related to the error message to determine whether they correspond. For example, if the code logic surrounding the error message is to trade a specific resource, and the input parameter of the error message is a non-specific resource, and the two do not correspond, then it can be determined that the cause of the error is a logical error in the contract code.

[0094] S440: Generate supplementary error information according to the cause of the error.

[0095] In one example, the error cause may be directly used as the error supplementary information.

[0096] In another example, the contract analysis model corresponds to multiple branches, which can be applied to different task scenarios, and the context information of the error is obtained in the contract call branch of the contract analysis model to determine the cause of the error, and then determine the solution based on the cause of the error, and then generate error supplementary information in combination with the cause of the error and the error solution.

[0097] It should be noted that Figure 4 For other detailed descriptions of steps S310 to S320 and S340 shown in Figure 3 The steps S310 to S320 and S340 shown are not described in detail here.

[0098] In the embodiment of the present application, relevant context information of the error message can be obtained through error information and input parameters, as well as the source code context information of the target smart contract, and then the cause of the error can be analyzed, so that the contract user can understand the cause of the error in detail and further improve the understanding of the error.

[0099] The present application embodiment provides another smart contract processing method, which can be applied to Figure 2 In the implementation environment shown, the method can be implemented by Figure 2 The blockchain nodes shown in are executed, such as Figure 5 As shown, the smart contract processing method will Figure 4 The S430 shown in FIG. 1 is extended to steps S510 to S520. Steps S510 to S520 are described in detail as follows:

[0100] S510: Classify the error information according to relevant context information of the error information to determine the error type of the error information.

[0101] In an embodiment of the present application, the blockchain node can classify the error information based on the relevant context information of the error information to determine the error type of the error information, wherein the error type includes common error types and unknown error types, and the common error types include syntax errors, logic errors, permission errors, etc.

[0102] In one example, feature extraction can be performed on the relevant context information of the error message, and the extracted features can be matched with the features of the predefined error type, wherein the predefined error type can be a pre-set error classification list, and it should be noted that the predefined error type is an error classification list set for all smart contracts in the corresponding blockchain. The error type to which the error message belongs can be determined based on the degree of matching between the extracted features and the features of the predefined error type; for example, if the error message contains features related to grammatical errors, it is classified as a grammatical error; if the error message has a high degree of matching with features related to logical errors, it is classified as a logical error.

[0103] In one example, when the extracted features are matched with features of predefined error types, if the corresponding features cannot be matched, the error information may be classified as an unknown type.

[0104] S520: If the error type is a target error type, determine the error cause based on the error description corresponding to the target error type.

[0105] In an embodiment of the present application, the target error type is a non-unknown error type, and the error description corresponding to the target error type specifically describes the specific content and nature involved in the error. Therefore, the cause of the error can be determined based on the error description corresponding to the target error type.

[0106] Among them, when determining the cause of the error based on the descriptive information corresponding to the target error type, it can be determined in combination with the relevant context information of the error message. For example, if the error type of the error message is a syntax error type, the error of this syntax error type describes the syntax problems existing in the contract, such as missing semicolons, mismatched brackets, variable naming errors, etc., then the cause of the error is determined to be a variable naming error in combination with the relevant context information.

[0107] It should be noted that Figure 5 For a detailed description of steps S310-S320, S410-S420, S440, and S340 shown in Figure 4 The steps S310 to S320, S410 to S420, S440, and S340 shown are not repeated here.

[0108] In an embodiment of the present application, relevant context information of the error information is used to classify the error information, and then the error type is determined. The cause of the error is determined based on the error description corresponding to the error type, thereby ensuring the accuracy and reliability of the determination of the cause of the error.

[0109] The present application also provides another smart contract processing method, which can be applied to Figure 2 In the implementation environment shown, the method can be implemented by Figure 2 The blockchain nodes shown in are executed, such as Figure 6 As shown, the smart contract processing method will Figure 5 Based on the above, steps S610 to S620 are added. Steps S610 to S620 are described in detail as follows:

[0110] S610: If the error type is a non-target error type, determine key information corresponding to the error information according to relevant context information of the error information.

[0111] In an embodiment of the present application, if the error type is a non-target error type, that is, an unknown error type, the key information corresponding to the error information is determined based on the relevant context information of the error information, wherein the key information is used to determine the specific location and related content of the error.

[0112] In one example, by analyzing the code, variables, parameters, function calls and context, key information in the error message can be extracted. In particular, from the contract code snippet where the error occurs, extract the code snippet directly related to the error, such as the function or method, code block, conditional statement, loop structure, etc. where the error occurs; identify the variable names and parameter names corresponding to the variables or / and input parameters related to the error message in the relevant context information, and find the usage in the contract code snippet to determine the specific variables and / or parameters that may be involved.

[0113] In addition, analyze the function call relationship in the error message, that is, check the function call chain where the error message is located, identify which functions are called when the error occurs, and the relationship between them, so as to understand whether the error is caused by a specific function call or the interaction between functions. Consider the context of the error message, including the order of code execution, related state variables, environment settings, etc., determine the dependency between the error message and the context, and understand the factors that may affect the occurrence of the error.

[0114] S620: Determine a triggering condition of the error information according to the key information, and determine a cause of the error based on the triggering condition of the error information.

[0115] In an embodiment of the present application, the blockchain node can infer the role played by the triggering of specific variables and / or parameter errors involved in the error information, such as specific input values, boundary conditions or data combinations that may cause errors to occur; check the dependencies and interactions between the code block or function where the error information is located and other code blocks or functions, and then determine whether there are other code blocks. The execution results or function calls will affect the triggering conditions of the error; check the function or method, code block, conditional statement, and loop structure where the error information is located, such as checking comparison operations, logical operators, and logical judgments that may lead to error paths.

[0116] In addition, the embodiments of the present application can also combine the environment settings and the values ​​of the state variables when the error information occurs, and determine whether there are specific environmental conditions or state changes related to the error by analyzing the state of the environment settings, global variables or state variables.

[0117] By analyzing data input, environment settings, state variables, dependencies and interactions, the triggering conditions that lead to errors can be further determined.

[0118] Among them, the trigger condition refers to the conditions or factors that may trigger the occurrence of an error under specific circumstances, and the trigger condition and the cause of the error are related to some extent, so the cause of the error can be determined based on the trigger condition of the error information; for example, the trigger condition is that an invalid parameter is provided when calling a contract method, which is the specific condition that causes the contract logic error to be triggered, that is, the cause of the error is a contract logic error caused by invalid parameters.

[0119] In one example, if multiple error causes can be determined based on the trigger conditions of the error information, then the multiple error causes can all be used as the error causes of the error information; or the most likely error cause can be selected from the multiple error causes, wherein the trigger conditions corresponding to the error causes with lower probabilities correspond to more specific or rare situations.

[0120] It should be noted that Figure 6 For other detailed descriptions of steps S310-S320, S410-S420, S510-S520, S440, and S340 shown in Figure 5 The steps S310-S320, S410-S420, S510-S520, S440, and S340 shown in FIG. 1 are not described in detail here.

[0121] In an embodiment of the present application, when the error type cannot be accurately determined, key information corresponding to the error information is determined through relevant context information, and then the trigger condition is determined, so as to determine the cause of the error through the trigger condition, thereby ensuring the reliability of the determination of the cause of the error.

[0122] In one embodiment of the present application, another smart contract processing method is also provided, which can be applied to Figure 2 In the implementation environment shown, the method can be implemented by Figure 2 The blockchain nodes shown in are executed, such as Figure 7 As shown in Figure 4 Based on the above, S440 is expanded to S710 to S730. Steps S710 to S730 are described in detail as follows:

[0123] S710: Determine key information corresponding to the error information according to relevant context information of the error information.

[0124] The process of determining key information can be found in Figure 6 As shown, no further description is given here.

[0125] S720. Determine a solution to the error message based on the key information and the error cause.

[0126] In the embodiment of the present application, the key information includes the code segment directly related to the error, the specific variables and / or parameters involved, the dependency relationship between the error information and the context, etc., and a solution is formulated based on the key information and the cause of the error to fix the error. For example, according to the specific cause of the error, the code is repaired accordingly, such as modifying condition judgment, variable assignment, function call, etc. For example, if the cause of the error is a contract logic error caused by invalid parameters, and the key information includes specific parameters, the solution is to strengthen the verification and boundary checking of the input parameters to prevent errors caused by illegal input.

[0127] If there are multiple causes of the error, it is necessary to determine the solution corresponding to each cause of the error; and for each cause of the error, there can be at least one solution; if there are multiple solutions, one or two solutions with the lowest complexity can be selected as target solutions based on the complexity of the multiple solutions, where the complexity of the solution can be determined by the operation steps and considerations involved in the solution, that is, the more operation steps and considerations, the higher the complexity; of course, multiple solutions can also be target solutions, and the contract user can choose.

[0128] S730: Generate supplementary error information according to the error cause and solution.

[0129] In the embodiment of the present application, the error cause and the solution are associated to generate error supplementary information. In one example, in addition to the error cause and the solution as error supplementary information, the error triggering condition and the error consequence can also be used as error supplementary information.

[0130] It should be noted that Figure 7 For other detailed descriptions of steps S310-S320, S410-S430, and S340 shown in Figure 4 The steps S310 to S320, S410 to S430, and S340 shown are not repeated here.

[0131] In the embodiment of the present application, a solution to the error message is determined based on key information and the cause of the error, so that the contract user can obtain specific solutions and guidance, further helping the contract user to handle the error.

[0132] It should be noted that Figures 5 to 7 The process can be the analysis and processing process of the contract analysis model, that is, the contract analysis model classifies the error information and further conducts error root cause analysis, that is, finds out the root cause of the error, and obtains corresponding correction and improvement measures through in-depth understanding of the error.

[0133] The present application embodiment provides another smart contract processing method, which includes a method that can be applied to Figure 2 In the implementation environment shown, the method can be implemented by Figure 2 The blockchain nodes shown in are executed, such as Figure 8 As shown, in Figure 3 Based on this, the smart contract processing method expands S310 to S810-S830. Steps S810-S830 are described in detail as follows:

[0134] S810. Obtain the certificate corresponding to the contract user and the public key corresponding to the certificate, and verify the certificate based on the public key.

[0135] In an embodiment of the present application, the blockchain node obtains the certificate corresponding to the contract user and also needs to obtain the corresponding public key, which can be obtained from a trusted certificate authority; wherein, the digital signature of the certificate is verified based on the public key to determine whether the certificate has been tampered with; for example, the blockchain node will first check the validity period of the certificate to ensure that the certificate is still valid within the current time range. If the certificate has expired or is not within the validity period, the node will reject the certificate; then the blockchain node will use the public key of the certificate authority to verify the signature of the issuing authority to ensure that the issuing authority is trustworthy and has the authority to issue the certificate.

[0136] S820: If the certificate verification is successful, extract the authority information of the contract user in the certificate.

[0137] In the embodiment of the present application, after the validity of the certificate is verified, the blockchain node can extract the permission information of the contract user based on the identity information contained in the certificate. For example, the certificate can contain the role, access rights and other information of the contract user, and the blockchain node can determine whether the contract user has the right to access specific resources or perform specific operations through the permission information.

[0138] S830. If it is determined based on the permission information that the contract user has the permission to call the target smart contract, the transaction request sent by the contract user for calling the target smart contract is executed.

[0139] If the permission information indicates that the contract user has the authority to call the target smart contract, such as if the permission information includes reading, writing or performing other operations on data on the blockchain, it means that the user has the authority to call the target smart contract, and the blockchain node can execute the transaction request sent by the contract user.

[0140] In one example, the target smart contract can define the access rules and permission control of resources. The blockchain node can verify the permission information of the contract user through the target smart contract. If the permission information in the certificate and the permission information of the contract user verified by the target smart contract both indicate that the contract user has the permission to call the target smart contract, the transaction request will be executed.

[0141] In the embodiment of the present application, the blockchain node can fully verify the certificates and permissions of the contract users, ensuring that only the contract users with valid certificates and legal permissions can perform the calling operations, thereby ensuring the security and credibility of the blockchain network.

[0142] It should be noted that Figure 8 For more detailed description of steps S320 to S340 shown in Figure 3 Steps S320 to S340 are shown and will not be described in detail here.

[0143] The present application embodiment provides another smart contract processing method, which includes a method that can be applied to Figure 2 In the implementation environment shown, the method can be implemented by Figure 2 The blockchain shown in Fig. 9 As shown in Figure 3 Steps S910 to S930 are added after S340 shown in FIG. Steps S910 to S930 are described in detail as follows:

[0144] S910. Obtain an optimization request sent by the contract user, where the optimization request includes feedback information obtained by the contract user based on the response information.

[0145] In an embodiment of the present application, the blockchain node also provides a feedback mechanism. After sending the response information to the contract user, the contract user can decide whether to determine the correctness of the response information. When it is decided that the correctness of the response information needs to be determined, the contract user obtains feedback information based on the response information, and then generates an optimization request through the feedback information, wherein the feedback information includes correct response information and incorrect response information. If the response information is incorrect, it may be accompanied by the reason for the error that the contract user believes, as well as the correct information that the contract user believes.

[0146] S920: Associating the feedback information with the error supplementary information to obtain update information.

[0147] S930. Optimize the contract analysis model according to the updated information.

[0148] In an embodiment of the present application, error information is analyzed based on a contract analysis model to obtain error supplementary information. When the contract analysis model needs to be optimized, the feedback information can be associated with the error supplementary information, that is, the correct information considered by the contract user and the error supplementary information analyzed by the blockchain node are associated to form positive and negative samples, and update information is obtained, and the contract analysis model is optimized according to the updated information.

[0149] In one example, when optimizing a contract analysis model based on update information, only the contract call branch of the contract analysis model can be optimized; wherein, the blockchain node can collect multiple update information and annotate the multiple update information to form a training set and a verification set, and then use the training set to perform supervised learning or combine unsupervised learning methods to optimize the performance of the model, and use the verification set to evaluate the retrained model, and further iteration and optimization can be performed based on the evaluation results.

[0150] In one example, after the contract analysis model is optimized, the error information can be re-analyzed based on the optimized contract analysis model to obtain new error supplementary information, and the new error supplementary information can be sent to the contract user.

[0151] It can be understood that in the embodiments of the present application, the collection of feedback information from contract users and the updating of the model is an ongoing process. With continuous use and feedback, the model will be continuously improved and optimized to provide better performance.

[0152] It should be noted that Fig. 9 For a detailed description of steps S310 to S340, see Figure 3 Steps S310 to S340 shown in FIG. 1 are not described in detail here.

[0153] In an embodiment of the present application, feedback information from contract users is collected and used to improve the contract analysis model. This feedback loop mechanism can help the model to continuously learn and improve to better meet the needs of contract users and provide accurate answers. The continuous improvement process can improve the performance and usability of the contract analysis model and provide a better experience.

[0154] The present application embodiment provides another smart contract processing method, which includes a method that can be applied to Figure 2 In the implementation environment shown, the method can be implemented by Figure 2 The blockchain nodes shown in are executed, such as Fig.10 As shown in Figure 3 Based on the above, steps S1010 to S1030 are added before S310. Steps S1010 to S1030 are described in detail as follows:

[0155] S1010. Receive a contract deployment request, which includes the source code of the target smart contract and parameters of the contract initialization method.

[0156] In an embodiment of the present application, the target smart contract can be developed and compiled by the contract user or other terminal, and the contract user or other terminal can request to deploy the target smart contract in the blockchain node; wherein, the blockchain node will receive the contract deployment request, and the contract deployment request is generated by the contract user or other terminal after packaging the source code of the target smart contract and the parameters of the contract initialization method and signing them, so the contract deployment request includes the source code of the target smart contract and the parameters of the contract initialization method; wherein, the target smart contract source code is usually written in a specific programming language (such as Solidity), and contains various methods, variables and events of the contract to define the logic and functions of the contract; the initialization method is used to set the initial state of the contract and execute the necessary initialization logic, and the parameters of the initialization method set the initial state of the contract and the corresponding parameters for executing the necessary initialization logic.

[0157] S1020. When the verification of the contract deployment request is passed, the source code of the target smart contract is checked for correctness.

[0158] After receiving the contract deployment request, the blockchain node will perform certificate verification and permission verification on the contract deployment request. For the specific verification process, please refer to Figure 8 As shown; if the verification of the contract deployment request is passed, the source code of the target smart contract will be further checked for correctness, such as verifying the code specifications of the contract to ensure that the code complies with the specifications and is executed on the blockchain node; it will also check whether the contract code volume is too large to avoid the contract being too complex and taking up too much storage space.

[0159] S1030. If the correctness check of the source code of the target smart contract passes, the initialization method of the target smart contract is executed according to the parameters of the contract initialization method, and a contract analysis model corresponding to the target smart contract is newly created according to the source code of the initialized target smart contract.

[0160] If the correctness check of the source code of the target smart contract passes, the blockchain node will execute the contract initialization method according to the parameters of the contract initialization method. By executing the initialization method, the target smart contract can complete some preset operations, such as allocating initial resources, setting permissions, etc.

[0161] After the contract is successfully initialized, in order to facilitate the subsequent analysis of the target smart contract, the blockchain node will create a contract analysis model corresponding to the target smart contract based on the source code of the target smart contract, so that the contract analysis model analyzes the source code of the target smart contract and subsequently provides contract-related information and feedback.

[0162] It should be noted that Fig.10 For a detailed description of steps S310 to S340 shown in Figure 3Steps S310 to S340 shown in FIG. 1 are not described in detail here.

[0163] In an embodiment of the present application, the target smart contract is deployed to the blockchain through a deployment request. The blockchain node not only verifies the deployment request, but also checks the correctness of the contract, and creates a new contract analysis model corresponding to the target smart contract after initialization, providing a more convenient way for contract development and use.

[0164] It is worth noting that the present application embodiment provides another smart contract processing method, which can be applied to Figure 2 In the implementation environment shown, the method can be implemented by Figure 2 The blockchain nodes shown in are executed as Fig.11 As shown in Fig.10 The S1030 shown in FIG. 1 is expanded into steps S1110 to S1140. Steps S1110 to S1140 are described in detail as follows:

[0165] S1110. If the correctness check of the source code of the target smart contract passes, the initialization method of the target smart contract is executed according to the parameters of the contract initialization method.

[0166] S1120, initialize the analysis model, and input the initialized source code of the target smart contract into the analysis model to analyze the source code logic of the target smart contract.

[0167] In an embodiment of the present application, the blockchain node initializes an analysis model, which can be a neural network model, and inputs the source code of the target smart contract into the analysis model, so that the analysis model can analyze the source code logic of the target smart contract, and then understand the relevant information of the target smart contract, such as obtaining the source code context information of the target smart contract, and providing relevant information about the target smart contract based on the source code context information.

[0168] S1130. Load the target smart contract into the corresponding contract address on the blockchain.

[0169] The blockchain node can assign a contract address to the target smart contract in the blockchain network, and then load the target smart contract to the corresponding contract address, so that other nodes can call or access the target smart contract through the contract address.

[0170] S1140. Associate the analysis model with the contract address to obtain a contract analysis model.

[0171] In order to facilitate subsequent use, it is necessary to associate the analysis model with the contract address to obtain the contract analysis model, so that the contract analysis model can analyze the target smart contract, and the contract analysis model can be used through the contract address to obtain information about the contract.

[0172] In one example, after obtaining the contract analysis model, the model structure of the contract analysis model can be copied to obtain a branch of the contract analysis model, and the branch can obtain the source code context information of the target smart contract based on the source code logic of the target smart contract; the branch can also provide relevant information about the target smart contract based on the source code context information.

[0173] It should be noted that Fig.11 For a detailed description of steps S1010 to S1020 and S310 to S340, see Fig.10 Steps S1010 to S1020 and S310 to S340 shown in FIG. 1 are not described in detail here.

[0174] In an embodiment of the present application, the source code logic of the target smart contract is analyzed through an analysis model, and then the contract address of the target smart contract is associated with the analysis model, so as to facilitate subsequent access to the contract analysis model according to the contract address to obtain information and feedback related to the contract, thereby further providing a more convenient way to use the contract.

[0175] The present application embodiment provides another smart contract processing method, which includes a method that can be applied to Figure 2 In the implementation environment shown, the method can be implemented by Figure 2 The blockchain nodes shown in are executed, such as Fig.12 As shown in Figure 3 Based on the above, steps S1210 to S1240 are added. S1210 to S1240 are described in detail as follows:

[0176] S1210. Receive an acquisition request sent by a contract user, where the acquisition request includes information acquisition requirements for a target smart contract.

[0177] In an embodiment of the present application, the contract user can not only call the target smart contract, but also obtain the contract information of the target smart contract; the contract user packages the contract name and information acquisition requirement of the target smart contract and signs them to generate an acquisition request; wherein, the information acquisition requirement is used to indicate the contract information that the contract user wants to know, which can be in the form of a dialogue.

[0178] S1220: Match the information acquisition demand with the hot demand, wherein the hot demand is generated according to the request frequency of each historical information acquisition demand and the similarity of each historical information acquisition demand.

[0179] It should be noted that in the embodiment of the present application, a hot demand is locally set up on the blockchain node, which is generated by the blockchain node based on the request frequency of each historical information acquisition demand and the similarity of each historical information acquisition demand. Specifically, the blockchain node first obtains the request frequency of each historical information acquisition demand for the target smart contract within a preset historical time period, and screens out the candidate historical information acquisition demands whose request frequency is greater than the preset frequency threshold, and then calculates the similarity between the candidate historical information acquisition demands, and screens out the target historical information acquisition demand whose similarity is greater than the preset similarity threshold, and then uses the target historical information acquisition demand as the hot demand.

[0180] In one example, after generating a hotspot demand, the blockchain node or contract user can also customize the demand, such as adding demands that they are interested in or frequently visit, and then add customized demands to the hotspot demand.

[0181] Of course, the blockchain node can also update the hot demand, such as replacing the least frequent or earliest historical information acquisition demand, so that the updated hot demand will retain the most relevant and most frequently accessed historical information acquisition demand.

[0182] In one example, when matching the information acquisition demand with the hot demand, the information acquisition demand may be matched with the hot demand in a recent period of time to match the similarity between the information acquisition demand and each demand in the hot demand.

[0183] S1230: If the information acquisition demand is a hot demand, a response result for the information acquisition demand is obtained according to the hot demand.

[0184] If the information acquisition demand belongs to a hot demand, the response result corresponding to the information acquisition information is directly searched according to the hot demand. If the similarity between a demand in the hot demand and the information acquisition demand is greater than the preset similarity threshold, it means that the information acquisition demand belongs to a hot demand, and then the response result corresponding to the demand is directly used as the response result of the information acquisition demand.

[0185] S1240. Send the response result to the information acquisition request to the contract user.

[0186] The blockchain node can immediately send the response result for the information acquisition request to the contract user, or it can choose to send the response result for the information acquisition request to the contract user in an idle state according to the resource usage.

[0187] It should be noted that Fig.12 For a detailed description of steps S310 to S340 shown in Figure 3 Steps S310 to S340 shown in FIG. 1 are not described in detail here.

[0188] In the embodiments of the present application, information acquisition requests can be managed more intelligently and efficiently through hot spot demands, and by matching information acquisition demands with hot spot demands, information acquisition requests can be effectively processed and a quick response can be provided.

[0189] The present application embodiment provides another smart contract processing method, which includes a method that can be applied to Figure 2 In the implementation environment shown, the method can be implemented by Figure 2 The blockchain nodes shown in are executed, such as Fig.13 As shown in Fig.12 Based on the above, steps S1310 to S1320 are added. S1310 to S1320 are described in detail as follows:

[0190] S1310. If the information acquisition demand does not belong to a hot demand, obtain an information response branch in the contract analysis model, where the information response branch is used to provide information related to the target smart contract based on the context information of the target smart contract.

[0191] In the embodiment of the present application, if the similarity between the information acquisition demand and each demand in the hot demand is less than the preset similarity threshold, it means that the information acquisition demand does not belong to the hot demand, and at this time, it can be responded through the contract analysis model. Among them, the contract analysis model can analyze the source code logic of the target smart contract, and the contract analysis model includes an information response branch, which is used for the context information of the target smart contract to provide information related to the target smart contract.

[0192] S1320: Input the information acquisition requirement into the information response branch to obtain a response result for the information acquisition requirement provided by the information response branch.

[0193] The information acquisition requirement is input into the information response branch, and the information response branch can provide a response result based on the information context information and the information acquisition requirement.

[0194] In other embodiments of the present application, after the response result of the information acquisition request is sent to the contract user, feedback information of the contract user on the response information can also be obtained, and the information response branch of the contract analysis model can be optimized based on the feedback information.

[0195] In the embodiment of the present application, when the information acquisition demand does not belong to a hot spot demand, a response result for the information acquisition demand is provided through the information response branch of the contract analysis model to ensure the reliability and accuracy of the demand response.

[0196] It should be noted that Fig.13For a detailed description of steps S310 to S340 and S1210 to S1240 shown in Fig.12 Steps S310 to S340 and S1210 to S1240 shown in FIG. 1 are not described in detail here.

[0197] The present application embodiment provides another smart contract processing method, which includes a method that can be applied to Figure 3 In the implementation environment shown, the method can be implemented by Figure 3 The blockchain nodes shown in are executed, such as Fig.14 As shown in Fig.12 Based on the above, steps S1410 to S1430 are added before S1220. S1410 to S1430 are described in detail as follows:

[0198] S1410, caching the information acquisition request into the message queue.

[0199] In an embodiment of the present application, in order to avoid the pressure brought to the blockchain node by the peak demand, a message queue mechanism is provided, and after receiving the acquisition request, the corresponding information acquisition request is cached in the message queue.

[0200] S1420: Obtain the priority of each acquisition request in the message queue and the cache order of each acquisition request in the message queue.

[0201] In an embodiment of the present application, each acquisition demand in the message queue has a corresponding priority. In one example, the priority may be based on the priority of the party to which the acquisition demand belongs, that is, the higher the priority of the initiator of the acquisition request, the higher the priority of the acquisition demand of the initiator; in another example, the priority may be determined based on the urgency of the acquisition demand, that is, the more urgent the acquisition demand, the higher the priority, wherein a correspondence table between the demand content and the urgency of the acquisition demand may be pre-set to determine the priority.

[0202] It is understandable that when each acquisition demand is cached in the message queue, a cache time is also corresponding to it, and the cache order of each acquisition demand can be determined based on the sequence of cache times.

[0203] S1430. Extract information acquisition requirements from the message queue according to priority and cache order.

[0204] In an embodiment of the present application, acquisition requirements are preferentially extracted from the message queue in order of priority, and are extracted from the message queue only when the priority corresponding to the information acquisition requirement is reached; if when the priority corresponding to the information acquisition requirement is reached, in addition to the corresponding information acquisition requirement, there are other corresponding acquisition requirements, then the information acquisition requirement and other acquisition requirements are extracted in order based on the cache order of the information acquisition requirement and the other acquisition requirements; for example, if the cache time of the information acquisition requirement is earlier than the cache time of other acquisition requirements, the information acquisition requirement is extracted first.

[0205] In the embodiment of the present application, the message queue can avoid resource pressure caused by demand peaks, and the message queue can handle demands more flexibly and efficiently, extracting demands from the message queue according to priority and cache order, ensuring the rationality and timeliness of demand extraction.

[0206] It should be noted that Fig.14 For a detailed description of steps S310 to S340 and S1210 to S1240 shown in Fig.12 Steps S310 to S340 and S1210 to S1240 shown in FIG. 1 are not described in detail here.

[0207] For ease of understanding, the following is based on Figure 2 The implementation environment shown is a detailed description of the smart contract processing provided by the embodiment of the present application:

[0208] like Fig.15 As shown, the blockchain node includes a network module for communicating with other blockchain nodes and terminals, an authentication module for verifying permissions and saving certificates, an interface service for receiving requests from the upper layer and dispatching them to the lower layer for execution, a virtual machine module for initializing the contract source code and executing the contract, and a model analysis module for storing the contract analysis model and conducting contract-based dialogue and error analysis.

[0209] Among them, the authentication module includes a node certificate module for storing certificates of each node of the blockchain, and an authentication algorithm module for verifying the legitimacy of certificates and the authority of other blockchain nodes and terminals. The interface service includes a transaction interface for receiving and executing requests for executing blockchain transactions; a dialogue interface for receiving interfaces for dialogues between terminals and contracts; a dialogue message queue, which uses message queues for buffering in order to prevent dialogue peaks from filling up resources; a hotspot dialogue cache, which is used to store hotspot message dialogues to avoid repeated requests for the model analysis module. The virtual machine module includes a contract warehouse, which is used to save all uploaded contracts; a contract deployment, which is used to perform contract deployment operations; a contract call, which performs contract call operations; and a contract dialogue, which is used to perform contract dialogue operations. The model analysis module includes a model storage, which is used to store all contract analysis models; a model execution, which executes the contract analysis model; a model optimization, which continuously optimizes the model through feedback information; and a model contract dialogue, which conducts dialogues through the contract analysis model.

[0210] It should be noted that the contract analysis model in the embodiment of the present application can be a language model, which can interact in text form. In addition to interacting in a natural dialogue manner, it can also be used for very complex language work, including automatic text generation, automatic question and answer, automatic summary and other tasks; for example, the language model is ChatGPT (Chat Generative Pre-trained Transformer); among them, different contracts deployed by blockchain nodes correspond to language models with different parameters.

[0211] Here, the target smart contract is used for resource transfer transactions, and the contract analysis model is ChatGPT. When the target smart contract is deployed to the blockchain network, the task of ChatGPT is to automatically analyze the context information of the target smart contract; the blockchain node can input the source code of the target smart contract into ChatGPT, and the ChatGPT can understand the source code logic of the target smart contract based on the code language of the source code, such as explaining the function, purpose and role of the smart contract, and then provide the context information of the target smart contract in combination with the source code logic. The context information can be a description of how the contract handles resource transfer transactions, what logic and operations are executed, and the context information can also be a transaction process to help the object understand how to use the contract to transfer resources. The transaction process may include the contract calling method, transaction parameters, etc.

[0212] Since ChatGPT can provide contextual information of the target smart contract, ChatGPT can provide the corresponding contract information to the object based on the object's conversation. For example, ChatGPT will identify possible missing information in the conversation, such as checking whether the conversation lacks necessary details, context or other key information. By identifying missing information, ChatGPT can determine whether it is necessary to further interact with the object to obtain the missing information; if the information is not missing, ChatGPT will analyze the semantic relationship, context and common patterns in the conversation, understand the meaning expressed by the object in the conversation to infer the object's intention, and then give an answer based on the intention and the contextual information of the contract. After giving the answer, ChatGPT can also analyze the semantic relationship between the answer and the conversation to determine the relevance, logical consistency and correctness of the information between the question and the answer. When the answer matches the question, it generates a reply text and outputs the reply text to the object.

[0213] Assuming that the subject raises the conversation "What are the contract functions and contract functions of the target smart contract", ChatGPT checks that there is no missing information in the conversation, and then performs semantic analysis on the conversation to determine that the intention is "contract function" and "contract function". At this time, ChatGPT can determine that the contract function is resource transfer based on the contract context information of the target smart contract, and extract all contract functions involved in the source code of the contract, as well as the function of each contract function, and finally generate text: The contract function is resource transfer. The contract includes function A and function B. The function of function A is resource type comparison, and the function of function B is resource transfer.

[0214] When the object calls the target smart contract, if the call fails, the target smart contract can return error information, which includes general errors, or there is no problem with the code, but internal error information; at this time, in order to inform the object of more comprehensive and detailed error information, the blockchain node will call ChatGPT, and output the error information and the input parameters entered for calling the target smart contract to ChatGPT for analysis. Since the target smart contract is in the deployment stage, ChatGPT has analyzed the context information of the target smart contract. Therefore, when analyzing the error information, ChatGPT can parse the error code corresponding to the error information, and combine the context information and input parameters of the target smart contract to determine the relevant context information of the error information, which includes the contract code snippet where the error occurred, the code logic around the error information, and the transaction data related to the error information.

[0215] ChatGPT can then perform error analysis based on the relevant context information, such as classifying errors and categorizing them into different error types. For example, feature extraction can be performed on the relevant context information of the error message, and the extracted features can be matched with the features of the predefined error type to determine whether it is a common error type, such as syntax error, insufficient authority type, etc. If it is classified as a common error type, the cause of the error is determined based on the error description corresponding to the common error type. For example, if the error type of the error message is a syntax error type, the error description of the syntax error type contains syntax problems in the contract, such as missing semicolons, mismatched brackets, variable naming errors, etc., then the cause of the error is determined to be a variable naming error in combination with the relevant context information.

[0216] Now assume that one of the contract methods is transfer. The object can transfer resources by calling the contract method. An error occurs when the object calls the method and returns an error message: Error (common error). ChatGPT determines the error message based on the context information of the contract source code and the input amount of resources to be transferred. It determines the contract code snippet where the error occurs: "Amount of incoming resources (input amount of resources)". It performs error analysis based on the relevant context information. Since the contract is to transfer resources and the amount of resources to be transferred is input, the error type is determined to be insufficient remaining resources based on the input amount of resources to be transferred. Based on the error description "Insufficient resources", the cause of the error is determined to be: the remaining resources must be large enough, otherwise the transfer operation cannot be completed.

[0217] After determining the cause of the error, ChatGPT can provide a solution based on the cause of the error. For example, based on the cause of the error, the key information can be determined as: insufficient remaining resources and unable to complete the transfer. Based on this key information, the solution to the cause of the error is determined to include two aspects. On the one hand, it is an optimization solution for the target smart contract, such as checking the remaining resource management logic of the contract to ensure sufficient remaining resource verification before resource transfer to avoid insufficient remaining resources; adding an error handling mechanism to perform specific error handling for insufficient remaining resources, such as returning a friendly error prompt to the object and instructing the object on how to increase the remaining resources or adjust the transferred resources; adding a remaining resource query method to the contract so that the object can query its own remaining resources before initiating a transfer; on the other hand, it is an optimization solution for the object transfer amount, such as increasing the remaining resources or reducing the resources to be transferred.

[0218] In an embodiment of the present application, after ChatGPT extracts the relevant context information of the error message, if the extracted features are matched with the features of the predefined error type and the corresponding features are not matched, the error message can be classified as an unknown type. At this time, by analyzing the code, variables, parameters, function calls and context information, the key information in the error message can be extracted, that is, the specific location and related content of the error, and then the triggering conditions for the error can be inferred. The triggering conditions are the circumstances under which the error will be triggered, and the corresponding specific conditions or situations; the triggering conditions involve specific input values, operation sequences, environment settings or other factors.

[0219] Among them, the method of inferring the triggering conditions includes: inferring the role played by the triggering of the specific variable or / and parameter error involved in the error information; checking the dependency and interaction between the code block or function where the error information is located and other code blocks or functions, and then determining whether there are other code blocks The execution results or function calls will affect the triggering conditions of the error; checking the conditional statement, branch statement or logical judgment where the error information is located, such as checking the comparison operation, logical operator and logical judgment that may lead to the error path in the conditional statement, and determining which conditional branch paths may cause the error to occur.

[0220] ChatGPT can determine the cause of the error through trigger conditions. For example, if invalid parameters are provided when calling a contract method, the cause of the error is incorrect data processing, and a solution can be given based on the cause of the error.

[0221] After giving a solution, ChatGPT outputs the cause of the error and the solution, and the blockchain node encapsulates the cause of the error and the solution and returns them to the object.

[0222] Based on the above-mentioned contract analysis model, namely the ChatGPT model, in an embodiment of the present application, smart contract processing includes contract deployment, contract calling and contract dialogue process.

[0223] like Fig.16 As shown in the figure, the contract deployment process of smart contract processing includes the process of writing the contract on the terminal, deploying the contract to the blockchain and initializing the reservation model dialogue, including:

[0224] S1601. The terminal writes the smart contract source code locally.

[0225] S1602. The terminal packages the source code and the parameters of the contract initialization method, and signs the packaged content to generate a deployment request.

[0226] S1603. The terminal sends the deployment request to the blockchain.

[0227] The terminal packages the written smart contract source code and the parameters required for the contract initialization method, and signs the packaged content to ensure the integrity and security of the request. It then sends the signed request to the blockchain network for subsequent contract deployment and execution.

[0228] S1604. The network module of the blockchain node receives the deployment request, and the authentication module performs certificate verification on the deployment request.

[0229] S1605. If the certificate verification fails, the network module of the blockchain node returns a verification failure result to the terminal.

[0230] S1606: If the certificate verification passes, the authentication module performs permission verification on the deployment request; if the permission verification fails, go to S1605.

[0231] That is, verify whether the party to which the deployment request belongs has the authority to access the blockchain node and deploy smart contracts.

[0232] S1607: If the authority verification is passed, the transaction interface of the interface service is called to process the deployment request.

[0233] S1608. The virtual machine module performs a contract correctness check.

[0234] S1609. If the contract correctness check fails, the network module of the blockchain node returns a verification failure result to the terminal.

[0235] S1610. If the contract correctness check passes, the virtual machine module calls the contract deployment module to deploy the contract uploaded by the terminal and executes the initialization method.

[0236] S1611. If the contract initialization fails, the network module of the blockchain node returns the result of the contract initialization failure to the terminal.

[0237] S1612. The contract is initialized successfully, and the virtual machine module loads the contract into the contract repository.

[0238] After successful initialization, the blockchain node loads the contract into the contract warehouse. After the contract is loaded into the warehouse, other terminals can access and call the contract according to the contract address.

[0239] S1613. The virtual machine module initializes a language model dialogue.

[0240] S1614. Put the source code into the dialogue for language model analysis.

[0241] The contract source code is used as the initial conversation content. The model can analyze the contract source code and provide contract-related information and feedback.

[0242] S1615. Set the dialog as the default dialog for the contract.

[0243] To facilitate subsequent dialogue interactions with the contract, the blockchain node will set the dialogue as the default dialogue for the contract. The default dialogue is a model dialogue instance associated with the contract. The terminal can use the contract analysis model by interacting with the dialogue, and then obtain information about the contract, ask questions, or correct errors through the contract analysis model.

[0244] S1616. The network module returns the result of successful contract deployment to the terminal.

[0245] like Fig.17 As shown in the figure, the contract calling process of smart contract processing includes calling the blockchain contract, the virtual machine module executing the contract and analyzing the error results through the language model, including:

[0246] S1701. The terminal initiates a call to the target smart contract locally.

[0247] S1702. The terminal packages the contract name, contract method and input parameters, and signs the packaged content to generate a transaction request.

[0248] S1703. The terminal sends the transaction request to the blockchain.

[0249] S1704. The network module of the blockchain node receives the transaction request, and the authentication module performs certificate verification on the transaction request.

[0250] S1705. If the certificate verification fails, the network module of the blockchain node returns a verification failure result to the terminal.

[0251] S1706: If the certificate verification passes, the authentication module performs authority verification on the transaction request; if the authority verification fails, go to S1705.

[0252] S1707: If the authority verification is passed, determine whether the request is a request related to the optimization model.

[0253] S1708. If the request is not related to the optimization model, call the transaction interface to process the request.

[0254] S1709, the virtual machine module calls the contract calling module to execute the target smart contract.

[0255] S1710. If the target smart contract is executed successfully, the network module returns the result of successful contract execution to the terminal.

[0256] S1711. If the target smart contract fails to execute, encapsulate the error information returned by the target smart contract.

[0257] S1712. Added default dialogue for language model of target smart contract.

[0258] S1713. Input parameters and error information into the language model default dialogue.

[0259] It is worth noting that the default dialogue of the language model of the newly added target smart contract can be a copy of the default dialogue in the contract deployment phase, that is, a branch of the contract analysis model is added, which is the same as the contract analysis model, but this branch can realize the task of error analysis, that is, there is a basic contract analysis model corresponding to the target smart contract, and subsequently there are different tasks for the target smart contract, corresponding to different branches, the parameters corresponding to the branches will be optimized with the tasks, and the parameters of the basic contract analysis model will not change, retaining the basic functions, that is, the function of analyzing the source code of the contract and understanding the source code logic, the language model of the target smart contract can cope with different task scenarios.

[0260] The terminal uses the branch of the contract analysis model by interacting with the newly added default dialogue, and inputs the input parameters and error information into the language model default dialogue, that is, the input parameters and error information are input into the branch of the contract analysis model, so that the branch of the contract analysis model further performs error analysis on the error information to determine the cause of the error and the solution.

[0261] S1714. Encapsulate the error supplementary information returned by the language model and cache it.

[0262] S1715. Generate response information using the error information and error supplementary information and send it to the terminal.

[0263] S1716: Whether the terminal determines the correctness of the response information.

[0264] S1717. The terminal determines that the result is correct and sends the correct result to the blockchain node.

[0265] S1718. The terminal determines that the result is wrong and sends the result of the wrong determination to the blockchain node.

[0266] S1719. If the request is a request related to optimizing the model, the dialogue interface opens the default dialogue of the language model when the contract is deployed.

[0267] S1720: Put the result determined by the terminal into the dialogue message queue and wait.

[0268] S1721. Start execution from the results in the message queue.

[0269] S1722. The model analysis module calls the model optimization module to optimize the model.

[0270] In the embodiment of the present application, when optimizing the model, specifically the branch of the contract analysis model that can realize the task of error analysis is optimized.

[0271] S1723. The language model returns error supplementary information and goes to S1714.

[0272] like Fig.18 As shown in the figure, the contract dialogue process handled by the smart contract includes the process of understanding the blockchain contract information through dialogue, including:

[0273] S1801. The terminal initiates a contract dialogue locally to obtain contract information.

[0274] S1802. The terminal packages the contract name and the conversation content, and signs the packaged content to generate an acquisition request.

[0275] The content of the conversation is the demand for obtaining contract information. For example, if the content of the conversation is "What are the contract methods of the contract", the information acquisition demand is the contract method name of the contract.

[0276] S1803. The terminal sends the acquisition request to the blockchain.

[0277] S1804. The network module of the blockchain node receives the acquisition request, and the authentication module performs certificate verification on the acquisition request.

[0278] S1805. If the certificate verification fails, the network module of the blockchain node returns a verification failure result to the terminal.

[0279] S1806: If the certificate verification passes, the authentication module performs permission verification on the acquisition request; if the permission verification fails, go to S1805.

[0280] S1807: If the authority verification is passed, determine whether the request is a request related to the optimization model.

[0281] S1808. If the request is not related to the optimization model, call the dialogue interface to process the request.

[0282] S1809: Put the conversation content into the message queue and wait.

[0283] S1810. Take out the conversation content from the queue and start execution.

[0284] S1811. Determine whether the hotspot conversation cache contains the conversation content.

[0285] In the embodiment of the present application, the hot conversation cache is the aforementioned hot demand, and determines whether the information acquisition demand corresponding to the conversation content belongs to the hot demand.

[0286] S1812: If the conversation content exists in the hot conversation cache, the result in the hot conversation cache is returned.

[0287] S1813. If the conversation content does not exist in the hotspot conversation cache, the virtual machine module calls the contract conversation module to execute the request.

[0288] S1814. Add a new language model dialogue for this contract.

[0289] S1815. Put the conversation content into the language model conversation.

[0290] In an embodiment of the present application, the default dialogue in the contract deployment phase is copied, that is, a branch of the contract analysis model is added, and the task of contract information feedback is implemented through this branch, that is, the information acquisition requirements corresponding to the dialogue content are input into the branch of the contract analysis model. The branch of the contract analysis model can automatically generate a reply text based on the acquisition requirements and contract information, such as "the contract method of the contract includes function A and function B".

[0291] S1816. Encapsulate the response information returned by the language model and cache it.

[0292] S1817. Send the response information to the terminal.

[0293] S1818: Whether the terminal determines the correctness of the response information.

[0294] S1819. The terminal determines that the result is correct and sends the correct result to the blockchain node.

[0295] S1820: The terminal determines that the result is wrong and sends the result of the wrong determination to the blockchain node.

[0296] S1821. If the request is a request related to optimizing the model, the dialogue interface opens the default dialogue of the language model when the contract is deployed.

[0297] S1822: Put the result determined by the terminal into the dialogue message queue and wait.

[0298] S1823. Start execution from the results in the message queue.

[0299] S1824. The model analysis module calls the model optimization module.

[0300] In the embodiment of the present application, when optimizing the model, specifically, the branch of the contract analysis model that can realize the task of contract information feedback is optimized.

[0301] S1825. The language model returns the dialogue result and goes to S1816.

[0302] The method provided in the embodiment of the present application provides a full life cycle process of the smart contract call feedback method, including the blockchain contract source code deployment process (the process of writing contracts, deploying contracts to the blockchain and initializing language model dialogue), the blockchain contract call process (the process of calling blockchain contracts, virtual machine modules executing contracts and analyzing error results through language models), and the blockchain contract dialogue process (the process of understanding blockchain contract information through dialogue). The design of these processes can ensure the stable and efficient operation of the full life cycle of the blockchain smart contract call feedback method.

[0303] Furthermore, for all transaction calls of the terminal, if an error occurs, the language model will analyze the cause of the error, encapsulate it as a supplement to the error information already returned by the code, and send it to the terminal, so that the terminal can obtain more comprehensive error information; at the same time, a dialogue interface is provided, so that the terminal can more easily obtain blockchain smart contract information through dialogue, and avoid the pressure on the system caused by dialogue peaks through dialogue message queues. Finally, hot dialogue caches are used to avoid reusing hot dialogues, so as to avoid entering the language model for each dialogue and affecting execution efficiency; in addition, a feedback mechanism is provided, so that the terminal can deny inappropriate model answers, and the denied results will be transmitted to the blockchain node, thereby improving the language model.

[0304] The device embodiment of the present application is introduced, which can be used to execute the smart contract processing method in the above embodiment of the present application. For details not disclosed in the device embodiment of the present application, please refer to the embodiment of the smart contract processing method in the above embodiment of the present application.

[0305] The present application embodiment provides a smart contract processing device, such as Fig.19 As shown, the smart contract processing device can be configured in a blockchain node, and the device includes:

[0306] An execution module 1910 is used to execute a transaction request sent by a contract user to call a target smart contract, wherein the transaction request includes contract parameters of the target smart contract;

[0307] The acquisition module 1920 is used to obtain error information returned by the target smart contract if the transaction request fails to execute;

[0308] The analysis module 1930 is used to call the contract analysis model to analyze the error information according to the contract parameters corresponding to the target smart contract to obtain error supplementary information;

[0309] The response module 1940 is used to generate response information according to the error information and the error supplementary information, and send the response information to the contract user.

[0310] In one embodiment of the present application, based on the aforementioned scheme, the contract parameters include the contract information of the target smart contract and the input parameters input into the target smart contract; the analysis module 1930 is further used to call the contract analysis model corresponding to the target smart contract at any time according to the contract information of the target smart contract to obtain the contract call branch in the contract analysis model, and the contract call branch is used to provide the source code context information of the target smart contract; the error information and the input parameters are input into the contract call branch to obtain the relevant context information of the error information provided by the contract call branch; the error analysis is performed according to the relevant context information of the error information to obtain the cause of the error; and the error supplementary information is generated according to the error cause.

[0311] In one embodiment of the present application, based on the aforementioned scheme, the analysis module 1930 is further used to classify the error information according to relevant context information of the error information to determine the error type of the error information; if the error type is a target error type, the cause of the error is determined based on the error description corresponding to the target error type.

[0312] In one embodiment of the present application, based on the aforementioned scheme, the analysis module 1930 is further used to determine the key information corresponding to the error information according to the relevant context information of the error information if the error type is not the target error type; determine the triggering condition of the error information according to the key information, and determine the cause of the error based on the triggering condition of the error information.

[0313] In one embodiment of the present application, based on the aforementioned scheme, the analysis module 1930 is further used to determine the key information corresponding to the error information based on the relevant context information of the error information; determine the solution for the error information based on the key information and the error cause; and generate the error supplementary information based on the error cause and the solution.

[0314] In one embodiment of the present application, based on the aforementioned scheme, the execution module is further used to obtain the certificate corresponding to the contract user and the public key corresponding to the certificate, and verify the certificate according to the public key; if the verification of the certificate is passed, the permission information of the contract user in the certificate is extracted; if it is determined according to the permission information that the contract user has the authority to call the target smart contract, the transaction request is executed.

[0315] In one embodiment of the present application, based on the aforementioned scheme, the device also includes an optimization module for obtaining an optimization request sent by the contract user, the optimization request including feedback information obtained by the contract user based on the response information; associating the feedback information with the error supplementary information to obtain update information; and optimizing the contract analysis model according to the updated information.

[0316] In one embodiment of the present application, based on the aforementioned scheme, the device also includes a deployment module for receiving a contract deployment request, the contract deployment request including the source code of the target smart contract and the parameters of the contract initialization method; when the verification of the contract deployment request is passed, the source code of the target smart contract is checked for correctness; if the correctness check of the source code of the target smart contract is passed, the initialization method of the target smart contract is executed according to the parameters of the contract initialization method, and a contract analysis model corresponding to the target smart contract is newly created according to the source code of the initialized target smart contract.

[0317] In one embodiment of the present application, based on the aforementioned scheme, the deployment module is further used to initialize the analysis model, and input the source code of the target smart contract into the analysis model to analyze the source code logic of the target smart contract; load the target smart contract into the corresponding contract address on the blockchain network; associate the analysis model with the contract address to obtain the contract analysis model.

[0318] In one embodiment of the present application, based on the aforementioned scheme, the acquisition module is also used to receive an acquisition request sent by the contract user, wherein the acquisition request includes an information acquisition requirement for the target smart contract; the information acquisition requirement is matched with a hot spot requirement, wherein the hot spot requirement is generated based on the request frequency of each historical information acquisition requirement and the similarity of each historical information acquisition requirement; if the information acquisition requirement belongs to the hot spot requirement, a response result for the information acquisition requirement is obtained based on the hot spot requirement; the response module is also used to send the response result for the information acquisition requirement to the contract user.

[0319] In one embodiment of the present application, based on the aforementioned scheme, the acquisition module is also used to obtain the information response branch in the contract analysis model if the information acquisition requirement does not belong to the hot spot requirement, and the information response branch is used to provide information related to the target smart contract based on the context information of the target smart contract; the information acquisition requirement is input into the information response branch to obtain the response result provided by the information response branch for the information acquisition requirement.

[0320] In one embodiment of the present application, based on the aforementioned scheme, the device also includes a cache module for caching the information acquisition request to a message queue; obtaining the priority of each acquisition request in the message queue and the cache order of each acquisition request cached to the message queue; and extracting the information acquisition request from the message queue according to the priority and the cache order.

[0321] It should be noted that the device provided in the above embodiment and the method provided in the above embodiment belong to the same concept, wherein the specific manner in which each module and unit performs the operation has been described in detail in the method embodiment and will not be repeated here.

[0322] An embodiment of the present application also provides an electronic device, comprising one or more processors and a storage device, wherein the storage device is used to store one or more computer programs. When the one or more computer programs are executed by one or more processors, the electronic device implements the above-mentioned smart contract processing method.

[0323] Fig. 20 A schematic diagram of the structure of a computer system suitable for implementing an electronic device of an embodiment of the present application is shown.

[0324] It should be noted that Fig. 20 The computer system 2000 of the electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application. The electronic device may be a terminal or a server.

[0325] like Fig. 20 As shown, computer system 2000 includes a processor (Central Processing Unit, CPU) 2001, which can perform various appropriate actions and processes according to the program stored in the read-only memory (Read-Only Memory, ROM) 2002 or the program loaded from the storage part 2008 to the random access memory (Random Access Memory, RAM) 2003, such as executing the method in the above embodiment. In RAM 2003, various programs and data required for system operation are also stored. CPU 2001, ROM 2002 and RAM 2003 are connected to each other through bus 2004. Input / output (Input / Output, I / O) interface 2005 is also connected to bus 2004.

[0326] In some embodiments, the following components are connected to the I / O interface 2005: an input section 2006 including a keyboard, a mouse, etc.; an output section 2007 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 2008 including a hard disk, etc.; and a communication section 2009 including a network interface card such as a LAN (Local Area Network) card, a modem, etc. The communication section 2009 performs communication processing via a network such as the Internet. A drive 2010 is also connected to the I / O interface 2005 as needed. A removable medium 2011, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 2010 as needed, so that a computer program read therefrom is installed into the storage section 2008 as needed.

[0327] In particular, according to an embodiment of the present application, the process described above with reference to the flowchart can be implemented as a computer program. For example, an embodiment of the present application includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a computer program for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication section 2009, and / or installed from a removable medium 2011. When the computer program is executed by a processor (CPU) 2001, various functions defined in the system of the present application are executed.

[0328] It should be noted that the computer-readable medium shown in the embodiment of the present application can be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium can be, for example, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media can include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (Erasable Programmable Read Only Memory), a flash memory, an optical fiber, a portable compact disk read-only memory (Compact Disc Read-Only Memory, CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present application, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, wherein a computer-readable computer program is carried. This propagated data signal can take a variety of forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination of the above. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. A computer program contained on a computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wired, etc., or any suitable combination of the above.

[0329] The flowcharts and block diagrams in the accompanying drawings illustrate the possible architecture, functions and operations of the devices, methods and computer program products according to various embodiments of the present application. Among them, each box in the flowchart or block diagram can represent a module, a program segment, or a part of the code, and the above-mentioned module, program segment, or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flowchart, and the combination of boxes in the block diagram or flowchart, can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and a computer program.

[0330] The units or modules involved in the embodiments described in this application may be implemented by software or hardware, and the units or modules described may also be set in a processor. The names of these units or modules do not, in some cases, constitute limitations on the units or modules themselves.

[0331] Another aspect of the present application also provides a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, the method described above is implemented. The computer-readable storage medium may be included in the electronic device described in the above embodiment, or may exist independently without being assembled into the electronic device.

[0332] Another aspect of the present application also provides a computer program product, which includes a computer program stored in a computer-readable storage medium. A processor of an electronic device reads the computer program from the computer-readable storage medium, and the processor executes the computer program, so that the electronic device executes the method provided in the above-mentioned embodiments.

[0333] It should be noted that, although several modules or units of the equipment for action execution are mentioned in the above detailed description, this division is not mandatory. In fact, according to the embodiments of the present application, the features and functions of two or more modules or units described above can be embodied in one module or unit. On the contrary, the features and functions of one module or unit described above can be further divided into being embodied by multiple modules or units.

[0334] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the embodiments disclosed herein. The present application is intended to cover any variations, uses or adaptations of the present application, which follow the general principles of the present application and include common knowledge or customary technical means in the art that are not disclosed in the present application.

[0335] The above content is only a preferred exemplary embodiment of the present application and is not intended to limit the implementation scheme of the present application. A person of ordinary skill in the art can easily make corresponding changes or modifications based on the main concept and spirit of the present application. Therefore, the scope of protection of the present application shall be based on the scope of protection required by the claims.

Claims

1. A smart contract processing method, characterized in that: include: Execute a transaction request sent by a contract user for invoking a target smart contract, wherein the transaction request includes contract parameters of the target smart contract; If the transaction request fails to execute, the error information returned by the target smart contract is obtained; According to the contract parameters corresponding to the target smart contract, calling the contract analysis model to analyze the error information to obtain error supplementary information; Generate response information according to the error information and the error supplementary information, and send the response information to the contract user.

2. The method according to claim 1, characterized in that The contract parameters include the contract information of the target smart contract and the input parameters of the target smart contract; the contract analysis model is called according to the contract parameters corresponding to the target smart contract to analyze the error information to obtain error supplementary information, including: Calling the contract analysis model corresponding to the target smart contract according to the contract information of the target smart contract to obtain a contract call branch in the contract analysis model, wherein the contract call branch is used to provide source code context information of the target smart contract; Input the error information and the input parameters into the contract call branch to obtain relevant context information of the error information provided by the contract call branch; Perform error analysis based on relevant context information of the error information to obtain the cause of the error; The error supplementary information is generated according to the error cause.

3. The method according to claim 2, characterized in that Performing error analysis based on relevant context information of the error information to obtain the cause of the error includes: classifying the error information according to relevant context information of the error information to determine the error type of the error information; If the error type is a target error type, the error cause is determined based on an error description corresponding to the target error type.

4. The method according to claim 3, characterized in that The method further comprises: If the error type is not the target error type, determining key information corresponding to the error information according to relevant context information of the error information; A triggering condition of the error information is determined according to the key information, and a cause of the error is determined based on the triggering condition of the error information.

5. The method according to claim 2, characterized in that: The generating the error supplementary information according to the error cause includes: Determine key information corresponding to the error information according to relevant context information of the error information; Determine a solution for the error information according to the key information and the error cause; The error supplementary information is generated according to the error cause and the solution.

6. The method according to claim 1, characterized in that The transaction request sent by the contract execution user to call the target smart contract includes: Obtaining the certificate corresponding to the contract user and the public key corresponding to the certificate, and verifying the certificate according to the public key; If the certificate is verified, extract the authority information of the contract user in the certificate; If it is determined according to the permission information that the contract user has the permission to call the target smart contract, the transaction request is executed.

7. The method according to claim 1, characterized in that After sending the response information to the contract user, the method further includes: Obtaining an optimization request sent by the contract user, wherein the optimization request includes feedback information obtained by the contract user based on the response information; Associating the feedback information with the error supplementary information to obtain update information; The contract analysis model is optimized according to the updated information.

8. The method according to any one of claims 1 to 7, characterized in that: Before the transaction request for invoking the target smart contract sent by the contract execution user, the method further includes: Receive a contract deployment request, the contract deployment request including the source code of the target smart contract and parameters of the contract initialization method; When the verification of the contract deployment request is passed, the source code of the target smart contract is checked for correctness; If the correctness check of the source code of the target smart contract passes, the initialization method of the target smart contract is executed according to the parameters of the contract initialization method, and a contract analysis model corresponding to the target smart contract is newly created according to the source code of the initialized target smart contract.

9. The method according to claim 8, characterized in that The step of creating a contract analysis model corresponding to the target smart contract according to the initialized source code of the target smart contract includes: Initialize an analysis model, and input the source code of the target smart contract into the analysis model to analyze the source code logic of the target smart contract; Load the target smart contract into the corresponding contract address on the blockchain network; The analysis model is associated with the contract address to obtain the contract analysis model.

10. The method according to any one of claims 1 to 7, characterized in that: The method further comprises: Receiving an acquisition request sent by the contract user, wherein the acquisition request includes an information acquisition requirement for the target smart contract; Matching the information acquisition demand with a hotspot demand, wherein the hotspot demand is generated according to the request frequency of each historical information acquisition demand and the similarity of each historical information acquisition demand; If the information acquisition requirement belongs to the hot spot requirement, obtaining a response result for the information acquisition requirement according to the hot spot requirement; The response result to the information acquisition requirement is sent to the contract user.

11. The method according to claim 10, characterized in that The method further comprises: If the information acquisition requirement does not belong to the hot demand, obtaining an information response branch in the contract analysis model, wherein the information response branch is used to provide information related to the target smart contract based on the context information of the target smart contract; The information acquisition requirement is input into the information response branch to obtain a response result for the information acquisition requirement provided by the information response branch.

12. The method according to claim 10, characterized in that Before matching the information acquisition requirement with the hotspot requirement, the method further includes: Cache the information acquisition demand in a message queue; Obtaining the priority of each acquisition request in the message queue and the cache order of each acquisition request in the message queue; The information acquisition request is extracted from the message queue according to the priority and the cache order.

13. A smart contract processing device, characterized in that: include: An execution module, used to execute a transaction request sent by a contract user for calling a target smart contract, wherein the transaction request includes contract parameters of the target smart contract; An acquisition module, used to obtain error information returned by the target smart contract if the transaction request fails to execute; An analysis module, configured to call a contract analysis model to analyze the error information according to the contract parameters corresponding to the target smart contract, and obtain error supplementary information; A response module is used to generate response information according to the error information and the error supplementary information, and send the response information to the contract user.

14. An electronic device, characterized in that: include: one or more processors; A storage device for storing one or more programs, which, when executed by the one or more processors, enables the electronic device to execute the method according to any one of claims 1 to 12.

15. A computer-readable storage medium, characterized in that: A computer program is stored thereon, and when the computer program is executed by a processor of an electronic device, the electronic device executes the method according to any one of claims 1 to 12.

16. A computer program product, characterized in that The computer program product comprises a computer program, wherein the computer program is stored in a computer-readable storage medium, and a processor of an electronic device reads and executes the computer program from the computer-readable storage medium, so that the electronic device executes the method according to any one of claims 1 to 12.