CN114168652A - Intelligent contract interaction method, device, equipment and storage medium - Google Patents

Intelligent contract interaction method, device, equipment and storage medium Download PDF

Info

Publication number
CN114168652A
CN114168652A CN202111485117.XA CN202111485117A CN114168652A CN 114168652 A CN114168652 A CN 114168652A CN 202111485117 A CN202111485117 A CN 202111485117A CN 114168652 A CN114168652 A CN 114168652A
Authority
CN
China
Prior art keywords
contract
target
block chain
called
name
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.)
Pending
Application number
CN202111485117.XA
Other languages
Chinese (zh)
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.)
China Zheshang Bank Co Ltd
Original Assignee
China Zheshang Bank Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by China Zheshang Bank Co Ltd filed Critical China Zheshang Bank Co Ltd
Priority to CN202111485117.XA priority Critical patent/CN114168652A/en
Publication of CN114168652A publication Critical patent/CN114168652A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2458Special types of queries, e.g. statistical queries, fuzzy queries or distributed queries
    • G06F16/2474Sequence data queries, e.g. querying versioned data
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1097Protocols in which an application is distributed across nodes in the network for distributed storage of data in networks, e.g. transport arrangements for network file system [NFS], storage area networks [SAN] or network attached storage [NAS]

Abstract

The invention discloses an intelligent contract interaction method, an intelligent contract interaction device, intelligent contract interaction equipment and a storage medium, and belongs to the technical field of block chains. The method comprises the following steps: under the condition that contract deployment requirements are determined, determining a target contract name and a target contract version of a target intelligent contract according to the contract deployment requirements; generating a contract deployment transaction request according to the contract deployment requirement; sending the contract deployment transaction request to a block chain node to instruct the block chain node to deploy the target intelligent contract according to the contract deployment transaction request and generate a target contract address of the target intelligent contract; and storing a target mapping relation among the target contract name, the target contract version and the target contract address fed back by the block chain node in a block chain network. By the technical scheme, the risk that the user cannot access the intelligent contract due to the fact that the contract address is lost is avoided, and the efficiency of developing the intelligent contract by the user is improved.

Description

Intelligent contract interaction method, device, equipment and storage medium
Technical Field
The embodiment of the invention relates to the technical field of block chains, in particular to an intelligent contract interaction method, an intelligent contract interaction device, intelligent contract interaction equipment and a storage medium.
Background
The block chain system is a decentralized distributed book and has the characteristics of traceability, tamper resistance, anonymity, certainty and the like. The intelligent contract is a program which is deployed on the blockchain and can be automatically executed according to a preset rule, and the introduction of the intelligent contract greatly expands the application scene of the blockchain.
The interaction process of the user and the intelligent contract is generally as follows: firstly, writing an intelligent contract, then compiling the intelligent contract to obtain an Application Binary Interface file (abi) for describing a contract Interface, then deploying the intelligent contract to obtain a contract address with the length of 20 bytes, after obtaining the contract address and a abi file, transmitting corresponding parameters according to the Interface in the contract and calling, and finally obtaining an execution result of the intelligent contract. The traditional intelligent contract interaction mode has the following defects: firstly, the user needs to store abi files by himself, which increases the storage cost of the user; secondly, the user needs to remember the contract address, if the contract address is lost, the contract cannot be accessed, and the memory cost of the user and the risk that the contract cannot be accessed are increased; thirdly, after the user upgrades the version of the intelligent contract, the contract address needs to be maintained again, and the management cost of the user is increased.
Disclosure of Invention
The invention provides an intelligent contract interaction method, an intelligent contract interaction device, equipment and a storage medium, which are used for improving the development efficiency of an intelligent contract and avoiding the risk that the contract cannot be accessed because the contract is lost.
In a first aspect, an embodiment of the present invention provides an intelligent contract interaction method, which is applied to a block chain platform, and the method includes:
extracting a target contract name of a target intelligent contract from the contract deployment demand under the condition that the contract deployment demand is determined;
inquiring from a block chain network according to the target contract name to obtain a historical mapping relation associated with the target contract name;
generating a target contract version of the target intelligent contract according to the historical contract version in the historical mapping relation;
generating a contract deployment transaction request according to the contract deployment requirement;
sending the contract deployment transaction request to a block chain node to instruct the block chain node to deploy the target intelligent contract according to the contract deployment transaction request and generate a target contract address of the target intelligent contract;
and storing a target mapping relation among the target contract name, the target contract version and the target contract address fed back by the block chain node in a block chain network.
In a second aspect, an embodiment of the present invention further provides an intelligent contract interaction apparatus configured on a blockchain platform, where the apparatus includes:
the target determining module is used for extracting a target contract name of a target intelligent contract from the contract deployment demand under the condition that the contract deployment demand is determined to exist; a history mapping relation determining module, configured to query from a block chain network according to the target contract name, and obtain a history mapping relation associated with the target contract name; the target contract version determining module is used for generating a target contract version of the target intelligent contract according to the historical contract version in the historical mapping relation;
the contract deployment transaction request generation module is used for generating a contract deployment transaction request according to the contract deployment requirement;
a deployment transaction request sending module, configured to send the contract deployment transaction request to a block chain node, so as to instruct the block chain node to deploy the target intelligent contract according to the contract deployment transaction request, and generate a target contract address of the target intelligent contract;
and the target mapping relation storage module is used for storing the target mapping relation among the target contract name, the target contract version and the target contract address fed back by the block chain node in a block chain network.
In a third aspect, an embodiment of the present invention further provides an electronic device, where the electronic device includes:
one or more processors;
a memory for storing one or more programs;
when executed by the one or more processors, cause the one or more processors to implement an intelligent contract interaction method as provided by any embodiment of the invention.
In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the intelligent contract interaction method provided in any embodiment of the present invention.
The technical scheme of the embodiment of the invention extracts the target contract name of the target intelligent contract from the contract deployment requirement under the condition of determining the contract deployment requirement, according to the target contract name, inquiring from the block chain network to obtain the historical mapping relation associated with the target contract name, generating a target contract version of the target intelligent contract according to the historical contract version in the historical mapping relation, and generates a contract deployment transaction request according to the contract deployment requirement, then sends the contract deployment transaction request to the block chain node, to instruct the blockchain node to deploy the target intelligent contract according to the contract deployment transaction request and generate a target contract address of the target intelligent contract, and further storing the target mapping relation among the target contract name, the target contract version and the target contract address fed back by the block chain link point in the block chain network. According to the technical scheme, the contract address does not need to be stored by the user, the risk that the user cannot access the intelligent contract due to losing the contract address is avoided, the efficiency of developing the intelligent contract by the user is improved, and the cost and risk of developing the intelligent contract are reduced.
Drawings
FIG. 1 is a flowchart of an intelligent contract interaction method according to an embodiment of the present invention;
FIG. 2 is a flowchart of an intelligent contract interaction method according to a second embodiment of the present invention;
FIG. 3 is a flowchart of an intelligent contract interaction method provided by a third embodiment of the present invention;
fig. 4 is a schematic structural diagram of an intelligent contract interaction apparatus according to a fourth embodiment of the present invention;
fig. 5 is a schematic structural diagram of an electronic device according to a fifth embodiment of the present invention.
Detailed Description
The present invention will be described in further detail with reference to the accompanying drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the invention and are not limiting of the invention. It should be further noted that, for the convenience of description, only some of the structures related to the present invention are shown in the drawings, not all of the structures.
Example one
Fig. 1 is a flowchart of an intelligent contract interaction method according to an embodiment of the present invention, where the method is applicable to a case where intelligent contracts interact, and the method may be executed by an intelligent interaction device, where the intelligent interaction device may be implemented by software and/or hardware, and may be integrated in a block chain platform.
As shown in fig. 1, the method may specifically include:
s110, extracting a target contract name of a target intelligent contract from the contract deployment demand under the condition that the contract deployment demand is determined; inquiring from a block chain network according to the target contract name to obtain a historical mapping relation associated with the target contract name; and generating a target contract version of the target intelligent contract according to the historical contract version in the historical mapping relation.
In this embodiment, the contract deployment requirement refers to a requirement that requires contract deployment, and may include an intelligent contract file including a target intelligent contract; the target intelligent contract refers to an intelligent contract written by a user, and may include a target contract name and further a target contract version.
Specifically, when a user has a demand for deploying a target intelligent contract, the contract deployment demand is sent to a block chain platform; correspondingly, the blockchain platform determines a target contract name and a target contract version of the target intelligent contract according to the contract deployment requirement when receiving the contract deployment requirement, namely under the condition that the contract deployment requirement is determined to be possessed.
According to an optional mode, a target contract name of a target intelligent contract can be extracted from contract deployment requirements, then, according to the target contract name, a historical mapping relation associated with the target contract name is obtained through query from a block chain network, and then, according to a historical contract version in the historical mapping relation, a target contract version of the target intelligent contract is generated.
The historical mapping relation refers to the mapping relation among the target contract name, the historical contract version and the historical contract address stored in the block chain network. It should be noted that the contract names of different versions of the intelligent contract stored in the blockchain network are not changed.
Specifically, the block chain platform analyzes the content of the intelligent contract file in the contract deployment requirement, extracts the target contract name of the target intelligent contract, and then queries from the block chain network by using the target contract name as an index based on a mapping relation query method to obtain a historical mapping relation associated with the target contract name, and further generates a target contract version of the target intelligent contract according to the historical contract version in the historical mapping relation.
For example, the target contract version of the target intelligent contract is generated according to the historical contract version in the historical mapping relationship, and if the target contract version of the target intelligent contract is extracted after analyzing the contract deployment requirement, whether the target contract version exists in the same historical contract version of the target intelligent contract or not is searched from the historical mapping relationship; if so, the target contract version is substituted for the historical contract version.
For example, the target contract version of the target intelligent contract is generated according to the historical contract version in the historical mapping relationship, and if the target contract version of the target intelligent contract is not extracted after the analysis on the contract deployment requirement, the version obtained by adding 1 to the historical contract version of the highest version in the historical mapping relationship may be used as the target contract version of the target intelligent contract.
And S120, generating a contract deployment transaction request according to the contract deployment requirement.
In this embodiment, the contract deployment transaction request is a request for indicating a block chain node to perform contract deployment, and optionally, the contract deployment transaction request may include a deployment file; the deployment file refers to files required for deploying the smart contract by the block link pairs, and may include abi files and bin files.
Specifically, the blockchain platform generates a contract deployment transaction request according to the contract deployment requirement of the user.
In an alternative mode, a target intelligent contract may be extracted from contract deployment requirements, and then the target intelligent contract is compiled to obtain a deployment file, so as to generate a contract deployment transaction request including the deployment file.
Specifically, the blockchain platform may extract a target intelligent contract from the contract deployment requirement, compile the target intelligent contract to obtain a deployment file including an abi file and a bin file, and further generate a contract deployment transaction request including the deployment file.
And S130, sending a contract deployment transaction request to the block chain nodes to indicate the block chain nodes to deploy the target intelligent contract according to the contract deployment transaction request and generate a target contract address of the target intelligent contract.
In this embodiment, the target contract address is a physical address of a target intelligent contract deployed in a blockchain node.
Specifically, the blockchain platform sends a contract deployment transaction request to the blockchain nodes; correspondingly, the block chain node deploys the target intelligent contract according to the contract deployment transaction request, generates a target contract address of the target intelligent contract, and then sends the target contract address to the block chain platform.
And S140, storing the target mapping relation among the target contract name, the target contract version and the target contract address fed back by the block chain link point in the block chain network.
In this embodiment, the target mapping relationship refers to a mapping relationship among a target contract address, a target contract version, and a target contract address, and may be obtained by a mapping relationship recording method.
Optionally, when determining that the historical contract relationship associated with the target contract name is stored in the block chain network according to the target contract name, identifying whether the target contract version is the same as the historical contract version in the historical contract relationship, and if so, replacing the historical contract relationship with the target contract version and the target contract relationship among the target contract addresses fed back by the block chain link points. And if not, storing the target mapping relation into the block chain network.
It should be noted that the mapping relation recording method and the mapping relation querying method in this embodiment are pre-stored in the pre-compilation contract, and when the block chain platform has a mapping relation recording or mapping relation querying requirement, the mapping relation method or the mapping relation querying method in the pre-compilation contract is automatically invoked to perform the mapping relation recording or querying.
The technical scheme of the embodiment of the invention extracts the target contract name of the target intelligent contract from the contract deployment requirement under the condition of determining the contract deployment requirement, according to the target contract name, inquiring from the block chain network to obtain the historical mapping relation associated with the target contract name, generating a target contract version of the target intelligent contract according to the historical contract version in the historical mapping relation, and generates a contract deployment transaction request according to the contract deployment requirement, then sends the contract deployment transaction request to the block chain node, to instruct the blockchain node to deploy the target intelligent contract according to the contract deployment transaction request and generate a target contract address of the target intelligent contract, and further storing the target mapping relation among the target contract name, the target contract version and the target contract address fed back by the block chain link point in the block chain network. According to the technical scheme, the contract address does not need to be stored by the user, the risk that the user cannot access the intelligent contract due to losing the contract address is avoided, the efficiency of developing the intelligent contract by the user is improved, and the cost and risk of developing the intelligent contract are reduced.
Example two
Fig. 2 is a flowchart of an intelligent contract interaction method provided in the second embodiment of the present invention, which is further optimized and provided as an alternative implementation scheme based on the second embodiment.
As shown in fig. 2, the method may specifically include:
s210, extracting a target contract name of a target intelligent contract from the contract deployment demand under the condition that the contract deployment demand is determined; inquiring from a block chain network according to the target contract name to obtain a historical mapping relation associated with the target contract name; and generating a target contract version of the target intelligent contract according to the historical contract version in the historical mapping relation.
And S220, generating a contract deployment transaction request according to the contract deployment requirement.
And S230, sending a contract deployment transaction request to the block chain nodes to indicate the block chain nodes to deploy the target intelligent contract according to the contract deployment transaction request and generate a target contract address of the target intelligent contract.
And S240, storing the target mapping relation among the target contract name, the target contract version and the target contract address fed back by the block chain link point in the block chain network.
And S250, under the condition that the contract calling requirement is determined, determining the contract name to be called and the contract interface name to be called of the intelligent contract to be called according to the contract calling requirement.
In this embodiment, the contract calling requirement refers to a requirement that needs to call an intelligent contract, and the contract calling requirement may include a contract name to be called and a contract interface name to be called, further, may further include parameters required by the contract interface to be called, and optionally, may further include a contract version to be called.
The contract interface name to be called refers to the name of an interface of a contract method in the intelligent contract to be called, and the parameters required by the contract to be called refer to the parameters required by the contract method in the intelligent contract to be called to realize.
Specifically, when a user has a demand for calling an intelligent contract, the user sends the contract calling demand to a block chain platform; correspondingly, the block chain platform receives the contract calling requirement, namely determines that the contract calling requirement exists, analyzes the contract calling requirement, and obtains the contract name to be called and the contract interface name to be called of the intelligent contract to be called.
And S260, inquiring from the block chain network according to the contract name to be called, and acquiring the available mapping relation associated with the contract name to be called.
In this embodiment, the available mapping relationship refers to a mapping relationship that is already stored in the blockchain network and is available for use and is associated with the contract name to be called.
Specifically, the block chain platform automatically calls a mapping relation query method in the pre-compiled contract based on the contract name to be called, and obtains an available mapping relation associated with the contract name to be called by querying from the block chain network.
And S270, extracting the contract address to be called of the intelligent contract to be called from the available mapping relation.
Specifically, the blockchain platform may extract the contract address to be called of the intelligent contract to be called from the available mapping relationship according to the contract version to be called.
And if the contract version to be called is not acquired from the contract calling requirement, extracting the contract address of the highest contract version cause from the available mapping relation to be used as the contract address to be called of the intelligent contract to be called.
In another optional mode, if the contract version to be called is acquired from the contract calling requirement, the contract address corresponding to the contract version to be called is extracted from the available mapping relation and is used as the contract address to be called of the intelligent contract to be called.
And S280, sending a contract calling request comprising a contract interface name to be called and a contract address to be called to the block link point, so that the block link point determines an intelligent contract to be called according to the contract address to be called, and executing the intelligent contract to be called according to the contract interface name to be called.
In this embodiment, the contract invoking request is used to instruct the block link point to execute an intelligent contract.
Specifically, after determining a contract address to be called, the block chain platform generates a contract calling request comprising a contract interface name to be called and the contract address to be called, and then sends the contract calling request comprising the contract interface name to be called and the contract address to be called to the block chain node; correspondingly, the block chain link points determine the intelligent contract to be called according to the contract address to be called, execute the intelligent contract to be called according to the contract interface name to be called, and then feed back the execution result to the block chain platform.
According to the technical scheme of the embodiment of the invention, the contract name to be called and the contract interface name to be called of the intelligent contract to be called are determined according to the contract calling requirement under the condition that the contract calling requirement is determined; inquiring from a block chain network according to the contract name to be called to obtain an available mapping relation associated with the contract name to be called; extracting a contract address to be called of the intelligent contract to be called from the available mapping relation; and sending a contract calling request comprising a contract interface name to be called and a contract address to be called to the block chain link point, so that the block chain link point determines an intelligent contract to be called according to the contract address to be called and executes the intelligent contract to be called according to the contract interface name to be called. According to the technical scheme, the contract address is acquired from the block chain network without being stored by the user, so that the risk that the user cannot access the intelligent contract due to the loss of the contract address is avoided.
On the basis of the above embodiment, as an optional mode of the embodiment of the present invention, an execution result of the intelligent contract to be called may also be obtained, and the execution result is fed back to the requiring party of the contract calling requirement.
Specifically, the block chain platform obtains an execution result of the intelligent contract to be called, which is fed back by the block chain node, and feeds back the execution result to a required party for calling the contract.
EXAMPLE III
Fig. 3 is a flowchart of an intelligent contract interaction method provided by a third embodiment of the present invention, which is further optimized and provides a preferred scheme based on the above embodiments.
As shown in fig. 3, the method may specifically include:
s301, when a user has a service requirement, writing a target intelligent contract, and sending a contract deployment requirement comprising the target intelligent contract to the block chain platform.
Specifically, when writing a target intelligent contract, a user may use a preset rule or a keyword to indicate a target contract version of the target intelligent contract. For example, a user writes a target intelligent contract of helloworl. sol, the version of the target contract is 1.0, the contract contains a sayHello method, and the expected return value of calling the method is "hello", that is, the execution result after the sayHello method is executed is "hello".
S302, under the condition that the block chain platform is determined to have contract deployment requirements, determining a target contract name and a target contract version of a target intelligent contract according to the contract deployment requirements.
For example, the blockchain platform parses a target intelligent contract of helloworld.sol in the contract deployment demand according to the contract deployment demand to obtain a target contract version 1.0 and a target contract name Helloworld.
And S303, generating a contract deployment transaction request according to the contract deployment requirement by the block chain platform, and sending the contract deployment transaction request to the block chain link point.
And S304, the block chain node deploys the target intelligent contract according to the contract deployment transaction request and generates a target contract address of the target intelligent contract.
Specifically, the block link point deploys the target intelligent contract helloworld.sol according to the deployment file in the contract deployment transaction request to generate a target contract address of the target intelligent contract.
S305, the block chain link point sends a target contract address to the block chain platform.
S306, the blockchain platform stores the target mapping relation among the target contract name, the target contract version and the target contract address in the blockchain network.
S307, when the user has a service requirement, the user sends a contract calling requirement to the block chain platform.
Specifically, the contract invoking requirement may include a contract name to be invoked Helloworld, a contract interface name to be invoked sayHello, and parameters required by the contract interface to be invoked, and the interface is not filled if the parameters are not required, and optionally, the contract invoking requirement further includes a contract version number to be invoked of 1.0.
S308, the block chain platform receives the contract calling requirement, and determines the contract name to be called and the contract interface name to be called of the intelligent contract to be called according to the contract calling requirement under the condition that the contract calling requirement is determined.
S309, the block chain platform queries from the block chain network according to the contract name to be called, and obtains an available mapping relation associated with the contract name to be called.
S310, the block chain platform extracts the contract address to be called of the intelligent contract to be called from the available mapping relation.
S311, the block chain platform sends a contract calling request comprising the contract interface name to be called and the contract address to be called to the block chain link point.
And S312, the block chain link point determines the intelligent contract to be called according to the contract address to be called, executes the intelligent contract to be called according to the contract interface name to be called, and feeds back the execution result of the contract to be called to the block chain platform.
S313, the block chain platform feeds back the execution result to the user.
According to the technical scheme, under the condition that contract deployment requirements are met, a target contract name and a target contract version of a target intelligent contract are determined according to the contract deployment requirements, a contract deployment transaction request is generated according to the contract deployment requirements, then the contract deployment transaction request is sent to a block chain node to indicate the block chain node to deploy the target intelligent contract according to the contract deployment transaction request, a target contract address of the target intelligent contract is generated, and the target mapping relation among the target contract name, the target contract version and the target contract address fed back by the block chain node is stored in a block chain network. According to the technical scheme, the contract address does not need to be stored by the user, the risk that the user cannot access the intelligent contract due to losing the contract address is avoided, the efficiency of developing the intelligent contract by the user is improved, and the cost and risk of developing the intelligent contract are reduced.
Example four
Fig. 4 is a schematic structural diagram of an intelligent contract interaction apparatus according to a fourth embodiment of the present invention, where this embodiment is applicable to a case where intelligent contracts interact, and the apparatus may be implemented by software and/or hardware, and may be integrated in a block chain platform.
As shown in fig. 4, the apparatus may specifically include:
a target determining module 410, configured to extract a target contract name of a target intelligent contract from the contract deployment demand if it is determined that there is a contract deployment demand; inquiring from a block chain network according to the target contract name to obtain a historical mapping relation associated with the target contract name; generating a target contract version of a target intelligent contract according to the historical contract version in the historical mapping relation;
a deployment transaction request generating module 420, configured to generate a contract deployment transaction request according to a contract deployment requirement;
a deployment transaction request sending module 430, configured to send a contract deployment transaction request to the block link node, so as to instruct the block link node to deploy a target intelligent contract according to the contract deployment transaction request, and generate a target contract address of the target intelligent contract;
and a target mapping relation storage module 440, configured to store a target mapping relation between the target contract name, the target contract version, and the target contract address fed back by the block link point in the block chain network.
The technical scheme of the embodiment of the invention extracts the target contract name of the target intelligent contract from the contract deployment requirement under the condition of determining the contract deployment requirement, according to the target contract name, inquiring from the block chain network to obtain the historical mapping relation associated with the target contract name, generating a target contract version of the target intelligent contract according to the historical contract version in the historical mapping relation, and generates a contract deployment transaction request according to the contract deployment requirement, then sends the contract deployment transaction request to the block chain node, to instruct the blockchain node to deploy the target intelligent contract according to the contract deployment transaction request and generate a target contract address of the target intelligent contract, and further storing the target mapping relation among the target contract name, the target contract version and the target contract address fed back by the block chain link point in the block chain network. According to the technical scheme, the contract address does not need to be stored by the user, the risk that the user cannot access the intelligent contract due to losing the contract address is avoided, the efficiency of developing the intelligent contract by the user is improved, and the cost and risk of developing the intelligent contract are reduced.
Further, the deployment transaction request generating module 420 is specifically configured to:
extracting a target intelligent contract from contract deployment requirements;
compiling the target intelligent contract to obtain a deployment file;
a contract deployment transaction request is generated that includes a deployment file.
Further, the target mapping relationship storage module 440 is specifically configured to:
under the condition that the historical mapping relation associated with the target contract name is stored in the block chain network according to the target contract name, identifying whether the target contract version is the same as the historical contract version in the historical mapping relation;
and if the contract names are the same, replacing the historical mapping relation with the target mapping relation among the target contract names, the target contract versions and the target contract addresses fed back by the block chain nodes.
Further, the apparatus further comprises:
the to-be-called information determining module is used for determining the contract name to be called and the contract interface name to be called of the intelligent contract to be called according to the contract calling requirement under the condition that the contract calling requirement is determined;
the available mapping relation acquisition module is used for inquiring from the block chain network according to the contract name to be called and acquiring the available mapping relation associated with the contract name to be called;
the contract address to be called determining module is used for extracting the contract address to be called of the intelligent contract to be called from the available mapping relation;
and the contract calling request sending module is used for sending a contract calling request comprising a contract interface name to be called and a contract address to be called to the block link point, so that the block link point determines an intelligent contract to be called according to the contract address to be called and executes the intelligent contract to be called according to the contract interface name to be called.
Further, the contract address determining module to be called is specifically configured to:
and extracting the contract address to be called of the intelligent contract to be called from the available mapping relation according to the contract version to be called.
Further, the apparatus further comprises:
and the execution result feedback module is used for acquiring the execution result of the intelligent contract to be called and feeding the execution result back to the requiring party of the contract calling requirement.
The intelligent contract interaction device can execute the intelligent contract interaction method provided by any embodiment of the invention, and has corresponding functional modules and beneficial effects of the execution method.
EXAMPLE five
Fig. 5 is a schematic structural diagram of an electronic device according to a fifth embodiment of the present invention, and fig. 5 shows a block diagram of an exemplary device suitable for implementing the embodiment of the present invention. The device shown in fig. 5 is only an example and should not bring any limitation to the function and the scope of use of the embodiments of the present invention.
As shown in FIG. 5, electronic device 12 is embodied in the form of a general purpose computing device. The components of electronic device 12 may include, but are not limited to: one or more processors or processing units 16, a system memory 28, and a bus 18 that couples various system components including the system memory 28 and the processing unit 16.
Bus 18 represents one or more of any of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, and a processor or local bus using any of a variety of bus architectures. By way of example, such architectures include, but are not limited to, Industry Standard Architecture (ISA) bus, micro-channel architecture (MAC) bus, enhanced ISA bus, Video Electronics Standards Association (VESA) local bus, and Peripheral Component Interconnect (PCI) bus.
Electronic device 12 typically includes a variety of computer system readable media. Such media may be any available media that is accessible by electronic device 12 and includes both volatile and nonvolatile media, removable and non-removable media.
The system memory 28 may include computer system readable media in the form of volatile memory, such as Random Access Memory (RAM)30 and/or cache memory (cache 32). The electronic device 12 may further include other removable/non-removable, volatile/nonvolatile computer system storage media. By way of example only, storage system 34 may be used to read from and write to non-removable, nonvolatile magnetic media (not shown in FIG. 5, and commonly referred to as a "hard drive"). Although not shown in FIG. 5, a magnetic disk drive for reading from and writing to a removable, nonvolatile magnetic disk (e.g., a "floppy disk") and an optical disk drive for reading from or writing to a removable, nonvolatile optical disk (e.g., a CD-ROM, DVD-ROM, or other optical media) may be provided. In these cases, each drive may be connected to bus 18 by one or more data media interfaces. System memory 28 may include at least one program product having a set (e.g., at least one) of program modules that are configured to carry out the functions of embodiments of the invention.
A program/utility 40 having a set (at least one) of program modules 42 may be stored, for example, in system memory 28, such program modules 42 including, but not limited to, an operating system, one or more application programs, other program modules, and program data, each of which examples or some combination thereof may comprise an implementation of a network environment. Program modules 42 generally carry out the functions and/or methodologies of embodiments described herein.
Electronic device 12 may also communicate with one or more external devices 14 (e.g., keyboard, pointing device, display 24, etc.), with one or more devices that enable a user to interact with electronic device 12, and/or with any devices (e.g., network card, modem, etc.) that enable electronic device 12 to communicate with one or more other computing devices. Such communication may be through an input/output (I/O) interface 22. Also, the electronic device 12 may communicate with one or more networks (e.g., a Local Area Network (LAN), a Wide Area Network (WAN), and/or a public network, such as the Internet) via the network adapter 20. As shown, the network adapter 20 communicates with other modules of the electronic device 12 via the bus 18. It should be understood that although not shown in the figures, other hardware and/or software modules may be used in conjunction with electronic device 12, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems, among others.
The processing unit 16 executes various functional applications and data processing by executing programs stored in the system memory 28, for example, to implement the intelligent contract interaction method provided by the embodiment of the present invention.
EXAMPLE six
The sixth embodiment of the present invention further provides a computer-readable storage medium, on which a computer program (or referred to as computer-executable instructions) is stored, where the computer program is used, when executed by a processor, to perform the intelligent contract interaction method provided in the sixth embodiment of the present invention, where the method includes:
under the condition that contract deployment requirements are determined, determining a target contract name and a target contract version of a target intelligent contract according to the contract deployment requirements;
generating a contract deployment transaction request according to the contract deployment requirement;
sending a contract deployment transaction request to the block chain nodes to indicate the block chain nodes to deploy a target intelligent contract according to the contract deployment transaction request and generate a target contract address of the target intelligent contract;
and storing a target mapping relation among the target contract name, the target contract version and the target contract address fed back by the block chain link point in the block chain network.
Computer storage media for embodiments of the invention may employ any combination of one or more computer-readable media. The computer readable medium may be a computer readable signal medium or a computer readable storage medium. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples (a non-exhaustive list) of the computer readable storage medium would include the following: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this document, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
A computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device.
Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
Computer program code for carrying out operations for embodiments of the present invention may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, Smalltalk, C + +, and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
It is to be noted that the foregoing is only illustrative of the preferred embodiments of the present invention and the technical principles employed. It will be understood by those skilled in the art that the present invention is not limited to the particular embodiments described herein, but is capable of various obvious changes, rearrangements and substitutions as will now become apparent to those skilled in the art without departing from the scope of the invention. Therefore, although the embodiments of the present invention have been described in more detail through the above embodiments, the embodiments of the present invention are not limited to the above embodiments, and many other equivalent embodiments may be included without departing from the spirit of the present invention, and the scope of the present invention is determined by the scope of the appended claims.

Claims (9)

1. An intelligent contract interaction method is applied to a block chain platform and comprises the following steps:
extracting a target contract name of a target intelligent contract from the contract deployment demand under the condition that the contract deployment demand is determined;
inquiring from a block chain network according to the target contract name to obtain a historical mapping relation associated with the target contract name;
generating a target contract version of the target intelligent contract according to the historical contract version in the historical mapping relation;
generating a contract deployment transaction request according to the contract deployment requirement;
sending the contract deployment transaction request to a block chain node to instruct the block chain node to deploy the target intelligent contract according to the contract deployment transaction request and generate a target contract address of the target intelligent contract;
and storing a target mapping relation among the target contract name, the target contract version and the target contract address fed back by the block chain node in a block chain network.
2. The method of claim 1, wherein generating a contract deployment transaction request according to the contract deployment requirements comprises:
extracting a target intelligent contract from the contract deployment requirement;
compiling the target intelligent contract to obtain a deployment file;
generating a contract deployment transaction request including the deployment file.
3. The method of claim 1, wherein storing a target mapping relationship between the target contract name, the target contract version, and the target contract address fed back by the blockchain node in a blockchain network comprises:
under the condition that the historical mapping relation associated with the target contract name is stored in a block chain network according to the target contract name, identifying whether the target contract version is the same as the historical contract version in the historical mapping relation;
and if the contract names are the same, replacing the historical mapping relation with a target mapping relation among the target contract name, the target contract version and the target contract address fed back by the block chain node.
4. The method of claim 1, further comprising:
under the condition that a contract calling requirement is determined, determining a contract name to be called and a contract interface name to be called of an intelligent contract to be called according to the contract calling requirement;
inquiring from a block chain network according to the contract name to be called to obtain an available mapping relation associated with the contract name to be called;
extracting the contract address to be called of the intelligent contract to be called from the available mapping relation;
and sending a contract calling request comprising the contract interface name to be called and the contract address to be called to a block chain link point, so that the block chain link point determines an intelligent contract to be called according to the contract address to be called and executes the intelligent contract to be called according to the contract interface name to be called.
5. The method of claim 4, wherein extracting the contract address to be invoked for the intelligent contract to be invoked from the available mapping comprises:
and extracting the contract address to be called of the intelligent contract to be called from the available mapping relation according to the contract version to be called.
6. The method of claim 4, further comprising:
and obtaining an execution result of the intelligent contract to be called, and feeding back the execution result to a demand side of the contract calling demand.
7. An intelligent contract interaction device, configured on a blockchain platform, comprising:
the target determining module is used for extracting a target contract name of a target intelligent contract from the contract deployment demand under the condition that the contract deployment demand is determined to exist; a history mapping relation determining module, configured to query from a block chain network according to the target contract name, and obtain a history mapping relation associated with the target contract name; the target contract version determining module is used for generating a target contract version of the target intelligent contract according to the historical contract version in the historical mapping relation;
the contract deployment transaction request generation module is used for generating a contract deployment transaction request according to the contract deployment requirement;
a deployment transaction request sending module, configured to send the contract deployment transaction request to a block chain node, so as to instruct the block chain node to deploy the target intelligent contract according to the contract deployment transaction request, and generate a target contract address of the target intelligent contract;
and the target mapping relation storage module is used for storing the target mapping relation among the target contract name, the target contract version and the target contract address fed back by the block chain node in a block chain network.
8. An electronic device, comprising:
one or more processors;
a memory for storing one or more programs;
when executed by the one or more processors, cause the one or more processors to implement the intelligent contract interaction method of any of claims 1-6.
9. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the intelligent contract interaction method according to any one of claims 1 to 6.
CN202111485117.XA 2021-12-07 2021-12-07 Intelligent contract interaction method, device, equipment and storage medium Pending CN114168652A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111485117.XA CN114168652A (en) 2021-12-07 2021-12-07 Intelligent contract interaction method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111485117.XA CN114168652A (en) 2021-12-07 2021-12-07 Intelligent contract interaction method, device, equipment and storage medium

Publications (1)

Publication Number Publication Date
CN114168652A true CN114168652A (en) 2022-03-11

Family

ID=80483831

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111485117.XA Pending CN114168652A (en) 2021-12-07 2021-12-07 Intelligent contract interaction method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN114168652A (en)

Similar Documents

Publication Publication Date Title
CN110297689B (en) Intelligent contract execution method, device, equipment and medium
CN109062563B (en) Method and device for generating page
CN107635027B (en) Domain name resolution method, medium, device and computing equipment
CN110688096B (en) Method and device for constructing application program containing plug-in, medium and electronic equipment
CN106656650A (en) Business test environment generation method and system and business test method, device and system
CN111143446A (en) Data structure conversion processing method and device of data object and electronic equipment
CN110365724B (en) Task processing method and device and electronic equipment
CN110858172A (en) Automatic test code generation method and device
CN111491037B (en) Communication method with object storage server through SFTP data stream
CN109669787B (en) Data transmission method and device, storage medium and electronic equipment
CN109104368B (en) Connection request method, device, server and computer readable storage medium
CN110647316A (en) Method and device for generating universal business object, computer equipment and storage medium
CN110109983B (en) Method and device for operating Redis database
CN110990346A (en) File data processing method, device, equipment and storage medium based on block chain
CN111324395B (en) Calling method, device and computer readable storage medium
CN113761412A (en) Application page display method and device, electronic equipment, medium and application system
CN113779452A (en) Data processing method, device, equipment and storage medium
WO2023151397A1 (en) Application program deployment method and apparatus, device, and medium
CN116032614A (en) Container network micro-isolation method, device, equipment and medium
CN111949648A (en) Memory cache data system and data indexing method
CN114168652A (en) Intelligent contract interaction method, device, equipment and storage medium
CN111459819B (en) Software testing method and device, electronic equipment and computer readable medium
CN110471708B (en) Method and device for acquiring configuration items based on reusable components
CN111538651A (en) Interface testing method, device, server and storage medium
CN113760318A (en) Information processing method, information processing apparatus, server, and storage medium

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