Intelligent contract generation and interpretable negotiation system, method, medium, and terminal

The smart contract generation and interpretable negotiation system solves the problems of high writing threshold and low collaboration efficiency in the smart contract generation process. It realizes the automatic conversion and efficient negotiation of natural language intent into executable contracts, thereby improving the collaboration efficiency of supply chain participants.

CN121478248BActive Publication Date: 2026-05-01ZHEJIANG UNIV
View PDF 4 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
ZHEJIANG UNIV
Filing Date
2026-01-08
Publication Date
2026-05-01

AI Technical Summary

Technical Problem

The existing smart contract generation process suffers from high writing barriers, low collaboration efficiency, and difficulties in mapping natural language to code, resulting in low negotiation efficiency and insufficient interpretability.

Method used

A smart contract generation and interpretable negotiation system is provided, including a natural language intent understanding module, a contract code generation module, a contract interpretation module, a contract negotiation and revision module, and a secure deployment module. The system generates contract elements through intent analysis, fills in the contract template to generate initial code, provides visual explanations and conducts negotiation and revision, and finally securely deploys the system on the blockchain.

Benefits of technology

It enables the automatic and accurate conversion of natural language intent into executable smart contracts, supports efficient collaborative modification, improves the generation efficiency and interpretability of smart contracts, and reduces the technical understanding barrier.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121478248B_ABST
    Figure CN121478248B_ABST
Patent Text Reader

Abstract

The application provides a smart contract generation and interpretable negotiation system, method, medium and terminal, the application performs intention analysis on natural language information from a contract initiating user, generates corresponding contract elements, fills the contract elements into a matched contract template to obtain initial smart contract code, generates corresponding contract interpretation according to the initial smart contract code, displays the contract interpretation for negotiation of the contract initiating user and a contract intention user, obtains a negotiated smart contract code, performs security audit on the negotiated smart contract code, and deploys the smart contract code passing the security audit on a blockchain, and the application solves the problems of high smart contract understanding barrier and low negotiation efficiency in the prior art, realizes automatic and interpretable conversion of natural language intention of a supply chain participant into reliable and executable smart contract, and supports efficient collaborative modification.
Need to check novelty before this filing date? Find Prior Art

Description

Smart contract generation and interpretable negotiation system, method, medium and terminal Technical Field

[0001] This invention relates to the intersection of artificial intelligence and blockchain, and in particular to a smart contract generation and interpretable negotiation system, method, medium and terminal. Background Technology

[0002] Modern supply chain systems have evolved into complex networks comprised of multi-tiered suppliers, manufacturers, logistics service providers, distributors, and retailers. Efficient collaboration and precise cooperation have become core requirements for supply chain operations, and their foundation lies in the clear definition of rights and responsibilities among all participants through commercial contracts such as procurement contracts, supply agreements, and logistics service contracts. Traditional supply chain contract management relies on paper documents or electronic agreements, which suffers from pain points such as low negotiation efficiency, insufficient transparency in execution, and high technical barriers, making it difficult to meet the demands for agile response in a dynamic market environment.

[0003] The rise of blockchain technology has injected revolutionary momentum into supply chain management. Smart contracts, as its core application, theoretically enable transparency, automation, and trustlessness in transaction processes by encoding contract terms into automatically executable programs. For example, when IoT sensors detect the arrival of goods at a designated port, a smart contract can instantly trigger a payment instruction, eliminating the need for manual reconciliation and approval. However, despite the advantages of smart contracts such as immutability and automatic execution, their large-scale application in supply chain scenarios still faces multiple challenges:

[0004] First, the drafting of current smart contracts relies heavily on the human intervention of lawyers and business experts, which is time-consuming and costly. Negotiation of multi-variable terms often requires multiple rounds of negotiations, and manual revisions are prone to logical conflicts, legal loopholes, or deviations from industry standards. At the same time, although blockchain can record the entire transaction process, the writing of smart contracts still requires professional developers and cannot achieve a direct mapping between natural language and code.

[0005] Secondly, smart contract development relies on specific programming languages, while business experts and legal advisors in the supply chain field typically lack coding skills. This skill gap makes smart contract generation heavily dependent on costly development resources, and a semantic gap exists between business logic and code implementation. Even with low-code tools simplifying development, their pre-set templates struggle to cover the complex needs of supply chain scenarios. Based on these factors, the generated smart contract code lacks intuitive explanation for non-technical personnel, and contracting parties may question its fairness due to their inability to verify the code logic. For example, a clause might implicitly contain an algorithm for "automatically adjusting prices when market fluctuations exceed a threshold," which, if not presented in an understandable form, could lead to disputes and hinder contract signing. Summary of the Invention

[0006] In view of the shortcomings of the prior art described above, the purpose of this invention is to provide a smart contract generation and interpretable negotiation system, method, medium and terminal to solve the technical problems of insufficient interpretability and standardization of smart contracts in the prior art, high threshold for writing smart contracts and low collaborative efficiency.

[0007] To achieve the above and other related objectives, this invention provides a smart contract generation and interpretable negotiation system. The system includes: a natural language intent understanding module, a contract code generation module, a contract interpretation module, a contract negotiation and revision module, and a secure deployment module. The natural language intent understanding module analyzes the natural language information from the contract initiating user to generate corresponding contract elements. The contract code generation module, connected to the natural language intent understanding module, fills the contract elements into a matching contract template to obtain initial smart contract code. The contract interpretation module, connected to the contract code generation module, generates a corresponding contract interpretation based on the initial smart contract code. The contract negotiation and revision module, connected to the contract interpretation module, displays the contract interpretation for negotiation between the contract initiating user and the contract prospective user to obtain a mutually agreed-upon smart contract code. The secure deployment module, connected to the contract negotiation and revision module, performs a security audit on the mutually agreed-upon smart contract code and deploys the audited smart contract code on the blockchain.

[0008] In one embodiment of the present invention, the intention analysis of natural language information from the contract initiating user to generate corresponding contract elements includes: receiving natural language information containing a specific intention from the contract initiating user; inputting the natural language information into a constructed natural language understanding model to perform named entity recognition, relation extraction and intention classification, and outputting the corresponding structured contract elements.

[0009] In one embodiment of the present invention, the step of filling the contract elements into a matching contract template to obtain initial smart contract code includes: based on the scene features in the contract elements, retrieving a contract template matching the scene from a preset contract template library; inputting the contract elements and the contract template into a constructed code generation model, so that the contract elements are filled into the contract template to obtain initial smart contract code.

[0010] In one embodiment of the present invention, generating a corresponding contract explanation based on the initial smart contract code includes: inputting the initial smart contract code into a constructed contract explanation model, translating the initial smart contract code into natural language, and generating a corresponding natural language description and a visual flowchart reflecting the execution logic of the smart contract.

[0011] In one embodiment of the present invention, the contract explanation is displayed through the online negotiation interface of the contract negotiation and revision module, allowing the contract initiating user and the contract prospective user to negotiate the initial smart contract code on the online negotiation interface. If an agreement is reached, the initial smart contract code is used as the agreed smart contract code. If no agreement is reached, a negotiation and revision process is executed. The negotiation and revision process includes: the contract initiating user and / or the contract prospective user revising the smart contract code on the online negotiation interface, and the contract initiating user and the contract prospective user negotiating the revised smart contract code. If an agreement is reached, the revised smart contract code is used as the agreed smart contract code. If no agreement is reached, the contract initiating user and / or the contract prospective user revises the smart contract code on the online negotiation interface until an agreement is reached on the revised smart contract code.

[0012] In one embodiment of the present invention, revising the smart contract code includes: the contract initiating user and / or the contract prospective user making revision comments on the current smart contract code on an online negotiation interface; integrating and risk-analyzing the revision comments based on the negotiation revision model to generate a corresponding revision scheme, and generating the revised smart contract code based on the revision scheme.

[0013] In one embodiment of the present invention, the security deployment module is used to perform formal verification and static security analysis on the agreed smart contract code, deploy the smart contract code that has passed the security audit on the blockchain, and record the contract address and hash value.

[0014] To achieve the above and other related objectives, this invention provides a method for generating and interpretable negotiation of smart contracts. The method includes: performing intent analysis on natural language information from a contract initiating user to generate corresponding contract elements; filling the contract elements into a matching contract template to obtain initial smart contract code; generating a corresponding contract interpretation based on the initial smart contract code; displaying the contract interpretation for negotiation between the contract initiating user and the contract prospective user to obtain a negotiated smart contract code; performing a security audit on the negotiated smart contract code; and deploying the security-audited smart contract code on a blockchain.

[0015] To achieve the above and other related objectives, the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the aforementioned smart contract generation and interpretable negotiation method.

[0016] To achieve the above and other related objectives, the present invention provides an electronic terminal, comprising: one or more memories and one or more processors; the one or more memories being used to store a computer program; and the one or more processors being connected to the memories and used to run the computer program to execute the smart contract generation and interpretable negotiation method.

[0017] As described above, this invention provides a smart contract generation and interpretable negotiation system, method, medium, and terminal, which has the following beneficial effects: This invention performs intent analysis on natural language information from the contract initiating user to generate corresponding contract elements; fills the contract elements into a matching contract template to obtain initial smart contract code; generates a corresponding contract interpretation based on the initial smart contract code; displays the contract interpretation for negotiation between the contract initiating user and the contract prospective user to obtain a mutually agreed-upon smart contract code; performs a security audit on the mutually agreed-upon smart contract code, and deploys the security-audited smart contract code on the blockchain; this invention solves the problems of high barriers to contract understanding and low negotiation efficiency in the prior art, enabling the natural language intent of supply chain participants to be automatically, accurately, and interpretably transformed into reliable and executable smart contracts, supporting efficient collaborative modification, and effectively improving the efficiency of smart contract achievement. Attached Figure Description

[0018] Figure 1 shows a schematic diagram of the modules of a smart contract generation and interpretable negotiation system according to an embodiment of the present invention.

[0019] Figure 2 shows a schematic diagram of the structure of a smart contract generation and interpretable negotiation method according to an embodiment of the present invention.

[0020] Figure 3 shows a schematic diagram of the structure of a smart contract generation and interpretable negotiation method according to another embodiment of the present invention.

[0021] Figure 4 shows a schematic diagram of the structure of an electronic terminal according to an embodiment of the present invention. Detailed Implementation

[0022] The following specific examples illustrate the implementation of the present invention. Those skilled in the art can easily understand other advantages and effects of the present invention from the content disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments, and various details in this specification can also be modified or changed based on different viewpoints and applications without departing from the spirit of the present invention. It should be noted that, unless otherwise specified, the following embodiments and features described therein can be combined with each other.

[0023] It should be noted that in the following description, reference is made to the accompanying drawings, which illustrate several embodiments of the present invention. It should be understood that other embodiments may also be used, and changes in mechanical composition, structure, electrical system, and operation may be made without departing from the spirit and scope of the invention. The following detailed description should not be considered limiting, and the scope of the embodiments of the invention is defined only by the claims of the published patents. The terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit the invention. Spatially related terms, such as “upper,” “lower,” “left,” “right,” “below,” “below,” “lower part,” “above,” “upper part,” etc., may be used herein to illustrate the relationship between one element or feature shown in the figures and another element or feature.

[0024] Throughout this specification, when it is said that a part is "connected" to another part, this includes not only "direct connection" but also "indirect connection" by placing other elements in between. Furthermore, when it is said that a part "includes" a certain constituent element, unless otherwise stated otherwise, this does not exclude other constituent elements, but rather means that other constituent elements may also be included.

[0025] The terms "first," "second," and "third," etc., used herein are for the purpose of describing various parts, components, regions, layers, and / or segments, but are not limiting. These terms are used only to distinguish one part, component, region, layer, or segment from others. Therefore, the "first part," "component," "region," "layer," or "segment" described below may refer to a "second part," "component," "region," "layer," or "segment" without departing from the scope of this invention.

[0026] Furthermore, as used herein, the singular forms “a,” “an,” and “the” are intended to include the plural forms as well, unless the context indicates otherwise. It should be further understood that the terms “comprising,” “including,” indicate the presence of the stated feature, operation, element, component, item, kind, and / or group, but do not preclude the presence, occurrence, or addition of one or more other features, operations, elements, components, items, kinds, and / or groups. The terms “or” and “and / or” as used herein are interpreted as inclusive, or mean any one or any combination thereof. Thus, “A, B, or C” or “A, B, and / or C” means “any one of: A; B; C; A and B; A and C; B and C; A, B, and C.” Exceptions to this definition arise only when combinations of elements, functions, or operations are inherently mutually exclusive in some manner.

[0027] Before providing a further detailed description of the present invention, the nouns and terms used in the embodiments of the present invention are explained, and the nouns and terms used in the embodiments of the present invention are subject to the following interpretations:

[0028] <1> SFT: Supervised Fine-Tuning, is used to fine-tune pre-trained models based on labeled data, making the models suitable for specific domain tasks such as smart contract element extraction, and improving the accuracy of task execution.

[0029] <2> RAG: Retrieval-Augmented Generation. It combines external knowledge base retrieval and generation models to obtain relevant information before generating content, thereby improving the security and scenario adaptability of smart contract code generation.

[0030] <3> MTF: Multi-Task Fine-Tuning, which involves simultaneously training the model to handle multiple related tasks, thereby enhancing the model's generalization ability and adaptability to various scenarios.

[0031] <4> RLHF: Reinforcement Learning from Human Feedback. This technique involves fine-tuning a model using reinforcement learning based on human feedback, with specific metrics as reward signals to optimize the model's decision-making logic.

[0032] This invention provides a smart contract generation and interpretable negotiation system, method, medium, and terminal. The invention performs intent analysis on natural language information from the contract initiating user to generate corresponding contract elements; fills the contract elements into a matching contract template to obtain initial smart contract code; generates a corresponding contract interpretation based on the initial smart contract code; displays the contract interpretation for negotiation between the contract initiating user and the contract prospective user to obtain a mutually agreed-upon smart contract code; performs a security audit on the mutually agreed-upon smart contract code, and deploys the security-audited smart contract code on the blockchain. This invention solves the problems of high barriers to contract understanding and low negotiation efficiency in existing technologies, enabling the automatic, accurate, and interpretable conversion of the natural language intent of supply chain participants into reliable and executable smart contracts, supporting efficient collaborative modification.

[0033] The present invention will now be described in detail with reference to the accompanying drawings, so that those skilled in the art can readily implement it. The present invention can be embodied in many different forms and is not limited to the embodiments described herein.

[0034] Figure 1 shows a schematic diagram of a smart contract generation and interpretable negotiation system 100 according to an embodiment of the present invention.

[0035] The system 100 includes: a natural language intent understanding module 101, a contract code generation module 102, a contract interpretation module 103, a contract negotiation and revision module 104, and a security deployment module 105; wherein, the natural language intent understanding module 101 is used to perform intent analysis on natural language information from the contract initiating user and generate corresponding contract elements; the contract code generation module 102, connected to the natural language intent understanding module 101, is used to fill the contract elements into a matching contract template to obtain initial smart contract code; the contract interpretation module 103, connected to the contract code generation module 102, is used to generate a corresponding contract interpretation based on the initial smart contract code; the contract negotiation and revision module 104, connected to the contract interpretation module 103, is used to display the contract interpretation for the contract initiating user and the contract prospective user to negotiate and obtain a negotiated smart contract code; the security deployment module 105, connected to the contract negotiation and revision module 104, is used to perform security audit on the negotiated smart contract code and deploy the security-audited smart contract code on the blockchain.

[0036] In one embodiment, the natural language intent understanding module 101 is used to receive one or more natural language information containing specific intent from the contract initiating user, and to transform the unstructured natural language information input by the contract initiating user into standardized structured contract elements, providing accurate data support for subsequent contract code generation; wherein the input forms of the multi-form natural language information can cover common natural language carriers such as text, voice or forms, covering contract requirement descriptions in scenarios such as supply chain procurement, supply, and logistics cooperation.

[0037] The Natural Language Intent Understanding module 101 is used for processing based on a Natural Language Understanding model. It has a built-in trained Natural Language Understanding model. After the received Natural Language information is input into the model, the model will perform processing operations in sequence: named entity recognition, relation extraction, and intent classification. After processing by the Natural Language Understanding model, the Natural Language Intent Understanding module 101 generates structured contract elements corresponding to the Natural Language information. The contract elements include, but are not limited to, key parameters such as the parties to the contract, the subject matter, quantity, price, date, and scenario features, as well as the cost of default. The contract elements are presented in a standardized format that can be parsed by a machine, preferably in JSON format. The contract elements fully cover the core information dimensions required by the contract and can be directly transmitted to the contract code generation module 102 for smart contract code generation.

[0038] The natural language understanding model used in the natural language intent understanding module 101 is trained and optimized using the SFT method. It relies on a corpus specifically for the supply chain domain to achieve domain adaptation of the model, ensuring the accuracy of parsing natural language information related to contracts.

[0039] Specifically, during the data preparation phase, a large number of real contract samples from supply chain scenarios are collected, covering sub-scenarios such as procurement, supply, and logistics, and including industry-specific terms such as delayed delivery, force majeure, and liquidated damages. The collected samples are manually labeled, including but not limited to contract entities such as participants, subject matter, price, delivery date, and the logical relationships between them, forming an labeled supply chain corpus. During the prompting engineering optimization phase, supply chain-specific prompts are designed, such as guiding language like "Extract contract elements from the following text, including participants, subject matter, quantity, price, default clauses, and corresponding triggering conditions." This prompt optimization enhances the code generation model's understanding and generalization ability of supply chain business logic, improving the targeting of element extraction. In the model training phase, the labeled supply chain corpus is input into the model for iterative training. A low learning rate is used during training to avoid overfitting and ensure stable performance in parsing new supply chain contract texts. Furthermore, training focuses on optimizing dynamic clause parsing capabilities, especially for easily changeable contract clauses such as penalty calculation and delivery date adjustments, strengthening the model's ability to identify and structure this type of information. Finally, the natural language understanding model is trained, ensuring the output of complete and accurate structured contract elements.

[0040] In one embodiment, the contract code generation module 102 automatically generates initial smart contract code based on the structured contract elements output by the natural language intent understanding module 101, realizing the transformation from contract elements to executable code. Specifically, after obtaining the structured contract elements output by the natural language intent understanding module 101, the contract code generation module 102 retrieves contract templates matching the scenario from a preset contract template library based on the scenario features of contract type identifiers such as procurement, supply, logistics, and warehousing in the elements. The contract template library contains standardized smart contract templates for various supply chain sub-scenarios, and each template reserves field filling interfaces corresponding to contract elements to adapt to the generation needs of different types of contracts.

[0041] After determining the contract template that matches the scenario, the contract code generation module 102 inputs the retrieved matching contract template and structured contract elements into the trained code generation model. This code generation model has the ability to accurately map contract elements to template fields. It can automatically fill the contract elements into the corresponding positions in the template according to the preset code framework and syntax rules of the template, complete the fusion and adaptation of elements and template, and generate initial smart contract code. The initial smart contract code includes, but is not limited to, initial smart contract code implemented using Solidity or Go programming languages, which is grammatically compliant and logically complete, in line with the goals of blockchain platforms such as Ethereum and Fabric.

[0042] The contract code generation module 102 uses a trained code generation model that is also based on SFT technology to complete model training. During the training process, it focuses on the smart contract code generation task, with the goal of improving the accuracy, security and scenario adaptability of code generation.

[0043] Specifically, in the construction of the training data for the model, the code generation model uses "template-code pairs" as the main training data. It extracts standardized contract templates related to the supply chain domain from a pre-set smart contract library, and pairs each template with a corresponding natural language description to cover information such as the template's applicable scenarios and main clause logic, forming a large number of labeled "template-code-natural language description" training samples. In addition, during the training process, smart contract vulnerability detection data containing vulnerability code cases and security remediation solutions corresponding to common attack types are introduced. The smart contract vulnerability detection data is integrated into the training sample set to inject secure coding awareness into the model.

[0044] Furthermore, during training, the generation logic is optimized using RAG technology. The model first matches the most suitable contract template with the input contract elements through the retrieval module, obtaining the corresponding structural framework and security specifications. Then, based on the retrieval results, the trained model completes the detailed filling of contract elements and code optimization, achieving synergy between accurate retrieval and intelligent generation, and improving the flexibility and scenario matching of code generation. Finally, the constructed training samples are input into the model for iterative fine-tuning training. During the training process, the focus is on strengthening the code syntax compliance, logical integrity, and security protection capabilities. Through reverse constraints from vulnerability detection data, the model learns to avoid vulnerable code patterns such as reentrancy attacks and integer overflows. At the same time, through low-learning-rate iteration and multiple rounds of verification, it is ensured that the model can stably generate secure and compliant smart contract code in different supply chain contract scenarios, ultimately completing the model training.

[0045] In one embodiment, the contract interpretation module 103 is used to convert the initial smart contract code into a form that non-technical personnel can intuitively understand, thereby eliminating the technical understanding barrier of smart contracts and providing clear content support for subsequent multi-party negotiations.

[0046] The contract interpretation module 103 receives the initial smart contract code output by the contract code generation module 102 and inputs it into the trained contract interpretation model. The contract interpretation model performs line-by-line logical parsing on the initial smart contract code, extracts key information such as core terms, execution conditions, division of rights and responsibilities, and triggering mechanisms from the code, and generates a clear and logical natural language description that conforms to business expression habits through natural language translation processing. The natural language description must fully cover the core logic in the code to ensure that non-technical personnel can accurately understand the rights, obligations, and execution rules of the contract.

[0047] In addition, while generating natural language descriptions, the execution flow logic of the smart contract is extracted simultaneously, including key nodes such as triggering conditions, execution steps, branch judgments, and result outputs. A visual flowchart that reflects the complete execution logic of the smart contract is automatically generated. The flowchart shows the relationship between each link and the execution order in an intuitive graphical way, helping contract stakeholders to quickly grasp the overall logic of the contract. Finally, a contract explanation containing natural language descriptions and visual flowcharts is generated for contract initiator users and contract prospective users to view, negotiate, and revise.

[0048] The contract interpretation module 103 uses a trained contract interpretation model trained using MTF technology. The goal is to simultaneously improve the accuracy of code-to-natural language conversion and the quality of logic flowchart generation, ensuring the accuracy and readability of the initial smart contract interpretation results.

[0049] Specifically, manually labeled paired data is first used as training samples. These samples consist of smart contract code and corresponding standard natural language interpretations. During the labeling process, the precise mapping relationship between the code logic and the natural language expression must be clearly defined. At the same time, the execution logic nodes and related relationships corresponding to the code are labeled simultaneously to provide training basis for the flowchart generation task.

[0050] Secondly, a multi-task learning framework is used to fine-tune the model, simultaneously training two core tasks: one is the code-to-text conversion task, which accurately converts smart contract code into a simple natural language description; the other is the logic flowchart generation task, which allows the model to learn to extract information such as execution nodes, triggering conditions, and branching logic from the code and automatically generate a visual flowchart. At the same time, the fine-tuning process emphasizes training the model's ability to reason about the causal logic of the code. By designing targeted training samples and optimization goals, the model is guided to accurately identify the causal relationships of logic such as condition judgments, loop execution, and event triggering in the code, avoiding interpretation bias due to logical misunderstandings. Finally, through multiple rounds of iterative training and verification, the fluency of the natural language description and the logical clarity of the flowchart are optimized to ensure that non-technical personnel can quickly and accurately understand the core logic of the contract, thus completing the training of the contract interpretation model.

[0051] In one embodiment, the contract negotiation and revision module 104 is used to provide an online collaborative negotiation interface for the contract initiating user and the contract prospective user. By visually displaying the content of the contract explanation, it supports both parties to complete the revision and generate smart contract code that reaches a consensus. At the same time, it relies on the trained negotiation and revision model to ensure the efficiency and security of the revision process. The contract prospective user can be one or more.

[0052] Specifically, the contract negotiation and revision module 104 receives the contract explanation, which includes natural language descriptions and a visual flowchart, output by the contract explanation module 103, and displays it synchronously to the contract initiating user and the contract prospective user through the online negotiation interface. This negotiation interface allows both parties to intuitively view the core logic, division of responsibilities, and execution process of the contract, providing a clear content foundation for collaborative revision. The contract initiating user and the contract prospective user can perform collaborative operations on the initial smart contract code based on the displayed contract explanation content on the online negotiation interface, including adding comments, proposing revision suggestions, and annotating disputed clauses. All operations are synchronized to both parties' interfaces in real time, ensuring information exchange during the negotiation.

[0053] Specifically, in the initial negotiation phase: the contract negotiation and revision module 104 synchronously displays a contract explanation, including natural language descriptions and visual flowcharts, through an online negotiation interface, allowing the contract initiating user and the contract prospective user to view and negotiate the initial smart contract code together; if both parties have no objection to the initial smart contract code after communication and reach an agreement, then the initial smart contract code is directly determined as the agreed smart contract code; if both parties have objections and fail to reach an agreement, the negotiation and revision process automatically begins.

[0054] First round of revision and negotiation: The contract initiator and / or contract prospective users make revision annotations on the smart contract code for disputed terms on the online negotiation interface. The negotiation revision model revises the smart contract code based on the revision annotations. After the revision is completed, both parties negotiate the revised smart contract code again.

[0055] Cyclic Revision and Consensus Confirmation: If both parties reach an agreement on the revised smart contract code, it will be confirmed as the agreed smart contract code; if no agreement is reached, the contract initiating user and / or contract prospective user will initiate a revision operation again on the online negotiation interface, repeating the revision-negotiation steps until both parties reach an agreement on the revised smart contract code, forming the final agreed smart contract code.

[0056] It should be further explained that when the contract initiator or prospective contract user submits revision comments such as adjusting the price of the subject matter, changing the penalty ratio, or modifying the delivery date, the contract negotiation revision module 104 will capture the modification operation in real time and automatically highlight the corresponding contract explanation text, visual flowchart, and related contract code segment in the online negotiation interface. The highlighting style adopts differentiated designs such as specific background colors and border markings to ensure that both parties can intuitively identify the modification location and specific content, and clearly trace the initiator of each modification and the differences before and after the modification.

[0057] In addition, the contract negotiation and revision module 104 has a built-in logic conflict detection unit. After capturing the revision comments from different participants, it will automatically extract the parameters and logical relationships corresponding to each revision comment and compare them with the basic contract rules, industry standards and confirmed terms. If it detects that there are logical contradictions in the modification opinions of different participants, such as one party proposing a 5% increase in unit price and another party proposing a 3% decrease in unit price, a conflict prompt will be triggered. The conflict location, conflict content and conflict type will be marked on the interface and pushed to all participants at the same time to help both parties quickly locate the focus of the dispute so as to carry out targeted negotiation and communication.

[0058] Based on the negotiation and revision model trained by the contract initiator and contract prospective users, the model collects revision comments submitted by all parties in real time, performs semantic parsing, conflict identification and integration of the comments, and forms a unified set of revision opinions. At the same time, the negotiation and revision model performs risk analysis on the integrated revision opinions to identify potential compliance issues, logical conflicts or security risks.

[0059] Based on the integrated revision annotations and risk analysis results, the negotiation revision model automatically generates the corresponding revision plan. If the contract initiator and the contract prospective user reach an agreement on the revision plan, the negotiated revised smart contract code is directly generated based on the revision plan, and this smart contract code is used as the agreed smart contract code. If the two parties do not reach an agreement on the revision plan, the content of the currently unagreed plan and the corresponding points of contention are retained, supporting both parties to further collaborate online to annotate and exchange opinions based on the content of the content of contention until an agreement is reached. During the negotiation process, the negotiation revision model will continuously collect new revision annotations and update the revision plan until the smart contract code agreed upon by both parties is generated.

[0060] The contract negotiation and revision module 104 uses a negotiation and revision model trained with RLHF technology. The goal is to improve the model's ability to integrate revision requests from multiple users, resolve conflicts, and promote negotiation, thereby helping contract initiators and prospective contract users reach a consensus quickly.

[0061] Specifically, the training sample is first based on real data from supply chain contract negotiation scenarios, including the negotiation dialogue history of transaction participants, supply chain negotiation records, and annotations from multiple rounds of revisions. Negotiation conflict points in the training sample, such as price disputes and delivery date disagreements, are manually labeled, along with corresponding conflict resolution methods and the contract code segments for which consensus was reached. This creates a labeled training dataset, where data labels directly associate with the corresponding contract code segments or solutions, providing clear guidance for model learning.

[0062] Simultaneously, the RLHF framework is used for model fine-tuning. During training, the negotiation success rate is used as the main reward signal. When the revised solution generated by the model promotes consensus between the two parties, shortens the negotiation cycle, or effectively resolves the conflict, a positive reward is given. If the generated solution causes new conflicts or prolongs the negotiation process, a negative penalty is given to guide the model to optimize its decision-making logic. Finally, through targeted training, the model is made capable of simulating the role of a neutral arbitrator. When negotiation conflicts are detected, it can automatically generate fair and reasonable compromise suggestions based on historical case and solution data, such as suggesting acceptable solutions or specific solutions for both parties, to help break the negotiation deadlock. At the same time, through multiple rounds of iterative training, the semantic understanding accuracy and integration efficiency of the model for revision annotations are optimized to ensure that the generated revision solution meets the real needs of both parties and has no logical conflicts, thus completing the training of the negotiation revision model.

[0063] In one embodiment, the security deployment module 105 is used to perform a security audit on the negotiated and revised smart contract code, and complete the blockchain deployment after ensuring that the code is compliant and risk-free, thereby ensuring the security and traceability of the contract after it is put on the chain.

[0064] Specifically, after receiving the negotiated revision output by the contract negotiation and revision module 104, the smart contract code of the security deployment module 105 undergoes dual testing through its built-in security audit unit. In terms of formal verification, mathematical modeling is used to verify the logical integrity and execution correctness of the contract code, ensuring that the code can execute according to the expected logic in all preset scenarios and avoiding execution anomalies due to logical vulnerabilities. In terms of static security analysis, the code is scanned for vulnerabilities in a non-running state, focusing on detecting common security risks of smart contracts such as reentrancy attacks, integer overflows, and access control defects, while verifying whether the code complies with relevant supply chain laws and regulations and industry compliance standards.

[0065] If the security audit is passed, the security deployment module 105 deploys the approved smart contract code to the designated blockchain network through a preset blockchain API interface. After deployment, the system automatically records the unique contract address and transaction hash value corresponding to the smart contract, forming a deployment certificate. The contract address and transaction hash value will be synchronously fed back to the contract initiator and the intended contract user, facilitating both parties to query the contract deployment status, execution records, and related traceability information. If the security audit fails, the security deployment module 105 will output the specific vulnerability location and risk warning, feeding them back to the contract negotiation and revision module 104 for negotiation and revision until the audit is passed and deployment is completed.

[0066] It should be understood that the module division in the embodiments of this application is illustrative and only represents one logical functional division. In actual implementation, there may be other division methods. Furthermore, the functional modules in the various embodiments of this application can be integrated into a single processor, exist as separate physical entities, or be integrated into a single module. The integrated modules described above can be implemented in hardware or as software functional modules.

[0067] Similar to the principles of the above embodiments, Figure 2 illustrates a smart contract generation and interpretable negotiation method provided by the present invention.

[0068] Step S21: Perform intent analysis on the natural language information from the contract initiator user and generate the corresponding contract elements.

[0069] Step S22: Fill the contract elements into the matching contract template to obtain the initial smart contract code.

[0070] Step S23: Generate the corresponding contract interpretation based on the initial smart contract code.

[0071] Step S24: Display the contract explanation so that the contract initiating user and the contract prospective user can negotiate and obtain the agreed smart contract code.

[0072] Step S25: Perform a security audit on the agreed-upon smart contract code, and deploy the smart contract code that has passed the security audit on the blockchain.

[0073] Since the implementation principles of smart contract generation and interpretable negotiation methods have been described in the foregoing embodiments, they will not be repeated here.

[0074] To better illustrate the smart contract generation and interpretable negotiation method, this invention, in conjunction with Figure 3, uses a supply chain scenario where an equipment integrator (contract initiator) purchases sensors from a component supplier (contract prospective party) as a specific embodiment for further detailed explanation:

[0075] Example 1: A method for automatic generation and interpretable negotiation of smart contracts in a specific supply chain.

[0076] Step 1: The user inputs their natural language intent.

[0077] The equipment integrator (contract initiator) logs into the system interface and submits a procurement request in the natural language input area: "Purchase 2000 sensors of model XX from Party B, at a unit price of 30 yuan. Delivery to our factory is required by June 30th; for delayed delivery, a penalty of 0.5% of the total contract price will be paid daily. Payment will be made within 7 working days after the goods are accepted."

[0078] Step 2: Parse and generate contract elements.

[0079] The above natural language is input into the natural language intent understanding model, which has been fine-tuned for the supply chain scenario:

[0080] The natural language intent understanding model extracts core elements through named entity recognition: participants (contract initiator = equipment integrator, contract prospective party = component supplier), subject matter (sensor of model XX), quantity (2000 units), unit price (30 yuan / unit), delivery date (June 30), delivery location (a factory of the contract initiator), default triggering conditions (delayed delivery), consequences of default (payment of 0.5% of the total contract price per day), and payment terms (within 7 working days after acceptance).

[0081] Simultaneously, it completes relationship extraction (such as "the contract initiator and the contract prospective party have a procurement supply and demand relationship" and "delayed delivery and liquidated damages have a causal constraint relationship") and intent classification (determined as "procurement contract"), and finally outputs a structured JSON object containing all elements as contract elements.

[0082] Step 3: Generate the initial smart contract code.

[0083] Based on the intent classification results of "procurement contract", the "standard procurement smart contract template" is matched from the supply chain contract template library;

[0084] The code generation model is invoked to fill the contract elements into the fields corresponding to the template. For example, "2000 model XX sensors" are mapped to the target parameters of the placeOrder function to generate Solidity smart contract code containing core functions such as placeOrder (initiate purchase), confirmDelivery (confirm delivery), delayPenalty (calculate delay penalty), and makePayment (trigger payment).

[0085] Step 4: Generate Contract Interpretation

[0086] Output natural language description: "Main terms of this contract: 1. Party A orders 2000 sensors of model XX from Party B, at a unit price of 30 yuan / unit; 2. Party B shall deliver the goods to Party A's factory before June 30th. If the delivery is delayed, Party B shall pay 0.5% of the total contract price (60,000 yuan) as liquidated damages per day; 3. After Party A confirms that the goods have passed inspection, the contract will automatically trigger the payment operation to Party B 7 working days later."

[0087] Synchronously generate a logic flowchart to intuitively show the execution chain of "initiating purchase → confirming delivery → determining whether there is a delay → calculating liquidated damages (if there is a delay) → acceptance → triggering payment".

[0088] Step 5: Online negotiation among contracting parties.

[0089] After logging into the system, the parties interested in the contract can view the natural language instructions and flowcharts on the online interface;

[0090] The contracting party believes that "the daily penalty rate of 0.5% is too high" and submits a revision suggestion (changing it to 0.3%). The system automatically highlights the revised part.

[0091] The negotiation revision model generates a revision plan based on the "negotiation success rate" as a reward signal: "This revision will reduce the risk protection of the contract initiator. It is recommended to negotiate a penalty rate of 0.4% and require the contract prospective party to provide a factory quality inspection report (with an electronic signature)."

[0092] Step 6: Is there an agreement reached through negotiation?

[0093] If (through mutual agreement):

[0094] An agreement was reached to revise the penalty for breach of contract to 0.4%, and require the supplier to provide a quality inspection report with the goods.

[0095] If not (no agreement reached):

[0096] Based on the unresolved issues, return to step 5 for further negotiation until a revised solution is agreed upon.

[0097] Step 7: Revise the smart contract code based on the consensus solution

[0098] Generate agreed-upon smart contract code based on the agreed-upon revision scheme.

[0099] Step 8: Has the security check passed?

[0100] If (security check passed):

[0101] Once the security test is passed, the smart contract code that passes the security test will be determined as the final smart contract code to be uploaded to the blockchain.

[0102] If not (security check failed):

[0103] The part of the smart contract code that failed the security check was identified.

[0104] Step 9: Revise the parts of the code that failed to pass the review.

[0105] The parts that failed the security test will continue to be revised, and the process will return to step 5 for further negotiation until a consensus on the revision plan is reached.

[0106] Step 10: Deploy the blockchain

[0107] The contract is deployed to a specified blockchain via API, the contract address and transaction hash value are recorded, and feedback is provided to both parties to the contract.

[0108] This invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements any of the methods described above.

[0109] The smart contract generation and interpretable negotiation system provided in this embodiment of the invention can be implemented on the terminal side or the server side. Regarding the hardware structure of the electronic terminal, please refer to Figure 4, which is a schematic diagram of an optional hardware structure of the electronic terminal 4000 provided in this embodiment of the invention. The electronic terminal 4000 can be a mobile phone, computer device, tablet device, personal digital processing device, factory back-end processing device, etc. The electronic terminal 4000 includes: at least one processor 4001, a memory 4002, at least one network interface 40010, and a user interface 4009. The various components in the device are coupled together through a bus system 4005. It can be understood that the bus system 4005 is used to realize the connection and communication between these components. In addition to a data bus, the bus system 4005 also includes a power bus, a control bus, and a status signal bus. However, for clarity, all buses are labeled as bus systems in Figure 4.

[0110] The user interface 4009 may include a monitor, keyboard, mouse, trackball, clicker, button, touchpad, or touch screen.

[0111] It is understood that memory 4002 can be volatile memory or non-volatile memory, or both. Non-volatile memory can be read-only memory (ROM) or programmable read-only memory (PROM), which serves as an external cache. By way of example, but not limitation, many forms of RAM are available, such as static random access memory (SRAM) and synchronous static random access memory (SSRAM). The memories described in the embodiments of this invention are intended to include, but are not limited to, these and any other suitable categories of memory.

[0112] In this embodiment of the invention, the memory 4002 is used to store various types of data to support the operation of the electronic terminal 4000. Examples of this data include: any executable program for operation on the electronic terminal 4000, such as the operating system 40021 and application programs 40022; the operating system 40021 includes various system programs, such as the framework layer, core library layer, driver layer, etc., for implementing various basic services and handling hardware-based tasks. The application program 40022 may include various applications, such as media players, browsers, etc., for implementing various application services. The smart contract generation and interpretable negotiation system provided in this embodiment of the invention may be included in the application program 40022.

[0113] The methods disclosed in the above embodiments of the present invention can be applied to, or implemented by, processor 4001. Processor 4001 may be an integrated circuit chip with signal processing capabilities. During implementation, each step of the above methods can be completed by integrated logic circuits in the hardware of processor 4001 or by instructions in software form. Processor 4001 may be a general-purpose processor, a digital signal processor (DSP), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Processor 4001 can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of the present invention. General-purpose processor 4001 may be a microprocessor or any conventional processor, etc. The steps of the accessory optimization method provided in the embodiments of the present invention can be directly manifested as execution by a hardware decoding processor, or execution by a combination of hardware and software modules in the decoding processor. The software modules may be located in a storage medium, which is located in a memory. The processor reads information from the memory and, in conjunction with its hardware, completes the steps of the aforementioned methods.

[0114] In an exemplary embodiment, the electronic terminal 4000 may be used by one or more application-specific integrated circuits (ASICs), DSPs, programmable logic devices (PLDs), or complex programmable logic devices (CPLDs) to execute the aforementioned method.

[0115] Those skilled in the art will understand that all or part of the steps of the above-described method embodiments can be implemented using computer program-related hardware. The aforementioned computer program can be stored in a computer-readable storage medium. When executed, the program performs the steps of the above-described method embodiments; and the aforementioned storage medium includes various media capable of storing program code, such as ROM, RAM, magnetic disks, or optical disks.

[0116] In the embodiments provided in this application, the computer-readable and writable storage medium may include read-only memory, random access memory, EEPROM, CD-ROM or other optical disc storage devices, disk storage devices or other magnetic storage devices, flash memory, USB flash drive, portable hard drive, or any other medium capable of storing desired program code in the form of instructions or data structures and accessible by a computer. Additionally, any connection may be appropriately referred to as a computer-readable medium. For example, if instructions are transmitted from a website, server, or other remote source using coaxial cable, fiber optic cable, twisted pair, digital subscriber line (DSL), or wireless technologies such as infrared, radio, and microwave, then the coaxial cable, fiber optic cable, twisted pair, DSL, or wireless technologies such as infrared, radio, and microwave are included in the definition of medium. However, it should be understood that computer-readable and writable storage media and data storage media do not include connections, carrier waves, signals, or other transient media, but are intended for non-transient, tangible storage media. The disks and optical discs used in the application include compact optical discs (CDs), laser optical discs, optical discs, digital multifunction optical discs (DVDs), floppy disks, and Blu-ray discs, where disks typically copy data magnetically, while optical discs use lasers to copy data optically.

[0117] In summary, this invention provides a smart contract generation and interpretable negotiation system, method, medium, and terminal, which has the following beneficial effects: This invention performs intent analysis on natural language information from the contract initiating user to generate corresponding contract elements; fills the contract elements into a matching contract template to obtain initial smart contract code; generates a corresponding contract interpretation based on the initial smart contract code; displays the contract interpretation for negotiation between the contract initiating user and the contract prospective user to obtain a mutually agreed-upon smart contract code; performs a security audit on the mutually agreed-upon smart contract code, and deploys the security-audited smart contract code on the blockchain; this invention solves the problems of high barriers to understanding smart contracts and low negotiation efficiency in existing technologies, realizing the automatic and interpretable conversion of the natural language intent of supply chain participants into reliable and executable smart contracts, supporting efficient collaborative modification.

[0118] The above embodiments are merely illustrative of the principles and effects of the present invention and are not intended to limit the invention. Any person skilled in the art can modify or alter the above embodiments without departing from the spirit and scope of the present invention. Therefore, all equivalent modifications or alterations made by those skilled in the art without departing from the spirit and technical concept disclosed in the present invention should still be covered by the claims of the present invention.

Claims

1. A smart contract generation and interpretable negotiation system, characterized in that, include: The system comprises a natural language intent understanding module, a contract code generation module, a contract interpretation module, a contract negotiation and revision module, and a security deployment module. The natural language intent understanding module analyzes the natural language information from the contract initiating user to generate corresponding contract elements. The contract code generation module, connected to the natural language intent understanding module, fills the contract elements into a matching contract template to obtain initial smart contract code. The contract interpretation module, connected to the contract code generation module, generates a corresponding contract interpretation based on the initial smart contract code. Generating the corresponding contract interpretation based on the initial smart contract code includes: processing the initial smart contract... The contract interpretation model, constructed from the input code, performs natural language translation on the initial smart contract code, generating a corresponding natural language description and a visual flowchart illustrating the smart contract execution logic. The contract negotiation and revision module, connected to the contract interpretation module, displays the contract interpretation for negotiation between the contract initiator and prospective users to obtain a mutually agreed-upon smart contract code. The contract interpretation is displayed through the online negotiation interface of the contract negotiation and revision module, allowing the initiator and prospective users to negotiate the initial smart contract code online. If an agreement is reached, the initial smart contract code is used as the agreed-upon smart contract code; otherwise, the agreement is not reached. If an agreement is reached, a negotiation and revision process is executed. This process includes: the contract initiating user and / or the contract prospective user revising the smart contract code on an online negotiation interface, and the contract initiating user and the contract prospective user negotiating the revised smart contract code. If an agreement is reached, the revised smart contract code is adopted as the agreed-upon smart contract code. If no agreement is reached, the contract initiating user and / or the contract prospective user revise the smart contract code again on the online negotiation interface until an agreement is reached on the revised smart contract code. The method of revising the smart contract code includes: the contract initiating user... Users and / or prospective contract users can add revision annotations to the current smart contract code on the online negotiation interface; based on the negotiation revision model, the revision annotations are integrated and risk analyzed to generate a corresponding revision plan, and the revised smart contract code is generated based on the revision plan; the negotiation revision process also includes: the contract negotiation revision module will capture modification operations in real time and automatically highlight the corresponding contract explanation text, visual flowchart and related contract code segments in the online negotiation interface; the security deployment module, connected to the contract negotiation revision module, is used to perform security audits on the negotiated smart contract code and deploy the security-audited smart contract code on the blockchain.

2. The smart contract generation and interpretable negotiation system according to claim 1, characterized in that, The step of performing intent analysis on natural language information from the contract initiating user to generate corresponding contract elements includes: receiving natural language information containing a specific intent from the contract initiating user; inputting the natural language information into a constructed natural language understanding model for named entity recognition, relation extraction, and intent classification, and outputting the corresponding structured contract elements.

3. The smart contract generation and interpretable negotiation system according to claim 1, characterized in that, The step of filling the contract elements into a matching contract template to obtain the initial smart contract code includes: based on the scene features in the contract elements, retrieving a contract template that matches the scene from a preset contract template library; inputting the contract elements and the contract template into the constructed code generation model, so that the contract elements are filled into the contract template to obtain the initial smart contract code.

4. The smart contract generation and interpretable negotiation system according to claim 1, characterized in that, The security deployment module is used to perform formal verification and static security analysis on the agreed smart contract code, deploy the smart contract code that has passed the security audit on the blockchain, and record the contract address and hash value.

5. A method for generating and interpretable negotiation of smart contracts, characterized in that, The method includes: performing intent analysis on natural language information from the contract initiating user to generate corresponding contract elements; filling the contract elements into a matching contract template to obtain initial smart contract code; generating a corresponding contract explanation based on the initial smart contract code; specifically, the method includes: inputting the initial smart contract code into a constructed contract explanation model, translating the initial smart contract code into natural language to generate a corresponding natural language description and a visual flowchart reflecting the smart contract execution logic; displaying the contract explanation for the contract initiating user and the contract prospective user to negotiate and obtain a mutually agreed smart contract code; specifically, the method includes: displaying the contract explanation through an online negotiation interface for the contract initiating user and the contract prospective user to negotiate the initial smart contract code on the online negotiation interface; if the negotiation reaches an agreement, the initial smart contract code is used as the mutually agreed smart contract code; if the negotiation fails to reach an agreement, a negotiation revision process is executed; the mutually agreed smart contract code undergoes a security audit, and the smart contract code that passes the security audit is deployed on the blockchain; wherein, The negotiation and revision process includes: the contract initiating user and / or the contract prospective user revising the smart contract code on the online negotiation interface, and the contract initiating user and the contract prospective user negotiating the revised smart contract code; if the negotiation reaches an agreement, the revised smart contract code is used as the agreed smart contract code; if the negotiation fails to reach an agreement, the contract initiating user and / or the contract prospective user revises the smart contract code on the online negotiation interface until an agreement is reached on the revised smart contract code; wherein, the method of revising the smart contract code includes: the contract initiating user and / or the contract prospective user annotating the current smart contract code on the online negotiation interface; based on the negotiation and revision model, the revision annotations are integrated and risk analyzed to generate a corresponding revision scheme, and the revised smart contract code is generated based on the revision scheme; the negotiation and revision process also includes: real-time capture of modification operations, and automatic highlighting of the corresponding contract explanation text, visual flowchart and related contract code segments in the online negotiation interface.

6. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the method of claim 5.

7. An electronic terminal, comprising a memory, a processor, and a computer program stored in the memory, characterized in that, The processor executes the computer program to implement the method of claim 5.

Citation Information

Patent Citations

  • Intelligent contract generation system, method and device based on large model and storage medium

    CN118504542A

  • Executable code blocks based on captured user interactions

    US20230131294A1

  • Using generative artificial intelligence for automated analysis of smart contracts on blockchain

    US20250078074A1

  • Devices, systems, and methods for transpiling machine-readable code into a human-readable format for the improved generation of an electronic contract stored on a blockchain network

    WO2024249378A2