Method and apparatus for executing smart contract

By dividing smart contracts into application layer and fund layer contracts, and managing and calling them through a contract management library, the problem of unclear contract responsibilities in commercial scenarios is solved, the logic processing is simplified and the fund processing is unified, and it is adapted to more commercial application scenarios.

CN113850573BActive Publication Date: 2026-05-08THE PEOPLES BANK OF CHINA DIGITAL CURRENCY INST
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
THE PEOPLES BANK OF CHINA DIGITAL CURRENCY INST
Filing Date
2021-08-19
Publication Date
2026-05-08

AI Technical Summary

Technical Problem

How to uniformly manage and execute smart contracts with complex and diverse processing logic, especially in commercial scenarios, to separate application logic processing from fund processing, clarify contract responsibilities, and simplify logic processing.

Method used

Smart contracts are divided into application layer contracts and fund layer contracts, which are stored and managed through a contract management library. Application layer contracts are used to execute business logic processing, while fund layer contracts are used for fund processing. Complex contracts can be combined simply by calling each other.

Benefits of technology

It achieves the separation of application logic processing and fund processing in commercial scenarios, with clear contract responsibilities, simple logic processing, expanded coverage of fund processing logic, adaptability to more commercial application scenarios, and support for consistent fund processing logic.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113850573B_ABST
    Figure CN113850573B_ABST
Patent Text Reader

Abstract

The application discloses an execution method and device of a smart contract, and relates to the technical field of digital currency. A specific implementation of the method comprises the following steps: in response to a smart contract execution request, calling an application layer contract to execute business logic processing, and constructing fund layer contract parameters required for fund layer contract execution; and according to the business logic and the fund layer contract parameters, calling the fund layer contract through the application layer contract to execute fund processing. The implementation can separate the application logic processing from the fund processing in a commercial scenario, and the contract responsibility is clear and the logic processing is simple; and the complex contract can be realized by combining simple contracts through the calling between the smart contracts, so that the implementation is suitable for more commercial application scenarios.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of digital currency technology, and in particular to a method and apparatus for executing smart contracts. Background Technology

[0002] A contract is an agreement or commitment reached between parties involved in a transaction. A smart contract is a set of digitally specified commitments, outlining how the parties will fulfill those commitments. Generally, a smart contract is considered a computer protocol designed to disseminate, verify, or execute contracts in an informational manner. With the increasing prevalence of digital currencies, smart contracts are being applied to more business scenarios, and their processing logic is becoming increasingly complex and diverse. Therefore, how to uniformly manage and execute smart contracts with their complex and diverse processing logic is a pressing technical problem that needs to be solved. Summary of the Invention

[0003] In view of this, embodiments of the present invention provide a method and apparatus for executing smart contracts, which enables the separation of application logic processing and fund processing in commercial scenarios, and the contract responsibilities are clear and the logic processing is simple; furthermore, by calling between smart contracts, complex contracts can be implemented by combining simple contracts, thereby adapting to more commercial application scenarios.

[0004] To achieve the above objectives, according to one aspect of the present invention, a method for executing a smart contract is provided.

[0005] A method for executing a smart contract includes: responding to a smart contract execution request, invoking an application layer contract to execute business logic processing, and constructing financial contract parameters required for the execution of a financial layer contract; and, based on the business logic and the financial contract parameters, invoking the financial layer contract through the application layer contract to execute financial processing.

[0006] Optionally, the method further includes: when the funding layer contract involves fund operations, calling the interface of the digital currency system through the funding layer contract to complete the fund operations.

[0007] Optionally, the application layer contract and the funding layer contract are stored and managed through a contract management library.

[0008] Optionally, the contract management library includes a first contract management library and a second contract management library, wherein the first contract management library is used to manage funding layer contracts and to audit and control application layer contracts; and the second contract management library is used to manage application layer contracts.

[0009] Optionally, the application layer contract is uploaded and registered to the first contract management library after being approved by the second contract management library; the fund layer contract is uniformly deployed after being approved by the first contract management library.

[0010] Optionally, when an application layer contract fails to pass the review in the first contract management library, the application layer contract is set to a controlled state so that the application layer contract can no longer perform signing operations and cannot be executed further.

[0011] Optionally, the first contract management library is configured with a contract control interface to review and control the application layer contracts through the contract control interface.

[0012] According to another aspect of the present invention, an execution device for a smart contract is provided.

[0013] A smart contract execution device includes: an application contract execution module, configured to respond to a smart contract execution request, invoke an application layer contract to execute business logic processing, and construct the financial contract parameters required for the execution of a financial layer contract; and a financial contract execution module, configured to execute financial processing by invoking the financial layer contract through the application layer contract according to the business logic and the financial contract parameters.

[0014] Optionally, the device further includes a funds operation processing module, used to: when the funds layer contract involves funds operation, call the interface of the digital currency system through the funds layer contract to complete the funds operation.

[0015] Optionally, the application layer contract and the funding layer contract are stored and managed through a contract management library.

[0016] Optionally, the contract management library includes a first contract management library and a second contract management library, wherein the first contract management library is used to manage funding layer contracts and to audit and control application layer contracts; and the second contract management library is used to manage application layer contracts.

[0017] Optionally, the application layer contract is uploaded and registered to the first contract management library after being approved by the second contract management library; the fund layer contract is uniformly deployed after being approved by the first contract management library.

[0018] Optionally, when an application layer contract fails to pass the review in the first contract management library, the application layer contract is set to a controlled state so that the application layer contract can no longer perform signing operations and cannot be executed further.

[0019] Optionally, the first contract management library is configured with a contract control interface to review and control the application layer contracts through the contract control interface.

[0020] According to another aspect of the present invention, an electronic device for executing smart contracts is provided.

[0021] An electronic device for executing smart contracts includes: one or more processors; and a storage device for storing one or more programs, which, when executed by the one or more processors, enable the one or more processors to implement the smart contract execution method provided in the embodiments of the present invention.

[0022] According to another aspect of the present invention, a computer-readable medium is provided.

[0023] A computer-readable medium having a computer program stored thereon, which, when executed by a processor, implements the smart contract execution method provided in the embodiments of the present invention.

[0024] One embodiment of the above invention has the following advantages or beneficial effects: By responding to a smart contract execution request, an application-layer contract is invoked to execute business logic processing, and the necessary financial contract parameters for the execution of the financial layer contract are constructed. Based on the business logic and financial contract parameters, the technical solution of invoking the financial layer contract through the application-layer contract to execute financial processing allows for the separation of application logic processing and financial processing in commercial scenarios when a smart contract needs to be executed. This ensures clear contract responsibilities and simplified logic processing. Furthermore, by using smart contract calls, complex contracts can be implemented by combining simpler contracts, thus adapting to more commercial application scenarios. Simultaneously, using the financial layer contract for financial processing supports transactions in different commercial application scenarios, expanding the coverage of financial processing logic. Regardless of the differences in business logic across various commercial application scenarios, consistent financial processing logic can be maintained.

[0025] The further effects of the aforementioned unconventional alternative methods will be explained below in conjunction with specific implementation methods. Attached Figure Description

[0026] The accompanying drawings are provided to better understand the invention and are not intended to unduly limit the scope of the invention. Wherein:

[0027] Figure 1 This is a schematic diagram illustrating the main steps of a smart contract execution method according to an embodiment of the present invention;

[0028] Figure 2 This is a schematic diagram illustrating the implementation principle of a contract management library according to an embodiment of the present invention;

[0029] Figure 3 This is a schematic diagram illustrating the smart contract execution principle of one embodiment of the present invention;

[0030] Figure 4 This is a schematic diagram of the main modules of a smart contract execution device according to an embodiment of the present invention;

[0031] Figure 5 This is an exemplary system architecture diagram in which embodiments of the present invention can be applied;

[0032] Figure 6 This is a schematic diagram of the structure of a computer system suitable for implementing terminal devices or servers of the present invention. Detailed Implementation

[0033] The following description, in conjunction with the accompanying drawings, illustrates exemplary embodiments of the present invention, including various details to aid understanding. These details should be considered merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the invention. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description.

[0034] To address the technical problems existing in the prior art, this invention provides a method for executing smart contracts. The method divides smart contracts (also referred to as contracts) according to their processing responsibilities, dividing them into fund layer smart contracts and application layer smart contracts, referred to as fund layer contracts and application layer contracts. A contract management library is used to store and manage the fund layer contracts and application layer contracts.

[0035] Funding layer contracts are the contractual components that provide digital currency-based fund processing services for smart contracts, such as prepayment contracts and revenue-sharing contracts. After being reviewed and signed by a central authority, funding layer contracts are distributed to various operating institutions for unified deployment. The central authority is responsible for reviewing the business or technical qualifications of the operating platforms of application layer contracts, providing digital currency technical service capabilities, reviewing their smart contracts to ensure compliance with regulatory requirements, and having control over deployed application layer contracts. It provides operating institutions with a centralized contract repository and a global data repository to facilitate the analysis and statistics of fund data; operating institutions provide digital currency technical service capabilities, build and manage the operating platforms of application layer contracts, review developed smart contracts to ensure compliance with regulatory requirements, and provide smart contract execution verification services. It provides regulatory agencies with comprehensive and real-time fund data to assist in fund management.

[0036] Application layer contracts are used to adapt the processing logic of commercial applications and construct the various parameters required for the execution process of the funding layer contracts. After development, application layer contracts generate contract code and are submitted to the second contract management repository belonging to the operating institution for review, verification, unified compilation, and signing. In addition to being reviewed and managed in the second contract management repository, application layer contracts are also required to be registered in the first contract management repository belonging to the central institution. The contract management repository is divided into the first contract management repository and the second contract management repository. It is a repository for storing application layer contracts and funding layer contracts and has functions such as contract uploading, contract decompression, contract review, contract signature verification, contract validation, contract packaging, and downloading contract source code and executable.

[0037] Figure 1 This is a schematic diagram illustrating the main steps of a smart contract execution method according to an embodiment of the present invention. Figure 1 As shown, the smart contract execution method of this embodiment mainly includes the following steps S101 and S102.

[0038] Step S101: In response to the smart contract execution request, call the application layer contract to execute business logic processing, and construct the financial layer contract parameters required for the execution of the financial layer contract;

[0039] Step S102: Based on the business logic and the parameters of the fund layer contract, the fund layer contract is called through the application layer contract to execute the fund processing.

[0040] According to embodiments of the present invention, when a smart contract needs to be executed, an application-layer contract is first invoked to perform business logic processing, and then a funds-layer contract is invoked through the application-layer contract to perform funds processing. This allows for the separation of application logic processing and funds processing in commercial scenarios, with clearly defined contract responsibilities and simplified logic processing. Furthermore, by invoking between smart contracts, complex contracts can be implemented by combining simpler contracts, thus adapting to a wider range of commercial application scenarios. Simultaneously, using a funds-layer contract for funds processing supports transactions in different commercial application scenarios, expanding the coverage of funds processing logic. Regardless of the differences in business logic across various commercial application scenarios, consistent funds processing logic can be maintained.

[0041] According to embodiments of the present invention, smart contracts are divided into application layer contracts and fund layer contracts based on their processing responsibilities. Application layer contracts are used to adapt to the processing logic of commercial applications and construct the parameters required for the execution process of fund layer contracts. Fund layer contracts are the contract portion that provides digital currency-based fund processing services for smart contracts, such as prepayment contracts and revenue-sharing contracts. Furthermore, application layer contracts and fund layer contracts are stored and managed through a contract management library, which includes a first contract management library and a second contract management library. The first contract management library is used to manage fund layer contracts and to audit and control application layer contracts; the second contract management library is used to manage application layer contracts. The first contract management library is deployed and managed, for example, by a central institution, and the second contract management library is deployed and managed, for example, by an operating institution. In this way, smart contracts can be divided according to their processing responsibilities, thereby separating application logic processing from fund processing in commercial scenarios, clarifying contract responsibilities, and simplifying logic processing. Furthermore, complex contracts can be implemented by combining simpler contracts through calls between smart contracts, thus adapting to a wider range of commercial application scenarios. The funding layer contracts are developed and managed by the operating institution, while the funding layer contracts are managed, issued and uniformly deployed by the central institution. The operating institution and the central institution each perform their respective duties, making contract execution simpler and faster.

[0042] Figure 2 This is a schematic diagram illustrating the implementation principle of a contract management library according to an embodiment of the present invention. Figure 2 As shown in the embodiments of the present invention, the contract management library has a two-layer structure, including a first contract management library and a second contract management library. The first contract management library is deployed and managed by a central organization, while the second contract management library is deployed and managed by an operating organization. The main functions of the contract management library include contract uploading, contract decompression, contract review, contract signature verification, contract validation, contract packaging, and downloading contract source code and executables. The functions of the contract management library can be used to complete the registration of a complete set of smart contracts.

[0043] The first contract management repository is deployed and managed by the central institution and is the repository for storing fund layer contracts; there is only one such repository. The second contract management repository is deployed and managed by the operating institution and is the repository for storing application layer contracts. There can be multiple second contract management repositories, but each operating institution can only have one.

[0044] The fund layer contract is a smart contract provided by the central institution for fund processing. After being reviewed and signed by the central institution in the first contract management repository, it is sent to each operating institution for unified deployment. The application layer contract can be a smart contract developed by the merchant based on their own business logic. After development, the application layer contract generates contract code and is uploaded to the second contract management repository of the operating institution for review, verification, unified compilation, and signing. In addition to being reviewed and managed in the second contract management repository, application layer contracts must also be registered in the first contract management repository of the central institution for unified control. Once approved in the second contract management repository, the application layer contract is automatically uploaded and registered in the first contract management repository. All application layer contracts approved by each operating institution must be uploaded and stored in the first contract management repository; therefore, the first contract management repository centrally stores all application layer contracts approved by the operating institutions.

[0045] The first contract management library provides an upload page for funding layer contracts for deployment. It also includes a contract control interface, allowing the central institution to review and control application layer contracts. After reviewing the application layer contracts uploaded by operating institutions, the central institution controls them. If an application layer contract is found to be illegal, non-compliant, or does not meet technical specifications, the central institution can use this contract control interface to mark it as an illegal contract and set its status to controlled. If an application layer contract is set to controlled status, the first contract management library automatically transmits the control instruction to the corresponding operating institution's second contract management library. The second contract management library then sets the specified application layer contract to controlled status, preventing any new contract signing operations from being performed on that contract, and rendering any existing contracts unusable.

[0046] According to one embodiment of the present invention, when the fund layer contract involves fund operations, the fund operations are completed by calling the interface of the digital currency system through the fund layer contract.

[0047] Figure 3 This is a schematic diagram illustrating the smart contract execution principle of one embodiment of the present invention. Figure 3As shown in the embodiments of the present invention, the execution of smart contracts is hierarchical. One smart contract can be called by another smart contract. For example, an application layer contract can call another application layer contract or a funds layer contract. The application layer contract implements the digital currency-related fund processing required for business logic by calling the funds layer contract. When a user interacts with the commercial institution's application service layer through the client's interaction layer and triggers a smart contract execution request, the commercial institution's application server layer calls the application layer contracts (e.g., fitness center membership service contracts, barbershop card issuance contracts, supermarket consumer card contracts, etc.) stored in the second contract management library to execute business logic processing and construct the funds contract parameters required for the execution of the funds layer contract. Then, the application layer contract calls the funds layer contract (e.g., transfer smart contracts, prepayment smart contracts, timed payment smart contracts, currency exchange smart contracts, etc.) to execute fund processing. If the execution of the funds layer contract involves fund operations, the funds layer contract calls the funds processing interface of the digital currency system to complete the fund processing through the funds processing layer of the digital currency system.

[0048] According to the technical solution of this invention, by dividing smart contracts into application layer contracts and fund layer contracts, the coverage of fund processing logic can be expanded. Fund processing is handled within a unified smart contract, and regardless of the differences in the business processing logic of various business systems, the processing at the fund layer will follow a unified fund processing logic. With the support of fund layer contracts in the first contract management library, fund settlement and clearing relationships become clear, simple, and direct, and fund processing is highly automated and interconnected, enabling timely fund arrival. By auditing and controlling the smart contracts in the second contract management library through the first contract management library, the legality and compliance of smart contracts before business deployment can be ensured; during the execution of smart contracts, in-process audits can be performed based on the business data transmitted to the first contract management library; after the transaction is completed, post-transaction traceability and verification can be performed based on the data retained in the first and second contract management libraries, thereby further strengthening the regulatory capability of fund flow. By saving fund transaction data to the first contract management library, the operating institution cannot modify the fund transaction data, thereby improving the credibility of the fund transaction data. Meanwhile, the fund transaction data recorded in the first contract management library can be used to build risk control mechanisms for users and merchants, thereby enabling the transformation of transaction expectations under smart contracts into transferable digital assets.

[0049] Figure 4 This is a schematic diagram of the main modules of a smart contract execution device according to an embodiment of the present invention. Figure 4 As shown, the smart contract execution device 400 of this embodiment mainly includes an application contract execution module 401 and a fund contract execution module 402.

[0050] The application contract execution module 401 is used to respond to smart contract execution requests, call the application layer contract to execute business logic processing, and construct the capital contract parameters required for the execution of the capital layer contract.

[0051] The funds contract execution module 402 is used to execute funds processing by calling the funds layer contract through the application layer contract according to the business logic and the funds contract parameters.

[0052] According to one embodiment of the present invention, the smart contract execution device 400 may further include a contract division module (not shown in the figure) for: dividing the smart contract into an application layer contract and a funding layer contract according to the processing responsibilities of the smart contract.

[0053] According to another embodiment of the present invention, the smart contract execution device 400 may further include a fund operation processing module (not shown in the figure), which is used to: in the case where the fund layer contract involves fund operation, call the interface of the digital currency system through the fund layer contract to complete the fund operation.

[0054] According to another embodiment of the present invention, the application layer contract and the funding layer contract are stored and managed through a contract management library. The contract management library includes a first contract management library and a second contract management library, wherein the first contract management library is used to manage the funding layer contracts and to audit and control the application layer contracts; the second contract management library is used to manage the application layer contracts.

[0055] According to another embodiment of the present invention, after the application layer contract is approved by the second contract management library, it is uploaded and registered to the first contract management library; after the fund layer contract is approved by the first contract management library, it is uniformly deployed.

[0056] According to another embodiment of the present invention, when the application layer contract fails the review in the first contract management library, the application layer contract is set to a controlled state so that the application layer contract can no longer perform the signing operation and cannot be executed further.

[0057] According to another embodiment of the present invention, the first contract management library is configured with a contract control interface to review and control the application layer contracts through the contract control interface.

[0058] According to the technical solution of this invention, in response to a smart contract execution request, an application layer contract is invoked to execute business logic processing, and the necessary financial contract parameters for the execution of the financial layer contract are constructed. Based on the business logic and financial contract parameters, the application layer contract invokes the financial layer contract to execute financial processing. When a smart contract needs to be executed, the application layer contract is first invoked to execute business logic processing, and then the financial layer contract is invoked through the application layer contract to execute financial processing. This allows for the separation of application logic processing and financial processing in commercial scenarios, with clear contract responsibilities and simplified logic processing. Furthermore, by invoking between smart contracts, complex contracts can be implemented by combining simpler contracts, thus adapting to more commercial application scenarios. Simultaneously, using the financial layer contract for financial processing supports transactions in different commercial application scenarios, expanding the coverage of financial processing logic. Regardless of the differences in business logic across various commercial application scenarios, consistent financial processing logic can be maintained.

[0059] Figure 5 An exemplary system architecture 500 is shown, in which the smart contract execution method or smart contract execution apparatus of embodiments of the present invention can be applied.

[0060] like Figure 5 As shown, system architecture 500 may include terminal devices 501, 502, and 503, a network 504, and a server 505. Network 504 serves as the medium for providing communication links between terminal devices 501, 502, and 503 and server 505. Network 504 may include various connection types, such as wired or wireless communication links, or fiber optic cables, etc.

[0061] Users can use terminal devices 501, 502, and 503 to interact with server 505 via network 504 to receive or send messages, etc. Various client applications can be installed on terminal devices 501, 502, and 503, such as banking applications, shared bicycle applications, gym membership applications, supermarket gift card tools, social media platform software, etc. (for example only).

[0062] Terminal devices 501, 502, and 503 can be various electronic devices with displays that support web browsing, including but not limited to smartphones, tablets, laptops, and desktop computers.

[0063] Server 505 can be a server providing various services, such as a backend management server (for example only) that supports smart contract execution requests sent by users using terminal devices 501, 502, and 503. The backend management server can invoke application-layer contracts to execute business logic processing on received smart contract execution requests and other data, and construct the necessary financial contract parameters for financial contract execution. Based on the business logic and the financial contract parameters, it invokes the financial layer contract through the application-layer contract to execute financial processing and other procedures, and feeds back the processing results (e.g., financial processing results, smart contract execution results – for example only) to the terminal device.

[0064] It should be noted that the smart contract execution method provided in this embodiment of the invention is generally executed by server 505, and correspondingly, the smart contract execution device is generally set in server 505.

[0065] It should be understood that Figure 5 The number of terminal devices, networks, and servers shown is merely illustrative. Depending on implementation needs, any number of terminal devices, networks, and servers can be included.

[0066] The following is for reference. Figure 6 It shows a schematic diagram of the structure of a computer system 600 suitable for implementing terminal devices or servers of the present invention. Figure 6 The terminal device or server shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of the present invention.

[0067] like Figure 6 As shown, the computer system 600 includes a central processing unit (CPU) 601, which can perform various appropriate actions and processes based on programs stored in read-only memory (ROM) 602 or programs loaded from storage section 608 into random access memory (RAM) 603. The RAM 603 also stores various programs and data required for the operation of the system 600. The CPU 601, ROM 602, and RAM 603 are interconnected via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.

[0068] The following components are connected to I / O interface 605: an input section 606 including a keyboard, mouse, etc.; an output section 607 including a cathode ray tube (CRT), liquid crystal display (LCD), etc., and speakers, etc.; a storage section 608 including a hard disk, etc.; and a communication section 609 including a network interface card such as a LAN card, modem, etc. The communication section 609 performs communication processing via a network such as the Internet. A drive 610 is also connected to I / O interface 605 as needed. A removable medium 611, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., is installed on drive 610 as needed so that computer programs read from it can be installed into storage section 608 as needed.

[0069] In particular, according to the embodiments disclosed in this invention, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments disclosed in this invention include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication section 609, and / or installed from removable medium 611. When the computer program is executed by central processing unit (CPU) 601, it performs the functions defined above in the system of this invention.

[0070] It should be noted that the computer-readable medium shown in this invention can be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this invention, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In this invention, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. Computer-readable signal media can also be any computer-readable medium other than computer-readable storage media, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to: wireless, wire, optical fiber, RF, etc., or any suitable combination thereof.

[0071] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present invention. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram or flowchart, and combinations of blocks in a block diagram or flowchart, may be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.

[0072] The units or modules described in the embodiments of the present invention can be implemented in software or hardware. The described units or modules can also be housed in a processor; for example, a processor can be described as including an application contract execution module and a funds contract execution module. The names of these units or modules do not necessarily limit the specific unit or module itself. For example, the application contract execution module can also be described as "a module for responding to a smart contract execution request, invoking an application layer contract to execute business logic processing, and constructing the funds contract parameters required for the execution of the funds layer contract."

[0073] In another aspect, the present invention also provides a computer-readable medium, which may be included in the device described in the above embodiments; or it may exist independently and not assembled into the device. The computer-readable medium carries one or more programs, which, when executed by the device, cause the device to: respond to a smart contract execution request, invoke an application-layer contract to perform business logic processing, and construct financial contract parameters required for the execution of a financial layer contract; and, based on the business logic and the financial contract parameters, invoke the financial layer contract through the application-layer contract to perform financial processing.

[0074] According to the technical solution of this invention, in response to a smart contract execution request, an application layer contract is invoked to execute business logic processing, and the necessary financial contract parameters for the execution of the financial layer contract are constructed. Based on the business logic and financial contract parameters, the application layer contract invokes the financial layer contract to execute financial processing. When a smart contract needs to be executed, the application layer contract is first invoked to execute business logic processing, and then the financial layer contract is invoked through the application layer contract to execute financial processing. This allows for the separation of application logic processing and financial processing in commercial scenarios, with clear contract responsibilities and simplified logic processing. Furthermore, by invoking between smart contracts, complex contracts can be implemented by combining simpler contracts, thus adapting to more commercial application scenarios. Simultaneously, using the financial layer contract for financial processing supports transactions in different commercial application scenarios, expanding the coverage of financial processing logic. Regardless of the differences in business logic across various commercial application scenarios, consistent financial processing logic can be maintained.

[0075] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can occur depending on design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.

Claims

1. A method for executing a smart contract, characterized in that, include: In response to a smart contract execution request, the application layer contract is invoked to execute business logic processing, and the necessary financial layer contract parameters for execution are constructed. Based on the business logic and the fund layer contract parameters, the fund layer contract is invoked through the application layer contract to execute fund processing. The application layer contracts and the funding layer contracts are stored and managed through a contract management library, which includes a first contract management library and a second contract management library. The first contract management library is used to manage the funding layer contracts and to audit and control the application layer contracts; the second contract management library is used to manage the application layer contracts. During the execution of a smart contract, in-process auditing is performed based on the business data transmitted to the first contract management library. After the transaction is completed, a post-transaction traceability and verification will be conducted based on the data retained in the first and second contract management databases. The first contract management library is deployed and managed by the central institution, while the second contract management library is deployed and managed by the operating institution. After the application layer contract is approved by the second contract management library, it is uploaded and registered to the first contract management library; The funding layer contracts are sent to each operating institution for unified deployment after being reviewed and signed by the central institution in the first contract management database.

2. The execution method according to claim 1, characterized in that, The method further includes: When the funding layer contract involves fund operations, the fund operations are completed by calling the interface of the digital currency system through the funding layer contract.

3. The execution method according to claim 1, characterized in that, When an application layer contract fails to pass the review in the first contract management library, the application layer contract is set to a controlled state so that the application layer contract can no longer perform signing operations and cannot be executed further.

4. The execution method according to claim 1, characterized in that, The first contract management library is configured with a contract control interface to review and control the application layer contracts.

5. A smart contract execution device, characterized in that, include: The application contract execution module is used to respond to smart contract execution requests, call application layer contracts to execute business logic processing, and construct the financial layer contract parameters required for the execution of the financial layer contract. The funds contract execution module is used to execute fund processing by calling the funds layer contract through the application layer contract according to the business logic and the funds layer contract parameters. The application layer contracts and the funding layer contracts are stored and managed through a contract management library, which includes a first contract management library and a second contract management library. The first contract management library is used to manage the funding layer contracts and to audit and control the application layer contracts; the second contract management library is used to manage the application layer contracts. During the execution of a smart contract, in-process auditing is performed based on the business data transmitted to the first contract management library. After the transaction is completed, a post-transaction traceability and verification will be conducted based on the data retained in the first and second contract management databases. The first contract management library is deployed and managed by the central institution, while the second contract management library is deployed and managed by the operating institution. After the application layer contract is approved by the second contract management library, it is uploaded and registered to the first contract management library; The funding layer contracts are sent to each operating institution for unified deployment after being reviewed and signed by the central institution in the first contract management database.

6. An electronic device for executing smart contracts, characterized in that, include: One or more processors; Storage device for storing one or more programs. When the one or more programs are executed by the one or more processors, the one or more processors implement the method as described in any one of claims 1-4.

7. A computer-readable medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the method as described in any one of claims 1-4.

Citation Information

Patent Citations

  • Method and device for processing block chain smart contract, equipment and medium

    CN108876619A

  • Block chain contract deployment method and device, equipment and storage medium

    CN110933163A