CN110955448A - Intelligent contract separation method, contract processing method, apparatus, device and medium - Google Patents

Intelligent contract separation method, contract processing method, apparatus, device and medium Download PDF

Info

Publication number
CN110955448A
CN110955448A CN201910965012.0A CN201910965012A CN110955448A CN 110955448 A CN110955448 A CN 110955448A CN 201910965012 A CN201910965012 A CN 201910965012A CN 110955448 A CN110955448 A CN 110955448A
Authority
CN
China
Prior art keywords
contract
logic
data
sub
target
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
CN201910965012.0A
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.)
Ping An One Wallet E Commerce Co Ltd
Original Assignee
Ping An One Wallet E Commerce 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 Ping An One Wallet E Commerce Co Ltd filed Critical Ping An One Wallet E Commerce Co Ltd
Priority to CN201910965012.0A priority Critical patent/CN110955448A/en
Publication of CN110955448A publication Critical patent/CN110955448A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management

Abstract

The invention discloses an intelligent contract separation method, a contract processing method, a device, equipment and a medium, wherein the method comprises the following steps: acquiring an original intelligent contract, wherein the original intelligent contract comprises a logic contract and a data contract address; based on the data contract address, splitting the logic contract into M sub-logic contracts and M contract data corresponding to the M sub-logic contracts one by one in an address calling mode according to a preset function class; updating the address of each sub-logic contract in a proxy calling mode to obtain M target sub-logic contracts; and storing the M-type contract data into the M target sub-logic contracts to obtain a target intelligent contract. The intelligent contract separation method realizes data separation of the intelligent contract and improves the efficiency and the accuracy of intelligent contract separation.

Description

Intelligent contract separation method, contract processing method, apparatus, device and medium
Technical Field
The invention relates to the field of intelligent contracts, in particular to an intelligent contract separation method, a contract processing method, a device, equipment and a medium.
Background
In the design of the Ethernet, the intelligent contract cannot be destroyed after being deployed, so the intelligent contract cannot be modified after being deployed in the Ethernet, if the business requirement is changed or the logic contract code is not compiled strictly, a bug exists, and the intelligent contract cannot be redeployed after being modified in the original contract. The design of the EtherFang intelligent contracts is not allowed to be modified after being deployed, so that the redeployed data is lost after the intelligent contracts are modified, but the change of business requirements is inevitable.
Conventionally, a data contract and a service contract are separated, and the data contract is called by the service contract, so that when the demand is changed, only the service contract needs to be redeployed, and the data stored in the data contract is not lost.
Disclosure of Invention
The embodiment of the invention provides an intelligent contract separation method, device, equipment and medium, aiming at solving the problems of low intelligent contract separation efficiency and low accuracy.
An intelligent contract separation method, comprising:
acquiring an original intelligent contract, wherein the original intelligent contract comprises a logic contract and a data contract address;
based on the data contract address, splitting the logic contract into M sub-logic contracts and M contract data corresponding to the M sub-logic contracts one by one in an address calling mode according to a preset function class, wherein M is a natural number greater than 1;
updating the address of each sub-logic contract in a proxy calling mode to obtain M target sub-logic contracts;
and storing the M-type contract data into the M target sub-logic contracts to obtain a target intelligent contract.
An intelligent contract separating apparatus comprising:
the system comprises an original contract acquisition module, a data contract acquisition module and a data contract acquisition module, wherein the original contract acquisition module is used for acquiring an original intelligent contract which comprises a logic contract and a data contract address;
the contract splitting module is used for splitting the logic contract into M sub-logic contracts and M types of contract data which are in one-to-one correspondence with the M sub-logic contracts according to a preset function type in an address calling mode based on the data contract address, wherein M is a natural number larger than 1;
the contract updating module is used for updating the address of each sub-logic contract in a proxy calling mode to obtain M target sub-logic contracts;
and the target contract acquisition module is used for storing the M-type contract data into the M target sub-logic contracts to obtain a target intelligent contract.
A contract processing method comprising:
the contract processing request module is used for acquiring a target intelligent contract in the intelligent contract processing request if the intelligent contract processing request is received, wherein the target intelligent contract is obtained by adopting the intelligent contract separation method and comprises M target sub-logic contracts and M-type contract data;
the contract processing module is used for carrying out logic processing on each target sub-logic contract, calling each contract data to carry out data processing, and combining a logic processing result and a data processing result into an intelligent contract processing result;
and the contract result feedback module is used for sending the intelligent contract processing result to the Ethernet workshop to carry out feedback.
If an intelligent contract processing request is received, acquiring a target intelligent contract in the intelligent contract processing request, wherein the target intelligent contract is obtained by adopting the intelligent contract separation method and comprises M target sub-logic contracts and M-type contract data;
carrying out logic processing on each target sub-logic contract, calling each contract data to carry out data processing, and combining a logic processing result and a data processing result into an intelligent contract processing result;
and sending the intelligent contract processing result to an Ethernet workshop uplink for feedback.
A contract processing apparatus comprising:
a computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, the processor implementing the intelligent contract splitting method when executing the computer program or implementing the contract processing method when executing the computer program.
A computer-readable storage medium storing a computer program which, when executed by a processor, implements the above-described intelligent contract splitting method, or which, when executed by the processor, implements the above-described contract processing method.
In the intelligent contract separation method, the device, the equipment and the medium, firstly, an original intelligent contract is obtained, wherein the original intelligent contract comprises a logic contract and a data contract address; then, based on the data contract address, splitting the logic contract into M sub-logic contracts and M-type contract data which are in one-to-one correspondence with the M sub-logic contracts according to a preset function type in an address calling mode, so that the simplicity and convenience of the intelligent contract are improved, and the accuracy and the efficiency of data separation are improved subsequently; then, address updating is carried out on each sub-logic contract in an agent calling mode to obtain M target sub-logic contracts, so that the accuracy and safety of transaction are guaranteed, and the intelligent contract is safe and accurate under the condition of updating or upgrading; and finally, storing the M-type contract data into M target sub-logic contracts to obtain a target intelligent contract, thereby further improving the efficiency and accuracy of intelligent contract data separation.
In the contract processing method, the contract processing device, the contract processing equipment and the contract processing medium, firstly, if an intelligent contract processing request is received, a target intelligent contract in the intelligent contract processing request is obtained, wherein the target intelligent contract is obtained by adopting an intelligent contract separation method and comprises M target sub-logic contracts and M-type contract data, so that the subsequent intelligent contract processing process is more convenient and flexible; then, each target sub-logic contract is logically processed, each contract data is called to be processed, and a logic processing result and a data processing result are combined into an intelligent contract processing result, so that the intelligent contract processing efficiency is improved, and the accuracy of the intelligent contract processing result is improved; and finally, the intelligent contract processing result is sent to the Ethernet workshop uplink for feedback, so that the efficiency and the safety of the transaction based on the Ethernet workshop are improved.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings needed to be used in the description of the embodiments of the present invention will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art that other drawings can be obtained according to these drawings without inventive labor.
FIG. 1 is a schematic diagram of an application environment of an intelligent contract separation method provided by an embodiment of the present invention;
FIG. 2 is a diagram of an example of an intelligent contract separation method provided by an embodiment of the present invention;
FIG. 3 is another exemplary diagram of an intelligent contract splitting method provided by an embodiment of the present invention;
FIG. 4 is another exemplary diagram of an intelligent contract splitting method provided by an embodiment of the present invention;
FIG. 5 is a functional block diagram of an intelligent contract splitting apparatus provided by an embodiment of the present invention;
FIG. 6 is another functional block diagram of an intelligent contract splitting apparatus provided by an embodiment of the present invention;
FIG. 7 is a diagram of an example of a contract processing method provided by an embodiment of the invention;
FIG. 8 is a functional block diagram of a contract processing apparatus provided by an embodiment of the present invention;
fig. 9 is a schematic diagram of a computer device according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The intelligent contract separation method provided by the application can be applied to an application environment as shown in fig. 1, wherein a client communicates with a server through a network, the server receives an original intelligent contract sent by the client, and the original intelligent contract comprises a logic contract and a data contract address; then based on the data contract address, splitting the logic contract into M sub-logic contracts and M contract data corresponding to the M sub-logic contracts one by one in an address calling mode according to a preset function class; then, carrying out address updating on each sub-logic contract in a proxy calling mode to obtain M target sub-logic contracts; and finally, storing the M-type contract data into the M target sub-logic contracts to obtain a target intelligent contract. The client may be, but is not limited to, various personal computers, notebook computers, smart phones, tablet computers, and portable wearable devices. The server can be implemented by an independent server or a server cluster composed of a plurality of servers.
In an embodiment, as shown in fig. 2, taking the application of the method to the server in fig. 1 as an example for explanation, the method includes the following steps:
s10: an original intelligent contract is obtained, the original intelligent contract comprising a logical contract and a data contract address.
A Smart contract (Smart contract), among others, is a computer protocol for propagating, verifying or executing contracts in an informative manner, i.e., a piece of code written on a blockchain in an ethernet design. The original intelligent contract in this embodiment is an intelligent contract that needs data separation, that is, an unprocessed intelligent contract, and includes a logic contract, a data contract, and a data contract address, where the logic contract includes a service code of a system and corresponding data, and is used to implement a specific service function requirement in an ethernet intelligent contract. The data contract address is a data read-write interface and is used as an entrance for accessing the logic contract.
Specifically, the original intelligent contract may be obtained through address instantiation call, and the specific implementation process is as follows: extracting the address of the deployed intelligent contract, then locally obtaining abi codes corresponding to the address of the intelligent contract, instantiating the intelligent contract through abi codes, wherein the instance can use the instance during deployment, and finally the intelligent contract instantiated by calling the address is the original intelligent contract.
S20: based on the data contract address, splitting the logic contract into M sub-logic contracts and M-type contract data which are in one-to-one correspondence with the M sub-logic contracts according to a preset function type in an address calling mode, wherein M is a natural number larger than 1.
The preset function type refers to a type of a function preset according to an application scene of the intelligent contract, M is the number of the preset function types, and the preset function types can be set according to actual needs, for example, the preset function includes 2 business function types including transaction transfer and transaction credit authorization, and at this time, M is 2. The sub-logical contract refers to a split logical contract with only one business function, such as a sub-logical contract with a transaction transfer business function. The contract data refers to data stored in the sub-logic contracts, and the categories of the contract data correspond to the sub-logic contracts one by one, namely the number of the categories of the contract data is M. The address calling mode refers to a mode of reading and writing data in a logic contract by calling a read and write interface (get function and set function) of a data field provided in a data contract address through the data contract address. In this embodiment, the logic contract is split by means of address calling. Specifically, after a logical contract is called according to a contract data address, data in the logical contract is split according to a function preset by the logical contract, so that M sub-logical contracts and M-class contract data corresponding to each sub-logical contract can be obtained. The method comprises the steps of generating a logic contract, generating a service code according to the service code, and dividing the logic contract into a plurality of logic contracts according to the service code, wherein the logic contract comprises data and service codes, and the logic contract comprises the data and the service code, so that the data of the logic contract is increased along with the increase of the service time of the intelligent contract, and the read-write efficiency of the data in the intelligent contract is influenced.
S30: and updating the address of each sub-logic contract in a proxy calling mode to obtain M target sub-logic contracts.
The method for invoking the agent is that the data field is defined in the data contract but a read-write interface of the data field is not provided, but the data contract is inherited in the logic contract, the logic contract can access the data in the parent data contract through the contract inheritance relationship, the proxy contract (agent contract) inherits the data contract, and meanwhile, a processing mode of an address variable of the logic contract is defined, and the processing mode is used for replacing the logic contract address to update the logic contract address when the logic contract needs to be updated and upgraded, so that the reliability and the accuracy of the transaction are enhanced. It can be understood that when an old contract is attacked, the property loss of a user is caused, and therefore, address updating is performed on each sub-logic contract in a proxy calling manner to obtain M target sub-logic contracts, that is, in a nameless function (Fallback function), a delagetecall function is used to cooperate with a defined logic contract address variable to perform proxy calling on the logic contract, which is beneficial to ensuring the accuracy and safety of intelligent contract-based transactions, so that the intelligent contract is safe and accurate under the condition of updating or upgrading.
S40: and storing the M-type contract data into M target sub-logic contracts to obtain a target intelligent contract.
The target intelligent contract is an intelligent contract obtained by subdividing an original intelligent contract, the structural design of the original intelligent contract is subjected to hierarchical splitting and function refinement and labor division, a control layer, a logic layer and a data layer of the intelligent contract are isolated, contract data are stored in corresponding target sub-logic contracts, independent updating and upgrading among all levels are not affected, and the target intelligent contract is convenient to maintain.
The method has the advantages that the agent contract is used as the controller layer, when the intelligent contract is updated, the external interface address of the intelligent contract in the application can be kept unchanged, the risk that a new transaction request is sent to an old contract does not exist, and the accuracy and the safety of the transaction are guaranteed; the data contract is separated from the logic contract, when the logic contract is updated and upgraded, the data contract is not affected, the new contract can access the data stored in the data contract as conveniently as the old logic contract, the data contract is separated according to the data structure design, the function of partitioning a database in a similar relational database is realized, the reading and writing efficiency of the data is ensured, the modification authority of the data in the data contract is easily controlled after the separation, the data in the data contract is not easy to be distorted, when the data migration needs to be carried out, the separated and stored data is more convenient than the traditional intelligent contract, and the efficiency and the accuracy of the data separation of the intelligent contract are further improved.
In the embodiment, firstly, an original intelligent contract is obtained, wherein the original intelligent contract comprises a logic contract and a data contract address; then, based on the data contract address, splitting the logic contract into M sub-logic contracts and M-type contract data which are in one-to-one correspondence with the M sub-logic contracts according to a preset function type in an address calling mode, so that the simplicity and convenience of the intelligent contract are improved, and the accuracy and the efficiency of data separation are improved subsequently; then, address updating is carried out on each sub-logic contract in an agent calling mode to obtain M target sub-logic contracts, so that the accuracy and safety of transaction are guaranteed, and the intelligent contract is safe and accurate under the condition of updating or upgrading; and finally, storing the M-type contract data into M target sub-logic contracts to obtain a target intelligent contract, thereby further improving the efficiency and accuracy of intelligent contract data separation.
In an embodiment, as shown in fig. 3, in step S20, based on the data contract address, splitting the logic contract into M sub-logic contracts and M-type contract data corresponding to the M sub-logic contracts one by one in an address call manner, specifically including the following steps:
s21: and calling the data contract address to initialize the logic contract corresponding to the data contract and determine the logic contract as a target logic contract.
The target logical contract is a logical contract initialized for the logical contract corresponding to the data contract. Specifically, a data contract address is called, the value of the data contract address variable is the address of a currently used logic contract corresponding to the data contract, after the logic contract is deployed, the corresponding data contract address variable is assigned as the address of the logic contract which is just deployed by calling a corresponding assignment function, the address variables are the addresses of the data contract where the data required in the logic contract is located, and after the logic contract is deployed, the corresponding data contract address is initialized into a new logic contract to obtain a target logic contract.
S22: and splitting the target logic contract according to the preset function category to obtain M sub-agent logic contracts.
Specifically, the target contract is decomposed into a plurality of sub-agent logical contracts according to the preset function categories, and the specific decomposition method is consistent with the splitting method in step S20, and is not described herein again.
S23: and separating the logic and data of the agent logic contract aiming at each sub agent logic contract.
Specifically, for each subagent logical contract, since the subagent logical contract contains both the service code and the contract data, the logic and the data of the subagent logical contract are separated and obtained respectively.
S24: and storing the logic and the data by using a Key-value form, wherein the logic is stored as a sub-logic contract, and the data is stored as contract data.
Specifically, after the logic and the data of the agent logic contract are separated, the logic and the data are stored according to a Key-value form, the logic is stored as a sub-logic contract, and the data is stored as contract data, so that the one-to-one correspondence between the service codes and the data of the logic contract is ensured, the query operation of the data and the logic is facilitated, and the sub-agent logic contract is further processed in the following process.
In this embodiment, first, a data contract address is called to initialize a logic contract corresponding to the data contract, and the logic contract is determined as a target logic contract; then, splitting the target logic contract according to a preset function category to obtain M sub-agent logic contracts; then, aiming at each sub-agent logic contract, separating the logic and data of the agent logic contract; and finally, storing the logic and the data in a Key-value form, wherein the logic is stored as a sub-logic contract, and the data is stored as contract data, so that the one-to-one correspondence between the service codes of the logic contract and the data is ensured, the query operation of the data and the logic is facilitated, and the like, and the sub-agent logic contract is further processed in the subsequent process.
In an embodiment, as shown in fig. 4, in step S30, address updating is performed on each sub-logic contract in a proxy call manner to obtain M target sub-logic contracts, which specifically includes the following steps:
s31: the delegatecall opcode of the sub-logic contract is obtained.
Where the delegatecall opcode is a code at a target address provided by the EVM, is a call opcode executed in the context of a call logic contract, for updating a logic contract in an intelligent contract. In particular, the delegatecall operation code of a sub-logic contract may be extracted from a storage structure of the sub-logic contract.
S32: and updating the address of each sub-logic contract by adopting the delegatecall operation code to obtain the target sub-logic contract.
Specifically, the server updates the address of each sub-logical contract using the delegatecall opcode and sends a function call request to the address of the sub-logical contract that can be updated. Since the delegatecall can keep the state of function call, the logic of the target function can be updated, the state can be kept in the address of the generation sub-logic contract for the logic of the updatable sub-logic contract, and since the delegatecall operation code can keep the call of each sub-logic contract address, the updating of each sub-logic contract is realized, the target sub-logic contract is obtained, and the accuracy of the target sub-logic contract is ensured.
In this embodiment, a delegatecall operation code of a sub-logic contract is obtained; and updating the address of each sub-logic contract by adopting the delegatecall operation code to obtain the target sub-logic contract, thereby ensuring the accuracy of the target sub-logic contract.
In one embodiment, after step S40, i.e., after storing M contract data into M target sub-logical contracts, the target intelligent contract splitting method further includes:
s50: and splitting each contract data according to the structure type to obtain sub-contract data, and setting a transaction authority for each sub-contract data.
Specifically, the data contract is structurally split, that is, different types of data are split into different data contracts, such as blacklist data in an ethernet digital asset application, according to a data structure design, where the data can be split into: the method comprises the steps of respectively storing different types of data such as an unlimited list, a limited transaction list, a refused transaction list and the like in different data contracts, wherein each data contract is only responsible for storing one type of data, so that the data contracts are divided in a refined mode, data management and data migration are facilitated, modification permission of different data is set conveniently, and therefore the data are protected from being tampered easily, and the safety of the data is improved.
In the embodiment, each contract data is split according to the structure type to obtain the sub-contract data, and the transaction authority is set for each sub-contract data, so that the data management and the data migration are facilitated, and the modification authority of different data is set conveniently, so that the data is protected from being tampered easily, and the data security is improved.
It should be understood that, the sequence numbers of the steps in the foregoing embodiments do not imply an execution sequence, and the execution sequence of each process should be determined by its function and inherent logic, and should not constitute any limitation to the implementation process of the embodiments of the present invention.
In one embodiment, an intelligent contract separation device is provided, which corresponds to the intelligent contract separation method in the above embodiments one to one. As shown in fig. 5, the intelligent contract separating apparatus includes an original contract acquisition module 10, a contract splitting module 20, a contract updating module 30 and a target contract acquisition module 40. The functional modules are explained in detail as follows:
an original contract obtaining module 10, configured to obtain an original intelligent contract, where the original intelligent contract includes a logic contract and a data contract address;
the contract splitting module 20 is configured to split a logic contract into M sub-logic contracts and M types of contract data corresponding to the M sub-logic contracts one to one in an address calling manner based on a data contract address, where M is a natural number greater than 1;
the contract updating module 30 is configured to perform address updating on each sub-logic contract in a proxy call manner to obtain M target sub-logic contracts;
and the target contract obtaining module 40 is used for storing the M-type contract data into the M target sub-logic contracts to obtain the target intelligent contract.
Preferably, as shown in fig. 6, the contract splitting module 20 includes a logical contract obtaining unit 21, a logical contract splitting unit 22, a contract separating unit 23, and a target logical contract obtaining unit 24.
A logic contract obtaining unit 21, configured to invoke a data contract address to initialize a logic contract corresponding to the data contract, and determine the logic contract as a target logic contract;
the logic contract splitting unit 22 is configured to split the target logic contract according to a preset function category to obtain M sub-agent logic contracts;
a contract separation unit 23, configured to separate out, for each sub-agent logic contract, logic and data of the agent logic contract;
and the target logic contract obtaining unit 24 is used for storing the logic and data in a Key-value form, wherein the logic is stored as a sub-logic contract, and the data is stored as contract data.
Preferably, the contract updating module comprises an operation code obtaining unit and a logic contract updating unit.
An operation code obtaining unit, configured to obtain a delegatecall operation code of the sub-logic contract;
and the logic contract updating unit is used for updating the address of each sub-logic contract by adopting the delegatecall operation code to obtain the target sub-logic contract.
Preferably, the intelligent contract separating device further comprises a data splitting module, which is used for splitting each contract data according to the structure type to obtain sub-contract data, and setting a transaction authority for each sub-contract data.
In one embodiment, a contract processing method is provided that may also be used in an application environment such as that of FIG. 1, where a client communicates with a server over a network. If the server side receives an intelligent contract processing request sent by the client side, a target intelligent contract in the intelligent contract processing request is obtained, wherein the target intelligent contract is obtained by adopting an intelligent contract separation method and comprises M target sub-logic contracts and M-type contract data; and carrying out logic processing on each target sub-logic contract, calling each contract data to carry out data processing, and combining a logic processing result and a data processing result into an intelligent contract processing result. The client may be, but is not limited to, various personal computers, notebook computers, smart phones, tablet computers, and portable wearable devices. The server can be implemented by an independent server or a server cluster composed of a plurality of servers.
In an embodiment, as shown in fig. 7, taking the application of the method to the server in fig. 1 as an example for explanation, the method includes the following steps:
s60: and if the intelligent contract processing request is received, acquiring a target intelligent contract in the intelligent contract processing request, wherein the target intelligent contract is obtained by adopting an intelligent contract separation method, and the target intelligent contract comprises M target sub-logic contracts and M-type contract data.
Specifically, when a user sends an intelligent contract processing request, such as a transaction request, the intelligent contract processing request first enters a target sub-logic contract in a target intelligent contract, the intelligent contract processing request and data are transmitted to a logic contract address required by the transaction through a fallback function, namely, address calling can be performed through the address, and the transaction request and data are sent to a corresponding logic contract. It can be understood that the target sub-logic contract is obtained by the intelligent contract separation method in the above embodiment, therefore, after the intelligent contract processing request performs corresponding logic processing in the logic contract, the logic contract needs to interact with necessary data in the current transaction and the data contract, the logic contract sends the data to be interacted to the data proxy contract through proxy call, and then the data proxy contract writes the data into the data contract through address call, thereby ensuring that the subsequent intelligent contract processing process is more convenient and flexible.
S70: and carrying out logic processing on each target sub-logic contract, calling each contract data to carry out data processing, and combining a logic processing result and a data processing result into an intelligent contract processing result.
The logic processing refers to logic verification of transaction information, for example, processing of transfer amount data in a transfer function, judging whether balance of a payer is enough, and if the balance is enough, deducting the balance of the payer and increasing the transfer amount to balance of a payee. Data processing refers to the manipulation of the contract data as required by the transaction in the transaction request.
It can be understood that, in step S60, the data contract of the target intelligent contract is split from the logic contract, when the logic contract is updated, the data contract is not affected, and the new contract can access the data stored in the data contract as conveniently as the old logic contract; the data contract is split according to the data structure design, so that the accuracy and the safety of transaction are ensured; the method has the advantages that the function of database sub-tables in a similar relational database is realized, the read-write efficiency of data is ensured, the modification authority of the data in the data contract is easily controlled after the data contract is split, the data in the data contract is not easily tampered, when the application needs to be subjected to data migration, the split and stored data are more convenient than the traditional intelligent contract, the intelligent contract processing efficiency is improved, and the accuracy of the intelligent contract processing result is improved.
S80: and sending the intelligent contract processing result to an Ethernet workshop to be fed back.
Specifically, the server side calls a read-write interface of data required in the data contract to perform data operation according to the requirement of the intelligent contract processing request, and then sends the intelligent contract processing result data to the Ethernet workshop uplink to complete the transaction and perform feedback, so that the efficiency and the safety of the Ethernet workshop-based transaction are improved.
In the embodiment, firstly, if an intelligent contract processing request is received, a target intelligent contract in the intelligent contract processing request is obtained, wherein the target intelligent contract is obtained by adopting an intelligent contract separation method and comprises M target sub-logic contracts and M-type contract data, so that the subsequent intelligent contract processing process is more convenient and flexible; then, each target sub-logic contract is logically processed, each contract data is called to be processed, and a logic processing result and a data processing result are combined into an intelligent contract processing result, so that the intelligent contract processing efficiency is improved, and the accuracy of the intelligent contract processing result is improved; and finally, the intelligent contract processing result is sent to the Ethernet workshop uplink for feedback, so that the efficiency and the safety of the transaction based on the Ethernet workshop are improved.
It should be understood that, the sequence numbers of the steps in the foregoing embodiments do not imply an execution sequence, and the execution sequence of each process should be determined by its function and inherent logic, and should not constitute any limitation to the implementation process of the embodiments of the present invention.
In one embodiment, there is provided a contract processing apparatus, which corresponds one-to-one to the contract processing methods in the above-described embodiments. As shown in fig. 8, the contract processing apparatus includes a contract processing request module 60, a contract processing module 70, and a contract result feedback module 80. The functional modules are explained in detail as follows:
a contract processing request module 60, configured to obtain a target intelligent contract in the intelligent contract processing request if the intelligent contract processing request is received, where the target intelligent contract is obtained by using the intelligent contract separation method in the foregoing embodiment, and the target intelligent contract includes M target sub-logical contracts and M-class contract data;
the contract processing module 70 is used for performing logic processing on each target sub-logic contract, calling each contract data to perform data processing, and combining a logic processing result and a data processing result into an intelligent contract processing result;
and a contract result feedback module 80, configured to send the intelligent contract processing result to the ethernet uplink for feedback.
For specific definition of the intelligent contract separating device, reference may be made to the definition of the intelligent contract separating method above, and details are not described here. The modules in the intelligent contract separating device can be wholly or partially realized by software, hardware and a combination thereof. The modules can be embedded in a hardware form or independent from a processor in the computer device, and can also be stored in a memory in the computer device in a software form, so that the processor can call and execute operations corresponding to the modules.
In one embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as shown in fig. 9. The computer device includes a processor, a memory, a network interface, and a database connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device comprises a nonvolatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of an operating system and computer programs in the non-volatile storage medium. The database of the computer device is used for storing data used in the intelligent contract separation method. The network interface of the computer device is used for communicating with an external terminal through a network connection. The computer program is executed by a processor to implement an intelligent contract splitting method.
In one embodiment, a computer device is provided, which includes a memory, a processor, and a computer program stored on the memory and executable on the processor, and the processor implements the intelligent contract splitting method in the above embodiments when executing the computer program, or implements the contract processing method in the above embodiments when executing the computer program.
In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored, which when executed by a processor implements the intelligent contract splitting method in the above-described embodiments, or which when executed by a processor implements the contract processing method in the above-described embodiments.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by hardware instructions of a computer program, which can be stored in a non-volatile computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. Any reference to memory, storage, database, or other medium used in the embodiments provided herein may include non-volatile and/or volatile memory, among others. Non-volatile memory can include read-only memory (ROM), Programmable ROM (PROM), Electrically Programmable ROM (EPROM), Electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), Dynamic RAM (DRAM), Synchronous DRAM (SDRAM), Double Data Rate SDRAM (DDRSDRAM), Enhanced SDRAM (ESDRAM), Synchronous Link DRAM (SLDRAM), Rambus Direct RAM (RDRAM), direct bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
It will be apparent to those skilled in the art that, for convenience and brevity of description, only the above-mentioned division of the functional units and modules is illustrated, and in practical applications, the above-mentioned function distribution may be performed by different functional units and modules according to needs, that is, the internal structure of the apparatus is divided into different functional units or modules to perform all or part of the above-mentioned functions.
The above-mentioned embodiments are only used for illustrating the technical solutions of the present invention, and not for limiting the same; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; such modifications and substitutions do not substantially depart from the spirit and scope of the embodiments of the present invention, and are intended to be included within the scope of the present invention.

Claims (10)

1. An intelligent contract separation method, characterized in that the intelligent contract separation method comprises:
acquiring an original intelligent contract, wherein the original intelligent contract comprises a logic contract and a data contract address;
based on the data contract address, splitting the logic contract into M sub-logic contracts and M contract data corresponding to the M sub-logic contracts one by one in an address calling mode according to a preset function class, wherein M is a natural number greater than 1;
updating the address of each sub-logic contract in a proxy calling mode to obtain M target sub-logic contracts;
and storing the M-type contract data into the M target sub-logic contracts to obtain a target intelligent contract.
2. The intelligent contract separation method according to claim 1, wherein the splitting the logical contract into M sub-logical contracts and M-type contract data corresponding to M sub-logical contracts in one-to-one correspondence by using address calling according to a preset function category based on the data contract address comprises:
calling the data contract address to initialize a logic contract corresponding to the data contract and determining the logic contract as a target logic contract;
splitting the target logic contract according to a preset function category to obtain M sub-agent logic contracts;
for each sub-agent logic contract, separating the logic and data of the agent logic contract;
and saving the logic and data by using a Key-value form, wherein the logic is saved as the sub-logic contract, and the data is saved as the contract data.
3. The intelligent contract splitting method according to claim 1, wherein the updating the address of each of the sub-logical contracts by means of proxy call to obtain M target sub-logical contracts comprises:
obtaining a delegatecall operation code of the sub-logic contract;
and updating the address of each sub-logic contract by using the delegatecall operation code to obtain the target sub-logic contract.
4. The intelligent contract splitting method of claim 1, wherein after said storing the M contract data into the M target sub-logical contracts to obtain target intelligent contracts, the intelligent contract splitting method further comprises:
and splitting each contract data according to the structure type to obtain sub-contract data, and setting a transaction authority for each sub-contract data.
5. A contract processing method, characterized by comprising:
if an intelligent contract processing request is received, acquiring a target intelligent contract in the intelligent contract processing request, wherein the target intelligent contract is obtained by adopting the intelligent contract separation method according to any one of claims 1-4, and the target intelligent contract comprises M target sub-logic contracts and M-type contract data;
carrying out logic processing on each target sub-logic contract, calling each contract data to carry out data processing, and combining a logic processing result and a data processing result into an intelligent contract processing result;
and sending the intelligent contract processing result to an Ethernet workshop uplink for feedback.
6. An intelligent contract separating apparatus, comprising:
the system comprises an original contract acquisition module, a data contract acquisition module and a data contract acquisition module, wherein the original contract acquisition module is used for acquiring an original intelligent contract which comprises a logic contract and a data contract address;
the contract splitting module is used for splitting the logic contract into M sub-logic contracts and M types of contract data which are in one-to-one correspondence with the M sub-logic contracts according to a preset function type in an address calling mode based on the data contract address, wherein M is a natural number larger than 1;
the contract updating module is used for updating the address of each sub-logic contract in a proxy calling mode to obtain M target sub-logic contracts;
and the target contract acquisition module is used for storing the M-type contract data into the M target sub-logic contracts to obtain a target intelligent contract.
7. The intelligent contract splitting apparatus of claim 6, wherein the contract splitting module comprises:
the logic contract acquisition unit is used for calling the data contract address to initialize a logic contract corresponding to the data contract and determining the logic contract as a target logic contract;
the logic contract splitting unit is used for splitting the target logic contract according to a preset function category to obtain M sub-agent logic contracts;
the contract separation unit is used for separating the logic and data of the agent logic contract aiming at each sub agent logic contract;
and the target logic contract acquisition unit is used for storing the logic and the data in a Key-value form, wherein the logic is stored as the sub-logic contract, and the data is stored as the contract data.
8. A contract processing apparatus characterized by comprising:
a contract processing request module, configured to obtain a target intelligent contract in an intelligent contract processing request if the intelligent contract processing request is received, where the target intelligent contract is obtained by using the intelligent contract separation method according to any one of claims 1 to 4, and the target intelligent contract includes M target sub-logical contracts and M-class contract data;
the contract processing module is used for carrying out logic processing on each target sub-logic contract, calling each contract data to carry out data processing, and combining a logic processing result and a data processing result into an intelligent contract processing result;
and the contract result feedback module is used for sending the intelligent contract processing result to the Ethernet workshop to carry out feedback.
9. A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that the processor implements the intelligent contract splitting method according to any one of claims 1 to 4 when executing the computer program or implements the contract processing method according to claim 5 when executing the computer program.
10. A computer-readable storage medium, in which a computer program is stored, which computer program, when being executed by a processor, carries out the intelligent contract splitting method according to any one of claims 1 to 4, or which processor, when executing the computer program, carries out the contract processing method according to claim 5.
CN201910965012.0A 2019-10-11 2019-10-11 Intelligent contract separation method, contract processing method, apparatus, device and medium Pending CN110955448A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910965012.0A CN110955448A (en) 2019-10-11 2019-10-11 Intelligent contract separation method, contract processing method, apparatus, device and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910965012.0A CN110955448A (en) 2019-10-11 2019-10-11 Intelligent contract separation method, contract processing method, apparatus, device and medium

Publications (1)

Publication Number Publication Date
CN110955448A true CN110955448A (en) 2020-04-03

Family

ID=69976341

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910965012.0A Pending CN110955448A (en) 2019-10-11 2019-10-11 Intelligent contract separation method, contract processing method, apparatus, device and medium

Country Status (1)

Country Link
CN (1) CN110955448A (en)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111415251A (en) * 2020-05-09 2020-07-14 杭州时戳信息科技有限公司 Block chain-based mortgage lending method and system, storage medium and computing device
CN111679902A (en) * 2020-08-14 2020-09-18 支付宝(杭州)信息技术有限公司 Intelligent contract calling method and device based on block chain and electronic equipment
CN111813836A (en) * 2020-08-13 2020-10-23 广州东港安全印刷有限公司 Method for improving Ethereum block chain system expansibility
CN112613877A (en) * 2020-12-17 2021-04-06 腾讯科技(深圳)有限公司 Intelligent contract triggering method and device applied to block chain network and related equipment
CN114201116A (en) * 2021-12-17 2022-03-18 深圳前海微众银行股份有限公司 Intelligent contract deployment method, device, equipment, medium and program product
WO2023020193A1 (en) * 2021-08-19 2023-02-23 中国人民银行数字货币研究所 Smart contract execution method and apparatus

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111415251A (en) * 2020-05-09 2020-07-14 杭州时戳信息科技有限公司 Block chain-based mortgage lending method and system, storage medium and computing device
CN111813836A (en) * 2020-08-13 2020-10-23 广州东港安全印刷有限公司 Method for improving Ethereum block chain system expansibility
CN111679902A (en) * 2020-08-14 2020-09-18 支付宝(杭州)信息技术有限公司 Intelligent contract calling method and device based on block chain and electronic equipment
CN111679902B (en) * 2020-08-14 2020-11-10 支付宝(杭州)信息技术有限公司 Intelligent contract calling method and device based on block chain and electronic equipment
CN112613877A (en) * 2020-12-17 2021-04-06 腾讯科技(深圳)有限公司 Intelligent contract triggering method and device applied to block chain network and related equipment
WO2023020193A1 (en) * 2021-08-19 2023-02-23 中国人民银行数字货币研究所 Smart contract execution method and apparatus
CN114201116A (en) * 2021-12-17 2022-03-18 深圳前海微众银行股份有限公司 Intelligent contract deployment method, device, equipment, medium and program product

Similar Documents

Publication Publication Date Title
CN110955448A (en) Intelligent contract separation method, contract processing method, apparatus, device and medium
CN107562513B (en) Intelligent contract life cycle management method based on JAVA
CN109787908B (en) Server current limiting method, system, computer equipment and storage medium
CN110008665B (en) Authority control method and device for blockchain
CN109144487B (en) Method, device, computer equipment and storage medium for developing business of parts
KR102340474B1 (en) System, method and computer program for data scrapping using script engine
CN110750267A (en) Service information updating method and device, computer equipment and storage medium
CN110532025B (en) Data processing method, device and equipment based on micro-service architecture and storage medium
CN112527835B (en) Authentication request processing method and device based on cache and related equipment
CN112016122A (en) Webpage data processing method and device, computer equipment and storage medium
US11018860B2 (en) Highly available and reliable secret distribution infrastructure
CN109358874A (en) Business rule update method, device, computer equipment and storage medium
CN112181423B (en) Project construction method and device based on configuration file, computer equipment and medium
CN111683083B (en) Block chain user identity authentication method, device, equipment and medium
CN107391539B (en) Transaction processing method, server and storage medium
CN113742681B (en) Account management method and device, computer equipment and storage medium
WO2022133827A1 (en) Method and apparatus for processing task processing request, and blockchain node device
CN112783866A (en) Data reading method and device, computer equipment and storage medium
CN110910140A (en) Method for realizing intelligent contract, front-end server, client, equipment and medium
CN112860287A (en) System program upgrading method and device, computer equipment and storage medium
CN110969430A (en) Method and device for identifying suspicious user, computer equipment and storage medium
CN113645064B (en) Task issuing method and device, electronic equipment and storage medium
CN112541756B (en) Block chain contract upgrading method and device, computer equipment and readable storage medium
EP4307142A1 (en) Update agent for multiple operating systems in a secure element
CN117272278B (en) Decentralization management method and device for digital asset platform

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