A bank smart contract generation method, device and equipment based on generative AI and medium
By generating a smart contract framework for banks using generative AI, and utilizing financial analysis models and knowledge graphs for logical path reasoning and verification, the system solves the problems of low efficiency and compliance in manual coding of banking contracts, and achieves automation and standardization of contract development.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- THE BANK OF CHONGQING CO LTD
- Filing Date
- 2026-03-25
- Publication Date
- 2026-06-23
AI Technical Summary
When generating smart contracts, the banking industry faces challenges such as difficulty in ensuring the accuracy and consistency of business logic due to the reliance on manual coding in contract generation methods, and the potential for compliance oversights.
A generative AI-generated contract framework is adopted. By acquiring banking business requirements, financial analysis models are used to parse and construct knowledge graphs, perform logical path reasoning and verification, and generate contract code that conforms to financial rules, thus avoiding manual coding.
It has achieved automation and standardization of contract development, improved the accuracy and consistency of contract generation, reduced compliance oversights, and solved the adaptation problem in a multi-chain environment.
Smart Images

Figure CN122264731A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of artificial intelligence technology, and in particular to a method, apparatus, device, and medium for generating smart contracts for banks based on generative AI. Background Technology
[0002] Currently, the banking industry faces a series of prominent challenges when using blockchain smart contract technology.
[0003] Current methods for generating bank contracts heavily rely on manual coding by professional blockchain programmers. This approach struggles to guarantee the accuracy and consistency of business logic and is prone to compliance oversights. Therefore, improving the accuracy and consistency of contract generation while reducing compliance loopholes has become a pressing technical challenge. Summary of the Invention
[0004] In view of this, the purpose of this invention is to provide a method, apparatus, device, and medium for generating smart contracts for banks based on generative AI. This method can generate contract frameworks through generative AI and then generate bank contracts based on those frameworks, avoiding manual coding and solving the problems of low efficiency and reliance on individual skill in manual coding. The specific solution is as follows:
[0005] Firstly, this application provides a method for generating smart contracts for banks based on generative AI, including:
[0006] Obtain the target banking business needs of the target business users, and use a preset financial analysis model to analyze the target banking business needs in order to obtain the structured demand information corresponding to the target banking business needs;
[0007] The target knowledge graph is queried based on the structured requirement information to obtain the financial rule constraints corresponding to the target banking business requirement. A target contract framework is generated based on the financial rule constraints and a preset contract framework generation model. An initial business logic path corresponding to the target banking business requirement is generated based on the target contract framework. The preset contract framework generation model is an artificial intelligence model built based on generative AI.
[0008] The initial business logic path is verified, the target business logic path is obtained based on the verification result, and the target business logic path is converted into target bank contract code corresponding to the data format of the target blockchain platform.
[0009] Optionally, the step of using a preset financial analysis model to analyze the target banking business demand to obtain structured demand information corresponding to the target banking business demand includes:
[0010] The preset financial analysis model is used to identify the intent and extract entities of the target banking business needs in order to obtain the structured demand information corresponding to the target banking business needs.
[0011] Optionally, before querying the target knowledge graph based on the structured requirement information, the method further includes:
[0012] Obtain the target financial data corresponding to the banking business requirements; wherein, the target financial data includes regulatory rules, contract templates and case data corresponding to the banking business requirements;
[0013] The target knowledge graph is constructed using the target financial data; wherein the target knowledge graph includes semantic relationships and constraint attributes between financial entities, and the target knowledge graph can be updated in real time.
[0014] Optionally, generating the initial business logic path corresponding to the target banking business requirement based on the target contract framework includes:
[0015] The graph nodes corresponding to each business step in the target business rule are determined from the target knowledge graph. Under the constraints of the target contract framework and the graph nodes, the shortest path reasoning is performed in the target knowledge graph using the target logic algorithm to obtain the initial business logic path. The target logic algorithm includes a backtracking search algorithm and a constraint propagation algorithm.
[0016] Optionally, the step of validating the initial business logic path and obtaining the target business logic path based on the corresponding validation result includes:
[0017] A preset path verification model is used to detect conflicts between the logical steps in the initial business logic path and the financial rule constraints. If any logical step conflicts with the financial rule constraints, the initial business logic path is determined to have failed the detection.
[0018] If none of the logical steps conflict with the financial rule constraints, then the initial business logic path is determined to have passed the test.
[0019] Optionally, the step of validating the initial business logic path and obtaining the target business logic path based on the corresponding validation result includes:
[0020] The initial business logic path is validated. If the validation result indicates that the initial business logic path passes the validation, then the initial business logic path is directly determined as the target business logic path.
[0021] If the initial business logic path fails the verification, the target logic step in the initial business logic path that conflicts with the financial rule constraints is identified, a correction instruction corresponding to the target logic step is generated, and the initial business logic path is partially replanned using the correction instruction to obtain the target business logic path.
[0022] Optionally, the step of converting the target business logic path into target bank contract code corresponding to the data format of the target blockchain platform includes:
[0023] By utilizing the structure mapping table corresponding to the target blockchain platform in the preset cross-chain adaptation rule base, each logical step in the target business logic path is converted into the syntax structure of the data format of the target blockchain platform to obtain the target bank contract code.
[0024] Secondly, this application provides a bank smart contract generation device based on generative AI, comprising:
[0025] The requirement parsing module is used to obtain the target banking business requirements of the target business users and to parse the target banking business requirements using a preset financial analysis model in order to obtain the structured requirement information corresponding to the target banking business requirements.
[0026] The graph query module is used to query the target knowledge graph based on the structured requirement information to obtain the financial rule constraints corresponding to the target banking business requirement, generate a target contract framework based on the financial rule constraints and a preset contract framework generation model, and generate the initial business logic path corresponding to the target banking business requirement according to the target contract framework; wherein, the preset contract framework generation model is an artificial intelligence model built based on generative AI.
[0027] The contract generation module is used to verify the initial business logic path, obtain the target business logic path based on the corresponding verification result, and convert the target business logic path into target bank contract code corresponding to the data format of the target blockchain platform.
[0028] Thirdly, this application provides an electronic device, comprising:
[0029] Memory, used to store computer programs;
[0030] A processor is used to execute the computer program to implement the aforementioned method for generating smart contracts for banks based on generative AI.
[0031] Fourthly, this application provides a computer-readable storage medium for storing a computer program, which, when executed by a processor, implements the aforementioned method for generating smart bank contracts based on generative AI.
[0032] This application first obtains the target banking business needs of the target business users, and then uses a preset financial analysis model to parse the target banking business needs to obtain the structured demand information corresponding to the target banking business needs. Next, based on the structured demand information, it queries the target knowledge graph to obtain the financial rule constraints corresponding to the target banking business needs. Based on the financial rule constraints and a preset contract framework generation model, it generates a target contract framework, and generates an initial business logic path corresponding to the target banking business needs according to the target contract framework. The preset contract framework generation model is an artificial intelligence model built based on generative AI. Finally, it verifies the initial business logic path, obtains the target business logic path based on the corresponding verification results, and converts the target business logic path into target bank contract code corresponding to the data format of the target blockchain platform. Therefore, this application utilizes generative AI to generate a contract framework and then generates bank contracts based on that framework, thus avoiding manual coding, achieving automation and standardization in contract development, and solving the problems of low efficiency and quality dependence on individuals in manual coding. By verifying the initial business logic path and obtaining the target logic path based on the verification results, compliance is embedded in the generation process, avoiding compliance oversights that are easily caused by manual coding. By converting the target logic path into the data format of the target blockchain platform, cross-chain adaptation is achieved, solving the adaptation problem in a multi-chain coexistence environment. Attached Figure Description
[0033] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.
[0034] Figure 1 This is a schematic diagram of a bank smart contract generation method based on generative AI disclosed in this application;
[0035] Figure 2 This application discloses a flowchart of a smart contract generation process.
[0036] Figure 3 This application discloses a logic flow verification flowchart;
[0037] Figure 4This is a schematic diagram of a bank smart contract generation device based on generative AI disclosed in this application;
[0038] Figure 5 This is a structural diagram of an electronic device disclosed in this application. Detailed Implementation
[0039] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0040] See Figure 1 As shown in the figure, this invention discloses a method for generating smart contracts for banks based on generative AI, including:
[0041] Step S11: Obtain the target banking business needs of the target business users, and use a preset financial analysis model to analyze the target banking business needs to obtain the structured demand information corresponding to the target banking business needs.
[0042] This embodiment uses generative AI as the core driver, without relying on traditional supervised learning and massive parameter tuning. Its workflow is as follows: Figure 2 As shown: First, the parsed business requirements are semantically matched with the knowledge graph to extract relevant entities, relationships, and constraints. Second, the structured requirements and compliance constraints are integrated into generative AI precise prompts, which are then input into a customized generative AI model for the financial field to initially generate an abstract contract framework that conforms to the business logic. Third, based on graph path reasoning, the framework output by the generative AI is optimized, and a sequence of business logic steps that satisfy all constraints is automatically arranged. Finally, verified logic units (such as "interest calculation" and "default trigger") in the contract component library are called to assemble an abstract business logic flow that is independent of the blockchain, and contract code is generated based on the abstract business logic flow.
[0043] The smart contract generation system for banks in this embodiment aims to achieve fully automated AI-driven contract code generation across the entire chain, from business requirements to multi-chain adaptation and compliant security, by deeply integrating financial knowledge graphs and generative artificial intelligence. The system is divided into an interaction layer, a core engine layer, and a resource layer from top to bottom. The interaction layer provides natural language interfaces and structured forms to capture the business intent of banking personnel. The core engine layer comprises four modules: requirement parsing, generative AI logic generation, compliance verification, and structure adaptation; it is the "brain" of the system. The resource layer includes a financial compliance knowledge graph, a contract component library, and a cross-chain adaptation rule base, providing power to the engine layer.
[0044] In this embodiment, a preset financial analysis model is used to analyze the target banking business requirements in order to obtain the structured requirement information corresponding to the target banking business requirements. This includes: using the preset financial analysis model to perform intent recognition and entity extraction on the target banking business requirements in order to obtain the structured requirement information corresponding to the target banking business requirements.
[0045] Specifically, banking staff can input their business requirements (i.e., target business requirements) through a web interface, either in natural language (such as "Create a revolving loan contract for movable property mortgages for SMEs, with a limit of 1 million, a maximum loan-to-value ratio of 70%, and an interest rate that fluctuates according to the LPR") or by filling out a structured form. <font color="red">This step uses an understanding type AI (i.e. preset financial analysis model) (BERT model) as a pre-processing module for generative AI< / font> The demand analysis module uses a pre-trained BERT model in the financial field to perform intent recognition and entity extraction on natural language, and outputs a structured demand object (i.e., structured demand information) Req {business type, participants, key terms (collateral ratio, interest rate, term)} suitable for generative AI input, providing a precise and structured input foundation for the subsequent core generation process of generative AI.
[0046] Step S12: Query the target knowledge graph based on the structured requirement information to obtain the financial rule constraints corresponding to the target banking business requirement; generate a target contract framework based on the financial rule constraints and the preset contract framework generation model; and generate the initial business logic path corresponding to the target banking business requirement according to the target contract framework; wherein, the preset contract framework generation model is an artificial intelligence model built based on generative AI.
[0047] In this embodiment, before querying the target knowledge graph based on structured requirement information, the following steps are also included:
[0048] Acquire target financial data corresponding to banking business needs; wherein, the target financial data includes regulatory rules, contract templates and case data corresponding to banking business needs; construct a target knowledge graph using the target financial data; wherein, the target knowledge graph includes semantic relationships and constraint attributes between financial entities, and the knowledge graph can be updated in real time.
[0049] Specifically, the target knowledge graph is constructed around the core of a "regulatory rule - contract template - case data" triple. It is not a static database, but rather dynamically updates the relationships (such as "must meet" and "prohibited") and attributes (such as "loan ratio cap") between entities (such as "borrower" and "collateral") by continuously learning from the latest regulatory documents, case law, and standard contract texts. This forms a machine-understandable semantic network of financial compliance, providing precise and interpretable compliance constraints for generative AI logic generation.
[0050] In this embodiment, the key entities and terms in the Req are used as the input to the financial compliance knowledge graph (i.e., the target knowledge graph). The graph is stored in the Neo4j graph database, and queries are performed using Cypher statements, for example:
[0051] MATCH (r:Regulation)-[:REGULATE]->(c:Clause {name: 'Loan-to-Value Ratio'});
[0052] MATCH (c)-[rel:APPLY_TO]->(p:Product {type: 'Revolving Loan'});
[0053] RETURN r.id, r.content, rel.value_limit;
[0054] The system acquires all relevant rules and their constraint values (e.g., value_limit=0.7), forming a structured constraint set C (i.e., financial rule constraints). The structured requirement object Req is merged with the structured constraint set C, and a precise generative AI prompt, Prompt, is constructed according to the generative AI prompt engineering specifications. The Prompt contains core information such as business requirements, compliance constraints, and business step requirements. The Prompt is then input into a customized generative AI contract logic generation model for the financial field (i.e., a preset contract framework generation model). This model is a dedicated financial contract generation model based on the CodeLlama / GLM (General Language Model, a pre-trained architecture for a general large language model). The model automatically generates an abstract contract logic framework (i.e., the target contract framework) Draft_L that meets business requirements and preliminary compliance requirements.
[0055] In addition, in this embodiment, the initial business logic path corresponding to the target banking business requirement is generated according to the target contract framework, including: determining the graph nodes corresponding to each business step in the target business rules from the target knowledge graph, and using the target logic algorithm to perform shortest path reasoning in the target knowledge graph under the constraints of the target contract framework and the graph nodes to obtain the initial business logic path; wherein the target logic algorithm includes a backtracking search algorithm and a constraint propagation algorithm.
[0056] Specifically, the logic generation algorithm performs constrained shortest path reasoning on the generative AI output Draft_L on a graph. The algorithm treats each business step (such as "application," "valuation," "loan disbursement," "repayment," and "default handling") as a graph node, and compliance rules as constraints that the path must satisfy. The algorithm's goal is to find a path from the start event to the end event that covers all necessary business nodes, and where all edges (relationships) satisfy the constraints. This can be formalized as a constraint satisfaction problem (CSP):
[0057] Let the variable set X = {x1, x2, ..., xn} represent the possible sequence of business steps, and the value range D_i be the set of optional operations for each step. The constraint set C comes from the knowledge graph, for example, C1: x_j (mortgage valuation) / x_k (collateral value) >= 0.7. The system uses backtracking search and constraint propagation algorithms to solve this CSP, optimize Draft_L, and obtain the optimal business logic sequence LogicFlow = [S1, S2, ..., Sm].
[0058] By using a financial compliance knowledge graph as the basis for deterministic reasoning, the generation process is interpretable and the results are auditable. This not only leverages the creative generation capabilities of generative AI but also avoids the unacceptability of model "black box" and "illusion" problems in the financial field.
[0059] This embodiment transforms the core driver of generation from "manual / fixed template" to a dual engine of "generative AI + knowledge graph". Generative AI enables autonomous and flexible logical generation, while the knowledge graph provides the generative AI with professional "common sense" and "regulatory" knowledge constraints in the financial field. The generation process is essentially intelligent reasoning and creation of generative AI under the constraints of the knowledge graph, rather than simple pattern fitting or manual splicing.
[0060] Step S13: Verify the initial business logic path, obtain the target business logic path based on the corresponding verification result, and convert the target business logic path into target bank contract code corresponding to the data format of the target blockchain platform.
[0061] In this embodiment, the initial business logic path is validated, and the target business logic path is obtained based on the corresponding validation results. This includes: using a preset path validation model to detect conflicts between the logical steps in the initial business logic path and the financial rule constraints; if any logical step conflicts with the financial rule constraints, the initial business logic path is determined to have failed the validation; if none of the logical steps conflict with the financial rule constraints, the initial business logic path is determined to have passed the validation.
[0062] In other words, this implementation "soft-aligns" the abstract logical flow output by generative AI with the mandatory regulatory rules in the knowledge graph, and calculates the conflict score between the logical steps and the compliance rules through a multi-head attention mechanism. If a potential conflict is detected (such as "not including the cross-border transaction reporting step"), the compliance pre-verification model (i.e., the path pre-verification model) will immediately feed back a correction signal to the generative AI logic generation algorithm, guiding it to reconstruct the logical path, thereby avoiding fundamental compliance risks before code generation and forming a generative AI closed loop of generation-verification-feedback-regeneration.
[0063] In addition, the initial business logic path is validated, and the target business logic path is obtained based on the validation result. This includes: validating the initial business logic path; if the validation result indicates that the initial business logic path passes the validation, then the initial business logic path is directly determined as the target business logic path; if the initial business logic path fails the validation, then the target logic steps in the initial business logic path that conflict with financial rule constraints are identified, correction instructions corresponding to the target logic steps are generated, and the initial business logic path is partially replanned using the correction instructions to obtain the target business logic path.
[0064] Specifically, for each step Si in the logic flow, the system matches the corresponding formally verified logic code block Block_i from the contract component library. The assembly process is a combination of sequence and branching to form the abstract business logic flow to be verified (i.e., the initial business logic path). Simultaneously, a compliance pre-verification model linked to generative AI is initiated. This model is a Transformer-based encoder, serving as a supporting verification module for generative AI. Its Transformer architecture works in synergy with the underlying architecture of the generative AI model, encoding the textual description T(L) of the LogicFlow and all relevant regulatory rule texts {T(R1), ... T(Rp)} respectively.
[0065] set up Encode vectors for logical streams. This is the rule set encoding matrix. Model calculation. and Multi-head attention:
[0066] ;
[0067] Where, Q = * , K = * V = * Q is the query vector, which is the "retrieval probe" by which the contract logic searches for matching rules in the semantic space; K is the key vector, which is the "feature label" of the regulatory rule in the semantic space; V is the value vector, which is the actual semantic information and importance weight of the regulatory rule. Encode vectors for logical streams; , , These are the weight matrices corresponding to Q, K, and V, respectively.
[0068] In the attention weight matrix A, A_{ij} represents the association strength between logical step i and rule j. The model defines a conflict detection function f_conflict to mark items in A with high weights but whose logical descriptions clearly contradict the semantics of the rules (judged by negative cosine similarity values). Figure 3 As shown, if a conflict is found, such as the step required by rule Rj not being reflected in the logic, a correction instruction Feedback is generated (e.g., "Please insert the step 'report transaction filing to the regulator' after step 2") and returned to the initial generation stage of generative AI, triggering generative AI to reconstruct the logic path according to the correction instruction, forming a generative AI closed loop of generation-verification-feedback-regeneration.
[0069] By leveraging a compliance pre-verification model and a real-time feedback mechanism from generative AI, compliance review is moved from the traditional ex-post, manual process to the pre-process of automatic generative AI generation, transforming "compliance checking" into "compliance design" and fundamentally reducing legal risks. In other words, this embodiment utilizes an attention mechanism for soft compliance review during generative AI code generation and dynamically guides the generative AI's refactoring logic, transforming compliance from an externally imposed attribute into an inherent, intrinsic one, thus addressing the industry pain point of pure generative AI easily generating non-compliant content.
[0070] By separating the "abstract logic flow" from the "concrete chain structure" design concept and using standardized structure mapping, the system effectively solves the adaptation problem of smart contracts for banks in a multi-chain coexistence environment. Combined with the batch generation capability of generative AI, it greatly improves development efficiency and operational consistency.
[0071] In addition, the target business logic path is transformed into target bank contract code corresponding to the data format of the target blockchain platform. This includes: using a structure mapping table in the preset cross-chain adaptation rule base that corresponds to the target blockchain platform to convert each logical step in the target business logic path into the syntax structure of the data format of the target blockchain platform in order to obtain the target bank contract code.
[0072] This system has a built-in cross-chain adaptation rule base, defining a "structure mapping table" for each mainstream blockchain platform. The abstract business logic flow, after compliance verification, will be automatically converted into a standardized code structure that conforms to the virtual machine specification of the target chain, based on the target chain's "structure mapping table". This includes specific state variable definitions, function modifiers, event triggering formats, and on-chain and off-chain interaction interfaces, realizing "one-time logic design, multi-chain code deployment" and maximizing the batch generation and adaptation capabilities of generative AI.
[0073] The system's final output consists of a deployable smart contract code package and related documentation. The outputs include: compilable contract source code for the target blockchain platform, contract interaction instructions, and a detailed compliance self-inspection report. This report clearly identifies the regulatory clause numbers that each piece of code meets, facilitating auditing. All outputs are final results of generative AI end-to-end processing, requiring no manual recoding.
[0074] Specifically, the validated LogicFlow and its corresponding code block set {Block_i} are sent to the structure adaptation module, which is the implementation stage for the core output of generative AI. The module loads the corresponding structure mapping table based on the target chain selected by the user (such as Hyperledger Fabric). This table is a JSON configuration that defines:
[0075] Naming conventions and storage methods for state variables (such as Fabric's World State).
[0076] Function signature format and access control modifiers.
[0077] Fixed methods of the chaincode interface (such as Init, Invoke).
[0078] Standards for defining an event.
[0079] The adapter iterates through {Block_i}, performing syntax transformation and encapsulation on each code segment according to the mapping table. For example, the generic `emitEvent("LoanIssued", args)` call is transformed into the Fabric chaincode `ctx.stub.setEvent("LoanIssued", payloadBuffer)`. Finally, all the transformed code blocks are assembled according to the target chain's contract file structure (such as the Fabric's `main.go` package structure) to generate a complete source code file that conforms to the specific chain's syntax.
[0080] The final delivery package after the end-to-end processing of generative AI is as follows:
[0081] 1) The smart contract source code files of the target chain;
[0082] 2) An API interface documentation listing all callable functions and their parameters;
[0083] 3) A machine-readable compliance evidence document (such as XML format) that associates code snippets from the contract with rule IDs in the knowledge graph.
[0084] All deliverables are final versions of generative AI, constrained by knowledge graphs and subject to compliance verification feedback, without any manual recoding. Users can directly deploy the source code to the corresponding blockchain network and utilize compliant evidence documents to support internal and external audits, completing the end-to-end implementation of generative AI from requirement input to contract deployment.
[0085] By introducing an "abstract logic flow" intermediate layer and a "structure mapping table," business logic is decoupled from the underlying blockchain technology. Combined with the batch generation capabilities of generative AI, contract logic can be "modeled once and deployed in multiple places," solving the fragmentation problem caused by heterogeneous blockchain platforms and maximizing the technological value of generative AI.
[0086] Therefore, this application utilizes generative AI to generate a contract framework and then generates bank contracts based on that framework, thus avoiding manual coding, achieving automation and standardization in contract development, and solving the problems of low efficiency and quality dependence on individuals in manual coding. By verifying the initial business logic path and obtaining the target logic path based on the verification results, compliance is embedded in the generation process, avoiding compliance oversights that are easily caused by manual coding. By converting the target logic path into the data format of the target blockchain platform, cross-chain adaptation is achieved, solving the adaptation problem in a multi-chain coexistence environment.
[0087] See Figure 4 As shown in the figure, an embodiment of the present invention discloses a bank smart contract generation device based on generative AI, comprising:
[0088] The requirement parsing module 11 is used to obtain the target banking business requirements of the target business users and to parse the target banking business requirements using a preset financial analysis model in order to obtain the structured requirement information corresponding to the target banking business requirements.
[0089] The graph query module 12 is used to query the target knowledge graph based on the structured requirement information to obtain the financial rule constraints corresponding to the target banking business requirement, generate a target contract framework based on the financial rule constraints and a preset contract framework generation model, and generate the initial business logic path corresponding to the target banking business requirement according to the target contract framework; wherein, the preset contract framework generation model is an artificial intelligence model built based on generative AI.
[0090] The contract generation module 13 is used to verify the initial business logic path, obtain the target business logic path according to the corresponding verification result, and convert the target business logic path into target bank contract code corresponding to the data format of the target blockchain platform.
[0091] In some specific embodiments, the requirement parsing module 11 may specifically include:
[0092] The demand information acquisition unit is used to perform intent recognition and entity extraction on the target banking business demand using the preset financial analysis model, so as to obtain the structured demand information corresponding to the target banking business demand.
[0093] In some specific embodiments, the map query module 12 further includes:
[0094] The data acquisition unit is used to acquire target financial data corresponding to banking business needs; wherein, the target financial data includes regulatory rules, contract templates and case data corresponding to banking business needs;
[0095] The graph construction unit is used to construct the target knowledge graph using the target financial data; wherein the target knowledge graph includes semantic relationships and constraint attributes between financial entities, and the target knowledge graph can be updated in real time.
[0096] In some specific embodiments, the map query module 12 may specifically include:
[0097] The path acquisition unit is used to determine the graph nodes corresponding to each business step in the target business rule from the target knowledge graph, and under the constraints of the target contract framework and the graph nodes, to perform shortest path reasoning in the target knowledge graph using the target logic algorithm to obtain the initial business logic path; wherein the target logic algorithm includes a backtracking search algorithm and a constraint propagation algorithm.
[0098] In some specific embodiments, the contract generation module 13 may specifically include:
[0099] The conflict detection unit is used to perform conflict detection between the logical steps in the initial business logic path and the financial rule constraints using a preset path verification model. If any logical step conflicts with the financial rule constraints, the initial business logic path is determined to have failed the detection.
[0100] The detection result determination unit is used to determine that the initial business logic path passes the detection if there is no conflict between each of the logical steps and the financial rule constraints.
[0101] In some specific embodiments, the contract generation module 13 may specifically include:
[0102] The path determination unit is used to verify the initial business logic path. If the verification result indicates that the initial business logic path passes the verification, the initial business logic path is directly determined as the target business logic path.
[0103] The path replanning unit is used to determine the target logical step in the initial business logic path that conflicts with the financial rule constraints if the initial business logic path fails the verification, generate the correction instruction corresponding to the target logical step, and use the correction instruction to perform local replanning on the initial business logic path to obtain the target business logic path.
[0104] In some specific embodiments, the contract generation module 13 may specifically include:
[0105] The contract acquisition unit is used to convert each logical step in the target business logic path into the syntax structure of the data format of the target blockchain platform by using the structure mapping table corresponding to the target blockchain platform in the preset cross-chain adaptation rule base, so as to obtain the target bank contract code.
[0106] Furthermore, embodiments of this application also disclose an electronic device, Figure 5 This is a structural diagram of an electronic device 20 according to an exemplary embodiment. The content of the diagram should not be construed as limiting the scope of this application.
[0107] Figure 5 This is a schematic diagram of the structure of an electronic device 20 provided in an embodiment of this application. Specifically, the electronic device 20 may include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input / output interface 25, and a communication bus 26. The memory 22 stores a computer program, which is loaded and executed by the processor 21 to implement the relevant steps in the generative AI-based smart contract generation method for banks disclosed in any of the foregoing embodiments. Alternatively, the electronic device 20 in this embodiment may specifically be an electronic computer.
[0108] In this embodiment, the power supply 23 is used to provide operating voltage for each hardware device on the electronic device 20; the communication interface 24 can create a data transmission channel between the electronic device 20 and external devices, and the communication protocol it follows can be any communication protocol applicable to the technical solution of this application, and is not specifically limited here; the input / output interface 25 is used to acquire external input data or output data to the outside world, and its specific interface type can be selected according to specific application needs, and is not specifically limited here.
[0109] In addition, the memory 22, as a carrier for resource storage, can be a read-only memory, random access memory, disk or optical disk, etc. The resources stored thereon can include operating system 221, computer program 222, etc., and the storage method can be temporary storage or permanent storage.
[0110] The operating system 221 is used to manage and control the various hardware devices on the electronic device 20 and the computer program 222, which may be Windows Server, Netware, Unix, Linux, etc. In addition to including a computer program capable of performing the generative AI-based smart contract generation method for banks, which is executed by the electronic device 20 as disclosed in any of the foregoing embodiments, the computer program 222 may further include computer programs capable of performing other specific tasks.
[0111] Furthermore, this application also discloses a computer-readable storage medium for storing a computer program; wherein, when the computer program is executed by a processor, it implements the aforementioned disclosed method for generating smart bank contracts based on generative AI. Specific steps of this method can be found in the corresponding content disclosed in the foregoing embodiments, and will not be repeated here.
[0112] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the apparatus disclosed in the embodiments, since it corresponds to the method disclosed in the embodiments, the description is relatively simple; relevant parts can be referred to in the method section.
[0113] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0114] The steps of the methods or algorithms described in conjunction with the embodiments disclosed herein can be implemented directly by hardware, a software module executed by a processor, or a combination of both. The software module can be located in random access memory (RAM), main memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, removable disk, CD-ROM, or any other form of storage medium known in the art.
[0115] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0116] The technical solutions provided in this application have been described in detail above. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the above embodiments are only for the purpose of helping to understand the methods and core ideas of this application. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this application. Therefore, the content of this specification should not be construed as a limitation of this application.
Claims
1. A method for generating smart contracts for banks based on generative AI, characterized in that, include: Obtain the target banking business needs of the target business users, and use a preset financial analysis model to analyze the target banking business needs in order to obtain the structured demand information corresponding to the target banking business needs; The target knowledge graph is queried based on the structured requirement information to obtain the financial rule constraints corresponding to the target banking business requirement. A target contract framework is generated based on the financial rule constraints and a preset contract framework generation model. An initial business logic path corresponding to the target banking business requirement is generated based on the target contract framework. The preset contract framework generation model is an artificial intelligence model built based on generative AI. The initial business logic path is verified, the target business logic path is obtained based on the verification result, and the target business logic path is converted into target bank contract code corresponding to the data format of the target blockchain platform.
2. The method for generating bank smart contracts based on generative AI according to claim 1, characterized in that, The step of using a pre-set financial analysis model to analyze the target banking business demand to obtain structured demand information corresponding to the target banking business demand includes: The preset financial analysis model is used to identify the intent and extract entities of the target banking business needs in order to obtain the structured demand information corresponding to the target banking business needs.
3. The method for generating bank smart contracts based on generative AI according to claim 1, characterized in that, Before querying the target knowledge graph based on the structured requirement information, the process also includes: Obtain the target financial data corresponding to the banking business requirements; wherein, the target financial data includes regulatory rules, contract templates and case data corresponding to the banking business requirements; The target knowledge graph is constructed using the target financial data; wherein the target knowledge graph includes semantic relationships and constraint attributes between financial entities, and the target knowledge graph can be updated in real time.
4. The method for generating bank smart contracts based on generative AI according to claim 1, characterized in that, The step of generating the initial business logic path corresponding to the target banking business requirement based on the target contract framework includes: The graph nodes corresponding to each business step in the target business rule are determined from the target knowledge graph. Under the constraints of the target contract framework and the graph nodes, the shortest path reasoning is performed in the target knowledge graph using the target logic algorithm to obtain the initial business logic path. The target logic algorithm includes a backtracking search algorithm and a constraint propagation algorithm.
5. The method for generating bank smart contracts based on generative AI according to claim 1, characterized in that, The step of validating the initial business logic path and obtaining the target business logic path based on the corresponding validation result includes: A preset path verification model is used to detect conflicts between the logical steps in the initial business logic path and the financial rule constraints. If any logical step conflicts with the financial rule constraints, the initial business logic path is determined to have failed the detection. If none of the logical steps conflict with the financial rule constraints, then the initial business logic path is determined to have passed the test.
6. The method for generating bank smart contracts based on generative AI according to claim 5, characterized in that, The step of validating the initial business logic path and obtaining the target business logic path based on the corresponding validation result includes: The initial business logic path is validated. If the validation result indicates that the initial business logic path passes the validation, then the initial business logic path is directly determined as the target business logic path. If the initial business logic path fails the verification, the target logic step in the initial business logic path that conflicts with the financial rule constraints is identified, a correction instruction corresponding to the target logic step is generated, and the initial business logic path is partially replanned using the correction instruction to obtain the target business logic path.
7. The method for generating bank smart contracts based on generative AI according to any one of claims 1 to 6, characterized in that, The step of converting the target business logic path into target bank contract code corresponding to the data format of the target blockchain platform includes: By utilizing the structure mapping table corresponding to the target blockchain platform in the preset cross-chain adaptation rule base, each logical step in the target business logic path is converted into the syntax structure of the data format of the target blockchain platform to obtain the target bank contract code.
8. A bank smart contract generation device based on generative AI, characterized in that, include: The requirement parsing module is used to obtain the target banking business requirements of the target business users and to parse the target banking business requirements using a preset financial analysis model in order to obtain the structured requirement information corresponding to the target banking business requirements. The graph query module is used to query the target knowledge graph based on the structured requirement information to obtain the financial rule constraints corresponding to the target banking business requirement, generate a target contract framework based on the financial rule constraints and a preset contract framework generation model, and generate the initial business logic path corresponding to the target banking business requirement according to the target contract framework; wherein, the preset contract framework generation model is an artificial intelligence model built based on generative AI. The contract generation module is used to verify the initial business logic path, obtain the target business logic path based on the corresponding verification result, and convert the target business logic path into target bank contract code corresponding to the data format of the target blockchain platform.
9. An electronic device, characterized in that, include: Memory, used to store computer programs; A processor for executing the computer program to implement the generative AI-based smart contract generation method for banks as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, Used to store a computer program, which, when executed by a processor, implements the method for generating bank smart contracts based on generative AI as described in any one of claims 1 to 7.