CN111273970B - Calling method, device, system, medium and electronic equipment of intelligent contract - Google Patents

Calling method, device, system, medium and electronic equipment of intelligent contract Download PDF

Info

Publication number
CN111273970B
CN111273970B CN202010070733.8A CN202010070733A CN111273970B CN 111273970 B CN111273970 B CN 111273970B CN 202010070733 A CN202010070733 A CN 202010070733A CN 111273970 B CN111273970 B CN 111273970B
Authority
CN
China
Prior art keywords
intelligent contract
calling
request
operation request
information
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202010070733.8A
Other languages
Chinese (zh)
Other versions
CN111273970A (en
Inventor
刘长辉
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN202010070733.8A priority Critical patent/CN111273970B/en
Publication of CN111273970A publication Critical patent/CN111273970A/en
Application granted granted Critical
Publication of CN111273970B publication Critical patent/CN111273970B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/448Execution paradigms, e.g. implementations of programming paradigms
    • G06F9/4482Procedural
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/23Updating
    • G06F16/2308Concurrency control
    • G06F16/2315Optimistic concurrency control
    • G06F16/2322Optimistic concurrency control using timestamps
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Computing Systems (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

The application provides a calling method of an intelligent contract, an execution method of the intelligent contract, a calling device of the intelligent contract, an execution device of the intelligent contract, a calling system of the intelligent contract, a computer readable storage medium and an electronic device; relates to the technical field of block chains; the method comprises the following steps: when a first calling request is received, inquiring intelligent contract information corresponding to the first calling request; determining calling service corresponding to the intelligent contract according to the intelligent contract information, wherein the intelligent contract corresponds to the intelligent contract information; and sending a second calling request to the calling program through the calling service so that the calling program executes the intelligent contract according to the second calling request. The method can embody the local deployment of the intelligent contract by remotely calling the intelligent contract, is beneficial to simplifying the debugging process of the intelligent contract and improves the debugging efficiency of the intelligent contract.

Description

Calling method, device, system, medium and electronic equipment of intelligent contract
Technical Field
The present application relates to the field of block chain technology, and in particular, to a method for calling an intelligent contract, a method for executing an intelligent contract, a device for calling an intelligent contract, a device for executing an intelligent contract, a system for calling an intelligent contract, a computer-readable storage medium, and an electronic device.
Background
An intelligent contract is a computer protocol intended to propagate, verify, or execute contracts in an informational manner, which may be deployed to enable self-execution and self-verification. Typically, intelligent contracts need to be deployed in non-local blockchain nodes so that each blockchain node can internally invoke the intelligent contract. Due to the changing of the transaction modes, the intelligent contracts also need to be frequently debugged to adapt to the processing of different transactions. However, updating the intelligent contract usually requires debugging each block link point in different places to complete the debugging of the intelligent contract, but this may cause a problem of complicated debugging process.
It is to be noted that the information disclosed in the above background section is only for enhancement of understanding of the background of the present application and therefore may include information that does not constitute prior art known to a person of ordinary skill in the art.
Disclosure of Invention
The application aims to provide an intelligent contract calling method, an intelligent contract executing method, an intelligent contract calling device, an intelligent contract executing device, an intelligent contract calling system, a computer readable storage medium and electronic equipment, which can embody the local deployment of intelligent contracts in a remote intelligent contract calling mode, facilitate the simplification of the debugging process of intelligent contracts and improve the debugging efficiency of intelligent contracts.
Other features and advantages of the present application will be apparent from the following detailed description, or may be learned by practice of the application.
According to a first aspect of the application, a method for calling an intelligent contract is provided, which comprises the following steps:
when a first calling request is received, inquiring intelligent contract information corresponding to the first calling request;
determining calling service corresponding to the intelligent contract according to the intelligent contract information, wherein the intelligent contract corresponds to the intelligent contract information;
and sending a second calling request to the calling program through the calling service so that the calling program executes the intelligent contract according to the second calling request.
In an exemplary embodiment of the present application, before querying the intelligent contract information corresponding to the first invocation request, the method may further include the following steps:
establishing connection with a calling program according to the connection establishing request, and receiving intelligent contract information sent by the calling program;
and registering the intelligent contract according to the intelligent contract information.
In one exemplary embodiment of the present application, the intelligent contract information includes at least one of an intelligent contract number and an intelligent contract version number.
In an exemplary embodiment of the present application, the method may further include the steps of:
and receiving a first calling request sent by a network application layer through an intelligent contract calling interface.
In an exemplary embodiment of the present application, querying intelligent contract information corresponding to the first invocation request includes:
and determining an intelligent contract number corresponding to the first calling request, and inquiring intelligent contract information according to the intelligent contract number.
In an exemplary embodiment of the present application, determining a call service corresponding to an intelligent contract according to intelligent contract information includes:
determining target information used for distinguishing the intelligent contract from other intelligent contracts in the intelligent contract information;
and inquiring the calling service matched with the intelligent contract according to the target information.
In an exemplary embodiment of the present application, sending a second call request to the calling program through the call service, so that the calling program executes the intelligent contract according to the second call request, includes:
sending a second calling request to the calling program through the calling service so that the calling program calls the intelligent contract, and sending an account book operation request to the calling program through the intelligent contract;
receiving an account book operation request sent by a calling program and responding to the account book operation request; the account book operation request corresponds to an intelligent contract;
the ledger operation request comprises at least one of a read operation request for reading the ledger according to the intelligent contract and a write operation request for writing the ledger according to the intelligent contract.
In an exemplary embodiment of the present application, after responding to the ledger operation request, the method may further include the following steps:
and transmitting a response result corresponding to the account book operation request to the calling program.
In an exemplary embodiment of the present application, the method may further include the steps of:
and when the detected response result indicates that the account book operation request fails to respond, performing compiling detection on the intelligent contract and debugging the intelligent contract according to the compiling detection result.
In an exemplary embodiment of the present application, responding to the ledger operation request includes:
verifying a digital signature corresponding to the account book operation request;
after the verification is successful, sequencing the transaction data in the account book operation request according to the transaction timestamp;
and performing consensus verification on the sequencing result through a consensus algorithm, and chaining the sequencing result after the verification is passed.
In an exemplary embodiment of the present application, sending the second call request to the calling program by the calling service includes:
and sending a second calling request containing the request parameters to the calling program through the calling service, wherein the second calling request is used for initiating a remote calling for the intelligent contract.
According to a second aspect of the present application, there is provided a method for executing an intelligent contract, including:
after the block chain node receives the first calling request, inquires the intelligent contract information corresponding to the first calling request and determines the calling service corresponding to the intelligent contract according to the intelligent contract information, receiving a second calling request sent by the block chain node through the calling service;
and executing the intelligent contract according to the second calling request.
According to a third aspect of the present application, there is provided an intelligent contract invoking device, including an intelligent contract information querying unit, an invoking service determining unit, and an invoking request sending unit, wherein:
the intelligent contract information query unit is used for querying intelligent contract information corresponding to the first calling request when the first calling request is received;
the calling service determining unit is used for determining calling services corresponding to the intelligent contracts according to the intelligent contract information, and the intelligent contract information corresponds to the intelligent contracts;
and the calling request sending unit is used for sending a second calling request to the calling program through the calling service so that the calling program executes the intelligent contract according to the second calling request.
According to a fourth aspect of the present application, there is provided an intelligent contract execution apparatus, including a call request receiving unit and an intelligent contract execution unit, wherein:
the system comprises a calling request receiving unit, a calling request sending unit and a calling request sending unit, wherein the calling request receiving unit is used for receiving a first calling request, inquiring intelligent contract information corresponding to the first calling request and determining a calling service corresponding to an intelligent contract according to the intelligent contract information, and then receiving a second calling request sent by a block chain node through the calling service;
and the intelligent contract execution unit is used for executing the intelligent contract according to the second calling request.
According to a fifth aspect of the present application, there is provided a calling system of an intelligent contract, comprising a block link point module and an intelligent contract agent module, wherein:
the block chain link point module is used for inquiring intelligent contract information corresponding to the first calling request when the first calling request is received; determining calling service corresponding to the intelligent contract according to the intelligent contract information, wherein the intelligent contract information corresponds to the intelligent contract; sending a second calling request to the calling program through the calling service so that the calling program executes the intelligent contract according to the second calling request;
and the intelligent contract agent module is used for receiving a second calling request sent by the blockchain node and executing the intelligent contract according to the second calling request, and the intelligent contract agent comprises a calling program.
In an exemplary embodiment of the present application, the block link point module is further configured to establish a connection with the calling program according to the connection establishment request and receive the intelligent contract information sent by the calling program before querying the intelligent contract information corresponding to the first calling request; registering the intelligent contract according to the intelligent contract information;
and the intelligent contract agent module is used for sending intelligent contract information to the block link point module through a calling program.
In one exemplary embodiment of the present application, the intelligent contract information includes at least one of an intelligent contract number and an intelligent contract version number.
In an exemplary embodiment of the present application, the block link point module is further configured to receive a first call request sent by the network application layer through the intelligent contract call interface.
In an exemplary embodiment of the present application, the manner of querying the intelligent contract information corresponding to the first invocation request by the block link point module may specifically be:
and the block chain link point module determines an intelligent contract number corresponding to the first calling request and inquires intelligent contract information according to the intelligent contract number.
In an exemplary embodiment of the present application, the manner in which the block link point module determines the call service corresponding to the intelligent contract according to the intelligent contract information may specifically be:
the block chain link point module determines target information used for distinguishing the intelligent contract from other intelligent contracts in the intelligent contract information; and inquiring the calling service matched with the intelligent contract according to the target information.
In an exemplary embodiment of the present application, the sending, by the block link point module, the second call request to the calling program through the call service, so that the manner in which the calling program executes the intelligent contract according to the second call request may specifically be:
the block chain node module sends a second calling request to the calling program through the calling service so that the calling program calls the intelligent contract and sends an account book operation request to the calling program through the intelligent contract; receiving an account book operation request sent by a calling program and responding to the account book operation request; the account book operation request corresponds to an intelligent contract;
the ledger operation request comprises at least one of a read operation request for reading the ledger according to the intelligent contract and a write operation request for writing the ledger according to the intelligent contract.
In an exemplary embodiment of the application, the block link point module is further configured to transmit a response result corresponding to the ledger operation request to the calling program after the ledger operation request is responded;
and the intelligent contract agent module is also used for receiving the account book operation request.
In an exemplary embodiment of the application, the block link point module is further configured to, when it is detected that the response result indicates that the response to the account book operation request fails, perform compilation detection on the intelligent contract and debug the intelligent contract according to the compilation detection result.
In an exemplary embodiment of the present application, the manner in which the block link point module responds to the ledger operation request may specifically be:
the block chain node module verifies a digital signature corresponding to the account book operation request; after the verification is successful, sequencing the transaction data in the account book operation request according to the transaction timestamp; and performing consensus verification on the sequencing result through a consensus algorithm, and chaining the sequencing result after the verification is passed.
In an exemplary embodiment of the present application, the manner in which the block link point module sends the second call request to the calling program by calling the service may specifically be:
and the block chain node module sends a second calling request containing the request parameters to the calling program through the calling service, and the second calling request is used for initiating remote calling aiming at the intelligent contract.
According to a sixth aspect of the present application, there is provided an electronic device comprising: a processor; and a memory for storing executable instructions of the processor; wherein the processor is configured to perform the method of any one of the above via execution of the executable instructions.
According to a seventh aspect of the present application, there is provided a computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements the method of any one of the above.
The exemplary embodiments of the present application may have some or all of the following advantages:
in the method for calling the intelligent contract provided by an example embodiment of the present application, the intelligent contract information (e.g., the intelligent contract code) corresponding to the first calling request may be queried when the first calling request is received; determining calling service corresponding to the intelligent contract according to the intelligent contract information, wherein the intelligent contract corresponds to the intelligent contract information; and sending a second calling request to the calling program through the calling service so that the calling program executes the intelligent contract according to the second calling request. According to the technical description, on one hand, the method can embody the local deployment of the intelligent contract in a mode of remotely calling the intelligent contract, is beneficial to simplifying the debugging process of the intelligent contract and improves the debugging efficiency of the intelligent contract; on the other hand, the deployment process of the intelligent contracts can be simplified.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the application.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and together with the description, serve to explain the principles of the application. It is obvious that the drawings in the following description are only some embodiments of the application, and that for a person skilled in the art, other drawings can be derived from them without inventive effort.
Fig. 1 is a schematic diagram illustrating an exemplary system architecture of a calling method and a calling device of an intelligent contract, to which an embodiment of the present application may be applied;
FIG. 2 illustrates a schematic structural diagram of a computer system suitable for use in implementing an electronic device of an embodiment of the present application;
FIG. 3 schematically illustrates a flow chart of a method for invoking an intelligent contract according to one embodiment of the present application;
FIG. 4 schematically illustrates a flow diagram of a method for invoking an intelligent contract, according to another embodiment of the present application;
FIG. 5 schematically illustrates a flow chart of a method of executing a smart contract according to one embodiment of the present application;
FIG. 6 schematically illustrates a block diagram of an invoking device of a smart contract according to one embodiment of the present application;
FIG. 7 is a block diagram schematically illustrating an apparatus for executing an intelligent contract according to an embodiment of the present application;
FIG. 8 schematically illustrates a block diagram of a calling system for a smart contract, in accordance with an embodiment of the present application;
fig. 9 is a block diagram schematically illustrating a calling system of a smart contract according to another embodiment of the present application.
Detailed Description
Example embodiments will now be described more fully with reference to the accompanying drawings. Example embodiments may, however, be embodied in many different forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the concept of example embodiments to those skilled in the art. The described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments. In the following description, numerous specific details are provided to give a thorough understanding of embodiments of the application. One skilled in the relevant art will recognize, however, that the subject matter of the present application can be practiced without one or more of the specific details, or with other methods, components, devices, steps, and so forth. In other instances, well-known technical solutions have not been shown or described in detail to avoid obscuring aspects of the present application.
Furthermore, the drawings are merely schematic illustrations of the present application and are not necessarily drawn to scale. The same reference numerals in the drawings denote the same or similar parts, and thus their repetitive description will be omitted. Some of the block diagrams shown in the figures are functional entities and do not necessarily correspond to physically or logically separate entities. These functional entities may be implemented in the form of software, or in one or more hardware modules or integrated circuits, or in different networks and/or processor devices and/or microcontroller devices.
Fig. 1 is a schematic diagram illustrating a system architecture of an exemplary application environment to which a method for calling an intelligent contract and a device for calling the intelligent contract according to an embodiment of the present application may be applied.
As shown in fig. 1, the system architecture 100 may include one or more of terminal devices 101, 102, 103, a network 104, and a server 105. The network 104 serves as a medium for providing communication links between the terminal devices 101, 102, 103 and the server 105. Network 104 may include various connection types, such as wired, wireless communication links, or fiber optic cables, to name a few. The terminal devices 101, 102, 103 may be various electronic devices having a display screen, including but not limited to desktop computers, portable computers, smart phones, tablet computers, and the like. It should be understood that the number of terminal devices, networks, and servers in fig. 1 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation. For example, server 105 may be a server cluster comprised of multiple servers, or the like.
The calling method of the intelligent contract provided by the embodiment of the application is generally executed by the server 105, and accordingly, the calling device of the intelligent contract is generally arranged in the server 105. However, it is easily understood by those skilled in the art that the method for invoking the intelligent contract provided in the embodiment of the present application may also be executed by the terminal devices 101, 102, and 103, and accordingly, the invoking device of the intelligent contract may also be disposed in the terminal devices 101, 102, and 103, which is not particularly limited in this exemplary embodiment. For example, in one exemplary embodiment, server 105 may, upon receiving a first invocation request, query intelligent contract information corresponding to the first invocation request; determining calling service corresponding to the intelligent contract according to the intelligent contract information, wherein the intelligent contract corresponds to the intelligent contract information; and sending a second calling request to the calling program through the calling service so that the calling program executes the intelligent contract according to the second calling request.
FIG. 2 illustrates a schematic structural diagram of a computer system suitable for use in implementing the electronic device of an embodiment of the present application.
It should be noted that the computer system 200 of the electronic device shown in fig. 2 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present application.
As shown in fig. 2, the computer system 200 includes a Central Processing Unit (CPU)201 that can perform various appropriate actions and processes in accordance with a program stored in a Read Only Memory (ROM)202 or a program loaded from a storage section 208 into a Random Access Memory (RAM) 203. In the RAM 203, various programs and data necessary for system operation are also stored. The CPU 201, ROM 202, and RAM 203 are connected to each other via a bus 204. An input/output (I/O) interface 205 is also connected to bus 204.
The following components are connected to the I/O interface 205: an input portion 206 including a keyboard, a mouse, and the like; an output section 207 including a display such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker; a storage section 208 including a hard disk and the like; and a communication section 209 including a network interface card such as a LAN card, a modem, or the like. The communication section 209 performs communication processing via a network such as the internet. A drive 210 is also connected to the I/O interface 205 as needed. A removable medium 211 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 210 as necessary, so that a computer program read out therefrom is mounted into the storage section 208 as necessary.
In particular, according to embodiments of the present application, the processes described below with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present application include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method illustrated by the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network through the communication section 209 and/or installed from the removable medium 211. The computer program, when executed by a Central Processing Unit (CPU)201, performs various functions defined in the methods and apparatus of the present application.
In the existing block chain technology, an intelligent contract runs in a block chain node point, however, in the debugging stage of frequently updating the intelligent contract, the debugging process of the intelligent contract in the existing mode is more complicated, and a developer is inconvenient to analyze logs and trace problems.
Accordingly, the present example embodiments provide a method for invoking an intelligent contract based on one or more of the problems set forth above. The method for calling the smart contract may be applied to the server 105, and may also be applied to one or more of the terminal devices 101, 102, and 103, which is not particularly limited in this exemplary embodiment. Referring to fig. 3, the calling method of the smart contract may include the following steps S310 to S330:
step S310: and when the first calling request is received, inquiring intelligent contract information corresponding to the first calling request.
Step S320: and determining the calling service corresponding to the intelligent contract according to the intelligent contract information, wherein the intelligent contract corresponds to the intelligent contract information.
Step S330: and sending a second calling request to the calling program through the calling service so that the calling program executes the intelligent contract according to the second calling request.
The above steps of the present exemplary embodiment will be described in more detail below.
In step S310, when the first invocation request is received, the intelligent contract information corresponding to the first invocation request is queried.
The first calling request and the second calling request are both used for calling the intelligent contract, the first calling request is sent by a network application layer, and the second calling request is sent by a block link point. In addition, the network includes an application layer, a presentation layer, a session layer, a transport layer, a data link layer, and a physical layer (i.e., network hardware), where the application layer, i.e., the network application layer in this application, is used to provide a network service interface; the presentation layer is used for providing data format conversion service; the session layer is used for establishing end connection and providing access authentication and session management; the transmission layer is used for providing logic communication between application processes; the data link layer is used for establishing data link connection between communicating entities; the physical layer is used to provide a path for transmission of the original bit stream for the data side device. In addition, the intelligent contract information may include contract metadata corresponding to the intelligent contract, i.e., a identity compiler generated JSON file, JSON (JSON notification, JS) is a lightweight data exchange format, and stores and represents data in a text format completely independent of a programming language. The intelligent contract information may also be understood as registration information of the intelligent contract, and specifically may include at least one of an intelligent contract number and an intelligent contract version number.
In this embodiment of the application, optionally, before querying the intelligent contract information corresponding to the first invocation request, the method may further include the following steps:
establishing connection with a calling program according to the connection establishing request, and receiving intelligent contract information sent by the calling program;
and registering the intelligent contract according to the intelligent contract information.
The calling program is used as an agent program and used for being connected with the block chain link points and sending intelligent contract information to the block chain link points so that the block chain link points register the intelligent contracts according to the intelligent contract information. The registered intelligent contract information stored in the blockchain node may be one or more, and the embodiment of the present application is not limited. The block link node in the present application may be a local block link node, or may also be a non-local block link node, such as a remote block link node, and the embodiments of the present application are not limited thereto.
In addition, the method for registering the intelligent contract according to the intelligent contract information may specifically be: the intelligent contract is registered in the block link point according to the intelligent contract information, and it can also be understood that the intelligent contract information is stored in the block link node.
Therefore, by implementing the optional embodiment, the intelligent contract information can be registered in the block link point by establishing connection with the calling program, the remote calling efficiency of the intelligent contract is improved, the local debugging of the intelligent contract is facilitated, and the debugging effect of the intelligent contract is improved.
In this embodiment of the application, optionally, before step S310, the method may further include the following steps:
and receiving a first calling request sent by a network application layer through an intelligent contract calling interface.
The intelligent contract calling Interface is an external Application Programming Interface (API) of the blockchain node, and may be configured to receive an intelligent contract calling request. In addition, the network application layer sends the first invocation request to the blockchain node based on the HTTP protocol, and the first invocation request may be a first invocation HTTP request.
Therefore, by implementing the optional embodiment, the calling request can be received through the intelligent contract calling interface, and the remote calling of the intelligent contract can be realized through the received calling request, so that the deployment process of the intelligent contract is simplified.
In this embodiment of the present application, optionally, querying the intelligent contract information corresponding to the first invocation request includes:
and determining an intelligent contract number corresponding to the first calling request, and inquiring intelligent contract information according to the intelligent contract number.
Wherein the intelligent contract number is used for representing the uniqueness of the intelligent contract.
In addition, the manner of determining the intelligent contract number corresponding to the first invocation request may specifically be: analyzing a code corresponding to the first calling request to determine a field for representing an intelligent contract number; this field is located to determine the intelligent contract number in the first invocation request.
In addition, the mode of querying the intelligent contract information according to the intelligent contract number may specifically be: and comparing the intelligent contract number with a plurality of pieces of intelligent contract information stored in the block chain nodes respectively, and further determining the intelligent contract information matched with the intelligent contract number.
Therefore, by implementing the optional embodiment, the currently required intelligent contract information can be determined by querying the intelligent contract number, so that the execution of the intelligent contract is remotely requested according to the intelligent contract information, the local debugging efficiency of the intelligent contract is improved, and the deployment process of the intelligent contract is simplified.
In step S320, a calling service corresponding to the intelligent contract is determined according to the intelligent contract information, and the intelligent contract corresponds to the intelligent contract information.
The calling service can be RPC service for providing remote calling service of the intelligent contract. Note that rpc (remote Procedure call) represents a remote Procedure call.
In this embodiment of the application, optionally, determining a call service corresponding to an intelligent contract according to the intelligent contract information includes:
determining target information used for distinguishing the intelligent contract from other intelligent contracts in the intelligent contract information;
and inquiring the calling service matched with the intelligent contract according to the target information.
At least one piece of information in the intelligent contract information, such as an intelligent contract number, can be included in the target information.
Therefore, by implementing the optional embodiment, the calling service matched with the intelligent contract can be determined through the intelligent contract information, and the calling service can be used for realizing remote calling of the intelligent contract.
In step S330, a second call request is sent to the calling program through the call service, so that the calling program executes the smart contract according to the second call request.
Wherein the calling program is used for executing the intelligent contract.
In this embodiment of the application, optionally, sending a second call request to the calling program by using the call service, so that the calling program executes the intelligent contract according to the second call request, where the method includes:
sending a second calling request to the calling program through the calling service so that the calling program calls the intelligent contract, and sending an account book operation request to the calling program through the intelligent contract;
receiving an account book operation request sent by a calling program and responding to the account book operation request; the account book operation request corresponds to an intelligent contract;
the ledger operation request comprises at least one of a read operation request for reading the ledger according to the intelligent contract and a write operation request for writing the ledger according to the intelligent contract.
In addition, the account book may be a distributed account book corresponding to the block link point, and is equivalent to a database corresponding to the block link point. The read operation request is used for reading data in the database, and the write operation request is used for writing data in the database. In addition, optionally, the ledger operation request may include one or more read operation requests and one or more write operation requests.
Therefore, by implementing the alternative embodiment, the response to the ledger operation request can be realized by executing the intelligent contract, so that the purpose of remotely calling the intelligent contract to complete the data writing operation or the data reading operation is realized.
Wherein, responding to the account book operation request comprises:
verifying a digital signature corresponding to the account book operation request;
after the verification is successful, sequencing the transaction data in the account book operation request according to the transaction timestamp;
and performing consensus verification on the sequencing result through a consensus algorithm, and chaining the sequencing result after the verification is passed.
Specifically, the manner of verifying the digital signature corresponding to the ledger operation request may be: and verifying a digital signature corresponding to the account book operation request through a public key in the blockchain node, wherein the digital signature is a character string generated after asymmetric encryption is performed on a hash value generated according to transaction data in the account book operation request.
In addition, the transaction timestamp is used for indicating transaction completion time of each transaction data in the account book operation request, and the manner of sequencing the transaction data in the account book operation request according to the transaction timestamp after the verification is successful can be as follows: after the verification is successful, sequencing the transaction data in the account book operation request according to the sequence of the transaction time from early to late; or after the verification is successful, the transaction data in the account book operation request are sequenced according to the sequence of the transaction time from late to early.
In addition, the way of performing consensus verification on the sequencing result through the consensus algorithm and chaining the sequencing result after the verification is passed may be: packaging the sequencing result into a block to be linked, and performing consensus verification on the block according to a consensus algorithm; when the block chain exceeds a preset proportion (e.g., 90%) of the block chain link points successfully verified, the block chain is linked.
Therefore, by implementing the optional embodiment, the ledger operation request can be responded after the verification is passed, and the uplink operation can be realized after the consensus verification, so that the authenticity and the tamper resistance of uplink data can be ensured.
Further, after responding to the ledger operation request, the method may further include the following steps:
and transmitting a response result corresponding to the account book operation request to the calling program.
Specifically, the manner of transmitting the response result corresponding to the ledger operation request to the calling program may be: transmitting a response result corresponding to the account book operation request to the calling program in an RPC (remote procedure call) mode; the response result may include a processing result of each transaction data in the ledger operation request.
Therefore, by implementing the optional embodiment, the response result to the operation request of the account book can be fed back remotely, so that the intelligent contract can be deployed locally and can be conveniently called by the block chain, and moreover, the intelligent contract can be deployed locally and can be convenient for debugging, tracking operation, analyzing logs and the like, and the development efficiency is improved.
And sending a second call request to the calling program by the calling service, including:
and sending a second calling request containing the request parameters to the calling program through the calling service, wherein the second calling request is used for initiating a remote calling for the intelligent contract.
The request parameter may be a specific representation of data in the second invocation request.
Therefore, by implementing the optional embodiment, the intelligent contract can be remotely called, the deployment process of the intelligent contract is simplified, the intelligent contract is locally deployed, and the debugging efficiency of the intelligent contract is improved.
In addition, optionally, the method may further include the steps of:
and when the detected response result indicates that the account book operation request fails to respond, performing compiling detection on the intelligent contract and debugging the intelligent contract according to the compiling detection result.
The response result indicates that the response failure of the account checking operation request may include a corresponding failure of a data write request in the account checking operation request and/or a corresponding failure of a data read request in the account checking operation request.
In addition, the method of performing compilation detection on the intelligent contract and debugging the intelligent contract according to the compilation detection result may be as follows: testing the intelligent contract through the sample data to detect a logical error (e.g., an infinite loop) in the code of the intelligent contract; and modifying the logic errors according to a preset modification mapping rule so as to realize the debugging of the intelligent contract. In addition, the compilation detection result may include a logic error or other errors in the code, and the embodiment of the present application is not limited.
Therefore, by implementing the optional embodiment, the intelligent contract can be optimized through detection and debugging of the intelligent contract, and the execution efficiency of the intelligent contract is improved.
Therefore, by implementing the calling method of the intelligent contract shown in fig. 3, the local deployment of the intelligent contract can be embodied in a manner of remotely calling the intelligent contract, which is beneficial to simplifying the debugging process of the intelligent contract and improving the debugging efficiency of the intelligent contract; and, the deployment process of the intelligent contracts can be simplified.
Referring to FIG. 4, FIG. 4 schematically illustrates a flow diagram of a method for invoking an intelligent contract, according to another embodiment of the present application. As shown in fig. 4, the method for calling a smart contract according to another embodiment includes steps S400 to S424, where:
step S400: and establishing connection with the calling program according to the connection establishing request, and receiving the intelligent contract information sent by the calling program.
Step S402: and registering the intelligent contract according to the intelligent contract information.
Step S404: and receiving a first calling request sent by a network application layer through an intelligent contract calling interface.
Step S406: when the first calling request is received, the intelligent contract number corresponding to the first calling request is determined, and intelligent contract information is inquired according to the intelligent contract number.
Step S408: target information used for distinguishing the intelligent contract from other intelligent contracts in the intelligent contract information is determined.
Step S410: and inquiring the calling service matched with the intelligent contract according to the target information.
Step S412: and sending a second calling request containing request parameters to the calling program through the calling service so that the calling program calls the intelligent contract, and sending a ledger operation request to the calling program through the intelligent contract, wherein the second calling request is used for initiating remote calling of the intelligent contract.
Step S414: receiving an account book operation request sent by a calling program; the ledger operation request corresponds to an intelligent contract.
Step S416: and verifying the digital signature corresponding to the ledger operation request.
Step S418: and after the verification is successful, sequencing the transaction data in the account book operation request according to the transaction timestamp.
Step S420: and performing consensus verification on the sequencing result through a consensus algorithm, and chaining the sequencing result after the verification is passed.
Step S422: and transmitting a response result corresponding to the account book operation request to the calling program.
Step S424: and when the detected response result indicates that the account book operation request fails to respond, performing compiling detection on the intelligent contract and debugging the intelligent contract according to the compiling detection result.
It should be noted that steps S400 to S424 correspond to steps S310 to S330 in fig. 3 and the specific embodiment, please refer to the limitations of step S310 to step S330 in fig. 3, which is not described herein again.
Therefore, by implementing the calling method of the intelligent contract shown in fig. 4, the local deployment of the intelligent contract can be embodied in a manner of remotely calling the intelligent contract, which is beneficial to simplifying the debugging process of the intelligent contract and improving the debugging efficiency of the intelligent contract; and, the deployment process of the intelligent contracts can be simplified.
Referring to FIG. 5, FIG. 5 schematically illustrates a flow diagram of a method for executing an intelligent contract, according to an embodiment of the present application. As shown in fig. 5, the execution method of the smart contract includes steps S510 to S520, where:
step S510: after the block chain node receives the first calling request, inquires the intelligent contract information corresponding to the first calling request and determines the calling service corresponding to the intelligent contract according to the intelligent contract information, the second calling request sent by the block chain node through the calling service is received.
Step S520: and executing the intelligent contract according to the second calling request.
It should be noted that steps S510 to S520 correspond to steps S310 to S330 in fig. 3, and for the specific implementation of steps S510 to S520, please refer to the limitations of steps S310 to S330 in fig. 3, which is not described herein again.
Therefore, by implementing the execution method of the intelligent contract shown in fig. 5, the localized deployment of the intelligent contract can be embodied in a manner of remotely calling the intelligent contract, which is beneficial to simplifying the debugging process of the intelligent contract and improving the debugging efficiency of the intelligent contract; and, the deployment process of the intelligent contracts can be simplified.
Further, in this example embodiment, a device for invoking an intelligent contract is also provided. The calling device of the intelligent contract can be applied to a server or a terminal device. Referring to fig. 6, the invoking device 600 of the intelligent contract may include an intelligent contract information querying unit 601, an invoking service determining unit 602, and an invoking request sending unit 603, where:
an intelligent contract information query unit 601, configured to query, when a first invocation request is received, intelligent contract information corresponding to the first invocation request;
a calling service determining unit 602, configured to determine a calling service corresponding to an intelligent contract according to the intelligent contract information, where the intelligent contract information corresponds to the intelligent contract;
a call request sending unit 603, configured to send a second call request to the calling program through the call service, so that the calling program executes the intelligent contract according to the second call request.
Therefore, the calling device for implementing the intelligent contract shown in fig. 6 can embody the local deployment of the intelligent contract in a manner of remotely calling the intelligent contract, which is beneficial to simplifying the debugging process of the intelligent contract and improving the debugging efficiency of the intelligent contract; and, the deployment process of the intelligent contracts can be simplified.
In an exemplary embodiment of the present application, the apparatus may further include an information receiving unit (not shown) and an intelligent contract registering unit (not shown), wherein:
an information receiving unit, configured to establish a connection with a calling program according to the connection establishment request before the intelligent contract information query unit 601 queries the intelligent contract information corresponding to the first calling request, and receive the intelligent contract information sent by the calling program;
and the intelligent contract registering unit is used for registering the intelligent contract according to the intelligent contract information.
Therefore, by implementing the exemplary embodiment, the intelligent contract information can be registered in the block link point by establishing connection with the calling program, the remote calling efficiency of the intelligent contract is improved, the local debugging of the intelligent contract is facilitated, and the debugging effect of the intelligent contract is improved.
In one exemplary embodiment of the present application, the intelligent contract information includes at least one of an intelligent contract number and an intelligent contract version number.
In an exemplary embodiment of the present application, the invocation request sending unit 603 is further configured to receive, through the intelligent contract invocation interface, a first invocation request sent by the network application layer.
Therefore, by implementing the exemplary embodiment, the calling request can be received through the intelligent contract calling interface, and the remote calling of the intelligent contract can be realized through the received calling request, so that the deployment process of the intelligent contract is simplified.
In an exemplary embodiment of the present application, the manner of querying the intelligent contract information corresponding to the first invocation request by the intelligent contract information querying unit 601 may specifically be:
the intelligent contract information query unit 601 determines an intelligent contract number corresponding to the first invocation request, and queries the intelligent contract information according to the intelligent contract number.
Therefore, by implementing the exemplary embodiment, the currently required intelligent contract information can be determined through querying the intelligent contract number, so that the execution of the intelligent contract is remotely requested according to the intelligent contract information, the local debugging efficiency of the intelligent contract is improved, and the deployment process of the intelligent contract is simplified.
In an exemplary embodiment of the present application, the manner in which the calling service determining unit 602 determines the calling service corresponding to the intelligent contract according to the intelligent contract information may specifically be:
the calling service determination unit 602 determines target information for distinguishing the intelligent contract from other intelligent contracts in the intelligent contract information;
the invocation service determination unit 602 queries the invocation service matching the intelligent contract according to the target information.
Therefore, by implementing the exemplary embodiment, the calling service matched with the intelligent contract can be determined through the intelligent contract information, and the remote calling of the intelligent contract can be realized by using the calling service.
In an exemplary embodiment of the present application, the method for sending the second call request to the calling program by the call request sending unit 603 through the call service, so that the manner for the calling program to execute the intelligent contract according to the second call request may specifically be:
the calling request sending unit 603 sends a second calling request to the calling program through the calling service, so that the calling program calls the intelligent contract, and sends the ledger operation request to the calling program through the intelligent contract;
the call request sending unit 603 receives an account book operation request sent by a call program and responds to the account book operation request; the account book operation request corresponds to an intelligent contract;
the ledger operation request comprises at least one of a read operation request for reading the ledger according to the intelligent contract and a write operation request for writing the ledger according to the intelligent contract.
It can be seen that, by implementing the exemplary embodiment, a response to the ledger operation request can be realized by executing the intelligent contract, so as to achieve the purpose of remotely calling the intelligent contract to complete a write data operation or a read data operation.
In an exemplary embodiment of the present application, after responding to the ledger operation request, the call request sending unit 603 is further configured to transmit a response result corresponding to the ledger operation request to the calling program.
Therefore, by implementing the exemplary embodiment, the response result to the ledger operation request can be fed back remotely, so that the intelligent contract can be deployed locally and can be conveniently called by the blockchain, and moreover, the intelligent contract can be deployed locally and can be convenient for debugging, tracking, running, analyzing logs and the like, and the development efficiency is improved.
In an exemplary embodiment of the present application, the apparatus may further include an intelligent contract debugging unit (not shown), wherein:
and the intelligent contract debugging unit is used for compiling and detecting the intelligent contract and debugging the intelligent contract according to the compiling and detecting result when the detected response result shows that the response of the account book operation request fails.
Therefore, by implementing the exemplary embodiment, the intelligent contract can be optimized through detection and debugging of the intelligent contract, and the execution efficiency of the intelligent contract is improved.
In an exemplary embodiment of the present application, a manner of the call request sending unit 603 responding to the ledger operation request may specifically be:
the call request sending unit 603 verifies the digital signature corresponding to the ledger operation request;
the calling request sending unit 603 sorts the transaction data in the account book operation request according to the transaction timestamp after the verification is successful;
the call request sending unit 603 performs consensus verification on the sequencing result through a consensus algorithm and links the sequencing result after the verification is passed.
It can be seen that, by implementing the exemplary embodiment, the ledger operation request can be responded after the verification is passed, and the uplink operation can be implemented after the consensus verification, so that the authenticity and the non-tamper property of uplink data can be ensured.
In an exemplary embodiment of the present application, the manner in which the call request sending unit 603 sends the second call request to the calling program through the call service may specifically be:
the call request sending unit 603 sends a second call request including a request parameter to the caller through the call service, the second call request being for initiating a remote call for the smart contract.
Therefore, by implementing the exemplary embodiment, the deployment process of the intelligent contract can be simplified by remotely calling the intelligent contract, so that the intelligent contract can be locally deployed, and the debugging efficiency of the intelligent contract is improved.
It should be noted that although in the above detailed description several modules or units of the device for action execution are mentioned, such a division is not mandatory. Indeed, the features and functions of two or more modules or units described above may be embodied in one module or unit according to embodiments of the application. Conversely, the features and functions of one module or unit described above may be further divided into embodiments by a plurality of modules or units.
For details which are not disclosed in the embodiments of the apparatus of the present application, please refer to the embodiments of the calling method of the intelligent contract described above in the present application for the details which are not disclosed in the embodiments of the apparatus of the present application.
Furthermore, in the present exemplary embodiment, an execution apparatus of an intelligent contract is also provided. Referring to fig. 7, the execution apparatus 700 of the intelligent contract may include a call request receiving unit 701 and an intelligent contract execution unit 702, where:
a call request receiving unit 701, configured to receive, after the block link point receives the first call request, queries the intelligent contract information corresponding to the first call request, and determines, according to the intelligent contract information, a call service corresponding to the intelligent contract, a second call request sent by the block link point through the call service;
and an intelligent contract execution unit 702, configured to execute the intelligent contract according to the second invocation request.
Therefore, the execution device for implementing the intelligent contract shown in fig. 7 can embody the local deployment of the intelligent contract in a manner of remotely calling the intelligent contract, which is beneficial to simplifying the debugging process of the intelligent contract and improving the debugging efficiency of the intelligent contract; and, the deployment process of the intelligent contracts can be simplified.
Still further, in the present exemplary embodiment, a system for invoking an intelligent contract is also provided. Referring to fig. 8, the intelligent contract invoking system 800 may include a block link point module 801 and an intelligent contract agent module 802, wherein:
a block link point module 801, configured to query, when receiving a first invocation request, intelligent contract information corresponding to the first invocation request; determining calling service corresponding to the intelligent contract according to the intelligent contract information, wherein the intelligent contract information corresponds to the intelligent contract; sending a second calling request to the calling program through the calling service so that the calling program executes the intelligent contract according to the second calling request;
and an intelligent contract agent module 802, configured to receive a second invocation request sent by the blockchain node, and execute an intelligent contract according to the second invocation request, where the intelligent contract agent includes an invocation program.
Therefore, the implementation of the intelligent contract calling system shown in fig. 8 can embody the local deployment of the intelligent contract in a manner of remotely calling the intelligent contract, which is beneficial to simplifying the debugging process of the intelligent contract and improving the debugging efficiency of the intelligent contract; and, the deployment process of the intelligent contracts can be simplified.
In an exemplary embodiment of the present application, the block link point module 801 is further configured to, before querying the intelligent contract information corresponding to the first invocation request, establish a connection with the invocation program according to the connection establishment request, and receive the intelligent contract information sent by the invocation program; registering the intelligent contract according to the intelligent contract information;
and an intelligent contract agent module 802, configured to send intelligent contract information to the block link point module through a calling program.
Therefore, by implementing the exemplary embodiment, the intelligent contract information can be registered in the block link point by establishing connection with the calling program, the remote calling efficiency of the intelligent contract is improved, the local debugging of the intelligent contract is facilitated, and the debugging effect of the intelligent contract is improved.
In one exemplary embodiment of the present application, the intelligent contract information includes at least one of an intelligent contract number and an intelligent contract version number.
In an exemplary embodiment of the present application, the block link point module 801 is further configured to receive a first call request sent by the network application layer through the intelligent contract call interface.
Therefore, by implementing the exemplary embodiment, the calling request can be received through the intelligent contract calling interface, and the remote calling of the intelligent contract can be realized through the received calling request, so that the deployment process of the intelligent contract is simplified.
In an exemplary embodiment of the present application, the manner of querying the intelligent contract information corresponding to the first invocation request by the block link point module 801 may specifically be:
the block link point module 801 determines an intelligent contract number corresponding to the first invocation request, and queries intelligent contract information according to the intelligent contract number.
Therefore, by implementing the exemplary embodiment, the currently required intelligent contract information can be determined through querying the intelligent contract number, so that the execution of the intelligent contract is remotely requested according to the intelligent contract information, the local debugging efficiency of the intelligent contract is improved, and the deployment process of the intelligent contract is simplified.
In an exemplary embodiment of the present application, the manner in which the block link point module 801 determines the calling service corresponding to the intelligent contract according to the intelligent contract information may specifically be:
the block chain node module 801 determines target information for distinguishing the intelligent contract from other intelligent contracts in the intelligent contract information; and inquiring the calling service matched with the intelligent contract according to the target information.
Therefore, by implementing the exemplary embodiment, the calling service matched with the intelligent contract can be determined through the intelligent contract information, and the remote calling of the intelligent contract can be realized by using the calling service.
In an exemplary embodiment of the present application, the block link point module 801 sends a second call request to the calling program through the call service, so that the manner in which the calling program executes the intelligent contract according to the second call request may specifically be:
the block link node module 801 sends a second call request to the calling program through the call service, so that the calling program calls an intelligent contract and sends an account book operation request to the calling program through the intelligent contract; receiving an account book operation request sent by a calling program and responding to the account book operation request; the account book operation request corresponds to an intelligent contract;
the ledger operation request comprises at least one of a read operation request for reading the ledger according to the intelligent contract and a write operation request for writing the ledger according to the intelligent contract.
It can be seen that, by implementing the exemplary embodiment, a response to the ledger operation request can be realized by executing the intelligent contract, so as to achieve the purpose of remotely calling the intelligent contract to complete a write data operation or a read data operation.
In an exemplary embodiment of the present application, the block link point module 801 is further configured to, after responding to the ledger operation request, transmit a response result corresponding to the ledger operation request to the calling program;
and the intelligent contract agent module 802 is further configured to receive an ledger operation request.
Therefore, by implementing the exemplary embodiment, the response result to the ledger operation request can be fed back remotely, so that the intelligent contract can be deployed locally and can be conveniently called by the blockchain, and moreover, the intelligent contract can be deployed locally and can be convenient for debugging, tracking, running, analyzing logs and the like, and the development efficiency is improved.
In an exemplary embodiment of the present application, the block link point module 801 is further configured to, when it is detected that the response result indicates that the response to the ledger operation request fails, perform compilation detection on the smart contract and debug the smart contract according to the compilation detection result.
Therefore, by implementing the exemplary embodiment, the intelligent contract can be optimized through detection and debugging of the intelligent contract, and the execution efficiency of the intelligent contract is improved.
In an exemplary embodiment of the present application, the manner in which the block link point module 801 responds to the ledger operation request may specifically be:
the block link point module 801 verifies a digital signature corresponding to the ledger operation request; after the verification is successful, sequencing the transaction data in the account book operation request according to the transaction timestamp; and performing consensus verification on the sequencing result through a consensus algorithm, and chaining the sequencing result after the verification is passed.
It can be seen that, by implementing the exemplary embodiment, the ledger operation request can be responded after the verification is passed, and the uplink operation can be implemented after the consensus verification, so that the authenticity and the non-tamper property of uplink data can be ensured.
In an exemplary embodiment of the present application, the manner in which the block link point module 801 sends the second call request to the calling program by calling the service may specifically be:
the blockchain node module 801 sends a second call request containing the request parameter to the caller through the call service, the second call request being used to initiate a remote call for the smart contract.
Therefore, by implementing the exemplary embodiment, the deployment process of the intelligent contract can be simplified by remotely calling the intelligent contract, so that the intelligent contract can be locally deployed, and the debugging efficiency of the intelligent contract is improved.
It should be noted that although in the above detailed description several modules or units of the device for action execution are mentioned, such a division is not mandatory. Indeed, the features and functionality of two or more modules or units described above may be embodied in one module or unit, according to embodiments of the application. Conversely, the features and functions of one module or unit described above may be further divided into embodiments by a plurality of modules or units.
For details which are not disclosed in the embodiment of the apparatus of the present application, please refer to the embodiment of the invoking method of the intelligent contract described above for the details which are not disclosed in the embodiment of the present application.
Still further, fig. 9 schematically shows a block diagram of a calling system of an intelligent contract according to another embodiment of the present application. Referring to fig. 9, the intelligent contract invocation system 900 may include a block link point module 930 and an intelligent contract agent module 920; the block link point module 930 comprises a routing sub-module 931, a proxy sub-module 932, a proxy service sub-module 933 and an accounting sub-module 934; intelligent contract agent module 920 includes registration sub-module 921, agent service sub-module 922, agent sub-module 923, and intelligent contract sub-module 924, specifically:
the block link point module 930 may establish a connection with the caller of the intelligent contract agent module 920 according to the connection establishment request sent by the intelligent contract agent module 920; furthermore, the routing sub-module 931 may register the intelligent contract according to the intelligent contract information sent by the registration sub-module 921; further, the routing sub-module 931 may receive, through the intelligent contract invocation interface 910, the first invocation request sent by the network application layer; furthermore, the agent sub-module 932 may determine an intelligent contract number corresponding to the first invocation request, query intelligent contract information according to the intelligent contract number, determine target information (e.g., an intelligent contract number) used for distinguishing the intelligent contract from other intelligent contracts in the intelligent contract information, and query an invocation service matched with the intelligent contract according to the target information; furthermore, the agent sub-module 932 may send a second invocation request containing the request parameter to the agent service sub-module 922 through the invocation service, so that the agent service sub-module 922 triggers the intelligent contract sub-module 924 to invoke and execute the intelligent contract, and send the ledger operation request to the agent sub-module 923 through the intelligent contract sub-module 924; further, the agent service sub-module 933 may receive the ledger operation request sent by the agent sub-module 923; further, the proxy service sub-module 933 may respond to the account book operation request, and transmit a response result corresponding to the account book operation request to the accounting sub-module 934 and the calling program.
Therefore, the implementation of the intelligent contract calling system shown in fig. 9 can embody the local deployment of the intelligent contract in a manner of remotely calling the intelligent contract, which is beneficial to simplifying the debugging process of the intelligent contract and improving the debugging efficiency of the intelligent contract; and, the deployment process of the intelligent contracts can be simplified.
It should be noted that although in the above detailed description several modules or units of the device for action execution are mentioned, such a division is not mandatory. Indeed, the features and functionality of two or more modules or units described above may be embodied in one module or unit, according to embodiments of the application. Conversely, the features and functions of one module or unit described above may be further divided into embodiments by a plurality of modules or units.
For details which are not disclosed in the embodiment of the apparatus of the present application, please refer to the embodiment of the invoking method of the intelligent contract described above for the details which are not disclosed in the embodiment of the present application.
As another aspect, the present application also provides a computer-readable medium, which may be contained in the electronic device described in the above embodiments; or may exist separately without being assembled into the electronic device. The computer readable medium carries one or more programs which, when executed by an electronic device, cause the electronic device to implement the method described in the above embodiments.
It should be noted that the computer readable medium shown in the present application may be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present application, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In this application, however, a computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present application. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units described in the embodiments of the present application may be implemented by software, or may be implemented by hardware, and the described units may also be disposed in a processor. Wherein the names of the elements do not in some way constitute a limitation on the elements themselves.
Other embodiments of the present application will be apparent to those skilled in the art from consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the invention following, in general, the principles of the application and including such departures from the present disclosure as come within known or customary practice within the art to which the invention pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the application being indicated by the following claims.
It will be understood that the present application is not limited to the precise arrangements described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the application is limited only by the appended claims.

Claims (25)

1. A method for calling an intelligent contract, comprising:
when a first calling request is received, inquiring intelligent contract information corresponding to the first calling request;
determining target information used for distinguishing the intelligent contract from other intelligent contracts in the intelligent contract information, and inquiring a calling service matched with the intelligent contract according to the target information, wherein the calling service is a remote calling service used for providing the intelligent contract, and the intelligent contract corresponds to the intelligent contract information;
sending a second calling request to a calling program through the calling service so that the calling program calls the intelligent contract, sending an account book operation request to the calling program through the intelligent contract, receiving the account book operation request sent by the calling program and responding to the account book operation request, wherein the account book operation request corresponds to the intelligent contract.
2. The method of claim 1, wherein prior to querying intelligent contract information corresponding to the first invocation request, the method further comprises:
establishing connection with the calling program according to the connection establishing request, and receiving the intelligent contract information sent by the calling program;
and registering the intelligent contract according to the intelligent contract information.
3. The method of claim 1, further comprising:
and receiving the first calling request sent by the network application layer through an intelligent contract calling interface.
4. The method of claim 1, wherein the intelligent contract information includes at least one of an intelligent contract number and an intelligent contract version number.
5. The method of claim 1 or 4, wherein querying intelligent contract information corresponding to the first invocation request comprises:
and determining an intelligent contract number corresponding to the first calling request, and inquiring the intelligent contract information according to the intelligent contract number.
6. The method of claim 1, wherein the ledger operation request comprises at least one of a read operation request for reading a ledger in accordance with the smart contract and a write operation request for writing to the ledger in accordance with the smart contract.
7. The method of claim 1, wherein after responding to the ledger operation request, the method further comprises:
and transmitting a response result corresponding to the account book operation request to the calling program.
8. The method of claim 7, further comprising:
and when the response result is detected to indicate that the response to the ledger operation request fails, compiling the intelligent contract and detecting and debugging the intelligent contract according to the compiling detection result.
9. The method of claim 1, wherein responding to the ledger operation request comprises:
verifying a digital signature corresponding to the account book operation request;
after the verification is successful, sequencing the transaction data in the account book operation request according to the transaction timestamp;
and performing consensus verification on the sequencing result through a consensus algorithm, and chaining the sequencing result after the verification is passed.
10. The method of claim 1, wherein sending a second call request to a calling program through the calling service comprises:
and sending a second calling request containing request parameters to the calling program through the calling service, wherein the second calling request is used for initiating remote calling aiming at the intelligent contract.
11. An execution method of an intelligent contract, comprising:
after a block link point receives a first calling request, inquires intelligent contract information corresponding to the first calling request, determines target information used for distinguishing the intelligent contract from other intelligent contracts in the intelligent contract information, and inquires a calling service matched with the intelligent contract according to the target information, a second calling request sent by the block link point through the calling service is received, wherein the calling service is a remote calling service used for providing the intelligent contract;
and calling the intelligent contract according to the second calling request to receive the ledger operation request sent by the intelligent contract.
12. An apparatus for invoking an intelligent contract, comprising:
the intelligent contract information inquiry unit is used for inquiring intelligent contract information corresponding to a first calling request when the first calling request is received;
the calling service determining unit is used for determining target information used for distinguishing the intelligent contract from other intelligent contracts in the intelligent contract information, and inquiring calling service matched with the intelligent contract according to the target information, wherein the calling service is remote calling service used for providing the intelligent contract, and the intelligent contract information corresponds to the intelligent contract;
and the calling request sending unit is used for sending a second calling request to a calling program through the calling service so that the calling program calls the intelligent contract, sending an account book operation request to the calling program through the intelligent contract, receiving the account book operation request sent by the calling program and responding to the account book operation request, wherein the account book operation request corresponds to the intelligent contract.
13. The apparatus of claim 12, further comprising:
the information receiving unit is used for establishing connection with the calling program according to the connection establishing request and receiving the intelligent contract information sent by the calling program;
and the intelligent contract registering unit is used for registering the intelligent contract according to the intelligent contract information.
14. The apparatus of claim 12, wherein the call request sending unit is further configured to:
and receiving the first calling request sent by the network application layer through an intelligent contract calling interface.
15. The apparatus of claim 12, wherein the intelligent contract information includes at least one of an intelligent contract number and an intelligent contract version number.
16. The apparatus according to claim 12 or 15, wherein the intelligent contract information query unit is specifically configured to:
and determining an intelligent contract number corresponding to the first calling request, and inquiring the intelligent contract information according to the intelligent contract number.
17. The apparatus of claim 12, wherein the ledger operation request comprises at least one of a read operation request for reading a ledger according to the smart contract and a write operation request for writing to the ledger according to the smart contract.
18. The apparatus of claim 12, wherein the call request sending unit is further configured to:
and transmitting a response result corresponding to the account book operation request to the calling program.
19. The apparatus of claim 18, further comprising:
and the intelligent contract debugging unit is used for compiling and detecting the intelligent contract and debugging the intelligent contract according to a compiling and detecting result when detecting that the response result represents that the response to the ledger operation request fails.
20. The apparatus according to claim 12, wherein the call request sending unit is specifically configured to:
verifying the digital signature corresponding to the account book operation request;
after the verification is successful, sequencing the transaction data in the account book operation request according to the transaction timestamp;
and performing consensus verification on the sequencing result through a consensus algorithm, and chaining the sequencing result after the verification is passed.
21. The apparatus according to claim 12, wherein the call request sending unit is specifically configured to:
and sending a second calling request containing request parameters to the calling program through the calling service, wherein the second calling request is used for initiating remote calling aiming at the intelligent contract.
22. An execution apparatus of an intelligent contract, comprising:
the intelligent contract management system comprises a calling request receiving unit, a calling request sending unit and a calling request receiving unit, wherein the calling request receiving unit is used for receiving a first calling request at a block chain node, inquiring intelligent contract information corresponding to the first calling request, determining target information used for distinguishing the intelligent contract from other intelligent contracts in the intelligent contract information, and receiving a second calling request sent by the block chain node through a calling service after inquiring the calling service matched with the intelligent contract according to the target information, wherein the calling service is a remote calling service used for providing the intelligent contract;
and the intelligent contract execution unit is used for calling the intelligent contract according to the second calling request so as to receive the ledger operation request sent by the intelligent contract.
23. A system for invoking an intelligent contract, comprising:
the block chain link point module is used for inquiring intelligent contract information corresponding to a first calling request when the first calling request is received; determining target information used for distinguishing the intelligent contract from other intelligent contracts in the intelligent contract information, and inquiring a calling service matched with the intelligent contract according to the target information, wherein the calling service is a remote calling service used for providing the intelligent contract, and the intelligent contract information corresponds to the intelligent contract; sending a second calling request to a calling program through the calling service so that the calling program calls the intelligent contract, sending an account book operation request to the calling program through the intelligent contract, receiving the account book operation request sent by the calling program and responding to the account book operation request, wherein the account book operation request corresponds to the intelligent contract;
and the intelligent contract agent module is used for receiving the second calling request sent by the blockchain node and calling the intelligent contract according to the second calling request so as to receive the ledger operation request sent by the intelligent contract, and the intelligent contract agent module comprises the calling program.
24. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the method of any one of claims 1-11.
25. An electronic device, comprising:
a processor; and
a memory for storing executable instructions of the processor;
wherein the processor is configured to perform the method of any of claims 1-11 via execution of the executable instructions.
CN202010070733.8A 2020-01-21 2020-01-21 Calling method, device, system, medium and electronic equipment of intelligent contract Active CN111273970B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010070733.8A CN111273970B (en) 2020-01-21 2020-01-21 Calling method, device, system, medium and electronic equipment of intelligent contract

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010070733.8A CN111273970B (en) 2020-01-21 2020-01-21 Calling method, device, system, medium and electronic equipment of intelligent contract

Publications (2)

Publication Number Publication Date
CN111273970A CN111273970A (en) 2020-06-12
CN111273970B true CN111273970B (en) 2022-05-06

Family

ID=71001233

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010070733.8A Active CN111273970B (en) 2020-01-21 2020-01-21 Calling method, device, system, medium and electronic equipment of intelligent contract

Country Status (1)

Country Link
CN (1) CN111273970B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111813441B (en) * 2020-09-10 2021-02-02 腾讯科技(深圳)有限公司 Intelligent contract issuing method and device, computer readable medium and electronic equipment

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108510389A (en) * 2018-03-30 2018-09-07 深圳前海微众银行股份有限公司 Intelligent contract call method, equipment and readable storage medium storing program for executing based on block chain
CN108830720A (en) * 2018-06-21 2018-11-16 北京京东尚科信息技术有限公司 Intelligent contract operation method, device, system and computer readable storage medium
CN109189396A (en) * 2018-08-16 2019-01-11 北京京东尚科信息技术有限公司 intelligent contract engine module, operation method and storage medium
CN109376541A (en) * 2018-09-21 2019-02-22 上海点融信息科技有限责任公司 For running the method, apparatus and computer storage medium of intelligent contract

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20190303623A1 (en) * 2018-04-02 2019-10-03 Ca, Inc. Promotion smart contracts for software development processes

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108510389A (en) * 2018-03-30 2018-09-07 深圳前海微众银行股份有限公司 Intelligent contract call method, equipment and readable storage medium storing program for executing based on block chain
CN108830720A (en) * 2018-06-21 2018-11-16 北京京东尚科信息技术有限公司 Intelligent contract operation method, device, system and computer readable storage medium
CN109189396A (en) * 2018-08-16 2019-01-11 北京京东尚科信息技术有限公司 intelligent contract engine module, operation method and storage medium
CN109376541A (en) * 2018-09-21 2019-02-22 上海点融信息科技有限责任公司 For running the method, apparatus and computer storage medium of intelligent contract

Also Published As

Publication number Publication date
CN111273970A (en) 2020-06-12

Similar Documents

Publication Publication Date Title
CN112104709B (en) Intelligent contract processing method, device, medium and electronic equipment
CN109922158A (en) Data processing method, device, medium and electronic equipment based on micro services
CN112597047B (en) Test method, test device, electronic equipment and computer readable medium
CN112187558B (en) Data verification method and device and electronic equipment
CN108846753B (en) Method and apparatus for processing data
WO2018153052A1 (en) Method and device for loading kernel module
US20180081911A1 (en) Deployment of applications conforming to application data sharing and decision service platform schema
CN105630684B (en) Software Development Kit recognition methods and device
CN111209202A (en) Terminal application testing method and device
CN109359194B (en) Method and apparatus for predicting information categories
WO2019015272A1 (en) Information processing method and device
CN111367821B (en) Software testing method and system
CN109284198A (en) A kind of method and apparatus verifying data
CN114567643B (en) Cross-blockchain data transfer method, device and related equipment
CN110688428B (en) Method and device for issuing intelligent contracts
CN111311407A (en) Data processing method and device based on block chain system and electronic equipment
CN114564203A (en) Service operation method and device, electronic equipment and readable medium
CN112463729A (en) Data file storage method and device, electronic equipment and medium
CN111787041B (en) Method and device for processing data
CN111273970B (en) Calling method, device, system, medium and electronic equipment of intelligent contract
CN112714042B (en) Pressure testing method and device, electronic equipment and storage medium
CN109218338B (en) Information processing system, method and device
CN111050326B (en) Block chain-based short message verification method, device, equipment and medium
CN110780915B (en) Data processing method, device and storage medium
CN115374207A (en) Service processing method and device, electronic equipment and computer readable storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
REG Reference to a national code

Ref country code: HK

Ref legal event code: DE

Ref document number: 40023577

Country of ref document: HK

SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant