Contract processing method and device

By deploying smart contracts on the blockchain, the contract terms are automatically processed, and the problems of inefficient contract execution and insufficient security in the existing technology are solved, and efficient and trustworthy contract automation is achieved.

CN119739787APending Publication Date: 2025-04-01CHINA MOBILE INTERNET CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411821834.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-11
Publication Date
2025-04-01

AI Technical Summary

Technical Problem

The execution of contract terms in the prior art relies on manual operations, resulting in inefficiency and false operation risks, reducing the security of contract execution.

Method used

By deploying smart contracts on the blockchain, automatically process contract terms and using the decentralized and immutable characteristics of the blockchain to achieve automated execution of contracts. The specific steps include determining the contract terms that trigger the expiration of the time from the smart contract terms, extracting relevant performance data, performing matching detection, and determining the next clause in the smart contract based on the detection results.

Benefits of technology

It improves the efficiency and safety of contract execution, reduces the risk of manual operations, and realizes the automation and trustworthiness of contracts.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119739787A_ABST
    Figure CN119739787A_ABST
Patent Text Reader

Abstract

An embodiment of this specification provides a contract processing method and device, the method comprising: determining a first contract clause with a trigger time expiration from the smart contract clause of the smart contract on the blockchain; extracting key performance data associated with the performance conditions contained in the first contract clause from the off-chain performance data corresponding to the first contract clause; matching and detecting the key performance data and the on-chain performance data corresponding to the first contract clause with the performance conditions; determining a second contract clause in the smart contract clause according to the test result, and sending the clause identifier of the second contract clause to the blockchain for clause execution processing. The use of the embodiment of this application can improve the efficiency and security of contract execution.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This document relates to the field of data processing technology, and in particular to a contract processing method and device. Background Art

[0002] With the development of science and technology and the continuous advancement of social information, business activities in more and more business fields are being carried out in an orderly manner. In order to clarify the rights and obligations of the participants in the course of business activities and to regulate and constrain business activities, the participants in business activities often sign contracts to ensure that the participants perform their respective duties as agreed.

[0003] At present, after the parties sign a contract, the execution of the contract terms often needs to rely on manual operations, and manual work is required to advance the contract task stage offline, resulting in low efficiency in contract execution. At the same time, manual operations also have the risk of false operations, resulting in low security in contract execution. Summary of the invention

[0004] The purpose of one embodiment of this specification is to provide a contract processing method and device to improve the efficiency and security of contract execution.

[0005] To solve the above technical problems, an embodiment of this specification is implemented as follows: In a first aspect, an embodiment of this specification provides a contract processing method, the method comprising: Determine a first contract clause whose trigger time expires from the smart contract clauses of the smart contract on the blockchain; Extracting key performance data associated with the performance conditions included in the first contract clause from the off-chain performance data corresponding to the first contract clause; Matching the key performance data and the on-chain performance data corresponding to the first contract clause with the performance conditions; A second contract clause is determined in the smart contract clause according to the detection result, and a clause identifier of the second contract clause is sent to the blockchain for clause execution processing.

[0006] The contract processing method provided in this embodiment first determines the first contract clause whose trigger time expires from the smart contract clause of the smart contract on the blockchain, and extracts key performance data from the off-chain performance data corresponding to the first contract clause based on the performance conditions contained in the first contract clause, thereby improving the relevance of the key performance data and the performance conditions, and improving the validity of the key performance data. Secondly, the key performance data and the on-chain performance data corresponding to the first contract clause are matched and tested with the performance conditions, thereby obtaining performance data from both off-chain and on-chain dimensions, and improving the comprehensiveness of the key performance data and on-chain performance data. On this basis, the clause identifier of the second contract clause determined in the smart contract clause based on the test results is sent to the blockchain for clause execution processing. In this way, the performance conditions are matched and detected through the performance data of two dimensions, namely the key performance data off-chain and the performance data on-chain, to improve the comprehensiveness of the matching detection and thus improve the accuracy of the test results. By sending the clause identifier of the second contract clause to the blockchain, the blockchain calls the second contract clause for automatic execution, thereby realizing the automatic execution of the contract and improving the efficiency of contract execution. At the same time, since no manual operation is involved in the contract processing process, the security of contract execution is improved.

[0007] In a second aspect, another embodiment of the present specification provides a contract processing device, the device comprising: A clause determination module, used to determine a first contract clause whose trigger time expires from the smart contract clauses of the smart contract on the blockchain; A data extraction module, configured to extract key performance data associated with the performance conditions included in the first contract clause from the off-chain performance data corresponding to the first contract clause; A matching detection module, used to match the key performance data and the on-chain performance data corresponding to the first contract clause with the performance condition; An identification sending module is used to determine a second contract clause in the smart contract clause according to the detection result, and send the clause identifier of the second contract clause to the blockchain for clause execution processing.

[0008] In the third aspect, another embodiment of the present specification provides a contract processing device, which includes: a memory, a processor, and computer executable instructions stored on the memory and executable on the processor, and when the computer executable instructions are executed by the processor, the steps of the contract processing method described in the first aspect above are implemented.

[0009] In a fourth aspect, another embodiment of the present specification provides a computer-readable storage medium, wherein the computer-readable storage medium is used to store computer-executable instructions, and when the computer-executable instructions are executed by a processor, the steps of the contract processing method described in the first aspect above are implemented.

[0010] In a fifth aspect, another embodiment of the present specification provides a computer program product, wherein the computer program product includes a contract processing program, and the contract processing program is executed by a processor to implement the steps of the contract processing method as described in the first aspect above. BRIEF DESCRIPTION OF THE DRAWINGS

[0011] In order to more clearly illustrate one or more embodiments of the present specification or the technical solutions in the prior art, the drawings required for use in the embodiments or the prior art descriptions are briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the present specification. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative work. Figure 1 A process flow chart of a contract processing method provided for one embodiment of this specification; Figure 2 A flowchart of a contract processing method applied to an electronic contract scenario provided by one embodiment of this specification; Figure 3 A schematic diagram of a contract processing device provided for one embodiment of this specification; Figure 4 A schematic diagram of the structure of a contract processing device provided for one embodiment of this specification. DETAILED DESCRIPTION

[0012] In order to enable those skilled in the art to better understand the technical solutions in one or more embodiments of this specification, the following will be combined with the drawings in one or more embodiments of this specification to clearly and completely describe the technical solutions in one or more embodiments of this specification. Obviously, the described embodiments are only part of the embodiments of this specification, not all of the embodiments. Based on one or more embodiments of this specification, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of this document.

[0013] An embodiment of a contract processing method provided in this specification is as follows: The contract processing method provided in this embodiment can be executed by a computer device, which can be a terminal or a server. The terminal can include a mobile phone, a laptop computer, an intelligent interactive device, etc., and the server can include an independent physical server, a server cluster composed of multiple servers, or a cloud server capable of cloud computing.

[0014] Reference Figure 1 The contract processing method provided in this embodiment specifically includes the following steps S102 to S108.

[0015] Step S102, determining the first contract clause whose trigger time expires from the smart contract clauses of the smart contract in the blockchain.

[0016] The contract in this embodiment can be any type of contract, such as a sales contract, a lease contract and / or a loan contract. In addition, the contract can also be other types of contracts, such as a labor contract. The contract can also be a contract in any business field, such as a contract in the e-commerce field and / or a contract in the medical field. In addition, the contract can also be a contract in other business fields. The contract in this embodiment can be an electronic contract or a paper contract. This embodiment can be applied to a contract processing platform.

[0017] The smart contract of a contract on the blockchain refers to the smart contract of the contract deployed on the blockchain, that is, the smart contract of the contract is deployed on the blockchain; the smart contract clause of a smart contract refers to the smart contract clauses contained in the smart contract. The smart contract of a contract may include one or more smart contract clauses. For example, the first smart contract clause of the smart contract of the contract is to receive the shipping quantity list on the chain and the failure rate of the goods off the chain on x1 month x1, the second smart contract clause is that the buyer pays xx thousand to the seller, and the third smart contract clause is the penalty for breach of contract.

[0018] The trigger time refers to the trigger time of the smart contract clause, which can be the time when the execution of the smart contract clause is triggered; the smart contract clauses of the smart contract of the contract can include automatically executed smart contract clauses and passively executed smart contract clauses. The automatically executed smart contract clauses can have a trigger time, that is, after the trigger time expires, the automatically executed smart contract clauses can be executed, and the passively executed smart contract clauses can be executed based on the instructions sent by the blockchain.

[0019] The first contract clause in this embodiment can be an automatically executed smart contract clause or a passively executed smart contract clause. Specifically, the smart contract can be automatically executed after detecting that the trigger time of the first contract clause has expired, or the contract processing platform can send the clause identifier of the first contract clause to the blockchain for clause execution processing after detecting that the trigger time of the first contract clause has expired.

[0020] In specific implementation, the first contract clause with the expiration of the triggering time can be determined in the smart contract clause based on the triggering time of the smart contract clause of the smart contract of the contract on the blockchain; using the above example, the first smart contract clause of the smart contract of the contract is to receive the shipping quantity list on the chain and the failure rate of the goods under the chain on x1 month x1. After arriving on x1 month x1, the first smart contract clause is the first contract clause with the expiration of the triggering time.

[0021] In actual applications, contract execution is often carried out manually, resulting in low efficiency of contract execution. To this end, in order to improve the efficiency of contract execution, the contract can be converted into a smart contract. By deploying the smart contract to the blockchain, the smart contract of the contract can be automatically executed through the cooperation of the blockchain and the contract processing platform. In an optional implementation provided by this embodiment, the smart contract of the contract on the blockchain can convert the contract elements into smart contract terms through a machine learning model, and generate a smart contract of the contract based on the smart contract terms. Specifically, it can be obtained in the following way: Perform matching calculation on the element features of the contract elements of the contract and the template features of the smart contract clause template, and determine the clause template corresponding to each contract element in the smart contract clause template based on the matching calculation result; The clause template is filled in based on each contract element to obtain each smart contract clause, and a smart contract is generated based on each smart contract clause.

[0022] Among them, the contract elements of a contract may include key elements in the contract, such as amount, signing date, Party A and / or Party B. In addition, the contract elements may also be other types of elements; the smart contract clause template may include a pre-set template for generating smart contract clauses. There may be empty placeholders in the smart contract clause template. The smart contract clause template may be a clause template generated based on multiple types of contracts.

[0023] On this basis, in an optional implementation manner provided in this embodiment, the contract elements are obtained in the following manner: Perform word segmentation on the contract text to obtain a word sequence, and perform named entity recognition on the word sequence to obtain multiple contract entities; The grammatical relationship between multiple contract entities is determined, and based on the grammatical relationship, elements are extracted from the multiple contract entities to obtain contract elements.

[0024] The contract entities may include the contracting party name, date, amount, rights and / or obligations, and may also include other entities, such as place names. Grammatical relations may include grammatical relations between multiple contract entities, such as subject-verb-object relations and / or attributive-predicate relations, and may also include other types of grammatical relations.

[0025] Specifically, in the process of performing word segmentation on the contract text of the contract to obtain a word sequence, the contract text can be segmented, part-of-speech tagged and / or stop words deleted to obtain a word sequence, and the word sequence is input into a named entity recognition model for named entity recognition to obtain multiple contract entities, and the grammatical relationship between the multiple contract entities is determined, and a grammatical relationship tree of the multiple contract entities is constructed based on the grammatical relationship, and elements are extracted from the multiple contract entities based on the grammatical relationship tree to obtain contract elements; thereby, the semantic information between the contract entities is represented by the grammatical relationship, thereby improving the accuracy of the contract elements.

[0026] Among them, the named entity recognition model can adopt any type of named entity recognition model, such as BiLSTM-CRF (Bidirectional Long Short-Term Memory - Conditional Random Field).

[0027] In order to improve the accuracy of the named entity recognition model, the model to be trained is trained to obtain the named entity recognition model. A weighted penalty term can be added to the loss function of the model to be trained. The specific loss function can be constructed based on the number of word sequence samples, the number of entity types of the word sequence samples, the entity recognition results of the word sequence samples, the sample labels, the loss weight of each entity type and / or the regularization term. For example, the loss function of the model to be trained includes:

[0028] in, represents the loss function of the model to be trained; n represents the number of word sequence samples; m represents the number of entity types; Ghostwriter The sample Sample labels of entity types; Represents the entity recognition result, that is, the predicted label; Representative The loss weight of each entity type, the loss weight of the key entity type can be higher than the loss weight of the common entity type; It is the L2 regularization term, which can control the complexity of the model and prevent overfitting; Represents preset parameters; Represents model parameters; the entity type here can represent the type of entity existing in the word sequence sample, such as date, name, place name, and key entity type such as name.

[0029] It should be noted that in the process of determining the syntactic relationships between multiple contract entities and constructing a syntactic relationship tree of multiple contract entities based on the syntactic relationships, multiple contract entities can also be input into a syntactic relationship recognition model for syntactic relationship recognition to obtain a syntactic relationship tree of multiple contract entities; the syntactic relationship recognition model here can be a syntactic relationship recognition model based on a neural network, such as Deep Biaffine Parser (Deep Biaffine Attention-based Dependency Parser, a dependency parsing analyzer based on deep learning).

[0030] In the process of extracting elements from multiple contract entities based on the syntactic relationship tree to obtain contract elements, the entity category of each contract entity in the contract text can be determined based on the syntactic relationship tree, and elements can be extracted from multiple contract entities based on the entity category to obtain contract elements; for example, if it is determined based on the syntactic relationship tree that entity_i <subject> AND entity_j <predicate> AND <predicate, meaning = sign>, then <entity_i, role = Party A> AND <entity_j, role = Party B>, then based on the syntactic relationship of subject-predicate-predicate between multiple contracts, determine the contract entity with the entity category of Party A and the contract entity with the entity category of Party B, that is, contract elements - Party A and Party B can be extracted from multiple contract entities.

[0031] In addition, in order to improve the accuracy of the syntactic relationship tree, based on the needs of the business scenario, in the process of constructing a syntactic relationship tree of multiple contract entities based on syntactic relationships, an initial syntactic relationship tree of multiple contract entities can be constructed based on syntactic relationships, and the initial syntactic relationship tree can be updated or optimized to obtain a syntactic relationship tree of multiple contract entities; specifically, according to the distances of each contract entity in the initial syntactic relationship tree, the updated weights of the connection edges between each contract entity in the initial syntactic relationship tree can be calculated, and the weights of the connection edges can be replaced with the updated weights; the initial syntactic relationship tree can also be input into a weight update algorithm for weight update to obtain a syntactic relationship tree; for example, the weight update algorithm includes:

[0032] Among them, represents the i-th contract entity; represents the j-th contract entity; represents the updated weight of the connection edge between the i-th contract entity and the j-th contract entity; represents the distance between the i-th contract entity and the j-th contract entity; represents a preset threshold.

[0033] It should be added that the above-mentioned contract can be an electronic contract, specifically, it can be an electronic contract obtained by the participating parties signing the initial contract text based on their respective electronic signatures. After the signing is completed, the contract processing platform can send the electronic contract to a third-party platform for chain storage.

[0034] The above-mentioned element features of the contract elements of the contract and the template features of the smart contract clause template are matched and calculated, and based on the matching calculation results, the clause template corresponding to each contract element is determined in the smart contract clause template. In this process, the element features of the contract elements of the contract can be obtained after feature extraction of the contract elements or encoding of the contract elements. Similarly, the template features of the smart contract clause template can also be obtained after feature extraction of the smart contract clause template or encoding of the smart contract clause template. The element features here can be element semantic vectors, and the template features can be template semantic vectors. For example, the contract elements and the smart contract clause template are converted into element semantic vectors respectively. and template semantic vector , represents the element semantic vector of the i-th contract element, Template semantic vector representing the j-th smart contract clause template.

[0035] Specifically, the contract elements and smart contract clause templates can be input into a feature extraction model for feature extraction or an encoding model for encoding processing to obtain element features and template features; wherein the feature extraction model or the encoding model can be a pre-trained language model, such as BERT (Bidirectional Encoder Representations from Transformers, a pre-trained language model).

[0036] In specific implementation, in order to improve the matching degree of the smart contract clause template corresponding to each subsequent contract element, each contract element and each smart contract clause template may be matched and calculated from multiple levels; in an optional implementation provided by this embodiment, in the process of matching and calculating the element features of the contract elements of the contract and the template features of the smart contract clause template, the following operations are performed: Perform self-attention calculation based on feature features and template features, and perform cross-attention calculation on the self-attention calculation results; Based on the cross-attention calculation results, element features and template features, the similarity between each contract element and each smart contract clause template is calculated as the matching calculation result.

[0037] On this basis, in an optional implementation manner provided in this embodiment, in the process of performing self-attention calculation based on element features and template features, the following operations are performed: Transforming the element feature based on the first transformation feature to obtain the element transformation feature, and transforming the template feature based on the second transformation feature to obtain the template transformation feature; Self-attention calculation is performed based on the element transformation features and the template transformation features to obtain the self-attention calculation result.

[0038] Specifically, the element features can be transformed based on the first transformation feature and the third transformation feature to obtain the first element transformation feature and the second element transformation feature, and the template features can be transformed based on the second transformation feature and the fourth transformation feature to obtain the first template transformation feature and the second template transformation feature; self-attention calculation is performed with the first element transformation feature as the query vector, the first template transformation feature as the key vector, the second template transformation feature as the value vector, and the second element transformation feature as the interaction vector to obtain the self-attention calculation result.

[0039] Among them, the self-attention calculation can be a multi-head self-attention calculation. Specifically, the first element transformation feature can be used as a query vector, the first template transformation feature as a key vector, the second template transformation feature as a value vector, and the second element transformation feature as an interaction vector to input into the self-attention algorithm for self-attention calculation to obtain the self-attention calculation result.

[0040] For example, self-attention algorithms include:

[0041] in, represents the self-attention calculation result; h represents the number of attention heads; Represents the self-attention calculation result of the h-th head; represents the concatenation of the self-attention calculation results of the 1st, 2nd, ...h heads; is a learnable transformation feature, which may specifically be a learnable transformation matrix; represents the element characteristics of the i-th contract element; Represents the template features of the j-th smart contract clause template; represents the first transformation feature, which may specifically be a learnable transformation matrix; represents the second transformation feature, which may be a learnable transformation matrix; represents the fourth transformation feature, which may specifically be a learnable transformation matrix; Represents the third transformation feature, which can be a learnable transformation matrix. Mapped to Same semantic space; represents the dimension of each attention head; Q, K, V, and Z represent the query vector, key vector, value vector, and interaction vector, respectively.

[0042] In addition, in order to increase the influence of the edge weights between elements on the matching calculation process, that is, to enhance the influence of the interaction vector on the matching process, enhance the influence of the contextual semantic information between elements on the matching calculation process, and thereby enhance the accuracy of the matching calculation; in an optional implementation manner provided by this embodiment, in the process of performing self-attention calculation based on the element transformation feature and the template transformation feature to obtain the self-attention calculation result, the following operations are performed: Performing splicing processing on the first element transformation feature and the second element transformation feature in the element transformation feature at a preset dimension to obtain a splicing feature; The contribution feature is calculated based on the splicing feature to obtain the control feature, and the self-attention calculation result is calculated based on the control feature, the element transformation feature and the template transformation feature.

[0043] The first factor transformation feature may be a query vector, the second factor transformation feature may be an interaction vector; the preset dimension may be the last dimension; the control feature may be a control vector, such as a gate vector, which can be used to control and The contribution ratio to the attention weight. The template transformation feature may include a first template transformation feature and a second template transformation feature.

[0044] Specifically, the first element transformation feature and the second element transformation feature can be spliced ​​in the last dimension to obtain the spliced ​​feature, and the spliced ​​feature can be input into the control feature calculation algorithm to calculate the control feature to obtain the control feature, and the self-attention calculation result can be calculated based on the control feature, the element transformation feature and the template transformation feature.

[0045] For example, the control characteristic calculation algorithm includes:

[0046] in, and represents the first preset parameter and the second preset parameter in the control feature calculation algorithm; G represents the control feature calculation algorithm, and may also represent the control feature; Q represents the query vector, which also represents the first element transformation feature; Z represents the interaction vector, which also represents the second element transformation feature; Represents the splicing feature; Represents the activation function.

[0047] In the above process of calculating the self-attention calculation result based on the control feature, factor transformation feature and template transformation feature, the control feature, factor transformation feature and template transformation feature can be input into the second self-attention algorithm for self-attention calculation to obtain the self-attention feature as the self-attention calculation result.

[0048] For example, the second self-attention algorithm includes:

[0049]

[0050] in, represents the second self-attention algorithm, and can also represent the self-attention calculation result; G represents the control feature; Q represents the query vector, that is, the first factor transformation feature; K represents the key vector, that is, the first template transformation feature; Z represents the interaction vector, that is, the second factor transformation feature; V represents the value vector, that is, the second template transformation feature; Represents the dimension of each attention head.

[0051] In the above process of performing self-attention calculation based on element features and template features, and performing cross-attention calculation on the self-attention calculation result, it is actually possible to perform iterative attention calculation based on element features and template features to obtain cross-attention calculation results; specifically, in each round of attention calculation, self-attention calculation can be performed based on the element features and template features of the previous round to obtain a first self-attention calculation result as the element features of the next round, and self-attention calculation can be performed based on the template features of the previous round and the element features of the next round to obtain a second self-attention calculation result; when it is detected that the first self-attention calculation result and the second self-attention calculation result meet a condition, the first self-attention calculation result and the second self-attention calculation result are spliced ​​to obtain a spliced ​​result as a cross-attention calculation result, and the condition may be that the number of iterations exceeds a preset number; specifically, the element features and template features may also be input into the cross-attention algorithm to perform iterative cross-attention calculation to obtain a cross-attention calculation result; the process of performing self-attention calculation here is similar to the process of performing self-attention calculation in the above content, and this embodiment will not be repeated here.

[0052] For example, the criss-cross attention algorithm includes:

[0053] in, Represents the element characteristics of the previous round; Represents the template features of the previous round; Represents the first self-attention calculation result; Represents the element characteristics of the latter round; Represents the template features of the next round; represents a concatenated result obtained by concatenating the first self-attention calculation result and the second self-attention calculation result; Represents the cross attention calculation result.

[0054] In the above process of calculating the similarity between each contract element and each smart contract clause template according to the cross-attention calculation results, element features and template features, in order to improve the comprehensiveness and accuracy of the calculated similarity, the similarity between each contract element and each smart contract clause template can be calculated from multiple dimensions; in an optional implementation provided by this embodiment, in the process of calculating the similarity between each contract element and each smart contract clause template according to the cross-attention calculation results, element features and template features, the following operations are performed: Based on the element features and template features, the first similarity between each contract element and each smart contract clause template is calculated, and the second similarity is calculated based on the cross-attention calculation result; The third similarity is calculated based on the number of preset grammatical relationships, the grammatical relationships corresponding to each contract element, and the grammatical relationships corresponding to each smart contract clause template, and the similarity is calculated based on the first similarity, the second similarity, and the third similarity.

[0055] Among them, the second similarity may include the second similarity between each contract element and each smart contract clause template; the third similarity may include the third similarity between each contract element and each smart contract clause template. The preset number of grammatical relations may include the total number of grammatical relations existing in the grammatical relationship tree of the contract elements. For example, if there are grammatical relations such as subject-predicate-object, subject-subject-predicate, and predicate-subject-subject in the grammatical relationship tree, then the preset number of grammatical relations is 3. The grammatical relations corresponding to each contract element may include the grammatical relations of each contract element corresponding to the root node in the grammatical relationship tree. The grammatical relations corresponding to each smart contract clause template may include the grammatical relations of each smart contract clause template corresponding to the root node in the grammatical relationship tree.

[0056] Specifically, in the process of calculating the first similarity between each contract element and each smart contract clause template based on element features and template features, the cosine distance between the element features and the template features can be calculated as the first similarity between each contract element and each smart contract clause template, or the element features and the template features can be input into a first similarity algorithm to perform similarity calculation to obtain the first similarity; the first similarity is used to measure the literal similarity between each contract element and each smart contract clause template.

[0057] For example, the first similarity algorithm includes:

[0058] in, represents the first similarity algorithm, and may also represent the first similarity; Represents the element features, which can be the TF-IDF (Term Frequency-Inverse Document Frequency) vector of each contract element; Represents template features, which can be the TF-IDF vector of each smart contract clause template; Represents the norm operation of feature features; Represents the norm operation on the template feature.

[0059] In the above process of calculating the second similarity based on the cross-attention calculation results, the cross-attention calculation results can be input into the second similarity algorithm for similarity calculation to obtain the second similarity; thereby, the second similarity is used to measure the similarity between each contract element and each smart contract clause template at the contextual semantic level.

[0060] For example, the second similarity algorithm includes:

[0061] in, represents the second similarity algorithm, and may also represent the second similarity; and representing a first parameter and a second parameter of a second similarity algorithm; Represents the sigmoid activation function, which maps the value to the (0, 1) interval through the activation function to obtain the second similarity.

[0062] In the above process of calculating the third similarity based on the preset number of grammatical relationships, the grammatical relationships corresponding to each contract element, and the grammatical relationships corresponding to each smart contract clause template, the third similarity can be calculated based on the preset number of grammatical relationships, the grammatical relationships corresponding to each contract element, the grammatical relationships corresponding to each smart contract clause template, and the distance between each contract element and the smart contract clause template; in addition, the preset number of grammatical relationships, the grammatical relationships corresponding to each contract element, the grammatical relationships corresponding to each smart contract clause template, and the distance between each contract element and each smart contract clause template can also be input into the third similarity algorithm to perform similarity calculation to obtain the third similarity; wherein, the distance between each contract element and each smart contract clause template can be the shortest path length between each contract element and each smart contract clause template in the grammatical relationship tree; in this way, the similarity between each contract element and each smart contract clause template at the grammatical relationship level is measured by the third similarity.

[0063] For example, the third similarity algorithm includes:

[0064] in, represents the third similarity algorithm, and may also represent the third similarity; Represents a set of preset grammatical relations; represents the number of preset grammatical relations, that is, the number of grammatical relations included in the preset grammatical relation set; and Respectively represent and The grammatical relationship corresponding to the root node; Represents the distance of each contract element from each smart contract clause template; Represents the length penalty coefficient, which can be used to weaken the impact of long paths; is the Kronecker function, which measures the consistency between two grammatical relations.

[0065] In the process of calculating the similarity based on the first similarity, the second similarity and the third similarity, the first similarity, the second similarity and the third similarity may be weighted to obtain the similarity; or the first similarity, the second similarity and the third similarity may be input into a similarity algorithm to perform similarity calculation to obtain the similarity; For example, similarity algorithms include:

[0066] in, , , Represent the weight coefficients of the first similarity, the second similarity and the third similarity respectively.

[0067] In addition, in the process of calculating the similarity between each contract element and each smart contract clause template based on the cross-attention calculation results, element features and template features, the first similarity, second similarity and / or third similarity between each contract element and each smart contract clause template can be calculated based on the cross-attention calculation results, element features and template features; that is, at least one of the first similarity, the second similarity and the third similarity can be calculated, and in the process of calculating the similarity, the corresponding similarity is calculated based on the required data. In the process of calculating the first similarity, the second similarity or the third similarity, only the required data can be obtained or calculated, and the similarity can be calculated using the required data, and the remaining data may not be obtained or calculated.

[0068] After the above-mentioned matching calculation of the element features of the contract elements of the contract and the template features of the smart contract clause template, the clause template corresponding to each contract element can be determined in the smart contract clause template based on the matching calculation results. Specifically, for each contract element, the smart contract clause template with the greatest similarity with each smart contract clause template can be selected as the clause template corresponding to the contract element.

[0069] In addition, in order to avoid the situation where the selected clause template is a local optimum in the process of determining the clause template corresponding to each contract element, and to further improve the matching degree between the clause template corresponding to each contract element and the contract element; in an optional implementation manner provided by this embodiment, in the process of determining the clause template corresponding to each contract element in the smart contract clause template based on the matching calculation result, the following operations are performed: Construct a multi-part graph based on each contract element and each smart contract clause template; According to the multi-part graph and matching calculation results, the clause template corresponding to each contract element is determined in each smart contract clause template.

[0070] The multipartite graph may be a bipartite graph, a tripartite graph or other types of multipartite graphs.

[0071] Specifically, in the process of determining the clause template corresponding to each contract element in each smart contract clause template based on the multi-part graph and the matching calculation results, the matching calculation results can be used as the weight of the edge between each contract element and each smart contract clause template in the multi-part graph, and the clause template corresponding to each contract element can be found in each smart contract clause template through a matching algorithm; wherein the matching algorithm can include KM (Kuhn-Munkres Algorithm, Hungarian algorithm); thereby achieving global optimal matching and improving the effectiveness of the clause template corresponding to each contract element.

[0072] In the process of filling in the clause template based on each contract element to obtain each smart contract clause, the element value in each contract element can be used to replace the placeholder in the clause template corresponding to each contract element to obtain each smart contract clause.

[0073] In order to improve the logical rationality of each smart contract clause, in the process of generating a smart contract based on each smart contract clause, each smart contract clause can be optimized, and a smart contract can be generated based on the optimization result; in the process of optimizing each smart contract clause, each smart contract clause can be verified for semantic anomalies, and after the verification is passed, each smart contract clause can be optimized in code, and a smart contract of the contract can be generated based on each smart contract clause after code optimization; Among them, the semantic anomaly verification of each smart contract clause may include: verifying whether the semantics and / or logic of each smart contract clause are consistent with the contract, and if so, determining that the verification is passed; for example, through the Semantic Web Rule Language (SWRL), verifying whether the semantics and / or logic of each smart contract clause are consistent with the contract, and if so, determining that the verification is passed; or semantic anomaly identification of each smart contract clause can be performed based on the contract, semantic correction is performed on the identification result to obtain corrected smart contract clauses, code optimization is performed on the corrected smart contract clauses, and a smart contract of the contract is generated based on the code-optimized smart contract clauses.

[0074] The above-mentioned code optimization can be a compilation optimization process, and the compilation optimization result can be trusted verified. After the verification is passed, the terms of each smart contract after the code optimization are obtained; for example, the compilation optimization process can include constant folding and / or dead code elimination. In addition, the compilation optimization process can also include other types of optimization processes; the trusted verification can specifically be a security verification, for example, the trusted verification includes verifying whether the integer overflows, and if not, determining that the verification is passed.

[0075] In the process of generating a smart contract based on each smart contract clause in the above optional implementation mode or generating a smart contract of a contract based on each smart contract clause after code optimization, each smart contract clause can be compiled and processed to obtain a smart contract of the contract. After that, the smart contract of the contract can be deployed to the blockchain. Specifically, the smart contract of the contract can be deployed to the blockchain by calling the deployment interface of the blockchain platform, and the deployment address of the smart contract in the blockchain is obtained, and the contract text of the contract and the deployment address are stored in the contract log of the blockchain. Specifically, the contract text and the deployment address can be stored in the contract log of the blockchain as a key-value pair.

[0076] For example, each smart contract clause is compiled into bytecode adapted to the blockchain platform, and the smart contract of the contract is deployed to the blockchain by calling the deployment interface of the blockchain platform - the RPC (Remote Procedure Call) interface.

[0077] During the specific execution process, after determining the first contract clause with the expiration of the trigger time from the smart contract clauses of the smart contract in the blockchain, the initial performance data corresponding to the first contract clause can be obtained; wherein, the initial performance data may include two aspects of data, on the one hand, the off-chain performance data, which may be the relevant data generated by the parties to the contract when performing the contract offline or off-chain, such as the off-chain performance data for the deposit amount, the total quantity of goods, the number of faulty goods, etc. in the deposit receipt of the goods obtained offline; on the other hand, the initial performance data may also include signature data provided by the provider of the off-chain performance data.

[0078] In actual applications, after obtaining the initial performance data corresponding to the first contract clause, since the initial performance data is not stored on the chain, there is a risk of tampering with the initial performance data, and the security is relatively low. Therefore, in order to improve the security of the initial performance data, the off-chain performance data in the initial performance data can be trusted for verification; in an optional implementation provided by this embodiment, after determining the execution of the first contract clause with the expiration of the trigger time from the smart contract clauses of the smart contract on the blockchain, the following operations are also performed: Provide credible verification of off-chain performance data; If the verification is successful, the following step S104 is executed.

[0079] On this basis, in order to further improve the comprehensiveness and effectiveness of trusted verification, trusted verification can be performed through a homomorphic encrypted hash verification algorithm; in an optional implementation provided by this embodiment, in the above-mentioned trusted verification process of off-chain performance data, the following operations are performed: Homomorphically encrypt the off-chain performance data based on the public key to obtain the encrypted performance data, and perform hash calculation on each data block in the encrypted performance data to obtain the hash value; The hash values ​​of each data block are aggregated to obtain an aggregated hash value, and the aggregated hash value and signature data are matched and verified based on the public key.

[0080] Among them, the public key can be the public key provided by the provider of off-chain performance data, that is, it can be the public key in the key pair. In addition, the key pair can also include a private key.

[0081] Specifically, in the process of performing homomorphic encryption on off-chain performance data based on the public key to obtain encrypted performance data, the public key and off-chain performance data can be input into the homomorphic encryption algorithm for homomorphic encryption to obtain encrypted performance data; in the process of performing hash calculation on each data block in the encrypted performance data to obtain a hash value, a factorial hash calculation can be performed on each data block in the encrypted performance data to obtain a hash value, or each data block in the encrypted performance data can be input into a hash calculation algorithm for hash calculation to obtain a hash value; in the process of aggregating the hash values ​​of each data block to obtain an aggregated hash value, a high-order transformation can be performed on the hash value of each data block, and based on the transformation result, the square of the first parameter in the public key can be modulo processing can be performed, and the modulo results of each data block can be multiplied to obtain an aggregated hash value. In addition, the hash value of each data block can also be input into an aggregation algorithm for aggregation processing to obtain an aggregated hash value.

[0082] For example, homomorphic encryption algorithms include:

[0083] in, Represents homomorphic encryption algorithm, and can also represent encrypted performance data; Represents off-chain performance data, represents the public key, , n represents the first parameter in the public key, , p and q represent large prime numbers; Represents the second parameter in the public key, for Random elements in Represents a random number; represents the multiplicative group modulo n; represents remainder; Hash calculation algorithms include:

[0084] in, Represents the hash value of the i-th data block in the encrypted performance data; represents each encrypted performance data; k represents a preset parameter, which can be a random number sequence or a salt value sequence; j represents the jth random number in the random number sequence or the jth salt value in the salt value sequence; It represents the concatenation or multiplication of k calculation results; Aggregation algorithms include:

[0085] in, Represents the aggregation algorithm, and can also represent the aggregation hash value; represent The first-order Bessel function; m represents the number of hash values ​​of each data block in the encrypted performance data; It represents the concatenation or multiplication of the modulo results of the m data blocks.

[0086] In the process of matching and verifying the aggregated hash value and the signature data based on the public key, in an optional implementation manner provided by this embodiment, the following operations are performed: Calculate a first verification value based on the public key and the signature data, and calculate a second verification value based on the aggregate hash value and preset parameters; If the first verification value matches the second verification value, it is determined that the verification is successful.

[0087] Among them, the signature data may be included in the initial performance data and provided by the provider; the signature data can be obtained by signing the second aggregate hash value based on the private key corresponding to the public key, and the second aggregate hash value is obtained after homomorphic encryption, hash calculation and aggregation of the off-chain performance data; the homomorphic encryption, hash calculation and aggregation processing here are similar to the process of obtaining the above-mentioned aggregate hash value, and this embodiment will not be repeated here. The preset parameter can be the first parameter n in the public key.

[0088] Specifically, in the process of signing the second aggregate hash value based on the private key corresponding to the public key, the second aggregate hash value and the private key may be input into the signature algorithm for signing to obtain signature data; For example, signature algorithms include:

[0089] in, Represents the signature algorithm and can also represent the signature data; Represents a private key; , is the first parameter in the private key, Is the second parameter in the private key; Stands for least common multiple.

[0090] Specifically, the signature data can be exponentially operated based on the public key to obtain a first verification value, the square of the first parameter in the public key is calculated, and the square is modulo the aggregate hash value to obtain the remainder as the second verification value. If the first verification value is equal to the second verification value, the verification is determined to be successful.

[0091] It should be supplemented that the initial performance data in the off-chain performance data can be obtained after preprocessing the off-chain initial performance data corresponding to the first contract terms. The preprocessing may include text recognition, cleaning and / or formatting of the off-chain initial performance data; the preprocessing may be performed by the provider.

[0092] Step S104: extract key performance data associated with the performance conditions included in the first contract clause from the off-chain performance data corresponding to the first contract clause.

[0093] Specifically, key performance data related to the performance conditions included in the first contract clause can be extracted from the off-chain performance data corresponding to the first contract clause.

[0094] The key performance data in this embodiment may include off-chain performance data related to the performance conditions. For example, the performance conditions included in the first contract terms are that the total amount of goods is greater than a and the failure rate of goods is less than b. The off-chain performance data includes the deposit amount in the deposit receipt of the goods, the total quantity of goods, the number of faulty goods, etc. Then the key performance data extracted from the off-chain performance data can be the total quantity of goods and the number of faulty goods.

[0095] Step S106: Match the key performance data and the on-chain performance data corresponding to the first contract terms with the performance conditions.

[0096] The above-mentioned performance conditions contained in the first contract clause extract key performance data from the off-chain performance data corresponding to the first contract clause. In this step, a matching check of the performance conditions is performed based on the key performance data and the on-chain performance data corresponding to the first contract clause.

[0097] The matching detection in this embodiment may include detecting whether both the key performance data and the on-chain performance data corresponding to the first contract terms match the performance conditions.

[0098] In specific implementation, in order to improve the accuracy of matching detection, in an optional implementation provided by this embodiment, in the process of matching the key performance data and the on-chain performance data corresponding to the first contract clause with the performance conditions, the following operations are performed: Combining the key performance data and the on-chain performance data to obtain combined performance data, and calculating a first matching value based on the combined features of the combined performance data and the transposed features of the combined features; The second matching value is calculated according to the frequency domain characteristics of the combined performance data, and the matching results of the first matching value and the second matching value with the performance conditions are determined based on the first matching value and the second matching value.

[0099] Among them, in the process of combining the key performance data and the on-chain performance data to obtain the combined performance data, each data item in the key performance data can be merged into the corresponding data item in the on-chain performance data, such as merging the amount of goods in the key performance data into the corresponding amount of goods in the on-chain performance data.

[0100] On this basis, in an optional implementation manner provided by this embodiment, in the process of calculating the first matching value based on the combined features of the combined performance data and the transposed features of the combined features, the following operations are performed: Perform polynomial expansion on the combined feature and the transposed feature respectively to obtain a first polynomial feature and a second polynomial feature; A first matching value is calculated according to the first polynomial feature, the second polynomial feature, and a polynomial kernel matrix corresponding to the combined feature.

[0101] In the above process of calculating the second matching value according to the frequency domain characteristics of the combined performance data, in an optional implementation manner provided by this embodiment, the following operations are performed: Preprocessing the combined performance data to obtain preprocessed data, performing Fourier transform on the preprocessed data to obtain frequency domain features, and performing frequency domain filtering on the frequency domain features to obtain filtering features; The filter feature is normalized to obtain a normalized result, the normalized result is inversely transformed by Fourier transform to obtain a time domain feature, and a second matching value is calculated based on the time domain feature.

[0102] In addition, in the process of matching and detecting the key performance data and the on-chain performance data corresponding to the first contract clause with the performance conditions, the key performance data and the on-chain performance data corresponding to the first contract clause, or the key performance data and the on-chain performance data corresponding to the first contract clause and the performance conditions, may be input into a matching detection algorithm for matching detection to obtain a matching detection result; For example, match detection algorithms include:

[0103] in, Represents the performance conditions; For the feature extraction function; The combined characteristics representing the combined performance data; Transposed features representing the combined features of the combined performance data; Represents the weight coefficient of the i-th feature in the combined feature; is the polynomial expansion function; represents the first polynomial characteristic; represents the second polynomial characteristic; Represents the polynomial kernel matrix corresponding to the i-th feature in the combined feature; are Fourier transform and inverse transform respectively, is the Hadamard product (multiplication of corresponding elements); represents the frequency domain threshold vector; For the A frequency domain feature extraction function; Represents preprocessed data; the matching calculation result can be the matching degree of the key performance data and the on-chain performance data corresponding to the first contract clause to the performance conditions. If the matching calculation result is close to 1, it means that the two meet the performance conditions and the test passes; if the matching calculation result is close to 0, it means that the two do not meet the performance conditions and the test fails.

[0104] In addition, it is also possible to detect whether both the key performance data and the on-chain performance data corresponding to the first contract terms meet the performance conditions. Specifically, based on the key performance data and the on-chain performance data corresponding to the first contract terms, the performance value corresponding to the performance item in the performance conditions can be calculated, and then the performance value can be detected whether it meets the performance conditions.

[0105] Continuing with the above example, the performance conditions included in the first contract clause are that the total quantity of goods is greater than a, and the failure rate of goods is less than b. The on-chain performance data is the cargo list. The key performance data can be the total quantity of goods and the number of faulty goods. The performance items in the performance conditions are the total quantity of goods and the failure rate of goods. The total quantity of goods c and the failure rate of goods d are calculated based on the key performance data and the on-chain performance data, and it is checked whether c and d meet the thresholds of the corresponding performance items in the performance conditions.

[0106] Step S108: Determine the second contract clause in the smart contract clause according to the detection result, and send the clause identifier of the second contract clause to the blockchain for clause execution processing.

[0107] The clause identifier in this embodiment may be an identifier that uniquely represents the second contract clause.

[0108] During specific execution, if the test result is that the test passes, the first smart contract clause in the smart contract clause is determined as the second contract clause, and specifically, the first smart contract clause can be determined as the second contract clause in the smart contract clause branch after the first contract clause; if the test result is that the test fails, the second smart contract clause in the smart contract clause is determined as the second contract clause, and the second smart contract clause can be determined as the second contract clause in the smart contract clause branch; the smart contract clause branch after the first contract clause may include the first smart contract clause and the second smart contract clause; this embodiment does not limit the number of the first smart contract clause and the second smart contract clause.

[0109] Continuing with the above example, if the test passes, the first smart contract clause for payment of the balance is determined as the second contract clause. If the test fails, the second smart contract clause for penalty for breach of contract is determined as the second contract clause.

[0110] After the second contract clause is determined, the clause identifier of the second contract clause can be sent to the blockchain for execution processing of the second contract clause; thereafter, the execution result can be sent to the blockchain for evidence storage.

[0111] It should be supplemented that each optional implementation method or each feasible execution method in steps S102 to S108 provided in this embodiment can be executed independently as needed, or can be combined and referenced with each other. At the same time, each specific execution step in each optional implementation method or each feasible execution method can also be executed independently, and this embodiment does not make specific limitations.

[0112] In summary, the contract processing method provided in this embodiment first determines the first contract clause whose trigger time expires from the smart contract clauses of the smart contract on the blockchain, and extracts key performance data from the off-chain performance data corresponding to the first contract clause based on the performance conditions contained in the first contract clause, thereby improving the relevance of the key performance data and the performance conditions and improving the validity of the key performance data; Secondly, the off-chain performance data is credibly verified. If the verification is passed, the key performance data and the on-chain performance data corresponding to the first contract clause are combined to obtain the combined performance data, and the first matching value is calculated based on the combined features of the combined performance data and the transposed features of the combined features. The second matching value is calculated according to the frequency domain features of the combined performance data, and the matching detection results of the key performance data and the on-chain performance data with the performance conditions contained in the first contract clause are determined based on the first matching value and the second matching value. In this way, the credibility and authenticity of the off-chain performance data are ensured through credible verification, and the off-chain performance data is prevented from being maliciously tampered with. Matching detection is performed on the data from both the on-chain and off-chain dimensions to improve the comprehensiveness and effectiveness of matching detection. Finally, the second contract clause is determined in the smart contract clause according to the detection results, and the clause identifier of the second contract clause is sent to the blockchain for clause execution processing; by sending the clause identifier of the second contract clause to the blockchain, the blockchain calls the second contract clause for automatic execution, thereby realizing the automated execution of the contract and improving the efficiency of contract execution. At the same time, since no manual operation is involved in the contract processing process, the security of contract execution is improved.

[0113] The following combination Figure 2 , taking the application of the contract processing method provided by this embodiment in the electronic contract scenario as an example, the contract processing method provided by this embodiment is further explained. Figure 2 , the contract processing method applied to the electronic contract scenario specifically includes the following steps.

[0114] Step S202, determining the first contract clause whose trigger time expires from the smart contract clauses of the electronic contract in the blockchain.

[0115] Step S204, obtain the initial performance data corresponding to the first contract clause, homomorphically encrypt the off-chain performance data in the initial performance data based on the public key to obtain encrypted performance data, and perform hash calculation on each data block in the encrypted performance data to obtain a hash value.

[0116] Step S206, aggregate the hash values ​​of each data block to obtain an aggregated hash value, and match and verify the aggregated hash value and the signature data in the initial performance data based on the public key.

[0117] Step S208, after verification, extract key performance data associated with the performance conditions included in the first contract terms from the off-chain performance data.

[0118] Step S210, combining the key performance data and the on-chain performance data corresponding to the first contract clause to obtain combined performance data, and calculating the first matching value based on the combined features of the combined performance data and the transposed features of the combined features.

[0119] Step S212, calculate the second matching value according to the frequency domain characteristics of the combined performance data, and determine the detection results of the key performance data and the on-chain performance data and the performance conditions based on the first matching value and the second matching value.

[0120] Step S214: determine the second contract clause in the smart contract clause according to the detection result, and send the clause identifier of the second contract clause to the blockchain for clause execution processing.

[0121] It should be noted that any one of steps S202 to S214 or any combination of multiple steps can be replaced by the corresponding technical means provided in the above steps S102 to S108 according to the needs of implementation and deployment, and will not be described one by one here.

[0122] Figure 3 A schematic diagram of a contract processing device provided by an embodiment of the present invention is shown in FIG. Figure 3 As shown, the device comprises: A clause determination module 302, for determining a first contract clause whose trigger time expires from the smart contract clauses of the smart contract in the blockchain; A data extraction module 304 is used to extract key performance data associated with the performance conditions included in the first contract clause from the off-chain performance data corresponding to the first contract clause; A matching detection module 306, configured to match the key performance data and the on-chain performance data corresponding to the first contract clause with the performance condition; The identification sending module 308 is used to determine the second contract clause in the smart contract clause according to the detection result, and send the clause identifier of the second contract clause to the blockchain for clause execution processing.

[0123] The contract processing device provided in this embodiment first determines the first contract clause whose trigger time expires from the smart contract clauses of the smart contract in the blockchain by running the clause determination module 302, and runs the data extraction module 304 to extract the key performance data associated with the performance conditions contained in the first contract clause from the off-chain performance data corresponding to the first contract clause, and then runs the matching detection module 306 to match the key performance data and the on-chain performance data corresponding to the first contract clause with the performance conditions, and finally runs the identification sending module 308 to determine the second contract clause in the smart contract clause according to the detection result, and sends the clause identification of the second contract clause to the blockchain for clause execution processing, so as to improve the efficiency and security of contract execution.

[0124] The contract processing device provided in one embodiment of this specification is capable of implementing each process in the method embodiment of the aforementioned contract processing method and achieving the same functions and effects, which will not be repeated here.

[0125] Furthermore, an embodiment of the present specification also provides a contract processing device, Figure 4 A schematic diagram of a contract processing device provided in an embodiment of this specification is shown in FIG. Figure 4 As shown, the device includes: a memory 401, a processor 402, a bus 403 and a communication interface 404. The memory 401, the processor 402 and the communication interface 404 communicate through the bus 403, and the communication interface 404 may include an input and output interface, which includes but is not limited to a keyboard, a mouse, a display, a microphone, a loudspeaker, etc.

[0126] Figure 4 In the embodiment, the memory 401 stores computer executable instructions that can be run on the processor 402. When the computer executable instructions are executed by the processor 402, the following process is implemented: Determine a first contract clause whose trigger time expires from the smart contract clauses of the smart contract on the blockchain; Extracting key performance data associated with the performance conditions included in the first contract clause from the off-chain performance data corresponding to the first contract clause; Matching the key performance data and the on-chain performance data corresponding to the first contract clause with the performance conditions; A second contract clause is determined in the smart contract clause according to the detection result, and a clause identifier of the second contract clause is sent to the blockchain for clause execution processing.

[0127] The contract processing device provided in this embodiment, through the cooperation of the memory 401, the processor 402, the bus 403 and the communication interface 404, determines the first contract clause whose trigger time expires from the smart contract clause of the smart contract on the blockchain, extracts the key performance data associated with the performance conditions included in the first contract clause from the off-chain performance data corresponding to the first contract clause, matches the key performance data and the on-chain performance data corresponding to the first contract clause with the performance conditions, determines the second contract clause in the smart contract clause according to the detection result, and sends the clause identifier of the second contract clause to the blockchain for clause execution processing, so as to improve the efficiency and security of contract execution.

[0128] The contract processing device provided in one embodiment of this specification can implement each process in the method embodiment of the aforementioned contract processing method and achieve the same functions and effects, which will not be repeated here.

[0129] Furthermore, another embodiment of the present specification provides a computer-readable storage medium, wherein the computer-readable storage medium is used to store computer-executable instructions, and when the computer-executable instructions are executed by a processor, the following process is implemented: Determine a first contract clause whose trigger time expires from the smart contract clauses of the smart contract on the blockchain; Extracting key performance data associated with the performance conditions included in the first contract clause from the off-chain performance data corresponding to the first contract clause; Matching the key performance data and the on-chain performance data corresponding to the first contract clause with the performance conditions; A second contract clause is determined in the smart contract clause according to the detection result, and a clause identifier of the second contract clause is sent to the blockchain for clause execution processing.

[0130] The computer-readable storage medium provided in this embodiment determines a first contract clause whose trigger time expires from the smart contract clause of the smart contract on the blockchain, extracts key performance data associated with the performance conditions included in the first contract clause from the off-chain performance data corresponding to the first contract clause, matches the key performance data and the on-chain performance data corresponding to the first contract clause with the performance conditions, determines a second contract clause in the smart contract clause based on the detection result, and sends the clause identifier of the second contract clause to the blockchain for clause execution processing, so as to improve the efficiency and security of contract execution.

[0131] The computer-readable storage medium includes a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.

[0132] A computer-readable storage medium provided in one embodiment of this specification can implement each process in the method embodiment of the aforementioned contract processing method and achieve the same functions and effects, which will not be repeated here.

[0133] Furthermore, another embodiment of the present specification also provides a computer program product, which implements the following process when executed by a processor: Determine a first contract clause whose trigger time expires from the smart contract clauses of the smart contract on the blockchain; Extracting key performance data associated with the performance conditions included in the first contract clause from the off-chain performance data corresponding to the first contract clause; Matching the key performance data and the on-chain performance data corresponding to the first contract clause with the performance conditions; A second contract clause is determined in the smart contract clause according to the detection result, and a clause identifier of the second contract clause is sent to the blockchain for clause execution processing.

[0134] The computer program product provided in this embodiment determines a first contract clause whose trigger time expires from the smart contract clause of the smart contract on the blockchain, extracts key performance data associated with the performance conditions included in the first contract clause from the off-chain performance data corresponding to the first contract clause, matches the key performance data and the on-chain performance data corresponding to the first contract clause with the performance conditions, determines a second contract clause in the smart contract clause based on the detection result, and sends the clause identifier of the second contract clause to the blockchain for clause execution processing, so as to improve the efficiency and security of contract execution.

[0135] A computer program product provided in one embodiment of this specification can implement each process in the method embodiment of the aforementioned contract processing method and achieve the same functions and effects, which will not be repeated here.

[0136] It will be appreciated by those skilled in the art that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Furthermore, the present invention may take the form of a computer program product implemented on one or more computer-readable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0137] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0138] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0139] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0140] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.

[0141] Memory may include non-permanent storage in a computer-readable storage medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. Memory is an example of a computer-readable storage medium.

[0142] Computer-readable storage media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer-readable instructions, data structures, program modules or other data. Examples of computer-readable storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer-readable storage media does not include temporary computer-readable media (transitory media), such as modulated data signals and carrier waves.

[0143] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.

[0144] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems or computer program products. Therefore, the present application may take the form of a complete hardware embodiment, a complete software embodiment or an embodiment combining software and hardware. Moreover, the present application may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.

[0145] The above is only an embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.

Claims

1. A contract processing method, characterized in that: The method comprises: Determine a first contract clause whose trigger time expires from the smart contract clauses of the smart contract on the blockchain; Extracting key performance data associated with the performance conditions included in the first contract clause from the off-chain performance data corresponding to the first contract clause; Matching the key performance data and the on-chain performance data corresponding to the first contract clause with the performance conditions; A second contract clause is determined in the smart contract clause according to the detection result, and a clause identifier of the second contract clause is sent to the blockchain for clause execution processing.

2. The contract processing method according to claim 1, characterized in that: The matching detection of the key performance data and the on-chain performance data corresponding to the first contract clause with the performance condition includes: Combining the key performance data and the on-chain performance data to obtain combined performance data, and calculating a first matching value based on a combined feature of the combined performance data and a transposed feature of the combined feature; A second matching value is calculated according to the frequency domain characteristics of the combined fulfillment data, and based on the first matching value and the second matching value, a detection result of the two with the fulfillment condition is determined.

3. The contract processing method according to claim 2, characterized in that: The calculating a first matching value based on the combined feature of the combined performance data and the transposed feature of the combined feature includes: Performing polynomial expansion on the combined feature and the transposed feature respectively to obtain a first polynomial feature and a second polynomial feature; The first matching value is calculated according to the first polynomial feature, the second polynomial feature and a polynomial kernel matrix corresponding to the combined feature.

4. The contract processing method according to claim 2, characterized in that: The calculating a second matching value according to the frequency domain characteristics of the combined performance data includes: Preprocessing the combined performance data to obtain preprocessed data, performing Fourier transform on the preprocessed data to obtain the frequency domain features, and performing frequency domain filtering on the frequency domain features to obtain filtering features; The filtering feature is normalized to obtain a normalized result, the normalized result is inversely transformed by Fourier transform to obtain a time domain feature, and the second matching value is calculated based on the time domain feature.

5. The contract processing method according to claim 1, characterized in that: After the step of determining the first contract clause of the expiration of the trigger time from the smart contract clause of the smart contract in the blockchain is executed, it also includes: Conduct credible verification of the off-chain performance data; If the verification is successful, the step of extracting key performance data associated with the performance conditions included in the first contract clause from the off-chain performance data corresponding to the first contract clause is executed.

6. The contract processing method according to claim 5, characterized in that: The credible verification of the off-chain performance data includes: Homomorphically encrypt the off-chain performance data based on the public key to obtain encrypted performance data, and perform hash calculation on each data block in the encrypted performance data to obtain a hash value; The hash values ​​of the data blocks are aggregated to obtain an aggregated hash value, and matching verification is performed on the aggregated hash value and signature data based on the public key.

7. The contract processing method according to claim 6, characterized in that: The matching verification of the aggregated hash value and the signature data based on the public key includes: Calculating a first verification value based on the public key and the signature data, and calculating a second verification value based on the aggregate hash value and preset parameters; If the first verification value matches the second verification value, it is determined that the verification is successful.

8. The contract processing method according to claim 1, characterized in that: The smart contract is obtained in the following way: Performing matching calculation on the element features of the contract elements of the contract and the template features of the smart contract clause template, and determining the clause template corresponding to each contract element in the smart contract clause template based on the matching calculation result; The clause template is filled based on the contract elements to obtain the smart contract clauses, and the smart contract is generated based on the smart contract clauses.

9. The contract processing method according to claim 8, characterized in that: The determining of the clause template corresponding to each contract element in the smart contract clause template based on the matching calculation result includes: Construct a multi-part graph based on the contract elements and smart contract clause templates; According to the multi-part graph and the matching calculation results, the clause template corresponding to each contract element is determined in each smart contract clause template.

10. The contract processing method according to claim 8, characterized in that: The matching calculation of the element features of the contract elements of the contract and the template features of the smart contract clause template includes: Performing self-attention calculation based on the element features and the template features, and performing cross-attention calculation on the self-attention calculation result; Based on the cross-attention calculation results, the element features and the template features, the similarity between each contract element and each smart contract clause template is calculated as the matching calculation result.

11. The contract processing method according to claim 10, characterized in that: The calculating the similarity between each contract element and each smart contract clause template according to the cross-attention calculation result, the element feature and the template feature includes: Based on the element features and the template features, calculating a first similarity between each contract element and each smart contract clause template, and calculating a second similarity according to the cross-attention calculation result; The third similarity is calculated based on the preset number of grammatical relationships, the grammatical relationships corresponding to the contract elements, and the grammatical relationships corresponding to the smart contract clause templates, and the similarity is calculated based on the first similarity, the second similarity and the third similarity.

12. The contract processing method according to claim 10, characterized in that: The performing self-attention calculation based on the element feature and the template feature includes: Transforming the element feature based on the first transformation feature to obtain an element transformation feature, and transforming the template feature based on the second transformation feature to obtain a template transformation feature; A self-attention calculation is performed based on the element transformation feature and the template transformation feature to obtain the self-attention calculation result.

13. The contract processing method according to claim 12, characterized in that: The performing self-attention calculation based on the element transformation feature and the template transformation feature to obtain the self-attention calculation result includes: Performing splicing processing on the first element transformation feature and the second element transformation feature in the element transformation feature in a preset dimension to obtain a splicing feature; A control feature is calculated based on the splicing feature to obtain the control feature, and the self-attention calculation result is calculated based on the control feature, the element transformation feature and the template transformation feature.

14. The contract processing method according to claim 8, characterized in that: The contract elements are obtained in the following ways: Performing word segmentation processing on the contract text of the contract to obtain a word sequence, and performing named entity recognition on the word sequence to obtain multiple contract entities; The grammatical relationship between the multiple contract entities is determined, and based on the grammatical relationship, elements are extracted from the multiple contract entities to obtain the contract elements.

15. A contract processing device, characterized in that: The device comprises: A clause determination module, used to determine a first contract clause whose trigger time expires from the smart contract clauses of the smart contract on the blockchain; A data extraction module, configured to extract key performance data associated with the performance conditions included in the first contract clause from the off-chain performance data corresponding to the first contract clause; A matching detection module, used to match the key performance data and the on-chain performance data corresponding to the first contract clause with the performance condition; An identification sending module is used to determine a second contract clause in the smart contract clause according to the detection result, and send the clause identifier of the second contract clause to the blockchain for clause execution processing.

16. A contract processing device, characterized in that: The device includes a memory and a processor, wherein the memory stores computer executable instructions, and when the computer executable instructions are executed on the processor, the steps of the method described in any one of claims 1 to 14 can be implemented.

17. A computer-readable storage medium having computer-executable instructions stored therein, characterized in that: When the computer executable instructions are executed by a processor, the steps of the method described in any one of claims 1 to 14 can be implemented.

18. A computer program product, characterized in that The computer program product includes a contract processing program, and when the contract processing program is executed by a processor, the steps of the method described in any one of claims 1 to 14 can be implemented.