CN112632573A - Intelligent contract execution method, device and system, storage medium and electronic equipment - Google Patents

Intelligent contract execution method, device and system, storage medium and electronic equipment Download PDF

Info

Publication number
CN112632573A
CN112632573A CN202011483371.1A CN202011483371A CN112632573A CN 112632573 A CN112632573 A CN 112632573A CN 202011483371 A CN202011483371 A CN 202011483371A CN 112632573 A CN112632573 A CN 112632573A
Authority
CN
China
Prior art keywords
contract
node
intelligent contract
execution end
execution
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.)
Granted
Application number
CN202011483371.1A
Other languages
Chinese (zh)
Other versions
CN112632573B (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.)
Neusoft Corp
Original Assignee
Neusoft Corp
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 Neusoft Corp filed Critical Neusoft Corp
Priority to CN202011483371.1A priority Critical patent/CN112632573B/en
Publication of CN112632573A publication Critical patent/CN112632573A/en
Application granted granted Critical
Publication of CN112632573B publication Critical patent/CN112632573B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/602Providing cryptographic facilities or services
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/64Protecting data integrity, e.g. using checksums, certificates or signatures
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/04Network architectures or network communication protocols for network security for providing a confidential data exchange among entities communicating through data packet networks
    • H04L63/0428Network architectures or network communication protocols for network security for providing a confidential data exchange among entities communicating through data packet networks wherein the data content is protected, e.g. by encrypting or encapsulating the payload
    • H04L63/0435Network architectures or network communication protocols for network security for providing a confidential data exchange among entities communicating through data packet networks wherein the data content is protected, e.g. by encrypting or encapsulating the payload wherein the sending and receiving network entities apply symmetric encryption, i.e. same key used for encryption and decryption
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/14Session management
    • H04L67/141Setup of application sessions

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • General Engineering & Computer Science (AREA)
  • General Health & Medical Sciences (AREA)
  • Signal Processing (AREA)
  • Health & Medical Sciences (AREA)
  • Bioethics (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computing Systems (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

The invention relates to an intelligent contract execution method, a device, a system, a storage medium and electronic equipment, wherein the method applied to contract calling nodes in a block chain network comprises the following steps: acquiring contract information of a target intelligent contract to be called from a registered intelligent contract list, wherein the contract information comprises a contract identifier and a contract execution end address, and the contract execution end address corresponds to a contract execution end outside the block chain network; sending an intelligent contract calling request to the contract execution end, wherein the intelligent contract calling request is used for the contract execution end to execute the target intelligent contract according to the contract identification in the intelligent contract calling request and the contract execution data; and receiving a contract execution response of the contract execution end to obtain an execution result of the target intelligent contract corresponding to the contract invoking node.

Description

Intelligent contract execution method, device and system, storage medium and electronic equipment
Technical Field
The present disclosure relates to the field of block chain technologies, and in particular, to an intelligent contract execution method, apparatus, system, storage medium, and electronic device.
Background
Blockchains are a technique that can collectively maintain a reliable database through decentralization and distrust. The method can store transactions occurring in a period of time by taking the blocks as units, and connect the blocks according to time sequence by using a cryptographic algorithm to form a data structure similar to a chain. The block chain technology has the characteristics of distributed accounts, decentralization, non-falsification and the like, and has a relatively high application prospect in many aspects.
In a related scenario, a number of functions, such as reading and writing of block data, can be implemented in the blockchain network through an intelligent contract, thereby improving the expansibility of the blockchain technology. By taking a alliance chain as an example, intelligent contracts are deployed on nodes, so that when the nodes call the contracts, the contracts can be packaged into images and started, and then the images are mounted on the nodes in a contract container mode for calling. However, such an approach requires more resources of the node, which may cause the lower-performance node to have difficulty in performing the related functions normally.
Disclosure of Invention
The present disclosure is directed to a method, an apparatus, a system, a storage medium, and an electronic device for executing an intelligent contract, so as to solve the above related technical problems.
In order to achieve the above object, according to a first aspect of the embodiments of the present disclosure, there is provided an intelligent contract execution method applied to a contract invoking node in a block chain network, the method including:
acquiring contract information of a target intelligent contract to be called from a registered intelligent contract list, wherein the contract information comprises a contract identifier and a contract execution end address, and the contract execution end address corresponds to a contract execution end outside the block chain network;
sending an intelligent contract calling request to the contract execution end, wherein the intelligent contract calling request is used for the contract execution end to execute the target intelligent contract according to the contract identification in the intelligent contract calling request and the contract execution data;
and receiving a contract execution response of the contract execution end to obtain an execution result of the target intelligent contract corresponding to the contract invoking node.
Optionally, before obtaining the contract information of the target intelligent contract to be called from the registered intelligent contract list, the method further includes:
establishing a communication connection with the contract execution end;
sending a contract identifier and starting parameters of the target intelligent contract to the contract execution end so that the contract execution end starts the intelligent contract corresponding to the contract identifier;
receiving a contract starting result sent by the contract execution end;
if the contract starting result represents that the contract execution end successfully starts the target intelligent contract, determining that the target intelligent contract is successfully registered;
adding the contract identification of the target intelligent contract and the contract execution end address of the contract execution end into the intelligent contract list;
and sending a registration success message to the contract execution end.
Optionally, the establishing a communication connection with the contract execution end includes:
acquiring registration parameter information of the target intelligent contract;
sending a connection request to a contract execution end corresponding to the contract execution end address according to the contract execution end address in the registration parameter information, wherein the connection request comprises the node information of the contract calling node and the contract identifier of the target intelligent contract;
receiving a connection request response message sent by the contract execution end, wherein the connection request response message comprises address information of the contract execution end and configuration information of an intelligent contract corresponding to the contract identification;
verifying the address information of the contract execution end in the connection request response message and the configuration information of the intelligent contract corresponding to the contract identifier according to the address information of the contract execution end and the configuration information of the intelligent contract in the registration parameter information;
when the verification is successful, sending connection confirmation information to the contract execution end;
and establishing a communication connection with the contract execution end.
Optionally, in the process of communication between the contract invoking node and the contract executing end, the data to be sent is encrypted in the following manner, so as to obtain first target encrypted sending data:
acquiring a hash value of data to be sent through a target hash function;
encrypting the hash value based on a private key of the contract calling node to obtain a first encrypted hash value;
randomly generating a first target symmetric key pair, and encrypting the first encrypted hash value and the data to be sent through a private key in the first target symmetric key pair to obtain first encrypted sending data;
and encrypting the first encrypted sending data and the public key of the first target symmetric key pair through the public key of the contract execution end to obtain the first target encrypted sending data.
Optionally, the intelligent contract invoking request further includes consensus node information, which is used by the contract execution end to terminate the invoking process of the target intelligent contract when determining that the consensus node information does not include the identification information of the contract invoking node, where the consensus node is a node having the invoking authority of the target intelligent contract; and/or
The intelligent contract invoking request further comprises consensus policy node information, and the consensus policy node information is used for terminating the invoking process of the target intelligent contract when the contract execution end determines that any consensus policy node in the consensus policy node information is not in the invoking permission list of the target intelligent contract of the contract execution end, wherein the consensus policy node is a consensus node required by the preset target intelligent contract to take effect.
According to a second aspect of the embodiments of the present disclosure, there is provided an intelligent contract execution method applied to a contract execution end outside a blockchain network, the method including:
receiving an intelligent contract invoking request sent by a contract invoking node in a block chain network, wherein the intelligent contract invoking request comprises a contract identifier of a target intelligent contract to be invoked and contract execution data of the target intelligent contract;
matching the node identification information of the contract calling node with the node identification information in the calling permission list corresponding to the target intelligent contract;
when the matching is successful, executing the target intelligent contract according to the contract identification in the intelligent contract calling request and the contract execution data;
and sending the execution result of the target intelligent contract to the contract invoking node.
Optionally, before receiving the intelligent contract invoking request sent by the contract invoking node in the blockchain network, the method further includes:
establishing a communication connection with the contract invoking node in response to receiving a connection request sent by the contract invoking node;
receiving a contract identifier and a starting parameter of the target intelligent contract sent by the contract calling node;
searching an intelligent contract corresponding to the contract identification, and starting the intelligent contract;
sending a contract starting result to the contract invoking node, wherein the contract starting result comprises a contract identification of the started intelligent contract;
and receiving a registration success message sent by the contract calling node, and adding the node address and the node identification of the contract calling node into the calling permission list.
Optionally, the establishing a communication connection with the contract invoking node in response to receiving the connection request sent by the contract invoking node includes:
receiving a connection request sent by the contract invoking node, wherein the connection request comprises node information of the contract invoking node and a contract identifier of the target intelligent contract;
searching configuration information of an intelligent contract corresponding to the contract identification;
sending a connection request response message to the contract invoking node, wherein the connection request response message comprises the configuration information of the intelligent contract and the address information of the contract execution end;
and receiving connection confirmation information sent by the contract calling node, and establishing communication connection with the contract calling node.
Optionally, in the process of communication between the contract execution end and the contract invoking node, the data to be sent is encrypted in the following manner, so as to obtain second target encrypted sending data:
acquiring a hash value of data to be sent through a target hash function;
encrypting the hash value based on a private key of the contract execution end to obtain a second encrypted hash value;
randomly generating a second target symmetric key pair, and encrypting the second encrypted hash value and the data to be sent through a private key in the second target symmetric key pair to obtain second encrypted sending data;
and encrypting the second encrypted sending data and the public key of the second target symmetric secret key pair through the public key of the contract calling node to obtain the second target encrypted sending data.
Optionally, the intelligent contract invoking request further includes consensus node information, and the method further includes:
verifying the node identification information of the contract calling node according to the consensus node information;
when the identification information of the contract calling node is not included in the consensus node information, the calling process of the target intelligent contract is terminated, wherein the consensus node is a node with the calling authority of the target intelligent contract; and/or
The intelligent contract invoking request further comprises consensus policy node information, and the method further comprises:
checking the consensus strategy node information according to the node identification information in the calling permission list of the target intelligent contract;
and when any consensus strategy node in the consensus strategy node information is not in the calling permission list, terminating the calling process of the target intelligent contract, wherein the consensus strategy node is a consensus node required by the preset target intelligent contract to take effect.
According to a third aspect of the embodiments of the present disclosure, there is provided an intelligent contract execution apparatus including:
the first acquisition module is used for acquiring contract information of a target intelligent contract to be called from a registered intelligent contract list, wherein the contract information comprises a contract identifier and a contract execution end address, and the contract execution end address corresponds to a contract execution end outside the blockchain network;
the first sending module is used for sending an intelligent contract calling request to the contract execution end, wherein the intelligent contract calling request is used for the contract execution end to execute the target intelligent contract according to the contract identification in the intelligent contract calling request and the contract execution data;
and the first receiving module is used for receiving the contract execution response of the contract execution end and obtaining the execution result of the target intelligent contract corresponding to the contract calling node.
According to a fourth aspect of the embodiments of the present disclosure, there is provided an intelligent contract execution apparatus, including:
the second receiving module is used for receiving an intelligent contract calling request sent by a contract calling node in a block chain network, wherein the intelligent contract calling request comprises a contract identifier of a target intelligent contract to be called and contract execution data of the target intelligent contract;
a first matching module, configured to match node identification information of the contract invocation node with node identification information in an invocation permission list corresponding to the target intelligent contract;
the first execution module is used for executing the target intelligent contract according to the contract identifier in the intelligent contract calling request and the contract execution data when the matching is successful;
and the second sending module is used for sending the execution result of the target intelligent contract to the contract calling node.
According to a fifth aspect of embodiments of the present disclosure, there is provided a computer-readable storage medium, on which a computer program is stored, which when executed by a processor, performs the steps of the method of any one of the above-mentioned first aspects.
According to a sixth aspect of embodiments of the present disclosure, there is provided a computer-readable storage medium, on which a computer program is stored, which when executed by a processor, implements the steps of the method of any one of the above second aspects.
According to a seventh aspect of embodiments of the present disclosure, there is provided a contract invoking node, including:
a memory having a computer program stored thereon;
a processor for executing the computer program in the memory to implement the steps of the method of any of the first aspects above.
According to an eighth aspect of embodiments of the present disclosure, there is provided a contract execution end including:
a memory having a computer program stored thereon;
a processor for executing the computer program in the memory to implement the steps of the method of any of the second aspects above.
According to a ninth aspect of the embodiments of the present disclosure, there is provided an intelligent contract execution system, including the contract invoking node according to the seventh aspect and the contract executing end according to the eighth aspect.
By adopting the technical scheme, when the contract calling node needs to call the target intelligent contract, the contract information of the target intelligent contract can be obtained from the registered intelligent contract list. In this way, the intelligent contract calling request can be sent to the corresponding contract execution end according to the contract execution end address in the contract information, so that the calling of the target intelligent contract is realized. That is to say, according to the technical scheme, the intelligent contract program is arranged at the contract execution end outside the block chain, so that the contract calling node does not need to mount the contract program independently, and the node resource occupation caused by the operation of the intelligent contract can be reduced. In addition, by means of executing the intelligent contract outside the chain, relevant limits (such as the calling limits of bottom-layer elements) in the block chain network can be broken through, so that the phenomenon of abnormal contract operation caused by the relevant limits is reduced.
Additional features and advantages of the disclosure will be set forth in the detailed description which follows.
Drawings
The accompanying drawings, which are included to provide a further understanding of the disclosure and are incorporated in and constitute a part of this specification, illustrate embodiments of the disclosure and together with the description serve to explain the disclosure without limiting the disclosure. In the drawings:
FIG. 1 is a flowchart illustrating a method for intelligent contract execution, according to an exemplary embodiment of the present disclosure.
FIG. 2 is a schematic diagram of a contract invocation node, shown in an exemplary embodiment of the present disclosure.
Fig. 3 is a flow chart illustrating registration of an intelligent contract according to an exemplary embodiment of the present disclosure.
Fig. 4 is a schematic diagram illustrating encryption of data to be transmitted according to an exemplary embodiment of the disclosure.
FIG. 5 is a flowchart illustrating a method for intelligent contract execution, according to an exemplary embodiment of the present disclosure.
FIG. 6 is a call flow diagram of a smart contract, shown in an exemplary embodiment of the present disclosure.
FIG. 7 is a schematic diagram of a contract execution side shown in an exemplary embodiment of the present disclosure.
Fig. 8 is a schematic diagram illustrating decryption of first target encrypted transmission data according to an exemplary embodiment of the present disclosure.
Fig. 9 is a block diagram of an intelligent contract execution apparatus according to an exemplary embodiment of the present disclosure.
Fig. 10 is a block diagram of an intelligent contract execution apparatus according to an exemplary embodiment of the present disclosure.
FIG. 11 is a block diagram of a contract invocation node, shown in an exemplary embodiment of the present disclosure.
FIG. 12 is a block diagram of a contract execution side, shown in an exemplary embodiment of the present disclosure.
Detailed Description
The following detailed description of specific embodiments of the present disclosure is provided in connection with the accompanying drawings. It should be understood that the detailed description and specific examples, while indicating the present disclosure, are given by way of illustration and explanation only, not limitation.
Before introducing the intelligent contract execution method, apparatus, system, storage medium, and electronic device of the present disclosure, an application scenario of each embodiment provided by the present disclosure is first introduced, and each embodiment provided by the present disclosure may be applied to an intelligent contract execution scenario in a block chain, such as a public chain, a federation chain, and the like.
Taking a federation chain as an example, in a related scenario, an intelligent contract can be deployed on a node, so that when the node calls the contract, the contract can be packaged into a mirror image and started, and then mounted on the node in a contract container mode for calling. However, such an approach requires more resources of the node, which may cause the lower-performance node to have difficulty in performing the related functions normally.
Furthermore, in some federation chains, operational rights may be strictly required, for example, there may be related rights restrictions on automatically invoking underlying elements, resulting in a contractual container being unable to create or initiate an exception, ultimately limiting the production and application of blockchain techniques.
To this end, the present disclosure provides an intelligent contract execution method applied to a contract invoking node in a block chain network, and referring to a flowchart of an intelligent contract execution method shown in fig. 1, the method includes:
in step S11, contract information of the target intelligent contract to be invoked is acquired from the registered intelligent contract list.
The contract invoking node may be any node (e.g., a full node) in the blockchain network that needs to invoke an intelligent contract, and the intelligent contract list may be implemented in a registry, an index table, etc., and may include contract information of various intelligent contracts registered in the node.
The contract information may include a contract identifier, such as a name, an ID (Identity) number, and the like of the intelligent contract, or a combination thereof, and a contract execution end address. The contract execution end address may correspond to a contract execution end external to the blockchain network, which may be any type of stationary or mobile computing device, including a mobile computer or mobile computing device (e.g., tablet, personal digital assistant, notebook, netbook, etc.), mobile phone, wearable computing device, or other type of mobile device, or a stationary computing device such as a desktop computer, server, etc.
In step S12, an intelligent contract invocation request is sent to the contract execution end.
The contract invocation request may include, for example, an identification of the intelligent contract to be invoked, parameters and data related to executing the target intelligent contract, and so on. In some implementation scenarios, the intelligent contract invocation request may also provide parameters required for the target intelligent contract to run by providing a relevant data interface.
In other implementation scenarios, the intelligent contract invocation request may further include security authentication identification information of the target intelligent contract. When the security authentication identification information represents that the target intelligent contract needs security authentication, the communication process between the contract execution end and the contract invoking node needs to verify the security certificate of the contract execution end. When the security authentication identification information represents that the target intelligent contract does not need security authentication, the communication process between the contract execution end and the contract invoking node does not need to verify the security certificate of the contract execution end.
In addition, in one possible implementation, the intelligent contract invoking request further comprises consensus node information. The common node is a node having the invoking right of the target intelligent contract, and the common node information may be, for example, an identifier of each common node, such as a node address, a number, and the like.
Taking the consensus node information as the node address of the consensus node as an example, when the contract execution end receives the contract invoking request, the contract execution end may determine whether the contract invoking node is the consensus node by comparing the node address of the contract invoking node with the addresses of the consensus nodes. When the contract invoking node is not the consensus node, the contract execution end can terminate the invoking process of the target intelligent contract.
In another possible implementation manner, the intelligent contract invoking request may include consensus policy node information, where the consensus policy node is a consensus node required for the preset target intelligent contract to take effect. It should be understood that the intelligent contract requires some nodes to agree on in the validation process, and therefore, the nodes can be used as the consensus policy nodes.
The contract execution end may maintain, for example, an invocation permission list corresponding to each intelligent contract, the invocation permission list including node information of nodes that have completed registration at the contract execution end and are capable of invoking the intelligent contract through the contract execution end. Still taking the node information as an example for explanation, when the contract execution end receives the contract invoking request, the contract execution end may determine whether the consensus policy node corresponding to the target intelligent contract completes registration at the contract execution end by comparing the node address of the consensus policy node with the node addresses of the nodes in the invoking permission list of the target intelligent contract.
In this way, when it is determined that any one of the consensus policy nodes in the consensus policy node information is not in the invocation permission list of the target intelligent contract of the contract execution end (assuming that the relevant nodes of the target intelligent contract all invoke the target intelligent contract through the external contract execution end), the contract execution end may terminate the invocation process of the target intelligent contract. Taking table 1 as an example, since the consensus policy node 10.0.0.2: g4f13 … yft is not in the invocation permission list of the target intelligent contract, the consensus policy node 10.0.0.2: g4f13 … yft cannot execute the target intelligent contract based on the contract execution end. Also, as shown in Table 1, the validation of the target intelligent contract requires that node 10.0.0.1: abc2d … asb and node 10.0.0.2: g4f13 … yft complete consensus. Therefore, in the case where 10.0.0.2 g4f13 … yft fails to execute the target intelligent contract based on the contract execution end, the target intelligent contract cannot take effect, and the contract execution end may terminate the calling process of the target intelligent contract.
Figure BDA0002838242000000091
TABLE 1
Of course, the above embodiment is only used to illustrate the technical solution of the present invention, and is not limited thereto, and it should be understood by those skilled in the art that, in the specific implementation, the intelligent contract invoking request may also include the consensus node information and the consensus policy node information at the same time as shown in table 1, which is not limited by the present disclosure.
Further, after sending the intelligent contract invoking request to the contract execution end, the contract execution end may execute the target intelligent contract according to the contract identification in the intelligent contract invoking request and the contract execution data. Of course, in some implementation scenarios, the contract execution end may also verify the contract invoking node before responding to the intelligent contract invoking request, so as to improve security, which will be described in the following embodiments of the present disclosure.
Thus, after the contract execution end executes the target intelligent contract, in step S13, the contract invoking node may receive a contract execution response of the contract execution end, and obtain an execution result of the target intelligent contract corresponding to the contract invoking node.
By adopting the technical scheme, when the contract calling node needs to call the target intelligent contract, the contract information of the target intelligent contract can be obtained from the registered intelligent contract list. In this way, the intelligent contract calling request can be sent to the corresponding contract execution end according to the contract execution end address in the contract information, so that the calling of the target intelligent contract is realized. That is to say, according to the technical scheme, the intelligent contract program is arranged at the contract execution end outside the block chain, so that the contract calling node does not need to mount the contract program independently, and the node resource occupation caused by the operation of the intelligent contract can be reduced. In addition, by means of executing the intelligent contract outside the chain, relevant limits (such as the calling limits of bottom-layer elements) in the block chain network can be broken through, so that the phenomenon of abnormal contract operation caused by the relevant limits is reduced.
Optionally, before obtaining the contract information of the target intelligent contract to be called from the registered intelligent contract list, the method further includes:
and establishing a communication connection with the contract execution end. Corresponding descriptions already exist in the related art for the manner of establishing communication connection through a network, and are not described herein.
In some possible embodiments, the contract invoking node may also perform a corresponding configuration file check when establishing a communication connection with the contract execution end to determine that the contract execution end is capable of executing the target intelligent contract. In this case, the establishing of the communication connection with the contract execution end includes:
and acquiring the registration parameter information of the target intelligent contract.
In particular, referring to a schematic diagram of a contract invocation node shown in FIG. 2, the contract invocation node may include a builder and a contract compression package. The contract compression package may include target intelligent contract registration and relevant data for constructing an execution environment, and when the target intelligent contract is deployed, the registration of the target intelligent contract and the relevant data of the execution environment may be compressed into the contract compression package and stored in an address that is local to a service end where a node is located or that is accessible to the node. In the example of fig. 2, the contract compression package may include data such as a deployment style, a contract name, a contract compression package storage path, a contract execution end address, whether a security authentication identifier is included, and the like.
The contract calling node is also provided with a constructor used for reading and analyzing the contract compression package and establishing the safe connection between the contract calling node and the contract execution end. For example, the decider in the builder may determine the deployment policy of the target intelligent contract by obtaining the deployment mode in the contract compression package. For example, the deployment may be a local deployment, an out-of-chain deployment, and so on. The local deployment can perform intelligent contract deployment locally at the contract invoking node by mounting a contract container, for example; and the out-of-chain deployment can deploy the contract program of the target intelligent contract in the contract execution end corresponding to the contract execution end address.
Of course, the deployment mode may further include whether the target intelligent contract is a deployment identifier, and when the target intelligent contract is deployed, the determiner may activate the connector to establish a communication connection with an external contract execution end. When the target intelligent contract is not deployed, the builder can copy the contract file to a local storage space in the builder through the contract name and the contract compression package storage path, and analyze the configuration and operation parameters of the target intelligent contract through a configuration resolver, such as the contract execution end address, the security authentication identification and other registration parameter information.
In this way, referring to the registration flowchart of an intelligent contract shown in fig. 3, after acquiring the registration parameter, the contract invoking node may send a connection request to the contract execution end corresponding to the contract execution end address according to the contract execution end address in the registration parameter information. Wherein the connection request includes node information (such as an IP address, a node ID, etc.) of the contract invoking node and a contract identification of the target intelligent contract. Correspondingly, after receiving the connection request, the contract execution end may store the node information of the contract invoking node in the connection request, and search the configuration information of the intelligent contract corresponding to the contract identifier of the contract execution end according to the contract identifier. In this way, the contract execution end can send a connection request response message to the contract invoking node, wherein the connection request response message comprises the configuration information of the intelligent contract and the address information of the contract execution end.
After receiving the connection request response message sent by the contract execution end, the contract invoking node may verify the address information of the contract execution end and the configuration information (e.g., contract ID) of the intelligent contract corresponding to the contract identifier in the connection request response message according to the address information of the contract execution end and the configuration information of the intelligent contract in the registration parameter information.
Wherein, upon failure of the verification, the contract invoking node may terminate the connection request; when the verification is successful, connection confirmation information can be sent to the contract execution end, so that the communication connection with the contract execution end is established.
In this way, after the communication connection is successfully established, the contract invoking node can also send the contract identification and the starting parameters of the target intelligent contract to the contract execution end. Correspondingly, the contract execution end can search the intelligent contract corresponding to the contract identification and start the intelligent contract. In addition, the contract execution end can also send a contract starting result to the contract invoking node, and the contract starting result comprises the contract identification of the started intelligent contract.
After receiving the contract start result sent by the contract execution end, the contract invoking node may parse the contract start result, for example, by comparing the contract identifier in the contract start result with the contract identifier of the target intelligent contract, so as to determine whether the intelligent contract started by the contract execution end is the target intelligent contract. And if the contract starting result represents that the contract execution end successfully starts the target intelligent contract, determining that the target intelligent contract is successfully registered. In this case, the contract identification of the target intelligent contract and the contract execution end address of the contract execution end may be added to the intelligent contract list for subsequent invocation. Further, the contract invoking node may also send a registration success message to the contract execution end, so that the contract execution end determines the registration result of the target intelligent contract. In this way, by setting the contract execution end and performing the contract registration process, off-chain execution of the intelligent contract can be realized, and the resource burden of the contract calling end is reduced.
In a possible implementation manner, in the process of communication between the contract invoking node and the contract executing end, the data to be sent may also be encrypted, so as to obtain the first target encrypted sending data. In this way, by transmitting the first target encrypted transmission data, the security of communication between the contract invoking node and the contract executing end can be improved.
For example, referring to fig. 3, before registering a target intelligent contract, the contract invoking node and the contract executing end may also upload their own public keys to facilitate encryption of communication between the two parties. Thus, referring to an encryption diagram of data to be sent shown in fig. 4, for the data to be sent, the hash value of the data to be sent may be obtained through the target hash function. The target hash function may be, for example, a function such as MD5, SHA-1, SHA-256, etc., which is not intended to be limiting in this disclosure.
After the hash value is obtained, the contract invoking node may further encrypt the hash value based on a private key of the contract invoking node to obtain a first encrypted hash value. In some possible embodiments, a corresponding key pair may also be provided for the builder, in which case the hash value may also be encrypted by the private key of the builder.
In addition, a first target symmetric key pair can be randomly generated by a key issuing mechanism in the builder, and the encrypted hash value and the data to be sent are encrypted by a private key in the first target symmetric key pair to obtain first encrypted sending data. Further, the first encrypted transmission data and the public key of the first target symmetric key pair may be encrypted by the public key of the contract execution end, so as to obtain the first target encrypted transmission data. In this way, the security of the communication between the contract calling node and the contract execution end can be improved through double encryption.
Fig. 5 is a flowchart of an intelligent contract execution method shown in an exemplary embodiment of the present disclosure, which may be applied to, for example, a contract execution end in the foregoing embodiment, and with reference to fig. 1, the method includes:
in step S51, an intelligent contract invoking request sent by a contract invoking node in the blockchain network is received.
The intelligent contract invoking request comprises a contract identification of a target intelligent contract to be invoked and contract execution data of the target intelligent contract, wherein the contract identification can be, for example, a name, an ID (Identity) number and the like of the intelligent contract or a combination of the name, the ID number and the like. The contract execution data includes parameters and data related to executing the target intelligent contract, and the like. In some implementation scenarios, the intelligent contract invocation request may also include a relevant data interface, so that the contract execution end may obtain parameters required by the target intelligent contract to operate through the data interface.
In some implementation scenarios, the intelligent contract invocation request may also include security authentication identification information of the target intelligent contract. When the security authentication identification information represents that the target intelligent contract needs security authentication, the communication process between the contract invoking node and the contract execution end needs to verify the security certificate of the contract execution end. For example, a root certificate and data to be sent of a contract execution end may be signed by a certificate private key, and the root certificate and the data to be sent obtained by signing may be encrypted by the private key of the contract execution end to obtain an encryption result, and the encryption result and the root certificate may be sent to the contract invoking node. Certainly, when the security authentication identification information represents that the target intelligent contract does not need security authentication, the communication process between the contract execution end and the contract invoking node does not need to verify the security certificate of the contract execution end.
In step S52, the node identification information of the contract invoking node is matched with the node identification information in the invocation permission list corresponding to the target intelligent contract.
Specifically, the contract execution end may maintain a corresponding invocation permission list for each type of intelligent contract, for example, and the invocation permission list may include node information, such as a node address, a node ID number, and the like, corresponding to various types of intelligent contracts registered in the contract execution end. In a specific implementation, the invoking permission list may be implemented in a registry, an index table, or the like, for example.
Referring to the invocation flow diagram of an intelligent contract shown in fig. 6, after receiving the contract invocation request, the contract execution end may perform matching verification on the node identification information of the contract invocation node and the node identification information in the invocation permission list corresponding to the target intelligent contract. When the matching fails, a call failure response message can be sent to the contract calling node so that the contract calling node terminates the calling process of the target intelligent contract.
In step S53, when the matching is successful, the target intelligent contract is executed according to the contract identification in the intelligent contract calling request and the contract execution data.
In step S54, the execution result of the target intelligent contract is sent to the contract invoking node.
By way of example, referring to a schematic diagram of a contract execution end shown in FIG. 7, the contract execution end includes an initiator and a contract. The initiator can be used for initiating and executing the contract program, and linking a connector in a constructor in the contract invoking node through a connector in the initiator so as to establish a communication connection between the contract executing end and the contract invoking node.
In fig. 7, the initiator includes a connector, a program initiator, a configuration parser, an information configurator and certificate/key authority, and a node registry. The connector can receive a contract calling request from a contract calling node, and the configuration resolver can obtain a contract identification of a target intelligent contract and contract execution data by resolving the contract calling request. In this way, the main process of the target intelligent contract corresponding to the contract identifier can be started through the program initiator, so that the target intelligent contract is executed based on the contract execution data, and the contract execution result is obtained.
The information configurator may convert the contract execution result into a corresponding data structure based on the contract configuration information, and transmit the contract calling result to the contract calling node through the connector. Of course, in some scenarios requiring encryption, the contract execution result may also be signed and encrypted by the certificate/key authority before being sent to the contract invoking node.
In addition, the initiator may also respond to contract invocation requests of multiple contract invocation nodes at the same time, for example, the contract invocation requests of different contract invocation nodes may be processed in a multi-thread manner respectively.
According to the technical scheme, the intelligent contract program is arranged at the contract execution end outside the block chain, so that the contract calling node does not need to independently mount the contract program, and the node resource occupation caused by the operation of the intelligent contract can be reduced. In addition, by means of executing the intelligent contract outside the chain, relevant limits (such as the calling limits of bottom-layer elements) in the block chain network can be broken through, so that the phenomenon of abnormal contract operation caused by the relevant limits is reduced.
In a possible implementation manner, the intelligent contract invoking request further includes consensus node information, where a consensus node is a node having the invoking authority of the target intelligent contract, and the consensus node information may be, for example, an identifier of each of the consensus nodes, such as a node address, a number, and the like. In this case, the method further includes:
verifying the node identification information of the contract calling node according to the consensus node information;
and when the identification information of the contract calling node is not included in the consensus node information, terminating the calling process of the target intelligent contract.
Taking the consensus node information as the node address of the consensus node as an example, when the contract execution end receives the contract invoking request, the contract execution end may determine whether the contract invoking node is the consensus node by comparing the node address of the contract invoking node with the addresses of the consensus nodes. When the contract invoking node is not the consensus node, the contract execution end can terminate the invoking process of the target intelligent contract.
In another possible implementation manner, the intelligent contract invoking request further includes consensus policy node information, where the consensus policy node is a consensus node required for the preset target intelligent contract to take effect. It should be understood that the intelligent contract requires some nodes to agree on in the validation process, and therefore, the nodes can be used as the consensus policy nodes.
In this case, the method further includes:
checking the consensus strategy node information according to the node identification information in the calling permission list of the target intelligent contract;
and when any consensus strategy node in the consensus strategy node information is not in the calling permission list, terminating the calling process of the target intelligent contract.
Still taking the node information as an example for explanation, when the contract execution end receives the contract invoking request, the contract execution end may determine whether the consensus policy node corresponding to the target intelligent contract completes registration at the contract execution end by comparing the node address of the consensus policy node with the node addresses of the nodes in the invoking permission list of the target intelligent contract.
In this way, the contract execution end can terminate the calling process of the target intelligent contract when determining that any consensus policy node in the consensus policy node information is not in the calling permission list of the target intelligent contract of the contract execution end. Taking table 1 as an example, since the consensus policy node 10.0.0.2: g4f13 … yft is not in the invocation permission list of the target intelligent contract, the consensus policy node 10.0.0.2: g4f13 … yft cannot execute the target intelligent contract based on the contract execution end. Also, as shown in Table 1, the validation of the target intelligent contract requires that node 10.0.0.1: abc2d … asb and node 10.0.0.2: g4f13 … yft complete consensus. Therefore, in the case where 10.0.0.2 g4f13 … yft fails to execute the target intelligent contract based on the contract execution end, the target intelligent contract cannot take effect, and the contract execution end may terminate the calling process of the target intelligent contract.
Of course, the above embodiment is only used to illustrate the technical solution of the present invention, and is not limited thereto, and it should be understood by those skilled in the art that, in specific implementation, the intelligent contract invoking request may also include the consensus node information and the consensus policy node information at the same time as shown in table 1, and the contract executing end may also determine whether to execute the target intelligent contract according to the consensus node information and the consensus policy node information at the same time, which is not limited by the present disclosure.
Optionally, before receiving the intelligent contract invoking request sent by the contract invoking node in the blockchain network, the method further includes:
and establishing a communication connection with the contract invoking node in response to receiving the connection request sent by the contract invoking node. Corresponding descriptions already exist in the related art for the manner of establishing communication connection through a network, and are not described herein.
In some possible embodiments, the contract invoking node may also perform a corresponding configuration file check when establishing a communication connection with the contract execution end to determine that the contract execution end is capable of executing the target intelligent contract. In this case, the establishing a communication connection with the contract invoking node in response to receiving the connection request sent by the contract invoking node includes:
and receiving a connection request sent by the contract invoking node. Wherein the connection request includes node information (such as an IP address, a node ID, etc.) of the contract invoking node and a contract identification of the target intelligent contract. Correspondingly, after receiving the connection request, the contract execution end may store the node information of the contract invoking node in the connection request, and search the configuration information of the intelligent contract corresponding to the contract identifier of the contract execution end according to the contract identifier. In this way, the contract execution end can send a connection request response message to the contract invoking node, wherein the connection request response message comprises the configuration information of the intelligent contract and the address information of the contract execution end.
Further, after receiving the connection confirmation information sent by the contract invoking node, the contract execution end may establish a communication connection with the contract invoking node.
In this way, after the communication connection is successfully established, the contract execution end may further receive the contract identifier and the start parameter of the target intelligent contract sent by the contract invoking node, search the intelligent contract corresponding to the contract identifier, and further start the intelligent contract. In addition, the contract execution end can also send a contract starting result to the contract invoking node, and the contract starting result comprises the contract identification of the started intelligent contract. Further, after receiving the registration success message sent by the contract invoking node, the contract invoking node may add the node address and the node identifier of the contract invoking node to the invocation permission list, thereby completing the registration. In this way, by setting the contract execution end and performing the contract registration process, off-chain execution of the intelligent contract can be realized, and the resource burden of the contract calling end is reduced.
In a possible implementation manner, in the process of communication between the contract execution end and the contract invoking node, the data to be sent is encrypted in the following manner, so as to obtain second target encrypted sending data:
acquiring a hash value of data to be sent through a target hash function;
encrypting the hash value based on a private key of the contract execution end to obtain a second encrypted hash value;
randomly generating a second target symmetric key pair, and encrypting the second encrypted hash value and the data to be sent through a private key in the second target symmetric key pair to obtain second encrypted sending data;
and encrypting the second encrypted sending data and the public key of the second target symmetric secret key pair through the public key of the contract calling node to obtain the second target encrypted sending data.
For the encryption mode, please refer to the description of the embodiment of the encryption method step at the contract invoking node side, which is not described herein again.
For the decryption process, referring to fig. 8, after receiving first target encrypted transmission data sent by a contract invoking node, the contract execution end may decrypt the first target encrypted transmission data through its own private key, so as to obtain the first encrypted transmission data and a public key of a first target symmetric key pair. In this way, the first encrypted transmission data may be decrypted by the public key of the first target symmetric key pair, so as to obtain the first encrypted hash value and the data to be transmitted.
Further, whether a hash value obtained by the data to be sent through a target hash function is consistent with a hash value obtained by the decryption of the first encrypted hash value or not can be verified, and when the hash value is consistent with the hash value obtained by the decryption of the first encrypted hash value, the correctness of the data to be sent obtained through the decryption can be determined. Therefore, the security of the communication between the contract execution end and the contract calling node can be improved by adopting a double encryption mode.
Of course, the above embodiment has been described by taking the example that the contract execution end decrypts the first target encrypted transmission data of the contract invoking node, but those skilled in the art know that the contract invoking node may also decrypt the second target encrypted transmission data transmitted by the contract execution end based on the same concept. For the brevity of the description, the disclosure is not repeated herein.
The present disclosure also provides an intelligent contract execution apparatus, referring to a block diagram of an intelligent contract execution apparatus shown in fig. 9, the apparatus 900 including:
a first obtaining module 901, configured to obtain contract information of a target intelligent contract to be invoked from a registered intelligent contract list, where the contract information includes a contract identifier and a contract execution end address, and the contract execution end address corresponds to a contract execution end outside the blockchain network;
a first sending module 902, configured to send an intelligent contract invoking request to the contract execution end, where the intelligent contract invoking request is used for the contract execution end to execute the target intelligent contract according to the contract identifier in the intelligent contract invoking request and the contract execution data;
a first receiving module 903, configured to receive a contract execution response of the contract execution end, and obtain an execution result of the target intelligent contract corresponding to the contract invoking node.
By adopting the technical scheme, when the contract calling node needs to call the target intelligent contract, the contract information of the target intelligent contract can be obtained from the registered intelligent contract list. In this way, the intelligent contract calling request can be sent to the corresponding contract execution end according to the contract execution end address in the contract information, so that the calling of the target intelligent contract is realized. That is to say, according to the technical scheme, the intelligent contract program is arranged at the contract execution end outside the block chain, so that the contract calling node does not need to mount the contract program independently, and the node resource occupation caused by the operation of the intelligent contract can be reduced. In addition, by means of executing the intelligent contract outside the chain, relevant limits (such as the calling limits of bottom-layer elements) in the block chain network can be broken through, so that the phenomenon of abnormal contract operation caused by the relevant limits is reduced.
Optionally, the apparatus 900 further comprises:
the first communication connection establishing module is used for establishing communication connection with the contract execution end before the first acquiring module acquires the contract information of the target intelligent contract to be called from the registered intelligent contract list;
a third sending module, configured to send the contract identifier and the start parameter of the target intelligent contract to the contract execution end, so that the contract execution end starts an intelligent contract corresponding to the contract identifier;
the third receiving module is used for receiving the contract starting result sent by the contract execution end;
the first determining module is used for determining that the target intelligent contract is successfully registered when the contract starting result represents that the contract execution end successfully starts the target intelligent contract;
a first adding module, configured to add a contract identifier of the target intelligent contract and a contract execution end address of the contract execution end to the intelligent contract list;
and the fourth sending module is used for sending a registration success message to the contract execution end.
Optionally, the first communication connection establishing module includes:
the first acquisition submodule is used for acquiring the registration parameter information of the target intelligent contract;
a first sending submodule, configured to send, according to a contract execution end address in the registration parameter information, a connection request to a contract execution end corresponding to the contract execution end address, where the connection request includes node information of the contract invoking node and a contract identifier of the target intelligent contract;
the first receiving submodule is used for receiving a connection request response message sent by the contract execution end, wherein the connection request response message comprises address information of the contract execution end and configuration information of an intelligent contract corresponding to the contract identifier;
the first checking submodule is used for verifying the address information of the contract execution end in the connection request response message and the configuration information of the intelligent contract corresponding to the contract identifier according to the address information of the contract execution end in the registration parameter information and the configuration information of the intelligent contract;
the second sending submodule is used for sending connection confirmation information to the contract execution end when the verification is successful;
and the first communication connection establishing submodule is used for establishing communication connection with the contract execution end.
Optionally, the apparatus 900 further comprises:
a first encryption module, configured to encrypt data to be sent in a process of communication between the contract invoking node and the contract executing end, to obtain first target encrypted sending data, where the first encryption module includes:
the second obtaining submodule is used for obtaining the hash value of the data to be sent through a target hash function;
the first encryption submodule is used for encrypting the hash value based on a private key of the contract calling node to obtain a first encrypted hash value;
the second encryption submodule is used for randomly generating a first target symmetric key pair, and encrypting the first encrypted hash value and the data to be sent through a private key in the first target symmetric key pair to obtain first encrypted sending data;
and the third encryption submodule is used for encrypting the first encrypted sending data and the public key of the first target symmetric key pair through the public key of the contract execution end to obtain the first target encrypted sending data.
Optionally, the intelligent contract invoking request further includes consensus node information, which is used by the contract execution end to terminate the invoking process of the target intelligent contract when determining that the consensus node information does not include the identification information of the contract invoking node, where the consensus node is a node having the invoking authority of the target intelligent contract; and/or
The intelligent contract invoking request further comprises consensus policy node information, and the consensus policy node information is used for terminating the invoking process of the target intelligent contract when the contract execution end determines that any consensus policy node in the consensus policy node information is not in the invoking permission list of the target intelligent contract of the contract execution end, wherein the consensus policy node is a consensus node required by the preset target intelligent contract to take effect.
The present disclosure also provides an intelligent contract execution apparatus, referring to a block diagram of an intelligent contract execution apparatus shown in fig. 10, the apparatus 1000 including:
a second receiving module 1001, configured to receive an intelligent contract invoking request sent by a contract invoking node in a block chain network, where the intelligent contract invoking request includes a contract identifier of a target intelligent contract to be invoked and contract execution data of the target intelligent contract;
a first matching module 1002, configured to match node identification information of the contract invoking node with node identification information in an invoking permission list corresponding to the target intelligent contract;
a first executing module 1003, configured to, when matching is successful, execute the target intelligent contract according to the contract identifier in the intelligent contract invoking request and the contract execution data;
a second sending module 1004, configured to send an execution result of the target intelligent contract to the contract invoking node.
According to the technical scheme, the intelligent contract program is arranged at the contract execution end outside the block chain, so that the contract calling node does not need to independently mount the contract program, and the node resource occupation caused by the operation of the intelligent contract can be reduced. In addition, by means of executing the intelligent contract outside the chain, relevant limits (such as the calling limits of bottom-layer elements) in the block chain network can be broken through, so that the phenomenon of abnormal contract operation caused by the relevant limits is reduced.
Optionally, the apparatus 1000 further comprises:
the second communication connection establishing module is used for responding to the received connection request sent by the contract calling node and establishing communication connection with the contract calling node before the second receiving module receives the intelligent contract calling request sent by the contract calling node in the block chain network;
a fourth receiving module, configured to receive the contract identifier and the start parameter of the target intelligent contract sent by the contract invoking node;
the second execution module is used for searching the intelligent contract corresponding to the contract identifier and starting the intelligent contract;
a fifth sending module, configured to send a contract starting result to the contract invoking node, where the contract starting result includes a contract identifier of the started intelligent contract;
and the third execution module is used for receiving a registration success message sent by the contract calling node and adding the node address and the node identifier of the contract calling node into the calling permission list.
Optionally, the second communication connection establishing module includes:
the second receiving submodule is used for receiving a connection request sent by the contract calling node, wherein the connection request comprises the node information of the contract calling node and the contract identifier of the target intelligent contract;
the first searching submodule is used for searching the configuration information of the intelligent contract corresponding to the contract identification;
a third sending submodule, configured to send a connection request response message to the contract invoking node, where the connection request response message includes configuration information of the intelligent contract and address information of the contract execution end;
and the third receiving submodule is used for receiving the connection confirmation information sent by the contract calling node and establishing communication connection with the contract calling node.
Optionally, the apparatus 1000 further comprises:
a second encryption module, configured to encrypt data to be sent in a process of communication between a contract execution end and the contract invoking node, to obtain second target encrypted sending data, where the second encryption module includes:
the third obtaining submodule is used for obtaining the hash value of the data to be sent through a target hash function;
the fourth encryption submodule is used for encrypting the hash value based on the private key of the contract execution end to obtain a second encrypted hash value;
the fifth encryption submodule is used for randomly generating a second target symmetric key pair, and encrypting the second encrypted hash value and the data to be sent through a private key in the second target symmetric key pair to obtain second encrypted sending data;
and the sixth encryption submodule is configured to encrypt the second encrypted sending data and the public key of the second target symmetric key pair by using the public key of the contract invoking node, so as to obtain the second target encrypted sending data.
Optionally, the intelligent contract invoking request further includes consensus node information, and the apparatus 1000 further includes:
the first checking module is used for checking the node identification information of the contract calling node according to the consensus node information;
the first termination calling module is used for terminating the calling process of the target intelligent contract when the identification information of the contract calling node is not included in the consensus node information, wherein the consensus node is a node with the calling authority of the target intelligent contract; and/or
The intelligent contract invoking request further includes consensus policy node information, and the apparatus 1000 further includes:
the second checking module is used for checking the consensus strategy node information according to the node identification information in the calling permission list of the target intelligent contract;
and a second termination calling module, configured to terminate a calling process of the target intelligent contract when any consensus policy node in the consensus policy node information is not in the calling permission list, where the consensus policy node is a consensus node required for the preset target intelligent contract to take effect.
With regard to the apparatus in the above-described embodiment, the specific manner in which each module performs the operation has been described in detail in the embodiment related to the method, and will not be elaborated here.
The present disclosure also provides a computer readable storage medium having stored thereon a computer program which, when executed by a processor, performs the steps of the intelligent contract execution method for contract invoking nodes provided by the present disclosure.
The present disclosure also provides a computer-readable storage medium having stored thereon a computer program that, when executed by a processor, performs the steps of the intelligent contract execution method for a contract execution end provided by the present disclosure.
The present disclosure also provides a contract invoking node, including:
a memory having a computer program stored thereon;
a processor for executing the computer program in the memory to implement the steps of the intelligent contract execution method for a contract invocation node provided by the present disclosure.
FIG. 11 is a block diagram illustrating a contract invocation node 1100 in accordance with an illustrative embodiment. As shown in fig. 11, the contract invoking node 1100 may include: a processor 1101, a memory 1102. The contract invoking node 1100 may also include one or more of a multimedia component 1103, an input/output (I/O) interface 1104, and a communication component 1105.
The processor 1101 is configured to control the overall operation of the contract invoking node 1100, so as to complete all or part of the steps in the intelligent contract execution method for the contract invoking node. The memory 1102 is used to store various types of data to support operations at the contract invoking node 1100, such as instructions for any application or method operating on the contract invoking node 1100, as well as application related data such as transceived messages, pictures, blocks, registries, and the like. The Memory 1102 may be implemented by any type or combination of volatile and non-volatile Memory devices, such as Static Random Access Memory (SRAM), Electrically Erasable Programmable Read-Only Memory (EEPROM), Erasable Programmable Read-Only Memory (EPROM), Programmable Read-Only Memory (PROM), Read-Only Memory (ROM), magnetic Memory, flash Memory, magnetic disk, or optical disk. The multimedia components 1103 may include screen and audio components. Wherein the screen may be, for example, a touch screen and the audio component is used for outputting and/or inputting audio signals. For example, the audio component may include a microphone for receiving external audio signals. The received audio signal may further be stored in the memory 1102 or transmitted through the communication component 1105. The audio assembly also includes at least one speaker for outputting audio signals. The I/O interface 1104 provides an interface between the processor 1101 and other interface modules, such as a keyboard, mouse, buttons, and the like. These buttons may be virtual buttons or physical buttons. The communication component 1105 is used for wired or wireless communication between the contract invoking node 1100 and other devices. Wireless Communication, such as Wi-Fi, bluetooth, Near Field Communication (NFC), 2G, 3G, 4G, NB-IOT, eMTC, or other 5G, etc., or a combination of one or more of them, which is not limited herein. The corresponding communication component 1105 can therefore include: Wi-Fi module, Bluetooth module, NFC module, etc.
In an exemplary embodiment, the contract invoking node 1100 may be implemented by one or more Application Specific Integrated Circuits (ASICs), Digital Signal Processors (DSPs), Digital Signal Processing Devices (DSPDs), Programmable Logic Devices (PLDs), Field Programmable Gate Arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components for executing the above-described intelligent contract execution method for the contract invoking node.
In another exemplary embodiment, a computer readable storage medium is also provided that includes program instructions which, when executed by a processor, implement the steps of the above-described intelligent contract execution method for a contract invocation node. For example, the computer readable storage medium may be the memory 1102 described above that includes program instructions executable by the processor 1101 of the contract invoking node 1100 to perform the intelligent contract execution method described above for the contract invoking node.
The present disclosure also provides a contract execution end, including:
a memory having a computer program stored thereon;
a processor for executing the computer program in the memory to implement the steps of the intelligent contract execution method for the contract execution end provided by the present disclosure.
FIG. 12 is a block diagram illustrating a contract execution side 1200 in accordance with an illustrative embodiment. For example, the contract execution side 1200 may be provided as a server. Referring to FIG. 12, contract execution end 1200 includes a processor 1222, which may be one or more in number, and a memory 1232 for storing computer programs executable by processor 1222. The computer programs stored in memory 1232 may include one or more modules that each correspond to a set of instructions. Further, the processor 1222 may be configured to execute the computer program to perform the intelligent contract execution method for a contract execution side described above.
In addition, the contract execution end 1200 may further include a power component 1226 and a communication component 1250, the power component 1226 may be configured to perform power management of the contract execution end 1200, and the communication component 1250 may be configured to implement communication, e.g., wired or wireless communication, of the contract execution end 1200. Additionally, the contract execution side 1200 may also include input/output (I/O) interfaces 1258. The contract execution side 1200 may operate based on an operating system, such as Windows Server, stored in the storage 1232TM,Mac OS XTM,UnixTM,LinuxTMAnd so on.
In another exemplary embodiment, a computer readable storage medium is also provided that includes program instructions which, when executed by a processor, implement the steps of the above-described intelligent contract execution method for a contract execution end. For example, the computer readable storage medium may be the above-described memory 1232 comprising program instructions executable by the processor 1222 of the contract execution end 1200 to perform the above-described intelligent contract execution method for the contract execution end.
The present disclosure also provides an intelligent contract execution system, which includes the contract invoking node and the contract execution end provided by the present disclosure.
In the system, when a contract calling node needs to call a target intelligent contract, contract information of the target intelligent contract can be acquired from a registered intelligent contract list. In this way, the intelligent contract calling request can be sent to the corresponding contract execution end according to the contract execution end address in the contract information, so that the calling of the target intelligent contract is realized. That is to say, according to the technical scheme, the intelligent contract program is arranged at the contract execution end outside the block chain, so that the contract calling node does not need to mount the contract program independently, and the node resource occupation caused by the operation of the intelligent contract can be reduced. In addition, by means of executing the intelligent contract outside the chain, relevant limits (such as the calling limits of bottom-layer elements) in the block chain network can be broken through, so that the phenomenon of abnormal contract operation caused by the relevant limits is reduced.
In another exemplary embodiment, a computer program product is also provided, which comprises a computer program executable by a programmable apparatus, the computer program having code portions for performing the above-described intelligent contract execution method for a contract invocation node when executed by the programmable apparatus.
In another exemplary embodiment, a computer program product is also provided, which includes a computer program executable by a programmable apparatus, the computer program having code portions for performing the intelligent contract execution method for a contract execution end described above when executed by the programmable apparatus.
The preferred embodiments of the present disclosure are described in detail with reference to the accompanying drawings, however, the present disclosure is not limited to the specific details of the above embodiments, and various simple modifications may be made to the technical solution of the present disclosure within the technical idea of the present disclosure, and these simple modifications all belong to the protection scope of the present disclosure.
It should be noted that, in the foregoing embodiments, various features described in the above embodiments may be combined in any suitable manner, and in order to avoid unnecessary repetition, various combinations that are possible in the present disclosure are not described again.
In addition, any combination of various embodiments of the present disclosure may be made, and the same should be considered as the disclosure of the present disclosure, as long as it does not depart from the spirit of the present disclosure.

Claims (10)

1. An intelligent contract execution method applied to a contract invoking node in a blockchain network, the method comprising:
acquiring contract information of a target intelligent contract to be called from a registered intelligent contract list, wherein the contract information comprises a contract identifier and a contract execution end address, and the contract execution end address corresponds to a contract execution end outside the block chain network;
sending an intelligent contract calling request to the contract execution end, wherein the intelligent contract calling request is used for the contract execution end to execute the target intelligent contract according to the contract identification in the intelligent contract calling request and the contract execution data;
and receiving a contract execution response of the contract execution end to obtain an execution result of the target intelligent contract corresponding to the contract invoking node.
2. The method of claim 1, wherein prior to obtaining contract information for a target intelligent contract to be invoked from the list of registered intelligent contracts, the method further comprises:
establishing a communication connection with the contract execution end;
sending a contract identifier and starting parameters of the target intelligent contract to the contract execution end so that the contract execution end starts the intelligent contract corresponding to the contract identifier;
receiving a contract starting result sent by the contract execution end;
if the contract starting result represents that the contract execution end successfully starts the target intelligent contract, determining that the target intelligent contract is successfully registered;
adding the contract identification of the target intelligent contract and the contract execution end address of the contract execution end into the intelligent contract list;
and sending a registration success message to the contract execution end.
3. The method of claim 2, wherein establishing the communication connection with the contract execution end comprises:
acquiring registration parameter information of the target intelligent contract;
sending a connection request to a contract execution end corresponding to the contract execution end address according to the contract execution end address in the registration parameter information, wherein the connection request comprises the node information of the contract calling node and the contract identifier of the target intelligent contract;
receiving a connection request response message sent by the contract execution end, wherein the connection request response message comprises address information of the contract execution end and configuration information of an intelligent contract corresponding to the contract identification;
verifying the address information of the contract execution end in the connection request response message and the configuration information of the intelligent contract corresponding to the contract identifier according to the address information of the contract execution end and the configuration information of the intelligent contract in the registration parameter information;
when the verification is successful, sending connection confirmation information to the contract execution end;
and establishing a communication connection with the contract execution end.
4. An intelligent contract execution method applied to a contract execution end outside a block chain network, the method comprising:
receiving an intelligent contract invoking request sent by a contract invoking node in a block chain network, wherein the intelligent contract invoking request comprises a contract identifier of a target intelligent contract to be invoked and contract execution data of the target intelligent contract;
matching the node identification information of the contract calling node with the node identification information in the calling permission list corresponding to the target intelligent contract;
when the matching is successful, executing the target intelligent contract according to the contract identification in the intelligent contract calling request and the contract execution data;
and sending the execution result of the target intelligent contract to the contract invoking node.
5. An intelligent contract execution apparatus, comprising:
the first acquisition module is used for acquiring contract information of a target intelligent contract to be called from a registered intelligent contract list, wherein the contract information comprises a contract identifier and a contract execution end address, and the contract execution end address corresponds to a contract execution end outside the blockchain network;
the first sending module is used for sending an intelligent contract calling request to the contract execution end, wherein the intelligent contract calling request is used for the contract execution end to execute the target intelligent contract according to the contract identification in the intelligent contract calling request and the contract execution data;
and the first receiving module is used for receiving the contract execution response of the contract execution end and obtaining the execution result of the target intelligent contract corresponding to the contract calling node.
6. An intelligent contract execution apparatus, comprising:
the second receiving module is used for receiving an intelligent contract calling request sent by a contract calling node in a block chain network, wherein the intelligent contract calling request comprises a contract identifier of a target intelligent contract to be called and contract execution data of the target intelligent contract;
a first matching module, configured to match node identification information of the contract invocation node with node identification information in an invocation permission list corresponding to the target intelligent contract;
the first execution module is used for executing the target intelligent contract according to the contract identifier in the intelligent contract calling request and the contract execution data when the matching is successful;
and the second sending module is used for sending the execution result of the target intelligent contract to the contract calling node.
7. A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the steps of the method according to any one of claims 1 to 3; alternatively, the program when executed by a processor implements the steps of the method of any of claim 4.
8. A contract invoking node, comprising:
a memory having a computer program stored thereon;
a processor for executing the computer program in the memory to carry out the steps of the method of any one of claims 1 to 3.
9. A contract execution side, comprising:
a memory having a computer program stored thereon;
a processor for executing the computer program in the memory to carry out the steps of the method as claimed in claim 4.
10. An intelligent contract execution system comprising a contract invocation node according to claim 8 and a contract execution end according to claim 9.
CN202011483371.1A 2020-12-15 2020-12-15 Intelligent contract execution method, device, system, storage medium and electronic equipment Active CN112632573B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011483371.1A CN112632573B (en) 2020-12-15 2020-12-15 Intelligent contract execution method, device, system, storage medium and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011483371.1A CN112632573B (en) 2020-12-15 2020-12-15 Intelligent contract execution method, device, system, storage medium and electronic equipment

Publications (2)

Publication Number Publication Date
CN112632573A true CN112632573A (en) 2021-04-09
CN112632573B CN112632573B (en) 2024-06-21

Family

ID=75314153

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011483371.1A Active CN112632573B (en) 2020-12-15 2020-12-15 Intelligent contract execution method, device, system, storage medium and electronic equipment

Country Status (1)

Country Link
CN (1) CN112632573B (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113190285A (en) * 2021-04-23 2021-07-30 神荼科技(山东)有限公司 Block chain-based virtual environment security detection method and device and storage medium
CN113472512A (en) * 2021-06-10 2021-10-01 东软集团股份有限公司 Intelligent contract execution method and device, storage medium and electronic equipment
EP4300398A4 (en) * 2021-08-12 2024-05-01 Tencent Technology (Shenzhen) Company Limited Smart contract-based data processing method and apparatus, electronic device, computer-readable storage medium, and computer program product

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110297689A (en) * 2019-05-06 2019-10-01 百度在线网络技术(北京)有限公司 Intelligent contract executes method, apparatus, equipment and medium
US20200118123A1 (en) * 2018-09-17 2020-04-16 Launch Tech Co., Ltd. Method, system, and apparatus for managing smart contracts and computer storage medium
KR102118921B1 (en) * 2018-12-31 2020-06-05 주식회사 코인플러그 Method and server for managing user identity using blockchain network, and method and terminal for verifying user using user identity based on blockchain network
CN111258725A (en) * 2020-01-17 2020-06-09 北京百度网讯科技有限公司 Data processing method, device, equipment and medium based on block chain
CN111401903A (en) * 2020-06-03 2020-07-10 腾讯科技(深圳)有限公司 Block chain message processing method, device, computer and readable storage medium
CN111464589A (en) * 2020-03-03 2020-07-28 深圳壹账通智能科技有限公司 Intelligent contract processing method, computer equipment and storage medium
CN111597269A (en) * 2020-05-21 2020-08-28 昆明大棒客科技有限公司 Block chain-based contract implementation method, device and equipment

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20200118123A1 (en) * 2018-09-17 2020-04-16 Launch Tech Co., Ltd. Method, system, and apparatus for managing smart contracts and computer storage medium
KR102118921B1 (en) * 2018-12-31 2020-06-05 주식회사 코인플러그 Method and server for managing user identity using blockchain network, and method and terminal for verifying user using user identity based on blockchain network
CN110297689A (en) * 2019-05-06 2019-10-01 百度在线网络技术(北京)有限公司 Intelligent contract executes method, apparatus, equipment and medium
CN111258725A (en) * 2020-01-17 2020-06-09 北京百度网讯科技有限公司 Data processing method, device, equipment and medium based on block chain
CN111464589A (en) * 2020-03-03 2020-07-28 深圳壹账通智能科技有限公司 Intelligent contract processing method, computer equipment and storage medium
CN111597269A (en) * 2020-05-21 2020-08-28 昆明大棒客科技有限公司 Block chain-based contract implementation method, device and equipment
CN111401903A (en) * 2020-06-03 2020-07-10 腾讯科技(深圳)有限公司 Block chain message processing method, device, computer and readable storage medium

Non-Patent Citations (4)

* Cited by examiner, † Cited by third party
Title
SRINIDHI SRINIVASAN ETC.: "Hierarchical Design and Execution of Smart Contracts in Blockchain", 《2020 INTERNATIONAL CONFERENCE ON SMART TECHNOLOGIES IN COMPUTING, ELECTRICAL AND ELECTRONICS》, pages 13 - 18 *
WEBER ETC.: "A Platform Architecture for Multi-Tenant Blockchain-Based Systems", 《 2019 IEEE INTERNATIONAL CONFERENCE ON SOFTWARE ARCHITECTURE》, pages 101 - 110 *
呼阳: "基于区块链技术的数据集成与分析平台的设计", 《中国优秀硕士学位论文全文数据库(信息科技辑)》, pages 138 - 866 *
许雄: "区块链智能合约技术的研究", 《中国优秀硕士学位论文全文数据库(信息科技辑)》, pages 138 - 1002 *

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113190285A (en) * 2021-04-23 2021-07-30 神荼科技(山东)有限公司 Block chain-based virtual environment security detection method and device and storage medium
CN113472512A (en) * 2021-06-10 2021-10-01 东软集团股份有限公司 Intelligent contract execution method and device, storage medium and electronic equipment
EP4300398A4 (en) * 2021-08-12 2024-05-01 Tencent Technology (Shenzhen) Company Limited Smart contract-based data processing method and apparatus, electronic device, computer-readable storage medium, and computer program product

Also Published As

Publication number Publication date
CN112632573B (en) 2024-06-21

Similar Documents

Publication Publication Date Title
US11076295B2 (en) Remote management method, and device
CN112559993B (en) Identity authentication method, device and system and electronic equipment
CN112632573B (en) Intelligent contract execution method, device, system, storage medium and electronic equipment
CN112765684B (en) Block chain node terminal management method, device, equipment and storage medium
EP3133791B1 (en) Double authentication system for electronically signed documents
EP3598333B1 (en) Electronic device update management
US11424915B2 (en) Terminal registration system and terminal registration method with reduced number of communication operations
US20220245631A1 (en) Authentication method and apparatus of biometric payment device, computer device, and storage medium
JP6650513B2 (en) Method and device for registering and authenticating information
WO2022160697A1 (en) Authorization authentication and software development kit generation methods and apparatuses, and electronic device
CN109815666B (en) Identity authentication method and device based on FIDO protocol, storage medium and electronic equipment
CN111414640B (en) Key access control method and device
CN111565179B (en) Identity verification method and device, electronic equipment and storage medium
CN108574658B (en) Application login method and device
CN110602051B (en) Information processing method based on consensus protocol and related device
CN116346341A (en) Private key protection and server access method, system, equipment and storage medium
US20240113898A1 (en) Secure Module and Method for App-to-App Mutual Trust Through App-Based Identity
CN107846390B (en) Authentication method and device for application program
CN113098685B (en) Security verification method and device based on cloud computing and electronic equipment
CN115242471A (en) Information transmission method and device, electronic equipment and computer readable storage medium
CN114117388A (en) Device registration method, device registration apparatus, electronic device, and storage medium
CN114915487B (en) Terminal authentication method, system, device, equipment and storage medium
CN114007218B (en) Authentication method, authentication system, terminal and digital identity authentication functional entity
TWI673621B (en) Information registration, authentication method and device
CN116226932A (en) Service data verification method and device, computer medium and electronic equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant