CN115760391A - Intelligent contract changing method and device in block chain, electronic equipment and storage medium - Google Patents

Intelligent contract changing method and device in block chain, electronic equipment and storage medium Download PDF

Info

Publication number
CN115760391A
CN115760391A CN202211401350.XA CN202211401350A CN115760391A CN 115760391 A CN115760391 A CN 115760391A CN 202211401350 A CN202211401350 A CN 202211401350A CN 115760391 A CN115760391 A CN 115760391A
Authority
CN
China
Prior art keywords
intelligent contract
change
change request
changing
response
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
CN202211401350.XA
Other languages
Chinese (zh)
Inventor
庄虔伟
曹崇瑞
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Netease Hangzhou Network Co Ltd
Original Assignee
Netease Hangzhou Network 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 Netease Hangzhou Network Co Ltd filed Critical Netease Hangzhou Network Co Ltd
Priority to CN202211401350.XA priority Critical patent/CN115760391A/en
Publication of CN115760391A publication Critical patent/CN115760391A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

The present disclosure provides a method, an apparatus, an electronic device and a storage medium for changing an intelligent contract in a block chain, wherein the method comprises: in response to a change request for changing an intelligent contract, judging whether a user address sending the change request for changing the intelligent contract has the authority of changing the intelligent contract; in response to determining that the user address has the authority to change the intelligent contract, verifying a change request for changing the intelligent contract; and in response to determining that the change request for changing the intelligent contract passes the verification, changing the intelligent contract according to the change request for changing the intelligent contract. In the method, the intelligent contract can be changed by the address of the user with the authority, and certain safety is ensured while the intelligent contract is changed.

Description

Intelligent contract changing method and device in block chain, electronic equipment and storage medium
Technical Field
The present disclosure relates to the field of blockchain technologies, and in particular, to a method and an apparatus for changing an intelligent contract in a blockchain, an electronic device, and a storage medium.
Background
This section is intended to provide a background or context to the embodiments of the disclosure that are recited in the claims. The description herein is not admitted to be prior art by inclusion in this section.
The intelligent contract is one of core technologies of the blockchain, and after the intelligent contract code is deployed to the blockchain, the intelligent contract code can never be modified so as to ensure the non-falsification characteristic of data on the blockchain.
However, in the process of developing and using the intelligent contract, there are cases that bug occurs or business change occurs, so that the intelligent contract code needs to be modified.
Disclosure of Invention
In view of the above, an object of the present disclosure is to provide a method, an apparatus, an electronic device, and a storage medium for intelligent contract modification in a block chain, which at least solve one of the technical problems in the related art to some extent.
In view of the above, an exemplary embodiment of the present disclosure provides a method for intelligent contract change in a blockchain, including:
in response to a change request for changing an intelligent contract, judging whether a user address sending the change request for changing the intelligent contract has the authority of changing the intelligent contract;
in response to determining that the user address has the authority to change the intelligent contract, verifying a change request for changing the intelligent contract;
and in response to determining that the change request for changing the intelligent contract passes the verification, changing the intelligent contract according to the change request for changing the intelligent contract.
Based on the same inventive concept, the exemplary embodiments of the present disclosure further provide an intelligent contract changing apparatus in a block chain, including:
the intelligent contract modification method comprises a modification permission judging module, a contract modification permission judging module and a contract modification permission judging module, wherein the modification permission judging module is configured to respond to a modification request for modifying an intelligent contract and judge whether a user address sending the modification request for modifying the intelligent contract has permission for modifying the intelligent contract;
a change request validation module configured to verify a change request to change the intelligent contract in response to determining that the user address has the right to change the intelligent contract;
an intelligent contract modification module configured to modify the intelligent contract in accordance with the change request to modify the intelligent contract in response to determining that the change request to modify the intelligent contract passes verification.
Based on the same inventive concept, the exemplary embodiments of the present disclosure also provide an electronic device, which includes a memory, a processor, and a computer program stored on the memory and executable on the processor, and when the processor executes the program, the method as described in any one of the above is implemented.
Based on the same inventive concept, the exemplary embodiments of the present disclosure also provide a non-transitory computer-readable storage medium storing computer instructions for causing a computer to perform the method as described in any one of the above.
As can be seen from the foregoing description, embodiments of the present disclosure provide a method, an apparatus, an electronic device, and a storage medium for intelligent contract change in a blockchain, where the method includes: in response to a change request for changing an intelligent contract, judging whether a user address sending the change request for changing the intelligent contract has the authority of changing the intelligent contract; in response to determining that the user address has the authority to change the intelligent contract, verifying the change request for changing the intelligent contract; and in response to determining that the change request for changing the intelligent contract passes the verification, changing the intelligent contract according to the change request for changing the intelligent contract. In the method, the intelligent contract can be changed by the address of the user with the authority, and certain safety is ensured while the intelligent contract is changed.
Drawings
In order to more clearly illustrate the technical solutions in the present disclosure or related technologies, the drawings needed to be used in the description of the embodiments or related technologies are briefly introduced below, and it is obvious that the drawings in the following description are only embodiments of the present disclosure, and for those skilled in the art, other drawings can be obtained according to these drawings without creative efforts.
Fig. 1 is a schematic diagram of an application scenario of an intelligent contract changing method in a blockchain according to an embodiment of the present disclosure;
fig. 2 is a schematic flowchart of an intelligent contract changing method in a blockchain according to an embodiment of the present disclosure;
fig. 3 is a schematic structural diagram of an intelligent contract changing apparatus in a blockchain according to an embodiment of the present disclosure;
fig. 4 is a schematic diagram of a structure of an electronic device according to an embodiment of the present disclosure.
Detailed Description
To make the objects, technical solutions, and advantages of the present disclosure more apparent, the principles and spirit of the present disclosure will be described below with reference to several exemplary embodiments. It is understood that these embodiments are presented merely to enable those skilled in the art to better understand and to practice the disclosure, and are not intended to limit the scope of the disclosure in any way. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
According to the embodiment of the disclosure, a method and a device for changing an intelligent contract in a block chain, an electronic device and a storage medium are provided.
In this document, it is to be understood that any number of elements in the figures are provided by way of illustration and not limitation, and any nomenclature is used for differentiation only and not in any limiting sense.
The principles and spirit of the present disclosure are explained in detail below with reference to several representative embodiments of the present disclosure.
In the related technology, based on the intelligent contract developed by evm in the solid language, because the contract code has an immutable property after being deployed to a block chain, the value of data in the contract can only be checked through function addition and deletion after being deployed, when the data structure of the contract needs to be changed, only a new contract can be re-deployed, and then the data in the old contract is migrated to the new contract. In this case, the contracts are deployed to contract accounts, and after the contracts are upgraded, the old contracts will be discarded while still being stored in the blockchain, wasting the memory resources of the blockchain,
in order to solve the complexity of data migration, various design modes with separated data and business logic are derived to solve the problem of upgrading the contract data structure, but the complexity of contract design is still increased; the self-contained delagetecall function in the solid language can only execute the code of the proxied contract and store the data of the proxied contract in the proxy contract, but when the new version data contract is upgraded, the mode requires that the data structure of the new version proxied contract and the data structure of the old version proxied contract are consistent, developers need to know the design of a memory to ensure the correctness of contract upgrading, the development difficulty is increased, and after the upgraded contract is deployed each time, expensive gas cost needs to be consumed, and the cost is increased.
In order to solve the above problem, the present disclosure provides a change scheme of an intelligent contract, specifically including: in response to a change request for changing an intelligent contract, judging whether a user address sending the change request for changing the intelligent contract has the authority of changing the intelligent contract; in response to determining that the user address has the authority to change the intelligent contract, verifying a change request for changing the intelligent contract; and in response to determining that the change request for changing the intelligent contract passes the verification, changing the intelligent contract according to the change request for changing the intelligent contract. In the method, the intelligent contract can be changed by the address of the user with the authority, and certain safety is ensured while the intelligent contract is changed.
Furthermore, in some embodiments, new intelligent contracts are overlaid on old intelligent contracts, and field levels can be added and deleted on the basis of the old intelligent contracts, so that the storage efficiency of the block chain is improved, the storage cost of the block chain is saved, various service requirements can be met, the complexity of contract upgrading is reduced, and the gas cost for deploying new contracts in contract upgrading is saved.
Having described the general principles of the present disclosure, various non-limiting embodiments of the present disclosure are described in detail below.
Referring to fig. 1, it is a schematic diagram of an application scenario of the method for intelligent contract change in a blockchain according to an embodiment of the present disclosure. The application scenario includes a terminal device 101 and a blockchain server 102. The terminal device 101 and the blockchain server 102 may be connected through a wired or wireless communication network. The terminal device 101 includes, but is not limited to, a desktop computer, a mobile phone, a mobile computer, a tablet computer, a media player, a smart wearable device, a Personal Digital Assistant (PDA), or other electronic devices capable of implementing the above functions. The blockchain server 102 may be an independent physical blockchain server, may also be a blockchain server cluster or a distributed system formed by a plurality of physical blockchain servers, and may also be a cloud blockchain server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDNs, and big data and artificial intelligence platforms.
The block chain server 102 is used for providing a change service of an intelligent contract for a user of the terminal device 101, a client end communicated with the block chain server 102 is installed in the terminal device 101, the user can input a change request for changing the intelligent contract through the client end, after a confirmation button is clicked, the client end sends the change request for changing the intelligent contract to the block chain server 102, and the block chain server 102 responds to the change request for changing the intelligent contract and judges whether a user address sending the change request for changing the intelligent contract has the permission for changing the intelligent contract or not; in response to determining that the user address has the authority to change the intelligent contract, verifying a change request for changing the intelligent contract; and in response to determining that the change request for changing the intelligent contract passes the verification, changing the intelligent contract according to the change request for changing the intelligent contract.
The intelligent contract changing method in a blockchain according to the exemplary embodiment of the present disclosure is described below with reference to an application scenario of fig. 1. It should be noted that the above application scenarios are only illustrated for the convenience of understanding the spirit and principles of the present disclosure, and the embodiments of the present disclosure are not limited in any way in this respect. Rather, embodiments of the present disclosure may be applied to any scenario where applicable.
Referring to fig. 2, it is a schematic flowchart of a method for intelligent contract change in a blockchain according to an embodiment of the present disclosure.
The intelligent contract changing method in the block chain comprises the following steps:
step S210, responding to the change request of the intelligent contract, and judging whether the user address sending the change request of the intelligent contract has the authority of changing the intelligent contract.
In some exemplary embodiments, the intelligent contracts are divided into modifiable intelligent contracts and non-modifiable intelligent contracts according to whether the intelligent contracts are modifiable, and when the intelligent contracts are deployed, whether the modifiable intelligent contracts or the non-modifiable intelligent contracts are deployed can be selected, wherein the selection of the modifiable intelligent contracts or the non-modifiable intelligent contracts can be realized through intelligent contract deployment parameters.
In some exemplary embodiments, when a modifiable intelligent contract is deployed, an Administrator (Administrator) of the intelligent contract, i.e., the address of the user having the right to modify the intelligent contract as described above, may be specified.
In some exemplary embodiments, the user address having the right to change the intelligent contract may be the user address in the blockchain of the intelligent contract deployment or the address of other intelligent contracts in the blockchain of the intelligent contract deployment.
In some exemplary embodiments, the address of the intelligent contract stores byte code and state data, the address of the user having the authority to change the intelligent contract is stored in the address of the intelligent contract in the form of variable, and optionally, the address of the user having the authority to change the intelligent contract in the form of variable is stored in the state data, namely, the state database.
In some exemplary embodiments, determining whether the address of the user sending the change request to change the intelligent contract has the authority to change the intelligent contract comprises:
in response to determining that the user address of the change request to change the intelligent contract is the same as the user address stored by the address of the intelligent contract that has the authority to change the intelligent contract, determining that the user address has the authority to change the intelligent contract.
In some exemplary embodiments, the present disclosure provides an intelligent contract interface that transfers rights to modify intelligent contracts, which may be invoked by initiating a transaction.
As an example, the intelligent contract interface that transfers the authority to change an intelligent contract may be transfercontrolowner (address connectiaddr, address newOwner), where connectiaddr represents the address of the intelligent contract to be changed and newOwner represents the address of the new administrator of the intelligent contract.
In some exemplary embodiments, the method further comprises:
in response to a change request for transferring the authority to change the intelligent contract, judging whether a first user address sending the change request for transferring the authority to change the intelligent contract has the authority to change the intelligent contract;
and in response to determining that the first user address has the authority to change the intelligent contract, transferring the authority to change the intelligent contract to a second user address corresponding to the change request for transferring the authority to change the intelligent contract, wherein the first user address loses the authority to change the intelligent contract.
When a user address serving as an administrator initiates a transaction to call an intelligent contract interface for transferring and changing the authority of an intelligent contract, judging whether the user address is the administrator of the intelligent contract, if not, the transaction fails, and if so, replacing the administrator of the intelligent contract with a new user address, wherein the original user address loses the identity of the administrator.
Step S220, in response to determining that the user address has the authority to change the intelligent contract, verifying the change request for changing the intelligent contract.
In some exemplary embodiments, the verifying the change request to change the intelligent contract in response to determining that the user address has the right to change the intelligent contract comprises:
and checking whether the variable sequence of the intelligent contract corresponding to the change request of the change intelligent contract is the same as the original variable sequence of the intelligent contract, and determining that the change request of the change intelligent contract passes the check in response to determining that the variable sequence of the intelligent contract corresponding to the change request of the change intelligent contract is the same as the original variable sequence of the intelligent contract.
In some exemplary embodiments, when the intelligent contract is compiled, addresses are allocated to variables in the intelligent contract according to positions of the variables, the addresses are converted into keys in a state database, and the value values corresponding to the keys in the state database are the value values of the variables in the intelligent contract. That is, the variables in the intelligent contract are not stored in the state database of the block chain according to the names of the variables, but each variable is assigned with an address as a key in the state database according to the position of the variable in the intelligent contract. Based on this, it is necessary to ensure that the order of variables in the intelligent contract after the change and the order of variables in the intelligent contract before the change remain unchanged.
And step S230, in response to the fact that the change request for changing the intelligent contract is verified, changing the intelligent contract according to the change request for changing the intelligent contract.
In some exemplary embodiments, the address of the smart contract stores bytecode;
the modifying the intelligent contract according to the modifying request of the modifying intelligent contract in response to the determination that the modifying request of the modifying intelligent contract passes the verification comprises the following steps:
and overwriting the original byte code of the intelligent contract with the byte code of the intelligent contract corresponding to the change request for changing the intelligent contract.
The variable sequence of the intelligent contract after being changed and the variable sequence of the intelligent contract before being changed are kept unchanged, and other service codes can be changed randomly.
In some exemplary embodiments, the modifying the intelligent contract according to the change request of the modified intelligent contract in response to determining that the change request of the modified intelligent contract passes the verification includes:
responding to the change request for changing the intelligent contract for adding a new variable, and adding the new variable corresponding to the change request for changing the intelligent contract after the original variable of the intelligent contract.
The newly added variables are added in the changed intelligent contract, the variable sequence of the intelligent contract before the change cannot be changed, the newly added variables are sequentially added after the variables of the intelligent contract before the change, and other service codes can be changed at will.
In some exemplary embodiments, the modifying the intelligent contract according to the change request of the modified intelligent contract in response to determining that the change request of the modified intelligent contract passes the verification includes:
and responding to the change request for changing the intelligent contract to delete the original variable, and enabling the value of the original variable of the intelligent contract to be zero.
And the variable sequence of the changed intelligent contract and the variable sequence of the intelligent contract before the change are kept unchanged, and the value of the original variable to be deleted is cleared or initialized.
In some exemplary embodiments, said modifying the intelligent contract in accordance with the change request to modify the intelligent contract in response to determining that the change request to modify the intelligent contract passed the check comprises:
and responding to the change request for changing the intelligent contract to modify the original variable, and modifying the original variable on the premise of ensuring that the variable sequence of the intelligent contract is not changed.
On the premise of ensuring that the variable sequence of the intelligent contract is not changed, the original variables can be modified according to the business requirements.
The values of the variables in the intelligent contract are stored according to the positions of the variables in the intelligent contract, so that when the modified intelligent contract is written, if the sequence of the variables in the intelligent contract is disturbed, the variables and the corresponding values will be disturbed, and the original storage content of the intelligent contract is damaged, so that the sequence of the variables in the modified intelligent contract and the sequence of the variables in the intelligent contract before modification need to be ensured to be unchanged.
As can be seen from the foregoing, an intelligent contract changing method in a blockchain provided by an embodiment of the present disclosure includes: in response to a change request for changing an intelligent contract, judging whether a user address sending the change request for changing the intelligent contract has the authority of changing the intelligent contract; in response to determining that the user address has the authority to change the intelligent contract, verifying the change request for changing the intelligent contract; and in response to determining that the change request for changing the intelligent contract passes the verification, changing the intelligent contract according to the change request for changing the intelligent contract. In the method, the intelligent contract can be changed by the address of the user with the authority, and certain safety is ensured while the intelligent contract is changed.
Furthermore, in the disclosure, the new intelligent contract is covered over the old intelligent contract, and the field level can be added and deleted on the basis of the old intelligent contract, so that the storage efficiency of the block chain is improved, the storage cost of the block chain is saved, meanwhile, various service requirements can be met, the complexity of contract upgrading is reduced, and the gas cost for deploying the new contract during contract upgrading is also saved.
It should be noted that the method of the embodiment of the present disclosure may be executed by a single device, such as a computer or a server. The method of the embodiment can also be applied to a distributed scene and completed by the mutual cooperation of a plurality of devices. In such a distributed scenario, one of the devices may only perform one or more steps of the method of the embodiments of the present disclosure, and the devices may interact with each other to complete the method.
It should be noted that the above describes some embodiments of the disclosure. Other embodiments are within the scope of the following claims. In some cases, the actions or steps recited in the claims may be performed in a different order than in the embodiments described above and still achieve desirable results. In addition, the processes depicted in the accompanying figures do not necessarily require the particular order shown, or sequential order, to achieve desirable results. In some embodiments, multitasking and parallel processing may also be possible or may be advantageous.
Based on the same inventive concept, corresponding to the method of any embodiment, the disclosure also provides an intelligent contract changing device in the block chain.
Referring to fig. 3, the intelligent contract changing apparatus in a blockchain includes:
a change authority judgment module 310 configured to, in response to a change request for changing an intelligent contract, judge whether a user address sending the change request for changing the intelligent contract has authority to change the intelligent contract;
a change request validation module 320 configured to verify a change request to change the intelligent contract in response to determining that the user address has the right to change the intelligent contract;
an intelligent contract modification module 330 configured to modify the intelligent contract in accordance with the change request to modify the intelligent contract in response to determining that the change request to modify the intelligent contract is verified.
In some exemplary embodiments, the intelligent contract altering apparatus in the blockchain is further configured to:
in response to the change request for transferring the authority to change the intelligent contract, judging whether a first user address sending the change request for transferring the authority to change the intelligent contract has the authority to change the intelligent contract;
in response to determining that the first user address has the authority to change the intelligent contract, transferring the authority to change the intelligent contract to a second user address corresponding to the change request for transferring the authority to change the intelligent contract, wherein the first user address loses the authority to change the intelligent contract.
In some exemplary embodiments, the address of the intelligent contract stores the address of the user with the right to change the intelligent contract; the modification permission determining module 310 is specifically configured to:
in response to determining that the user address of the change request to change the intelligent contract is the same as the user address stored by the address of the intelligent contract that has the authority to change the intelligent contract, determining that the user address has the authority to change the intelligent contract.
In some exemplary embodiments, the address of the user having the right to change the intelligent contract is stored in the address of the intelligent contract in the form of a variable.
In some exemplary embodiments, the change request validation module 320 is specifically configured to:
and checking whether the variable sequence of the intelligent contract corresponding to the change request of the change intelligent contract is the same as the original variable sequence of the intelligent contract, and determining that the change request of the change intelligent contract passes the check in response to determining that the variable sequence of the intelligent contract corresponding to the change request of the change intelligent contract is the same as the original variable sequence of the intelligent contract.
In some exemplary embodiments, the address of the intelligent contract stores bytecode; the intelligent contract altering module 330 is specifically configured to:
and overwriting the original byte code of the intelligent contract with the byte code of the intelligent contract corresponding to the change request for changing the intelligent contract.
In some exemplary embodiments, the intelligent contract altering module 330 is specifically configured to:
responding to the change request for changing the intelligent contract for adding a new variable, and adding the new variable corresponding to the change request for changing the intelligent contract after the original variable of the intelligent contract.
In some exemplary embodiments, intelligent contract altering module 330 is specifically configured to:
and responding to the change request of the intelligent contract for changing the original variable, and enabling the value of the original variable of the intelligent contract to be zero.
In some exemplary embodiments, intelligent contract altering module 330 is specifically configured to:
and responding to the change request for changing the intelligent contract to modify the original variable, and modifying the original variable on the premise of ensuring that the variable sequence of the intelligent contract is not changed.
For convenience of description, the above devices are described as being divided into various modules by functions, and are described separately. Of course, the functionality of the various modules may be implemented in the same one or more pieces of software and/or hardware in practicing the present disclosure.
The apparatus in the foregoing embodiment is used to implement the method for changing an intelligent contract in a block chain in any of the foregoing embodiments, and has the beneficial effects of the corresponding method embodiment, which are not described herein again.
Based on the same inventive concept, corresponding to the method of any embodiment described above, the present disclosure further provides an electronic device, which includes a memory, a processor, and a computer program stored on the memory and capable of running on the processor, and when the processor executes the program, the method for intelligently changing contracts in a block chain according to any embodiment described above is implemented.
Fig. 4 is a schematic diagram illustrating a more specific hardware structure of an electronic device according to this embodiment, where the electronic device may include: a processor 1010, a memory 1020, an input/output interface 1030, a communication interface 1040, and a bus 1050. Wherein the processor 1010, memory 1020, input/output interface 1030, and communication interface 1040 are communicatively coupled to each other within the device via a bus 1050.
The processor 1010 may be implemented by a general-purpose CPU (Central Processing Unit), a microprocessor, an Application Specific Integrated Circuit (ASIC), or one or more Integrated circuits, and is configured to execute related programs to implement the technical solutions provided in the embodiments of the present disclosure.
The Memory 1020 may be implemented in the form of a ROM (Read Only Memory), a RAM (Random Access Memory), a static Memory device, a dynamic Memory device, or the like. The memory 1020 may store an operating system and other application programs, and when the technical solution provided by the embodiments of the present specification is implemented by software or firmware, the relevant program codes are stored in the memory 1020 and called to be executed by the processor 1010.
The input/output interface 1030 is used for connecting an input/output module to input and output information. The input/output module may be configured as a component in a device (not shown) or may be external to the device to provide a corresponding function. Wherein the input devices may include a keyboard, mouse, touch screen, microphone, various sensors, etc., and the output devices may include a display, speaker, vibrator, indicator light, etc.
The communication interface 1040 is used for connecting a communication module (not shown in the drawings) to implement communication interaction between the present apparatus and other apparatuses. The communication module can realize communication in a wired mode (such as USB, network cable and the like) and also can realize communication in a wireless mode (such as mobile network, WIFI, bluetooth and the like).
Bus 1050 includes a path that transfers information between various components of the device, such as processor 1010, memory 1020, input/output interface 1030, and communication interface 1040.
It should be noted that although the above-mentioned device only shows the processor 1010, the memory 1020, the input/output interface 1030, the communication interface 1040 and the bus 1050, in a specific implementation, the device may also include other components necessary for normal operation. In addition, those skilled in the art will appreciate that the above-described apparatus may also include only the components necessary to implement the embodiments of the present disclosure, and need not include all of the components shown in the figures.
The electronic device of the foregoing embodiment is used to implement the method for changing an intelligent contract in a block chain in any of the foregoing embodiments, and has the beneficial effects of the corresponding method embodiment, which are not described herein again.
Based on the same inventive concept, corresponding to any of the above-mentioned embodiment methods, the present disclosure also provides a non-transitory computer-readable storage medium storing computer instructions for causing the computer to execute the method for intelligent contract change in a block chain according to any of the above-mentioned embodiments.
The non-transitory computer readable storage medium may be any available medium or data storage device that can be accessed by a computer, including but not limited to magnetic memory (e.g., floppy disks, hard disks, magnetic tape, magneto-optical disks (MOs), etc.), optical memory (e.g., CDs, DVDs, BDs, HVDs, etc.), and semiconductor memory (e.g., ROMs, EPROMs, EEPROMs, non-volatile memories (NAND FLASH), solid State Disks (SSDs)), etc.
The computer instructions stored in the storage medium of the foregoing embodiment are used to cause the computer to execute the method for changing an intelligent contract in a block chain according to any embodiment of the foregoing exemplary method, and have the beneficial effects of corresponding method embodiments, which are not described herein again.
As will be appreciated by one skilled in the art, embodiments of the present disclosure may be embodied as a system, method or computer program product. Accordingly, the present disclosure may be embodied in the form of: entirely hardware, entirely software (including firmware, resident software, micro-code, etc.) or a combination of hardware and software, and is referred to herein generally as a "circuit," module "or" system. Furthermore, in some embodiments, the present disclosure may also be embodied in the form of a computer program product in one or more computer-readable media having computer-readable program code embodied therein.
Any combination of one or more computer-readable media may be employed. The computer readable medium may be a computer readable signal medium or a computer readable storage medium. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples (a non-exhaustive example) of the computer readable storage medium may include, for example: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this document, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
A computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device.
Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
Computer program code for carrying out operations for aspects of the present disclosure may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, smalltalk, C + +, and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the latter scenario, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
It will be understood that each block of the flowchart illustrations and/or block diagrams, and combinations of blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions/acts specified in the flowchart and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer readable medium that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer readable medium produce an article of manufacture including instruction means which implement the function/act specified in the flowchart and/or block diagram block or blocks.
The computer program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other devices to cause a series of operational steps to be performed on the computer, other programmable apparatus or other devices to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide processes for implementing the functions/acts specified in the flowchart and/or block diagram block or blocks.
Further, while the operations of the disclosed methods are depicted in the drawings in a particular order, this does not require or imply that the operations must be performed in this particular order, or that all of the illustrated operations must be performed, to achieve desirable results. Rather, the steps depicted in the flowcharts may change the order of execution. Additionally or alternatively, certain steps may be omitted, multiple steps combined into one step execution, and/or one step broken down into multiple step executions.
It is to be noted that technical terms or scientific terms used in the embodiments of the present disclosure should have a general meaning as understood by those having ordinary skill in the art to which the present disclosure belongs, unless otherwise defined. The use of "first," "second," and similar terms in the embodiments of the disclosure is not intended to indicate any order, quantity, or importance, but rather to distinguish one element from another. The word "comprising" or "comprises", and the like, means that the element or item preceding the word comprises the element or item listed after the word and its equivalent, but does not exclude other elements or items. The terms "connected" or "coupled" and the like are not restricted to physical or mechanical connections, but may include electrical connections, whether direct or indirect. "upper", "lower", "left", "right", and the like are used only to indicate relative positional relationships, and when the absolute position of the object being described is changed, the relative positional relationships may also be changed accordingly.
While the spirit and principles of the present disclosure have been described with reference to several particular embodiments, it is to be understood that the present disclosure is not limited to the particular embodiments disclosed, nor is the division of aspects which is intended to be construed to be merely illustrative of the fact that features of the aspects may be combined to advantage. The disclosure is intended to cover various modifications and equivalent arrangements included within the spirit and scope of the appended claims. The scope of the following claims is to be accorded the broadest interpretation so as to encompass all such modifications and equivalent structures and functions.

Claims (12)

1. An intelligent contract changing method in a block chain is characterized by comprising the following steps:
in response to a change request for changing an intelligent contract, judging whether a user address sending the change request for changing the intelligent contract has the authority of changing the intelligent contract;
in response to determining that the user address has the authority to change the intelligent contract, verifying a change request for changing the intelligent contract;
and in response to determining that the change request for changing the intelligent contract passes the verification, changing the intelligent contract according to the change request for changing the intelligent contract.
2. The method of claim 1, further comprising:
in response to the change request for transferring the authority to change the intelligent contract, judging whether a first user address sending the change request for transferring the authority to change the intelligent contract has the authority to change the intelligent contract;
in response to determining that the first user address has the authority to change the intelligent contract, transferring the authority to change the intelligent contract to a second user address corresponding to the change request for transferring the authority to change the intelligent contract, wherein the first user address loses the authority to change the intelligent contract.
3. The method according to claim 1, characterized in that the address of the intelligent contract stores the address of the user with the right to change the intelligent contract;
the judging whether the address of the user sending the change request for changing the intelligent contract has the authority for changing the intelligent contract comprises the following steps:
in response to determining that the user address of the change request to change the intelligent contract is the same as the user address stored by the address of the intelligent contract that has the authority to change the intelligent contract, determining that the user address has the authority to change the intelligent contract.
4. A method according to claim 3, characterized in that the address of the user having the right to change the intelligent contract is stored in the address of the intelligent contract in the form of a variable.
5. The method of claim 1, wherein verifying the change request to change the intelligent contract in response to determining that the user address has the right to change the intelligent contract comprises:
the method comprises the steps of checking whether the variable sequence of the intelligent contract corresponding to the change request for changing the intelligent contract is the same as the original variable sequence of the intelligent contract or not, and in response to the fact that the variable sequence of the intelligent contract corresponding to the change request for changing the intelligent contract is the same as the original variable sequence of the intelligent contract, determining that the change request for changing the intelligent contract passes the checking.
6. The method of claim 1, wherein the address of the intelligent contract stores bytecode;
the modifying the intelligent contract according to the modifying request of the modifying intelligent contract in response to the determination that the modifying request of the modifying intelligent contract passes the verification comprises the following steps:
and overwriting the original byte code of the intelligent contract with the byte code of the intelligent contract corresponding to the change request for changing the intelligent contract.
7. The method of claim 1, wherein modifying the intelligent contract in accordance with the change request to modify the intelligent contract in response to determining that the change request to modify the intelligent contract is verified comprises:
responding to the change request for changing the intelligent contract for adding a new variable, and adding the new variable corresponding to the change request for changing the intelligent contract after the original variable of the intelligent contract.
8. The method of claim 1, wherein modifying the intelligent contract in accordance with the change request to modify the intelligent contract in response to determining that the change request to modify the intelligent contract is verified comprises:
and responding to the change request for changing the intelligent contract to delete the original variable, and enabling the value of the original variable of the intelligent contract to be zero.
9. The method of claim 1, wherein modifying the intelligent contract in accordance with the change request to modify the intelligent contract in response to determining that the change request to modify the intelligent contract is verified comprises:
and responding to the change request for changing the intelligent contract for modifying the original variables, and modifying the original variables on the premise of ensuring that the variable sequence of the intelligent contract is not changed.
10. An apparatus for intelligent contract modification in a blockchain, comprising:
the intelligent contract modification method comprises the following steps of determining whether a user address sending a change request for changing an intelligent contract has the authority of changing the intelligent contract or not in response to the change request for changing the intelligent contract;
a change request validation module configured to verify a change request to change the intelligent contract in response to determining that the user address has the right to change the intelligent contract;
an intelligent contract modification module configured to modify the intelligent contract in accordance with the change request to modify the intelligent contract in response to determining that the change request to modify the intelligent contract passes verification.
11. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the method of any one of claims 1 to 9 when executing the program.
12. A non-transitory computer readable storage medium storing computer instructions for causing a computer to perform the method of any one of claims 1 to 9.
CN202211401350.XA 2022-11-09 2022-11-09 Intelligent contract changing method and device in block chain, electronic equipment and storage medium Pending CN115760391A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211401350.XA CN115760391A (en) 2022-11-09 2022-11-09 Intelligent contract changing method and device in block chain, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211401350.XA CN115760391A (en) 2022-11-09 2022-11-09 Intelligent contract changing method and device in block chain, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN115760391A true CN115760391A (en) 2023-03-07

Family

ID=85369872

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211401350.XA Pending CN115760391A (en) 2022-11-09 2022-11-09 Intelligent contract changing method and device in block chain, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN115760391A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117155536A (en) * 2023-09-01 2023-12-01 佛山市康颐福城市服务科技有限公司 Transaction management method, device, equipment and readable storage medium of intelligent contract

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117155536A (en) * 2023-09-01 2023-12-01 佛山市康颐福城市服务科技有限公司 Transaction management method, device, equipment and readable storage medium of intelligent contract

Similar Documents

Publication Publication Date Title
CN107506221B (en) Application program upgrading method, device and equipment
US8739147B2 (en) Class isolation to minimize memory usage in a device
CN105786538B (en) software upgrading method and device based on android system
CN110806868B (en) Single-page building and loading method
CN106406961A (en) Method and device for loading and providing application based on browser
JP2017146966A (en) Method and system for extending function to package file
US11995453B2 (en) Method and apparatus for generating image file and computer-readable storage medium
CN114077423A (en) Airport APP development container architecture based on mobile cross-platform
US9513762B1 (en) Static content updates
CN113986402A (en) Function calling method and device, electronic equipment and storage medium
CN112667246A (en) Application function extension method and device and electronic equipment
CN115760391A (en) Intelligent contract changing method and device in block chain, electronic equipment and storage medium
CN115113972A (en) Application transformation method, system, cluster, medium and program product
CN113031957A (en) Application program installation method, client, terminal, server and storage medium
CN106778270B (en) Malicious application detection method and system
CN116107623A (en) Software development method and device and electronic equipment
KR101684454B1 (en) Hybrid application and event handling method thereof
CN114547604A (en) Application detection method and device, storage medium and electronic equipment
CN113986744A (en) Method and device for testing warehouse and table components and storage medium
CN113282363A (en) Method and device for optimizing hybrid APP
CN116149639A (en) Method and device for developing components, electronic equipment and storage medium
CN111309322A (en) Rule-based response type intelligent application development system
CN112068814A (en) Method, device, system and medium for generating executable file
CN111506301B (en) Method for bypassing system restriction reflection call and related equipment
CN117093286B (en) Plug-in generation method, device, equipment and computer readable storage medium

Legal Events

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