Contract calling method and device, electronic equipment and storage medium

By generating the binary interface file of Ethereum application, the problem of difficulty in calling smart contracts between different blockchain platforms is solved, and cross-platform calls of Solidity contracts to Move contracts are realized.

CN120125237APending Publication Date: 2025-06-10LINGSHU TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510175410.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-02-18
Publication Date
2025-06-10

AI Technical Summary

Technical Problem

Due to the differences in programming languages ​​and virtual machines, smart contracts on different blockchain platforms are difficult to achieve mutual calls.

Method used

By obtaining the function information of the smart contract and the Ethereum application binary interface specification, an Ethereum application binary interface file is generated and sent to the target smart contract, allowing it to make cross-platform calls.

Benefits of technology

The Solidity contract of Ethereum is implemented to call the Move contract, solving the interoperability problem between different languages ​​and virtual machines.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120125237A_ABST
    Figure CN120125237A_ABST
Patent Text Reader

Abstract

The invention discloses a contract calling method and device, electronic equipment and a storage medium, and relates to the technical field of block chains. The method comprises the following steps: obtaining function information of a first smart contract and an Ethereum application binary interface specification; according to the function information and the Ethereum application binary interface specification, generating an Ethereum application binary interface file for the first smart contract; and sending the Ethereum application binary interface file to a second smart contract in the Ethereum, so that the second smart contract calls the first smart contract according to the Ethereum application binary interface file. According to the scheme, the effect of calling other smart contracts by the Ethereum smart contract is achieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of blockchain technology, and in particular, to a contract calling method, apparatus, electronic device, and storage medium. Background Art

[0002] Currently, different blockchain platforms have their own mainstream smart contract programming languages, such as Solidity for Ethereum, C++ for EOS, Go for Hyperledger Fabric, etc. These languages define the syntax, data types, function structures, etc. of smart contracts, providing a basis for the writing and implementation of contracts. Smart contracts usually run on specific virtual machines, such as the Ethereum Virtual Machine (EVM), EOS Virtual Machine (EOS VM), etc. The virtual machine provides an execution environment for smart contracts, responsible for parsing and executing contract code, and managing the state and resources of contracts.

[0003] Since smart contracts implemented in different programming languages are executed in different types of virtual machines, how to achieve the mutual call of smart contracts on different types of virtual machines has become a technical problem that needs to be solved urgently. Summary of the Invention

[0004] The present invention provides a contract calling method, apparatus, electronic device, and storage medium.

[0005] According to one aspect of the present invention, there is provided a contract calling method, including:

[0006] Obtaining function information of a first smart contract and an Ethereum Application Binary Interface (ABI) specification;

[0007] Generating an Ethereum Application Binary Interface file for the first smart contract according to the function information and the Ethereum Application Binary Interface specification;

[0008] Sending the Ethereum Application Binary Interface file to a second smart contract in Ethereum, so that the second smart contract calls the first smart contract according to the Ethereum Application Binary Interface file.

[0009] In some embodiments, obtaining the function information of the first smart contract includes:

[0010] Obtaining the function information of the first smart contract through a compilation tool; wherein the function information includes the function name, input / output parameters, types of input / output parameters, return parameters, and types of return parameters of each contract function in the first smart contract.

[0011] In some embodiments, generating an Ethereum Application Binary Interface file for the first smart contract according to the function information and the Ethereum Application Binary Interface specification includes:

[0012] For each contract function in the first smart contract, map the types of the input / output parameters and the return parameter included in the function information of the contract function to the parameter types in the Ethereum Application Binary Interface (ABI) specification respectively, to obtain the parameter type mapping result;

[0013] Generate an Ethereum Application Binary Interface file for the first smart contract according to the parameter type mapping result.

[0014] In some embodiments, the second smart contract calls the first smart contract according to the Ethereum Application Binary Interface file, including:

[0015] Receive the contract call information encoded by the second smart contract according to the Ethereum Application Binary Interface file;

[0016] Decode the received contract call information according to the Ethereum Application Binary Interface file, and send the decoding result to the first smart contract, so that the first smart contract executes the corresponding contract function according to the decoding result;

[0017] Receive the contract execution result returned by the first smart contract, and encode the contract execution result according to the Ethereum Application Binary Interface file;

[0018] Send the encoded contract execution result to the second smart contract, so that the second smart contract decodes the contract execution result according to the Ethereum Application Binary Interface file to complete the contract call.

[0019] In some embodiments, the first smart contract is a Move smart contract; the second smart contract is a Solidity contract.

[0020] According to another aspect of the present invention, there is provided a contract call device, including:

[0021] An acquisition module, configured to acquire the function information of the first smart contract and the Ethereum Application Binary Interface specification;

[0022] A generation module, configured to generate an Ethereum Application Binary Interface file for the first smart contract according to the function information and the Ethereum Application Binary Interface specification;

[0023] A call module, configured to send the Ethereum Application Binary Interface file to a second smart contract in Ethereum, so that the second smart contract calls the first smart contract according to the Ethereum Application Binary Interface file.

[0024] In some embodiments, the acquisition module is specifically configured to:

[0025] Obtain the function information of the first smart contract through a compilation tool; wherein, the function information includes the function name, input / output parameters, types of input / output parameters, return parameters, and types of return parameters of each contract function in the first smart contract.

[0026] In some embodiments, the generation module is further configured to:

[0027] For each contract function in the first smart contract, map the types of input / output parameters and return parameters included in the function information of the contract function to the parameter types in the Ethereum Application Binary Interface (ABI) specification respectively, to obtain a parameter type mapping result;

[0028] Generate an Ethereum Application Binary Interface file for the first smart contract according to the parameter type mapping result.

[0029] In some embodiments, the invocation module is further configured to:

[0030] Receive contract call information encoded by the second smart contract according to the Ethereum Application Binary Interface file;

[0031] Decode the received contract call information according to the Ethereum Application Binary Interface file, and send the decoding result to the first smart contract, so that the first smart contract executes the corresponding contract function according to the decoding result;

[0032] Receive the contract execution result returned by the first smart contract, and encode the contract execution result according to the Ethereum Application Binary Interface file;

[0033] Send the encoded contract execution result to the second smart contract, so that the second smart contract decodes the contract execution result according to the Ethereum Application Binary Interface file to complete the contract call.

[0034] In some embodiments, the first smart contract is a Move smart contract; the second smart contract is a Solidity contract.

[0035] According to another aspect of the present invention, there is provided an electronic device, which includes:

[0036] At least one processor; and

[0037] A memory communicatively connected to the at least one processor; wherein,

[0038] The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the contract call method of the embodiments of the present invention.

[0039] According to another aspect of the present invention, there is provided a computer-readable storage medium storing computer instructions for causing a processor to implement the contract calling method of the embodiments of the present invention when executed.

[0040] The technical solution of the embodiments of the present invention can achieve the effect of calling a Move contract by a Solidity contract on Ethereum.

[0041] It should be understood that the content described in this part is not intended to identify the key or important features of the embodiments of the present invention, nor is it used to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0042] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following will briefly introduce the drawings required for the description of the embodiments. Obviously, the drawings in the following description are only some embodiments of the present invention, and those of ordinary skill in the art can also obtain other drawings based on these drawings without creative efforts.

[0043] Figure 1a is a schematic flowchart of a contract calling method provided by an embodiment of the present invention;

[0044] Figure 1b is a schematic diagram of obtaining function information of a Move smart contract through a Move language compilation tool provided by an embodiment of the present invention;

[0045] Figure 2a is a schematic flowchart of another contract calling method provided by an embodiment of the present invention;

[0046] Figure 2b is a timing diagram of contract calling provided by an embodiment of the present invention;

[0047] Figure 3 is a schematic structural diagram of a contract calling device provided by an embodiment of the present invention;

[0048] Figure 4 is a schematic structural diagram of an electronic device for implementing the contract calling method of the embodiments of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0049] To enable those skilled in the art to better understand the solution of the present invention, the following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present invention.

[0050] In the Ethereum ecosystem, the Application Binary Interface (ABI) is a standard way for contracts to interact with each other. Since the Move virtual machine does not implement the Ethereum Application Binary Interface, it is impossible to implement the call of Ethereum's Solidity contract to the Move contract. Based on this, the present invention proposes a contract call method specifically to solve this problem. The specific implementation process can be seen in the following embodiments.

[0051] Embodiment 1

[0052] Figure 1a It is a flowchart of a contract call method provided by an embodiment of the present invention. This embodiment is applicable to the scenario where a smart contract in Ethereum calls other smart contracts. This method can be executed by a contract call device, which can be implemented in the form of hardware and / or software, and the contract call device can be configured in an electronic device.

[0053] As Figure 1a shown, the contract call method includes:

[0054] S101. Obtain the function information of the first smart contract and the Ethereum Application Binary Interface specification.

[0055] In some embodiments, the first smart contract refers to the smart contract that needs to be called. Exemplarily, the first smart contract is a Move smart contract. Among them, the Move smart contract is a smart contract written in the Move programming language and running on a blockchain platform that supports the Move language. A smart contract may include multiple contract functions, and a contract function is the basic unit for performing operations in a smart contract.

[0056] In some embodiments, obtaining the function information of the first smart contract includes: obtaining the function information of the first smart contract through a compilation tool; wherein, when the first smart contract is a Move smart contract, the compilation tool can be a Move language compilation tool; the function information may include the function name, input / output parameters, types of input / output parameters, return parameters, and types of return parameters of each contract function in the first smart contract. For example, for the transfer function in a Move smart contract, through the Move language compilation tool, its function name transfer can be obtained, the input parameter may be amount of type u64, and the output parameter may be success of type bool. It should be noted that the types of input / output parameters and the types of return parameters may include at least one of the following: bool (Boolean type), u8 (8-bit unsigned integer), u16 (16-bit unsigned integer), u32 (32-bit unsigned integer), u64 (64-bit unsigned integer), u128 (128-bit unsigned integer), u256 (256-bit unsigned integer), address (address type). See Figure 1b , which shows a schematic diagram of obtaining the function information of a Move smart contract through a Move language compilation tool.

[0057] In some embodiments, the Ethereum Application Binary Interface (ABI) specification includes at least various data types and the encoding / decoding methods of various data types, etc., which is the basis for generating the Ethereum Application Binary Interface file later. Exemplarily, the data types included in the Ethereum Application Binary Interface specification are as follows: uint8 (8-bit unsigned integer), uint16 (16-bit unsigned integer), uint32 (32-bit unsigned integer), uint64 (64-bit unsigned integer), uint128 (128-bit unsigned integer), uint256 (256-bit unsigned integer), bool (Boolean type), address (address type), type (byte type). The present invention can obtain the Ethereum Application Binary Interface specification through a dedicated tool.

[0058] S102. Generate an Ethereum Application Binary Interface file for the first smart contract according to the function information and the Ethereum Application Binary Interface specification.

[0059] According to the above step description, for the contract functions of smart contracts compiled in different languages with the same parameter type, different representation methods are adopted. In order to generate an Ethereum Application Binary Interface (ABI) file for the first smart contract, it is necessary to convert the representation method of the function type in the first smart contract function into the representation method corresponding to the data type in the Ethereum Application Binary Interface specification. Therefore, in some embodiments, according to the function information and the Ethereum Application Binary Interface specification, generating an Ethereum Application Binary Interface file for the first smart contract includes: First, for each contract function in the first smart contract, map the types of input / output parameters and return parameters included in the function information of the contract function to the parameter types in the Ethereum Application Binary Interface specification respectively, to obtain the parameter type mapping result. For example, map the u64 type in each contract function to the uint64 type in the Ethereum Application Binary specification. When performing the specific conversion, a mapping table can be constructed in advance by means of exhaustive enumeration, and subsequently, according to the mapping table, the types of input / output parameters and return parameters included in the function information of the contract functions in the Move contract can be mapped to the parameter types in the Ethereum Application Binary Interface specification respectively; or, a mapping function can be constructed in advance, taking the types of input / output parameters and return parameters included in the function information of the contract function as the input of the mapping function, and obtaining the corresponding parameter types in the Ethereum Application Binary Interface specification according to the output of the mapping function. Further, according to the parameter type mapping result, generate an Ethereum Application Binary Interface file for the first smart contract. Among them, the Ethereum Application Binary Interface file of the first smart contract can be presented in JSON format, which describes the interface information of the first smart contract, including the function signatures, parameter types, etc. of the contract functions included in the first smart contract, facilitating the subsequent understanding and calling of the second smart contract; and the parameter types of the contract functions of the first smart contract described in the interface information are the parameter types in the Ethereum Application Binary Interface specification determined according to the parameter type mapping result.

[0060] S103. Send the Ethereum Application Binary Interface file to the second smart contract in Ethereum, so that the second smart contract calls the first smart contract according to the Ethereum Application Binary Interface file.

[0061] In some embodiments, the second smart contract is a Solidity contract in Ethereum. After sending the Ethereum Application Binary Interface (ABI) file created for the first smart contract to the second smart contract in Ethereum, the second smart contract can know the contract functions included in the first smart contract and the specific information of each contract function, such as the function name, the type and quantity of input parameters, the type of return value, etc., based on the ABI file of the first smart contract. On this basis, when the second smart contract needs to call a certain contract function in the first smart contract, it knows the specific information of this contract function, such as the function name, the type and quantity of input parameters, the type of return value, etc., through the ABI file of the first smart contract. This enables the second smart contract to call the functions of the first smart contract in the correct way and achieve collaborative work between contracts. For example, in a decentralized finance (DeFi) application, a lending contract may need to call the transfer function of a token contract. Through the ABI file of the token contract, the lending contract can accurately call the transfer function and pass the correct parameters.

[0062] The solution of the embodiment of the present invention realizes the interaction between contracts written in different languages by constructing an Ethereum application binary file, and solves the problem that the Solidity contract in Ethereum cannot call the Move smart contract.

[0063] Embodiment 2

[0064] Figure 2a It is a flowchart of a contract calling method provided by an embodiment of the present invention. In the embodiment of the present invention, in order to realize the call of the first smart contract by the second smart contract, a conversion layer tool is specially configured. This conversion layer tool can generate an Ethereum Application Binary Interface (ABI) file for the first smart contract through steps S201 - S203 and send it to the second smart contract; and then perform contract calls according to the steps of S204 - S207. The specific method includes the following steps:

[0065] S201. Obtain the function information and the Ethereum Application Binary Interface (ABI) specification of the first smart contract.

[0066] Optionally, obtaining the function information of the first smart contract includes: obtaining the function information of the first smart contract through a compilation tool; wherein the function information includes the function name, input / output parameters, the type of input / output parameters, return parameters, and the type of return parameters of each contract function in the first smart contract.

[0067] S202. Generate an Ethereum Application Binary Interface (ABI) file for the first smart contract according to the function information and the Ethereum Application Binary Interface (ABI) specification.

[0068] In some embodiments, the first smart contract is a Move smart contract; in some embodiments, according to the function information and the Ethereum Application Binary Interface (ABI) specification, an Ethereum Application Binary Interface file is generated for the first smart contract, including: for each contract function in the first smart contract, mapping the types of the input / output parameters and the return parameter included in the function information of the contract function to the parameter types in the Ethereum Application Binary Interface specification respectively to obtain a parameter type mapping result; and generating an Ethereum Application Binary Interface file for the first smart contract according to the parameter type mapping result.

[0069] S203. Send the Ethereum Application Binary Interface file to a second smart contract in Ethereum.

[0070] Wherein, the second smart contract is a Solidity contract in Ethereum.

[0071] Based on the above, the process of the second smart contract calling the first smart contract according to the received Ethereum Application Binary Interface file of the first smart contract can refer to steps S204 - S207.

[0072] S204. Receive the contract call information encoded by the second smart contract according to the Ethereum Application Binary Interface file.

[0073] In the embodiments of the present invention, the second smart contract encodes the information required to call the first smart contract (such as function name, input / output parameter values) according to the Ethereum Application Binary Interface file of the first smart contract to obtain contract call information. The conversion layer tool can receive the contract call information encoded by the second smart contract.

[0074] S205. Decode the received contract call information according to the Ethereum Application Binary Interface file, and send the decoding result to the first smart contract so that the first smart contract can execute the corresponding contract function according to the decoding result.

[0075] In the embodiments of the present invention, the conversion layer tool can decode the received contract call information according to the Ethereum Application Binary Interface file of the first smart contract to obtain a decoding result that can be understood by the first smart contract, and forward the decoding result to the first smart contract so that the first smart contract can execute the corresponding contract function according to the decoding result of the contract call information.

[0076] S206. Receive the contract execution result returned by the first smart contract, and encode the contract execution result according to the Ethereum Application Binary Interface file.

[0077] In an embodiment of the present invention, the conversion layer tool can receive the contract execution result returned by the first smart contract and encode the contract execution result according to the Ethereum Application Binary Interface file.

[0078] S207. Send the encoded contract execution result to the second smart contract, so that the second smart contract decodes the contract execution result according to the Ethereum Application Binary Interface file to complete the contract call.

[0079] In an embodiment of the present invention, the conversion layer tool can send the encoded contract execution result to the second smart contract; furthermore, the second smart contract can decode the contract execution result according to the Ethereum Application Binary Interface file to obtain the contract call result, thereby completing a contract call.

[0080] In an embodiment of the present invention, by constructing an Ethereum Application Binary Interface file for any smart contract, the smart contract in Ethereum can complete the call to the smart contract according to the Ethereum Application Binary Interface file of the smart contract.

[0081] To illustrate the process of the entire solution in detail, see Figure 2b , which shows the timing diagram of the contract call. The specific process is as follows: First, construct a conversion layer tool; then, in the first step, generate an Ethereum Application Binary Interface file for the first smart contract (Move smart contract). Specifically, first obtain the function information from the first smart contract, and map the types of input / output parameters and return parameters in the function information to the data types included in the Ethereum Application Binary Interface specification. Based on the mapping result, construct the Ethereum Application Binary Interface file of the first smart contract. In the second step, send the Ethereum Application Binary Interface file of the first smart contract to the second smart contract (Solidity smart contract), and the second smart contract can encode the contract call information according to the received Ethereum Application Binary Interface file of the first smart contract. In the third step, call the first smart contract. Specifically, send the encoded contract call information to the conversion layer tool. In the fourth step, the conversion layer tool decodes the contract call information according to the Ethereum Application Binary Interface file of the first smart contract to obtain the call information that the first smart contract can understand. In the fifth step, the conversion layer tool sends the decoded contract call information to the first smart contract and obtains the call result from the first smart contract (that is, the execution result after the first smart contract responds to the call information). In the sixth step, the conversion layer tool encodes the call result according to the Ethereum Application Binary Interface file of the first smart contract. In the seventh step, send the encoded call result to the second smart contract. In the eighth step, the second smart contract decodes the call result according to the Ethereum Application Binary Structure file, thus completing a contract call.

[0082] Embodiment 3

[0083] Figure 3 This is a schematic structural diagram of a contract call device provided by an embodiment of the present invention. This embodiment is applicable to the scenario where a smart contract in Ethereum calls other smart contracts. As Figure 3 shown, the device includes:

[0084] An acquisition module 301, configured to acquire function information of a first smart contract and an Ethereum Application Binary Interface (ABI) specification;

[0085] A generation module 302, configured to generate an Ethereum Application Binary Interface file for the first smart contract according to the function information and the Ethereum Application Binary Interface specification;

[0086] A call module 303, configured to send the Ethereum Application Binary Interface file to a second smart contract in Ethereum, so that the second smart contract calls the first smart contract according to the Ethereum Application Binary Interface file.

[0087] In some embodiments, the acquisition module 301 is specifically configured to:

[0088] Acquire function information of the first smart contract through a compilation tool; wherein, the function information includes the function name, input / output parameters, types of input / output parameters, return parameters, and types of return parameters of each contract function in the first smart contract.

[0089] In some embodiments, the generation module 302 is further configured to:

[0090] For each contract function in the first smart contract, map the types of input / output parameters and the types of return parameters included in the function information of the contract function to the parameter types in the Ethereum Application Binary Interface specification respectively, to obtain a parameter type mapping result;

[0091] Generate an Ethereum Application Binary Interface file for the first smart contract according to the parameter type mapping result.

[0092] In some embodiments, the call module 303 is further configured to:

[0093] Receive contract call information encoded by the second smart contract according to the Ethereum Application Binary Interface file;

[0094] Decode the received contract call information according to the Ethereum Application Binary Interface file, and send the decoding result to the first smart contract, so that the first smart contract executes the corresponding contract function according to the decoding result;

[0095] Receive the contract execution result returned by the first smart contract, and encode the contract execution result according to the Ethereum Application Binary Interface file;

[0096] Send the encoded contract execution result to the second smart contract, so that the second smart contract decodes the contract execution result according to the Ethereum Application Binary Interface file to complete the contract call.

[0097] In some embodiments, the first smart contract is a Move smart contract; the second smart contract is a Solidity contract.

[0098] The contract call device provided by the embodiments of the present invention can execute the contract call method provided by any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.

[0099] Embodiment Four

[0100] Figure 4 FIG. shows a schematic structural diagram of an electronic device 10 that can be used to implement the embodiments of the present invention. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or claimed herein.

[0101] As Figure 4 shown, the electronic device 10 includes at least one processor 11, and a memory communicatively connected to the at least one processor 11, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc. The memory stores a computer program executable by the at least one processor. The processor 11 can execute various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 into the random access memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other through a bus 14. The input / output (I / O) interface 15 is also connected to the bus 14.

[0102] Multiple components in the electronic device 10 are connected to the I / O interface 15, including: an input unit 16; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a magnetic disk, an optical disc, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.

[0103] The processor 11 may be various general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The processor 11 executes the various methods and processes described above, such as executing the contract call method.

[0104] In some embodiments, the contract call method may be implemented as a computer program tangibly embodied in a computer-readable storage medium, such as the storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed onto the electronic device 10 via the ROM 12 and / or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the contract call method described above may be executed. Alternatively, in other embodiments, the processor 11 may be configured to execute the contract call method by any other suitable means (e.g., by means of firmware).

[0105] The various embodiments of the systems and techniques described above herein may be implemented in digital electronic circuitry, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-chip (SOCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include: implemented in one or more computer programs that may be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor that receives data and instructions from a storage system, at least one input device, and at least one output device, and transmits the data and instructions to the storage system, the at least one input device, and the at least one output device.

[0106] The computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to the processors of a general-purpose computer, a special-purpose computer, or other programmable contract call devices, such that when the computer programs are executed by the processors, the functions / operations specified in the flowcharts and / or block diagrams are implemented. The computer programs may be executed entirely on the machine, partially on the machine, as a stand-alone software package partially on the machine and partially on a remote machine, or entirely on a remote machine or server.

[0107] In the context of the present invention, a computer-readable storage medium can be a tangible medium that can contain or store a computer program for use by or in connection with an instruction execution system, apparatus, or device. The computer-readable storage medium can include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. Alternatively, the computer-readable storage medium can be a machine-readable signal medium. More specific examples of the machine-readable storage medium would include an electrical connection based on 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.

[0108] To provide for interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or a trackball) by which the user can provide input to the electronic device. Other kinds of devices can also be used to provide for interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic, speech, or tactile input).

[0109] The systems and techniques described herein can be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer having a graphical user interface or a web browser through which the user can interact with an implementation of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: local area network (LAN), wide area network (WAN), blockchain network, and the Internet.

[0110] A computing system may include a client and a server. The client and the server are generally far from each other and usually interact via a communication network. The relationship between the client and the server is created by computer programs running on respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or a cloud host, which is a host product in the cloud computing service system, and solves the defects of difficult management and weak business scalability existing in traditional physical hosts and VPS services.

[0111] It should be understood that various forms of processes shown above can be used, steps can be reordered, added or deleted. For example, the steps recited in the present invention can be executed in parallel, sequentially or in a different order, as long as the desired results of the technical solution of the present invention can be achieved, and no limitation is made herein.

[0112] The above specific embodiments do not constitute a limitation on the protection scope of the present invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principle of the present invention shall be included within the protection scope of the present invention.

Claims

1. A contract calling method, characterized in that: include: Obtain function information and Ethereum application binary interface specification of the first smart contract; Generate an Ethereum application binary interface file for the first smart contract according to the function information and the Ethereum application binary interface specification; The Ethereum application binary interface file is sent to a second smart contract in Ethereum, so that the second smart contract calls the first smart contract according to the Ethereum application binary interface file.

2. The method according to claim 1, characterized in that The obtaining of function information of the first smart contract includes: Obtain function information of the first smart contract through a compilation tool; wherein the function information includes a function name, input / output parameters, types of input / output parameters, return parameters, and types of return parameters of each contract function in the first smart contract.

3. The method according to claim 2, characterized in that Generating an Ethereum application binary interface file for the first smart contract according to the function information and the Ethereum application binary interface specification includes: For each contract function in the first smart contract, the types of the input / output parameters and the type of the return parameter included in the function information of the contract function are respectively mapped to parameter types in the Ethereum Application Binary Interface specification to obtain a parameter type mapping result; According to the parameter type mapping result, an Ethereum application binary interface file is generated for the first smart contract.

4. The method according to claim 1, characterized in that: The second smart contract calls the first smart contract according to the Ethereum application binary interface file, including: Receiving the contract call information encoded by the second smart contract according to the Ethereum application binary interface file; Decoding the received contract call information according to the Ethereum application binary interface file, and sending the decoding result to the first smart contract, so that the first smart contract executes the corresponding contract function according to the decoding result; Receive the contract execution result returned by the first smart contract, and encode the contract execution result according to the Ethereum application binary interface file; The encoded contract execution result is sent to the second smart contract, so that the second smart contract decodes the contract execution result according to the Ethereum application binary interface file to complete the contract call.

5. The method according to claim 1, characterized in that The first smart contract is a Move smart contract; the second smart contract is a Solidity contract.

6. A contract calling device, characterized in that: include: An acquisition module, used to acquire function information of the first smart contract and Ethereum application binary interface specification; A generation module, configured to generate an Ethereum application binary interface file for the first smart contract according to the function information and the Ethereum application binary interface specification; A calling module is used to send the Ethereum application binary interface file to a second smart contract in Ethereum, so that the second smart contract calls the first smart contract according to the Ethereum application binary interface file.

7. The device according to claim 6, characterized in that The acquisition module is specifically used for: Obtain function information of the first smart contract through a compilation tool; wherein the function information includes a function name, input / output parameters, types of input / output parameters, return parameters, and types of return parameters of each contract function in the first smart contract.

8. The device according to claim 7, characterized in that The generation module is also used for: For each contract function in the first smart contract, the types of the input / output parameters and the type of the return parameter included in the function information of the contract function are respectively mapped to parameter types in the Ethereum Application Binary Interface specification to obtain a parameter type mapping result; According to the parameter type mapping result, an Ethereum application binary interface file is generated for the first smart contract.

9. An electronic device, characterized in that: include: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can perform the method according to any one of claims 1 to 5.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the method according to any one of claims 1 to 5 when executed.