WO2021229304A1 - 智能合约的更新 - Google Patents

智能合约的更新 Download PDF

Info

Publication number
WO2021229304A1
WO2021229304A1 PCT/IB2021/000354 IB2021000354W WO2021229304A1 WO 2021229304 A1 WO2021229304 A1 WO 2021229304A1 IB 2021000354 W IB2021000354 W IB 2021000354W WO 2021229304 A1 WO2021229304 A1 WO 2021229304A1
Authority
WO
WIPO (PCT)
Prior art keywords
transaction
node
blockchain system
smart contract
update
Prior art date
Application number
PCT/IB2021/000354
Other languages
English (en)
French (fr)
Inventor
从德鹏
Original Assignee
支付宝实验室(新加坡)有限公司
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 支付宝实验室(新加坡)有限公司 filed Critical 支付宝实验室(新加坡)有限公司
Publication of WO2021229304A1 publication Critical patent/WO2021229304A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/23Updating
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/65Updates
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q40/00Finance; Insurance; Tax strategies; Processing of corporate or income taxes
    • G06Q40/04Trading; Exchange, e.g. stocks, commodities, derivatives or currency exchange

Definitions

  • the embodiments of this specification relate to the field of information technology, and in particular to a method, system, device, and equipment for updating smart contracts.
  • Blockchain application scenarios are becoming more and more abundant, and more and more scenarios need to write smart contracts to complete business logic. With the continuous development of business scenarios, smart contracts need to be released and updated frequently. At present, contract updates generally use the traditional release model directly. After the new contract is released, the blockchain nodes use the new smart contract code.
  • the release time of each node may be different.
  • a transaction may be the result of two different smart contracts, the new or the old, at different nodes, and the results may be inconsistent. It is easy to Cause the blockchain to fork or the consensus result fails.
  • the embodiment of this specification provides a synchronized smart contract update solution.
  • the purpose of the embodiments of the present application is to provide a more synchronized smart contract update solution in the blockchain system.
  • the embodiment of the present specification provides a method for updating a smart contract, which is applied to a blockchain system including multiple nodes, and the method includes: a first node obtains a new smart contract that includes a desired update condition; The first node generates a transaction that includes the new smart contract, and broadcasts the transaction to the blockchain system, so that the blockchain system agrees on the transaction, and writes the transaction to the blockchain after the consensus is passed.
  • the block chain system the second node in the block chain system obtains from the block chain system the new smart contract containing the desired update conditions in the transaction, and feeds back its own preparation state to the first Node; the first node counts the readiness feedback of each second node, generates a statistical result, when the statistical result meets a preset condition, generates a transaction containing an update instruction, and broadcasts the transaction to the block In the chain system, in order to make a consensus on the transaction in the block chain system, and write it into the block chain system after the consensus is passed; any node in the block chain system, from the block chain system Obtain the transaction containing the update instruction, and deploy the new smart contract according to the update instruction when the desired update condition is reached.
  • the embodiment of this specification also provides a method for updating a smart contract, which is applied to the first node of a blockchain system, and the method includes: obtaining a new smart contract containing the desired update condition; generating a new smart contract containing the new Smart contract transactions, and broadcast the transaction to the blockchain system, so that the blockchain system can reach a consensus on the transaction, and write it into the blockchain system after the consensus is passed; obtain each The prepared state fed back by the two nodes generates statistical results, and when the statistical results meet the preset conditions, generates a transaction containing an update instruction; broadcasts the transaction to the blockchain system so that the blockchain system Any node of obtains the transaction containing the update instruction from the blockchain system, and deploys the new smart contract when the desired update condition is reached.
  • the embodiments of the present specification also provide a method for updating a smart contract, which is applied to a second node of a blockchain system, and the method includes: obtaining from the blockchain system the desired update contained in the transaction Conditional new smart contract, wherein the transaction is a transaction generated by the first node that includes the new smart contract; feeds back its own readiness status to the first node; obtains the transaction content from the blockchain system Update instruction; when the desired update condition is reached, deploy the new smart contract according to the update instruction.
  • the embodiment of this specification also provides a smart contract update system, which is applied to a blockchain system containing multiple nodes, in which the first node obtains a new smart contract that contains the desired update condition.
  • Contract the first node generates a transaction that includes the new smart contract, and broadcasts the transaction to the blockchain system so that the blockchain system can reach a consensus on the transaction, and after the consensus is passed
  • the second node in the blockchain system obtains the new smart contract in the transaction that contains the desired update conditions from the blockchain system, and feeds back its own ready status to all
  • the first node the first node counts the preparation status fed back by each second node, generates a statistical result, and when the statistical result meets a preset condition, generates a transaction containing an update instruction, and broadcasts the transaction to the In the block chain system, in order to make a consensus on the transaction in the block chain system, and write it into the block chain system after the consensus is passed; any node in the block chain system, from the block chain system
  • the embodiment of this specification also provides a smart contract update device, which is applied to the first node of the blockchain, and the device includes: an acquisition module to acquire a new smart contract that includes desired update conditions; The generation module generates a transaction including the new smart contract, and broadcasts the transaction to the blockchain system, so that the blockchain system can reach a consensus on the transaction, and write the transaction after the consensus is passed.
  • Blockchain system the acquisition module is also used to acquire the feedback readiness status of each second node, generate statistical results, and when the statistical results meet preset conditions, generate a transaction containing an update instruction; a broadcast module, Broadcast the transaction to the blockchain system so that any node in the blockchain system obtains the transaction containing the update instruction from the blockchain system, and when the desired update condition is reached, Deploy the new smart contract.
  • the embodiment of this specification also provides a smart contract update device, which is applied to the second node of the blockchain system, and the device includes: an acquisition module, which acquires from the blockchain system A new smart contract in the transaction that contains the desired update condition, where the transaction is a transaction that contains the new smart contract generated by the first node; a feedback module, which feeds back its own readiness status to the first node; the acquisition The module is also used to obtain the update instructions included in the transaction from the blockchain system; the update module, when the expected update condition is reached, deploy the new smart contract according to the update instruction.
  • the smart contract in the blockchain system needs to be updated, the expected update conditions are agreed between each node, and each node determines its own preparation state before the update, thereby ensuring the new intelligence
  • the synchronous update of the contract on each node ensures the success rate and consistency of the smart contract update.
  • the new smart contract can take effect on each node in the blockchain network at the same time, avoiding the fork of the ledger due to different smart contracts. .
  • any one of the embodiments of the present specification does not need to achieve all the above-mentioned effects.
  • FIG. 1 is a schematic diagram of a system architecture provided by an embodiment of the specification
  • FIG. 2 is a schematic flowchart of a method for updating a smart contract provided by an embodiment of the specification
  • FIG. 3 is a schematic flowchart of another method for updating a smart contract provided by an embodiment of the specification
  • FIG. 4 is a schematic flowchart of yet another method for updating a smart contract provided by an embodiment of the specification
  • FIG. 5 is a schematic structural diagram of a smart contract updating device provided by an embodiment of this specification.
  • Figure 6 is a smart contract updating device provided by an embodiment of this specification.
  • Fig. 7 is a schematic structural diagram of a device for configuring the method of the embodiment of this specification.
  • the update of the smart contract refers to the update of the smart contract in all nodes in the blockchain, so that after the update, all nodes use the new smart contract (the one before the update can be called Old smart contract) to execute business logic.
  • the code of the new smart contract should be written into the ledger of the blockchain, and the node should be instructed to use the code of the new smart contract when executing business logic in the future.
  • the traditional update method is to use the release method, and other nodes obtain the released new smart contract and update and deploy by themselves.
  • the release time of each node is different.
  • a transaction may be the result of two different smart contracts executed at different nodes, and the results may be inconsistent; or, some nodes
  • the above may be due to the incompatibility of the system or hardware with the code of the smart contract, causing the update to fail, which may also cause the same transaction to be the result of the execution of two different smart contracts, new or old.
  • Different consensus results may easily lead to blockchain forks or consensus results failure.
  • FIG. 1 is a schematic diagram of a system architecture provided by the embodiment of the specification.
  • the blockchain system in this schematic diagram can be in various forms such as alliance chains, public chains, or private chains.
  • FIG. 1 A schematic diagram of the process of updating a smart contract method, including:
  • S201 The first node obtains a new smart contract that includes desired update conditions.
  • the first node can be any node. It can also be a number of designated nodes selected in advance. For example, in a consortium chain formed by multiple institutions, the first node can be the node corresponding to any one of the institutions, or it can be a pre-designated node that specifically coordinates the nodes of each institution.
  • the new smart contract is relative to the old smart contract currently in use. Obviously, with the continuous upgrade and iteration of smart contracts, once a new smart contract is successfully deployed, it becomes an old smart contract and may be replaced by other new smart contracts in the future.
  • the new smart contract obtained by the first node should contain expected update conditions, and the expected update conditions are used to indicate under what circumstances each node should deploy the new smart contract (that is, update the smart contract).
  • the expected update condition can be a specific expected update time point, for example, at 12: 00: 00 seconds on xx, xx, 2020, which is used to instruct any node to deploy a new smart contract at that point in time; or, the expected update
  • the condition can also be a specific block height value (ie update block height) in the blockchain system, for example, a block height of 5000, which is used to instruct a node to deploy a new smart contract when the number of blocks in the blockchain reaches 5000 .
  • the obtained new smart contract may also include multi-party signatures.
  • multi-party signatures For example, in the consortium chain, multiple institutions obtain and deploy a new smart contract through mutual negotiation. At this time, each of the multiple institutions is required to digitally sign the new smart contract, so that the first node can The digital signature is verified to confirm the legitimacy. If the verification is passed, it can be confirmed that the smart contract has been approved by the aforementioned multiple institutions. Otherwise, if the verification fails, the subsequent update process is terminated.
  • S203 The first node generates a transaction including the new smart contract, and broadcasts the transaction to the blockchain system, so that the blockchain system can reach a consensus on the transaction, and after the consensus is passed Write to the blockchain system.
  • the first node can also use its own private key to sign the generated transaction, so that any other node can also use the public key of the first node to verify the signature, thereby ensuring the integrity of the transaction. Consensus and storage of transactions are already very common now, so I won't repeat them here.
  • the second node in the blockchain system obtains the new smart contract in the transaction that includes the desired update condition from the blockchain system, and feeds back its own preparation state to the first node.
  • the second node in the blockchain can be any other node except the first node.
  • other nodes ie, the second node
  • first node and the second node there is essentially no difference between the first node and the second node, and they are only named for the convenience of distinction in an update process.
  • first node in an update process can be the second node in other update processes, and any second node in other update processes can also be used as the first node to generate the new intelligence. Contract transactions and broadcast.
  • any second node can first determine whether the local system (including software and hardware) is compatible with the new smart contract, and when the desired update condition is a specific point in time, the second node can also It can be judged whether the local node can update the smart contract in time at this point in time.
  • each second node can determine its own state of preparation for the new smart contract that contains the desired update conditions, that is, "can be updated” or "cannot be updated", and can also feed back the state of preparation to the first node .
  • feature values can be used to characterize the preparation status, for example, “1” means “can be updated”, “0” means “cannot be updated” and so on.
  • the second node before feeding back the ready state, can also verify the legality of the smart contract, for example, verify whether the number of signatures contained in the new smart contract meets preset conditions, and verify the new smart contract. Does the signature contained in the contract include the signature of the preset designated authority, and whether the signature contained in the new smart contract can be decrypted, and so on. If the verification fails, it can be determined that the preparation status is "Unable to update". Obviously, the first node that initiates the contract update should be defaulted to its ready state of "can be updated".
  • the second node feed back the ready state to the first node.
  • the first node is a pre-designated coordinating node
  • other nodes may have the communication mode of the coordinating node, so that it can directly send information containing its own preparation status to the first node.
  • a node for another example, in some public chain scenarios, each node that receives a new smart contract can generate a transaction containing its own readiness state, and broadcast the transaction to the blockchain system, So that the first node obtains its own preparation state included in the transaction from the blockchain system.
  • the first node counts the readiness feedback from each second node, generates a statistical result, and when the statistical result meets a preset condition, generates a transaction including an update instruction, and broadcasts the transaction to the block In the chain system, in order to make a consensus on the transaction in the block chain system, and write it into the block chain system after the consensus is passed.
  • the first node After the first node obtains the preparation status fed back by each second node, it can perform statistics on the results to obtain statistical results. When the statistical result meets the preset condition, a transaction containing an update instruction is generated.
  • the preset condition may be that the preparation status of each second node is required to be "updateable”.
  • the subsequent process will not continue, that is, the transaction containing the update instruction will no longer be broadcast to the blockchain system.
  • the synchronization update this time is suspended, and the first node can again initiate a new smart contract that includes another desired update condition, so as to re-coordinate between the nodes.
  • the first node If the statistical result meets the preset condition, the first node generates a transaction including an update instruction, and broadcasts the transaction to the blockchain system.
  • the update instruction is used to instruct each second node to deploy the new smart contract.
  • the update instruction is essentially a piece of executable code, and its function is to execute the executable code when the expected update condition is met. The effect of execution is that the new smart contract is updated to the node, that is, the final The new smart contract is deployed to the blockchain system through update instructions.
  • any node in the blockchain system obtains the transaction containing the update instruction from the blockchain system, and when the desired update condition is reached, deploys the new smart contract according to the update instruction .
  • Any node at this time includes the first node and also includes the second node. Any node can obtain the transaction containing the update instruction that has been passed by consensus from the blockchain system, so that the update instruction can be obtained. As mentioned above, when the expected update condition in the new smart contract is met, every A node deploys the new smart contract according to the update instruction.
  • any node can also determine the deployment result of deploying the new smart contract, that is, whether the deployment result is successful, thereby generating a transaction containing the deployment result, and broadcasting the transaction to the blockchain In the system. Therefore, after the transaction is approved by consensus and stored, any other node can obtain the deployment result included in the transaction, and perform statistics on the deployment results of all other nodes.
  • the alliance chain is usually composed of a limited number of institutional nodes, usually each node is a full node (that is, a full amount of transactions are stored), and each node also has a consensus function, then Each node in the consortium chain often needs higher consistency in the consensus of the transaction, that is, the consensus result of all nodes may be required to be consistent before the transaction consensus can be considered to be stored.
  • the embodiment of the present specification also provides a method for updating the smart contract, as shown in FIG. 3, which is The flow diagram of another smart contract update method provided by the embodiment of this specification is applied to the first node of the blockchain system.
  • the first node can be a district.
  • An ordinary node in the block chain system may also be a pre-designated coordination node that specifically coordinates the relationship between the nodes.
  • the method includes:
  • S303 Generate a transaction including the new smart contract, and broadcast the transaction to the blockchain system, so that the blockchain system can reach a consensus on the transaction, and write it into the area after the consensus is passed.
  • Block chain system
  • S305 Obtain the feedback preparation status of each second node, generate a statistical result, and when the statistical result meets a preset condition, generate a transaction including an update instruction;
  • the embodiment of this specification also provides a method for updating a smart contract, which is applied to the second node of the blockchain system, as shown in FIG. 4, which is another one provided by the embodiment of the specification.
  • the second node can be any node in the blockchain system, and the method includes:
  • S401 Obtain a new smart contract that includes a desired update condition in a transaction from the blockchain system, where the transaction is a transaction that includes the new smart contract and is generated by a first node;
  • S403 Feed back its own readiness state to the first node; specifically, it may directly feed back to the first node, or generate a transaction including the readiness state, and indirectly feedback to the first node through the transaction on the chain.
  • the smart contract in the blockchain system needs to be updated, the expected update conditions are agreed between each node, and each node determines its own preparation state before the update, thereby ensuring the new intelligence
  • the synchronous update of the contract on each node ensures the success rate and consistency of the smart contract update.
  • the new smart contract can take effect on each node in the blockchain network at the same time, avoiding the fork of the ledger due to different smart contracts. .
  • the embodiment of the present specification also provides a smart contract update system, which is applied to a blockchain system containing multiple nodes, in the system,
  • the first node obtains a new smart contract that contains the desired update conditions
  • the first node generates a transaction including the new smart contract, and broadcasts the transaction to the blockchain system, so that the blockchain system can reach a consensus on the transaction, and write it after the consensus is passed
  • the blockchain system
  • the second node in the blockchain system obtains the new smart contract in the transaction that contains the desired update conditions from the blockchain system, and feeds back its own preparation status to the first node;
  • the first node counts the preparation status fed back by each second node, generates a statistical result, and when the statistical result meets a preset condition, generates a transaction including an update instruction, and broadcasts the transaction to the blockchain system In order to reach a consensus on the transaction in the blockchain system, and write it into the blockchain system after the consensus is passed;
  • Any node in the blockchain system obtains the transaction containing the update instruction from the blockchain system, and when the desired update condition is reached, deploys the new smart contract according to the update instruction.
  • this specification also provides an update device for a smart contract in an embodiment, which is applied to the first node of the blockchain, as shown in FIG. 5, which is a type provided by the embodiment of this specification.
  • a schematic diagram of the structure of a smart contract updating device, the device includes:
  • the obtaining module 501 obtains a new smart contract containing the desired update conditions
  • the generation module 503 generates a transaction including the new smart contract, and broadcasts the transaction to the blockchain system, so that the blockchain system can reach a consensus on the transaction, and write it into the transaction after the consensus is passed.
  • the blockchain system ;
  • the obtaining module 501 is further configured to obtain the feedback preparation status of each second node, generate a statistical result, and when the statistical result meets a preset condition, generate a transaction including an update instruction;
  • the broadcast module 505 broadcasts the transaction to the blockchain system, so that any node in the blockchain system can obtain the transaction containing the update instruction from the blockchain system, and update it when it is desired When the conditions are reached, the new smart contract is deployed.
  • this specification is an embodiment also provides a smart contract updating device, as shown in FIG. 6, which is a smart contract updating device provided by this embodiment of the specification, which is applied to the blockchain
  • the device includes:
  • An obtaining module 601 which obtains a new smart contract that includes a desired update condition in a transaction from the blockchain system, where the transaction is a transaction generated by the first node and includes the new smart contract;
  • the obtaining module 601 is further configured to obtain update instructions included in the transaction from the blockchain system;
  • the update module 605 is configured to deploy the new smart contract according to the update instruction when the expected update condition is reached.
  • the embodiments of this specification also provide a computer device, which includes at least a memory, a processor, and a computer program stored in the memory and running on the processor, wherein the processor implements the intelligence shown in FIG. 3 when the program is executed.
  • the method of contract renewal includes at least a memory, a processor, and a computer program stored in the memory and running on the processor, wherein the processor implements the intelligence shown in FIG. 3 when the program is executed. The method of contract renewal.
  • the embodiments of this specification also provide a computer device, which at least includes a memory, a processor, and a computer program stored in the memory and running on the processor, wherein the processor implements the intelligence shown in FIG. 4 when the program is executed.
  • the method of contract renewal is also provided.
  • FIG. 7 shows a more specific hardware structure diagram of a computing device provided by an embodiment of this specification.
  • the device may include a processor 1010, a memory 1020, an input/output interface 1030, a communication interface 1040, and a bus 1050.
  • the processor 1010, the memory 1020, the input/output interface 1030, and the communication interface 1040 realize the communication connection between each other in the device through the bus 1050.
  • the processor 1010 may be implemented by a general CPU (Central Processing Unit, central processing unit), microprocessor, application specific integrated circuit (Application Specific Integrated Circuit, ASIC), or one or more integrated circuits, etc., for execution related Program to implement the technical solutions provided in the embodiments of this specification.
  • CPU Central Processing Unit
  • ASIC Application Specific Integrated Circuit
  • the memory 1020 may be implemented in the form of ROM (Read Only Memory), RAM (Random Access Memory, random access memory), static storage device, dynamic storage device, etc.
  • the memory 1020 may store an operating system and other application programs. When the technical solutions provided in the embodiments of the present specification are implemented through software or firmware, related program codes are stored in the memory 1020 and called and executed by the processor 1010.
  • the input/output interface 1030 is used to connect an input/output module to realize information input and output.
  • the input/output/module can be configured in the device as a component (not shown in the figure), or can be connected to the device to provide corresponding functions.
  • the input device may include a keyboard, a mouse, a touch screen, a microphone, various sensors, etc., and an output device may include a display, a speaker, a vibrator, an indicator light, and the like.
  • the communication interface 1040 is used to connect a communication module (not shown in the figure) to realize the communication interaction between the device and other devices.
  • the communication module can realize communication through wired means (such as USB, network cable, etc.), or through wireless means (such as mobile network, WIFI, Bluetooth, etc.).
  • the bus 1050 includes a path to transmit information between various components of the device (for example, the processor 1010, the memory 1020, the input/output interface 1030, and the communication interface 1040).
  • the above device only shows the processor 1010, the memory 1020, the input/output interface 1030, the communication interface 1040, and the bus 1050, in the specific implementation process, the device may also include the necessary equipment for normal operation. Other components.
  • the above-mentioned device may also include only the components necessary to implement the solutions of the embodiments of the present specification, and not necessarily include all the components shown in the figures.
  • the embodiment of this specification also provides a computer-readable storage medium on which a computer program is stored, and when the program is executed by a processor, the method for updating the smart contract shown in FIG. 3 is implemented.
  • the embodiment of this specification also provides a computer-readable storage medium on which a computer program is stored, and when the program is executed by a processor, the method for updating the smart contract shown in FIG. 4 is implemented.
  • Computer-readable media include permanent and non-permanent, removable and non-removable media, and information storage can be realized by any method or technology.
  • the information can be computer-readable instructions, data structures, program modules, or other data.
  • Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, CD-ROM, digital versatile disc (DVD) or other optical storage, Magnetic cassettes, magnetic tape storage or other magnetic storage devices or any other non-transmission media can be used to store information that can be accessed by computing devices. According to the definition in this article, computer-readable media does not include transitory media, such as modulated data signals and carrier waves.
  • a typical implementation device is a computer.
  • the specific form of the computer can be a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email receiving and sending device, and a game control A console, a tablet computer, a wearable device, or a combination of any of these devices.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Physics & Mathematics (AREA)
  • Business, Economics & Management (AREA)
  • Databases & Information Systems (AREA)
  • Finance (AREA)
  • Accounting & Taxation (AREA)
  • Software Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Economics (AREA)
  • Computing Systems (AREA)
  • Development Economics (AREA)
  • Computer Security & Cryptography (AREA)
  • Marketing (AREA)
  • Strategic Management (AREA)
  • Technology Law (AREA)
  • General Business, Economics & Management (AREA)
  • Financial Or Insurance-Related Operations Such As Payment And Settlement (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

公开了一种智能合约的更新方法、系统、装置及设备。在区块链系统中的智能合约需要更新时,通过在各节点间约定期望更新条件,并且各节点在更新之前确定自己的准备状态,从而确保了新智能合约在各节点上的同步更新。

Description

智能合约的更新 技术领域
本说明书实施例涉及信息技术领域,尤其涉及一种智能合约的更新方法、系统、装置及设备。
背景技术
区块链应用场景越来越丰富,越来越多的场景需要通过编写智能合约来完成业务逻辑。随着业务场景的不断发展,智能合约需要经常进行发布和更新。目前,合约更新一般都是直接采用传统的发布模式,新的合约发布后,区块链节点都是使用新的智能合约代码。
由于发布过程中,每个节点的发布时间都可能不一样,在发布期间,一笔交易在不同的节点可能是新或旧两个不同的智能合约执行的结果,可能出现结果不一致等情况,容易导致区块链分叉或者共识结果失败。
基于此,本说明书实施例提供一种同步的智能合约更新方案。
发明内容
本申请实施例的目的是提供一种在区块链系统中更为同步的智能合约更新方案。
为解决上述技术问题,本申请实施例是这样实现的:
一方面,本说明书实施例提供一种一种智能合约的更新方法,应用于包含多个节点的区块链系统中,所述方法包括:第一节点获取包含期望更新条件的新智能合约;所述第一节点生成包含所述新智能合约的交易,并广播所述交易至所述区块链系统中,以便在所述区块链系统对该交易进行共识,并在共识通过后写入所述区块链系统;区块链系统中的第二节点,从所述区块链系统中获取所述交易中的包含期望更新条件的新智能合约,并反馈自身的准备状态至所述第一节点;所述第一节点统计各第二节点所反馈的准备状态,生成统计结果,当所述统计结果符合预设条件时,生成包含更新指令的交易,并广播所述交易至所述区块链系统中,以便在所述区块链系统对该交易进行共识,并在共识通过后写入所述区块链系统;区块链系统中的任一节点,从所述区块链系统中获取所述包含更新指令的交易,并在所述期望更新条件到达时,根据所述更新指令部署所述 新智能合约。
另一方面,本说明书实施例还提供一种智能合约的更新方法,应用于区块链系统的第一节点中,所述方法包括:获取包含期望更新条件的新智能合约;生成包含所述新智能合约的交易,并广播所述交易至所述区块链系统中,以便在所述区块链系统对该交易进行共识,并在共识通过后写入所述区块链系统;获取各第二节点的所反馈的准备状态,生成统计结果,当所述统计结果符合预设条件时,生成包含更新指令的交易;广播所述交易至所述区块链系统中,以便区块链系统中的任一节点从所述区块链系统中获取所述包含更新指令的交易,并在所述期望更新条件到达时,部署所述新智能合约。
再一方面,本说明书实施例还提供一种智能合约的更新方法,应用于区块链系统的第二节点中,所述方法包括:从所述区块链系统中获取交易中的包含期望更新条件的新智能合约,其中,所述交易为第一节点生成的包含所述新智能合约的交易;反馈自身的准备状态至所述第一节点;从所述区块链系统中获取交易包含的更新指令;在所述期望更新条件到达时,根据所述更新指令部署所述新智能合约。
与一方面对应的,本说明书实施例还提供一种智能合约的更新系统,应用于包含多个节点的区块链系统中,在所述系统中,第一节点获取包含期望更新条件的新智能合约;所述第一节点生成包含所述新智能合约的交易,并广播所述交易至所述区块链系统中,以便在所述区块链系统对该交易进行共识,并在共识通过后写入所述区块链系统;区块链系统中的第二节点,从所述区块链系统中获取所述交易中的包含期望更新条件的新智能合约,并反馈自身的准备状态至所述第一节点;所述第一节点统计各第二节点所反馈的准备状态,生成统计结果,当所述统计结果符合预设条件时,生成包含更新指令的交易,并广播所述交易至所述区块链系统中,以便在所述区块链系统对该交易进行共识,并在共识通过后写入所述区块链系统;区块链系统中的任一节点,从所述区块链系统中获取所述包含更新指令的交易,并在所述期望更新条件到达时,根据所述更新指令部署所述新智能合约。
与另一方面对应的,本说明书实施例还提供一种智能合约的更新装置,应用于区块链的第一节点中,所述装置包括:获取模块,获取包含期望更新条件的新智能合约;生成模块,生成包含所述新智能合约的交易,并广播所述交易至所述区块链系统中,以便在所述区块链系统对该交易进行共识,并在共识通过后写入所述区块链系统;所述获取模块还用于,获取各第二节点的所反馈的准备状态,生成统计结果,当所述统计结果符合预设条件时,生成包含更新指令的交易;广播模块,广播所述交易至所述区块链系统 中,以便区块链系统中的任一节点从所述区块链系统中获取所述包含更新指令的交易,并在所述期望更新条件到达时,部署所述新智能合约。
与再一方面对应的,本说明书实施例还提供一种智能合约的更新装置,应用于区块链系统的第二节点中,所述装置包括:获取模块,从所述区块链系统中获取交易中的包含期望更新条件的新智能合约,其中,所述交易为第一节点生成的包含所述新智能合约的交易;反馈模块,反馈自身的准备状态至所述第一节点;所述获取模块还用于,从所述区块链系统中获取交易包含的更新指令;更新模块,在所述期望更新条件到达时,根据所述更新指令部署所述新智能合约。
通过本说明书实施例所提供的方案,在区块链系统中的智能合约需要更新时,通过在各节点间约定期望更新条件,并且各节点在更新之前确定自己的准备状态,从而确保了新智能合约在各节点上的同步更新,确保了智能合约更新的成功率和一致性,新智能合约可以在区块链网络中的各节点上同时生效,避免了因为智能合约不同而导致的账本分叉。
应当理解的是,以上的一般描述和后文的细节描述仅是示例性和解释性的,并不能限制本说明书实施例。
此外,本说明书实施例中的任一实施例并不需要达到上述的全部效果。
附图说明
为了更清楚地说明本说明书实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本说明书实施例中记载的一些实施例,对于本领域普通技术人员来讲,还可以根据这些附图获得其他的附图。
图1为本说明书实施例所提供的一种系统架构的示意图;
图2为说明书实施例体所提供的一种智能合约的更新方法的流程示意图;
图3为本说明书实施例所提供的另一种智能合约的更新方法的流程示意图;
图4为本说明书实施例所提供的再一种智能合约的更新方法的流程示意图;
图5是本说明书实施例提供的一种智能合约的更新装置的结构示意图;
图6是本说明书实施例提供的一种智能合约的更新装置;
图7是用于配置本说明书实施例方法的一种设备的结构示意图。
具体实施方式
为了使本领域技术人员更好地理解本说明书实施例中的技术方案,下面将结合本说明书实施例中的附图,对本说明书实施例中的技术方案进行详细地描述,显然,所描述的实施例仅仅是本说明书的一部分实施例,而不是全部的实施例。基于本说明书中的实施例,本领域普通技术人员所获得的所有其他实施例,都应当属于保护的范围。
随着区块链应用场景越来越丰富,越来越多的场景需要通过编写智能合约来完成业务逻辑。随着业务场景的不断发展,智能合约需要经常进行发布和更新。目前,合约更新一般都是直接采用传统的发布模式。
在区块链的场景下,如对于智能合约的更新指的是在区块链中的所有节点中进行智能合约的更新,从而在更新以后所有节点都使用新智能合约(更新前的可以称为旧智能合约)来执行业务逻辑。具体而言,对于区块链中的每一个节点而言,即应当将新智能合约的代码写入到区块链的账本中,并且指示该节点在以后执行业务逻辑时使用新智能合约的代码。
传统的更新方式即为采用发布的方式,其它节点获取发布的新智能合约并自行更新部署。这个方式下每个节点的发布时间都不一样,在发布期间,一笔交易在不同的节点可能是新或旧两个不同的智能合约执行的结果,可能出现结果不一致等情况;或者,有些节点上可能因为系统或者硬件的对于智能合约的代码不兼容,导致更新失败,这也会导致同一笔交易可能是新或旧两个不同的智能合约执行的结果。不同的共识结果就有可能容易导致区块链分叉或者共识结果失败。
基于此,本说明书实施例提供一种同步更新智能合约的方案,如图1所示,图1为本说明书实施例所提供的一种系统架构的示意图。该示意图中的区块链系统可以是诸如联盟链、公有链或者私有链等各种形式。
基于图1所示的系统,本说明书实施例体提供一种智能合约的更新方法,应用于包含多个节点的区块链系统中,如图2所示,图2为说明书实施例体所提供的一种智能合约的更新方法的流程示意图,包括:
S201,第一节点获取包含期望更新条件的新智能合约。
在如图1所示的区块链系统中,第一节点可以是任意一个节点。也可以是预先所选 定的若干指定节点。例如,在多个机构所形成的联盟链中,第一节点可以是其中的任一机构所对应的节点,也可以是预先就指定好的某个专门协调各机构节点的节点。
如前所述,所述新智能合约是相对于目前正在使用中的旧智能合约而言。显然,随着智能合约的不断升级迭代,新智能合约一旦被部署成功,就成为了旧智能合约,并且有可能在以后被其它的新智能合约所替换。
第一节点获取得到的新智能合约中应当包含期望更新条件,所述期望更新条件用于指示各节点应当在什么情况下部署所述新智能合约(即更新智能合约)。具体而言,期望更新条件可以是一个具体的期望更新时间点,例如2020年xx月xx日12点00分00秒,用于指示任一节点在该时间点部署新智能合约;或者,期望更新条件还可以是区块链系统中的一个具体的块高值(即更新块高),例如,块高5000,用于指示一个节点当区块链中的区块数量达到5000时部署新智能合约。
在一种实施方式中,获取得到的新智能合约中还可以包含有多方签名。例如,在联盟链中,多个机构经过互相协商得到一个新智能合约并进行部署,此时,新智能合约中需要该多个机构中每一个机构进行数字签名,从而第一节点可以对每一个数字签名进行验证,来确认合法性,如果验证通过,则可以确认该智能合约是得到了前述多个机构的认可的。否则,若验证失败,即终止后续的更新流程。
S203,所述第一节点生成包含所述新智能合约的交易,并广播所述交易至所述区块链系统中,以便在所述区块链系统对该交易进行共识,并在共识通过后写入所述区块链系统。
具体而言,第一节点还可以对生成的交易使用自己的私钥进行签名,从而任一其它节点还可以使用第一节点的公钥对该签名进行验证,从而确保交易的完整性。对于交易的共识和存储在当前已经很常见,此处不再赘述。
S205,区块链系统中的第二节点,从所述区块链系统中获取所述交易中的包含期望更新条件的新智能合约,并反馈自身的准备状态至所述第一节点。
区块链中的第二节点可以是除了第一节点以外的任一其它节点。在前述包含新的智能合约的交易被写入到区块链系统中以后,其它节点(即第二节点)即可以从区块链系统中获取得到该交易,并解析得到其中所包含的新智能合约。
在本说明书实施例中,第一节点和第二节点本质上并没有区别,仅是为了在一个更新流程中便于区分而进行命名。在实际应用中,一个更新流程中的第一节点,在其它更 新流程中即可以是第二节点,而任何第二节点在其它的更新流程中,也可以作为第一节点生成包含所述新智能合约的交易并广播。
进而,任一第二节点都可以首先判断本地系统(包括软件方面的和硬件方面的)是不是可以兼容新智能合约,以及,当期望更新条件是一具体的时间点时,该第二节点还可以判断在该时间点本地节点是不是能够及时更新该智能合约。从而,每个第二节点都可以确定出自己对于该包含期望更新条件的新智能合约的准备状态,即“可以更新”,或者,“不能更新”,并且还可以反馈该准备状态至第一节点。
在实际应用中,可以使用特征值的方式来表征准备状态,例如,“1”表示“可以更新”,“0”表示“不能更新”等等。
在一种实施方式中,在反馈准备状态之前,第二节点还可以对智能合约的合法性进行验证,例如,验证新智能合约中所包含的签名的数量是不是满足预设条件,验证新智能合约中所包含的签名是不是包含预设的指定机构的签名,以及有,验证新智能合约中所包含的签名是不是可以解密通过,等等。如果验证不通过,则可以确定准备状态为“不能更新”。显然,发起合约更新的第一节点应当被默认为其准备状态是“可以更新”。
第二节点反馈准备状态给第一节点的方式有多种。例如,在联盟链的场景中,如果第一节点是预先指定的某个协调节点,则其它节点可能都有该协调节点的通信方式,从而可以直接发送包含自身的准备状态的信息至所述第一节点;又例如,在某些公有链的场景下,则可以是每个收到新智能合约的节点生成包含自身的准备状态的交易,并广播所述交易至所述区块链系统中,以便所述第一节点从所述区块链系统中获取所述交易中所包含的自身的准备状态。
S207,所述第一节点统计各第二节点所反馈的准备状态,生成统计结果,当所述统计结果符合预设条件时,生成包含更新指令的交易,并广播所述交易至所述区块链系统中,以便在所述区块链系统对该交易进行共识,并在共识通过后写入所述区块链系统。
第一节点在获取得到各第二节点所反馈的准备状态之后,既可以对结果进行统计,从而得到统计结果。当所述统计结果符合预设条件时,生成包含更新指令的交易。
例如,预设条件可以是要求每个第二节点的准备状态都是“可以更新”。在这种实施方式下,如果有任一第二节点返回的准备状态为“不能更新”,则不再继续后续流程,即不再广播包含更新指令的交易至区块链系统。此时,这一次的同步更新即中止了,第一节点还可以再次以发起包含另一个期望更新条件的新智能合约,从而重新在各节点之 间进行协调。
如果统计结果满足了预设条件,第一节点则生成包含更新指令的交易,并广播所述交易至所述区块链系统中。更新指令用于指示各第二节点部署所述新智能合约。具体而言,更新指令本质上是一段可执行代码,其作用在于当期望更新条件被满足时,执行该可执行代码,执行的效果即为新的智能合约被更新至该节点中中,即最终新智能合约通过更新指令被部署至所述区块链系统中。
S209,区块链系统中的任一节点,从所述区块链系统中获取所述包含更新指令的交易,并在所述期望更新条件到达时,根据所述更新指令部署所述新智能合约。
此时的任一节点包括第一节点,也包括第二节点。任一节点都可以从区块链系统中获取已经被共识通过的包含更新指令的交易,从而可以获取得到更新指令,如前所述,当新智能合约中的期望更新条件被满足时,在每一各节点中根据所述更新指令部署所述新智能合约。
在一种实施方式中,任一节点还可以确定部署所述新智能合约的部署结果,即部署结果是否成功,从而生成包含所述部署结果的交易,并广播所述交易至所述区块链系统中。从而,在该交易被共识通过并存储之后,任一其它节点都可以获取所述交易中所包含的部署结果,并且对全量的其它节点的部署结果进行统计。
在联盟链中这种方式更为常用,由于联盟链通常是有限个的机构节点所组成,通常每个节点都是全节点(即存储有全量交易),每个节点也都有共识功能,那么联盟链中的每个节点对于交易的共识往往是需要更高的一致性,即可能需要所有节点的共识结果一致才能认为交易共识通过存储。
因此,如果有某一两个节点因为更新智能合约失败而导致后续的共识失败,其它节点有必要了解是哪几个节点上可能发生了这样的错误,而通过将部署结果写入交易并广播,就有利于其它节点知晓区块链系统中整体的更新情形,从而可以即时的调整整个区块链的业务逻辑。
前述方式从区块链的整体上对于智能合约的更新方式进行了描述,相应的,在另一方面,本说明书实施例还提供一种智能合约的更新方法,如图3所示,图3为本说明书实施例所提供的另一种智能合约的更新方法的流程示意图,应用于区块链系统的第一节点中,如一方面所述,在这种更新方式下,第一节点可以是区块链系统中的一个普通节点,也可以是预先指定的专门协调各节点之间关系的协调节点,所述方法包括:
S301,获取包含期望更新条件的新智能合约;
S303,生成包含所述新智能合约的交易,并广播所述交易至所述区块链系统中,以便在所述区块链系统对该交易进行共识,并在共识通过后写入所述区块链系统;
S305,获取各第二节点的所反馈的准备状态,生成统计结果,当所述统计结果符合预设条件时,生成包含更新指令的交易;
S307,广播所述交易至所述区块链系统中,以便区块链系统中的任一节点从所述区块链系统中获取所述包含更新指令的交易,并在所述期望更新条件到达时,部署所述新智能合约。
再一方面,本说明书实施例还提供一种一种智能合约的更新方法,应用于区块链系统的第二节点中,如图4所示,图4为本说明书实施例所提供的再一种智能合约的更新方法的流程示意图,如一方面所述,在这种更新方式下,第二节点可以是区块链系统中的任一节点,所述方法包括:
S401,从所述区块链系统中获取交易中的包含期望更新条件的新智能合约,其中,所述交易为第一节点生成的包含所述新智能合约的交易;
S403,反馈自身的准备状态至所述第一节点;具体而言,可以直接向第一节点反馈,也可以生成包含准备状态的交易,通过交易上链,向第一节点间接的反馈。
S404,从所述区块链系统中获取交易包含的更新指令;
S405,在所述期望更新条件到达时,根据所述更新指令部署所述新智能合约。
通过本说明书实施例所提供的方案,在区块链系统中的智能合约需要更新时,通过在各节点间约定期望更新条件,并且各节点在更新之前确定自己的准备状态,从而确保了新智能合约在各节点上的同步更新,确保了智能合约更新的成功率和一致性,新智能合约可以在区块链网络中的各节点上同时生效,避免了因为智能合约不同而导致的账本分叉。
与一方面对应的,本说明书实施例还提供一种智能合约的更新系统,应用于包含多个节点的区块链系统中,在所述系统中,
第一节点获取包含期望更新条件的新智能合约;
所述第一节点生成包含所述新智能合约的交易,并广播所述交易至所述区块链系统中,以便在所述区块链系统对该交易进行共识,并在共识通过后写入所述区块链系统;
区块链系统中的第二节点,从所述区块链系统中获取所述交易中的包含期望更新条件的新智能合约,并反馈自身的准备状态至所述第一节点;
所述第一节点统计各第二节点所反馈的准备状态,生成统计结果,当所述统计结果符合预设条件时,生成包含更新指令的交易,并广播所述交易至所述区块链系统中,以便在所述区块链系统对该交易进行共识,并在共识通过后写入所述区块链系统;
区块链系统中的任一节点,从所述区块链系统中获取所述包含更新指令的交易,并在所述期望更新条件到达时,根据所述更新指令部署所述新智能合约。
与另一方面对应的,本说明书是实施例还提供一种智能合约的更新装置,应用于区块链的第一节点中,如图5所示,图5是本说明书实施例提供的一种智能合约的更新装置的结构示意图,所述装置包括:
获取模块501,获取包含期望更新条件的新智能合约;
生成模块503,生成包含所述新智能合约的交易,并广播所述交易至所述区块链系统中,以便在所述区块链系统对该交易进行共识,并在共识通过后写入所述区块链系统;
所述获取模块501还用于,获取各第二节点的所反馈的准备状态,生成统计结果,当所述统计结果符合预设条件时,生成包含更新指令的交易;
广播模块505,广播所述交易至所述区块链系统中,以便区块链系统中的任一节点从所述区块链系统中获取所述包含更新指令的交易,并在所述期望更新条件到达时,部署所述新智能合约。
与再一方面对应的,本说明书是实施例还提供一种智能合约的更新装置,如图6所示,图6是本说明书实施例提供的一种智能合约的更新装置,应用于区块链系统的第二节点中,所述装置包括:
获取模块601,从所述区块链系统中获取交易中的包含期望更新条件的新智能合约,其中,所述交易为第一节点生成的包含所述新智能合约的交易;
反馈模块603,,反馈自身的准备状态至所述第一节点;
所述获取模块601还用于,从所述区块链系统中获取交易包含的更新指令;
更新模块605,在所述期望更新条件到达时,根据所述更新指令部署所述新智能合约。
本说明书实施例还提供一种计算机设备,其至少包括存储器、处理器及存储在存储 器上并可在处理器上运行的计算机程序,其中,处理器执行所述程序时实现图3所示的智能合约的更新方法。
本说明书实施例还提供一种计算机设备,其至少包括存储器、处理器及存储在存储器上并可在处理器上运行的计算机程序,其中,处理器执行所述程序时实现图4所示的智能合约的更新方法。
图7示出了本说明书实施例所提供的一种更为具体的计算设备硬件结构示意图,该设备可以包括:处理器1010、存储器1020、输入/输出接口1030、通信接口1040和总线1050。其中处理器1010、存储器1020、输入/输出接口1030和通信接口1040通过总线1050实现彼此之间在设备内部的通信连接。
处理器1010可以采用通用的CPU(Central Processing Unit,中央处理器)、微处理器、应用专用集成电路(Application Specific Integrated Circuit,ASIC)、或者一个或多个集成电路等方式实现,用于执行相关程序,以实现本说明书实施例所提供的技术方案。
存储器1020可以采用ROM(Read Only Memory,只读存储器)、RAM(Random Access Memory,随机存取存储器)、静态存储设备,动态存储设备等形式实现。存储器1020可以存储操作系统和其他应用程序,在通过软件或者固件来实现本说明书实施例所提供的技术方案时,相关的程序代码保存在存储器1020中,并由处理器1010来调用执行。
输入/输出接口1030用于连接输入/输出模块,以实现信息输入及输出。输入输出/模块可以作为组件配置在设备中(图中未示出),也可以外接于设备以提供相应功能。其中输入设备可以包括键盘、鼠标、触摸屏、麦克风、各类传感器等,输出设备可以包括显示器、扬声器、振动器、指示灯等。
通信接口1040用于连接通信模块(图中未示出),以实现本设备与其他设备的通信交互。其中通信模块可以通过有线方式(例如USB、网线等)实现通信,也可以通过无线方式(例如移动网络、WIFI、蓝牙等)实现通信。
总线1050包括一通路,在设备的各个组件(例如处理器1010、存储器1020、输入/输出接口1030和通信接口1040)之间传输信息。
需要说明的是,尽管上述设备仅示出了处理器1010、存储器1020、输入/输出接口1030、通信接口1040以及总线1050,但是在具体实施过程中,该设备还可以包括实现正常运行所必需的其他组件。此外,本领域的技术人员可以理解的是,上述设备中也可以仅包含实现本说明书实施例方案所必需的组件,而不必包含图中所示的全部组件。
本说明书实施例还提供一种计算机可读存储介质,其上存储有计算机程序,该程序被处理器执行时实现图3所示的智能合约的更新方法。
本说明书实施例还提供一种计算机可读存储介质,其上存储有计算机程序,该程序被处理器执行时实现图4所示的智能合约的更新方法。
计算机可读介质包括永久性和非永久性、可移动和非可移动媒体可以由任何方法或技术来实现信息存储。信息可以是计算机可读指令、数据结构、程序的模块或其他数据。计算机的存储介质的例子包括,但不限于相变内存(PRAM)、静态随机存取存储器(SRAM)、动态随机存取存储器(DRAM)、其他类型的随机存取存储器(RAM)、只读存储器(ROM)、电可擦除可编程只读存储器(EEPROM)、快闪记忆体或其他内存技术、只读光盘只读存储器(CD-ROM)、数字多功能光盘(DVD)或其他光学存储、磁盒式磁带,磁带磁磁盘存储或其他磁性存储设备或任何其他非传输介质,可用于存储可以被计算设备访问的信息。按照本文中的界定,计算机可读介质不包括暂存电脑可读媒体(transitory media),如调制的数据信号和载波。
通过以上的实施方式的描述可知,本领域的技术人员可以清楚地了解到本说明书实施例可借助软件加必需的通用硬件平台的方式来实现。基于这样的理解,本说明书实施例的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品可以存储在存储介质中,如ROM/RAM、磁碟、光盘等,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本说明书实施例各个实施例或者实施例的某些部分所述的方法。
上述实施例阐明的系统、方法、模块或单元,具体可以由计算机芯片或实体实现,或者由具有某种功能的产品来实现。一种典型的实现设备为计算机,计算机的具体形式可以是个人计算机、膝上型计算机、蜂窝电话、相机电话、智能电话、个人数字助理、媒体播放器、导航设备、电子邮件收发设备、游戏控制台、平板计算机、可穿戴设备或者这些设备中的任意几种设备的组合。
本说明书中的各个实施例均采用递进的方式描述,各个实施例之间相同相似的部分互相参见即可,每个实施例重点说明的都是与其他实施例的不同之处。尤其,对于方法实施例而言,由于其基本相似于方法实施例,所以描述得比较简单,相关之处参见方法实施例的部分说明即可。以上所描述的方法实施例仅仅是示意性的,其中所述作为分离部件说明的模块可以是或者也可以不是物理上分开的,在实施本说明书实施例方案时可以把各模块的功能在同一个或多个软件和/或硬件中实现。也可以根据实际的需要选择其 中的部分或者全部模块来实现本实施例方案的目的。本领域普通技术人员在不付出创造性劳动的情况下,即可以理解并实施。
以上所述仅是本说明书实施例的具体实施方式,应当指出,对于本技术领域的普通技术人员来说,在不脱离本说明书实施例原理的前提下,还可以做出若干改进和润饰,这些改进和润饰也应视为本说明书实施例的保护范围。

Claims (11)

  1. 一种智能合约的更新方法,应用于包含多个节点的区块链系统中,所述方法包括:
    第一节点获取包含期望更新条件的新智能合约;
    所述第一节点生成包含所述新智能合约的交易,并广播所述交易至所述区块链系统中,以便在所述区块链系统对该交易进行共识,并在共识通过后写入所述区块链系统;
    区块链系统中的第二节点,从所述区块链系统中获取所述交易中的包含期望更新条件的新智能合约,并反馈自身的准备状态至所述第一节点;
    所述第一节点统计各第二节点所反馈的准备状态,生成统计结果,当所述统计结果符合预设条件时,生成包含更新指令的交易,并广播所述交易至所述区块链系统中,以便在所述区块链系统对该交易进行共识,并在共识通过后写入所述区块链系统;
    区块链系统中的任一节点,从所述区块链系统中获取所述包含更新指令的交易,并在所述期望更新条件到达时,根据所述更新指令部署所述新智能合约。
  2. 如权利要求1所述的方法,所述期望更新条件包括:系统时间到达期望更新时间点,或者,区块链中账本的块高达到期望更新块高。
  3. 如权利要求1所述的方法,当所述新智能合约中还包含数字签名时,在所述第一节点生成包含所述新智能合约的交易之前,所述方法还包括:
    所述第一节点验证所述新智能合约中所包含的数字签名的合法性;
    相应的,所述第二节点,在反馈自身的准备状态至所述第一节点之前,所述方法还包括:所述第二节点验证获取得到的新智能合约中的数字签名的合法性。
  4. 如权利要求1所述的方法,所述第二节点,反馈自身的准备状态至所述第一节点,包括:
    发送包含自身的准备状态的信息至所述第一节点;或者,
    生成包含自身的准备状态的交易,并广播所述交易至所述区块链系统中,以便所述第一节点从所述区块链系统中获取所述交易中所包含的自身的准备状态。
  5. 如权利要求1所述的方法,还包括:
    任一节点,确定自身部署所述新智能合约的部署结果,生成包含所述部署结果的交易,并广播所述交易至所述区块链系统中,以便其它节点获取所述交易中所包含的部署结果。
  6. 一种智能合约的更新方法,应用于区块链系统的第一节点中,所述方法包括:
    获取包含期望更新条件的新智能合约;
    生成包含所述新智能合约的交易,并广播所述交易至所述区块链系统中,以便在所述区块链系统对该交易进行共识,并在共识通过后写入所述区块链系统;
    获取各第二节点的所反馈的准备状态,生成统计结果,当所述统计结果符合预设条件时,生成包含更新指令的交易;
    广播所述交易至所述区块链系统中,以便区块链系统中的任一节点从所述区块链系统中获取所述包含更新指令的交易,并在所述期望更新条件到达时,部署所述新智能合约。
  7. 一种智能合约的更新方法,应用于区块链系统的第二节点中,所述方法包括:
    从所述区块链系统中获取交易中的包含期望更新条件的新智能合约,其中,所述交易为第一节点生成的包含所述新智能合约的交易;
    反馈自身的准备状态至所述第一节点;
    从所述区块链系统中获取交易所包含的更新指令;
    在所述期望更新条件到达时,根据所述更新指令部署所述新智能合约。
  8. 一种智能合约的更新系统,应用于包含多个节点的区块链系统中,在所述系统中,
    第一节点获取包含期望更新条件的新智能合约;
    所述第一节点生成包含所述新智能合约的交易,并广播所述交易至所述区块链系统中,以便在所述区块链系统对该交易进行共识,并在共识通过后写入所述区块链系统;
    区块链系统中的第二节点,从所述区块链系统中获取所述交易中的包含期望更新条件的新智能合约,并反馈自身的准备状态至所述第一节点;
    所述第一节点统计各第二节点所反馈的准备状态,生成统计结果,当所述统计结果符合预设条件时,生成包含更新指令的交易,并广播所述交易至所述区块链系统中,以便在所述区块链系统对该交易进行共识,并在共识通过后写入所述区块链系统;
    区块链系统中的任一节点,从所述区块链系统中获取所述包含更新指令的交易,并在所述期望更新条件到达时,根据所述更新指令部署所述新智能合约。
  9. 一种智能合约的更新装置,应用于区块链的第一节点中,所述装置包括:
    获取模块,获取包含期望更新条件的新智能合约;
    生成模块,生成包含所述新智能合约的交易,并广播所述交易至所述区块链系统中,以便在所述区块链系统对该交易进行共识,并在共识通过后写入所述区块链系统;
    所述获取模块还用于,获取各第二节点的所反馈的准备状态,生成统计结果,当所述统计结果符合预设条件时,生成包含更新指令的交易;
    广播模块,广播所述交易至所述区块链系统中,以便区块链系统中的任一节点从所述区块链系统中获取所述包含更新指令的交易,并在所述期望更新条件到达时,部署所述新智能合约。
  10. 一种智能合约的更新装置,应用于区块链系统的第二节点中,所述装置包括:
    获取模块,从所述区块链系统中获取交易中的包含期望更新条件的新智能合约,其中,所述交易为第一节点生成的包含所述新智能合约的交易;
    反馈模块,反馈自身的准备状态至所述第一节点;
    所述获取模块还用于,从所述区块链系统中获取交易包含的更新指令;
    更新模块,在所述期望更新条件到达时,根据所述更新指令部署所述新智能合约。
  11. 一种计算机设备,包括存储器、处理器及存储在存储器上并可在处理器上运行的计算机程序,其中,所述处理器执行所述程序时实现如权利要求6至7任一项所述的方法。
PCT/IB2021/000354 2020-05-11 2021-05-11 智能合约的更新 WO2021229304A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202010394200.5 2020-05-11
CN202010394200.5A CN111639127B (zh) 2020-05-11 2020-05-11 一种智能合约的更新方法、系统、装置及设备

Publications (1)

Publication Number Publication Date
WO2021229304A1 true WO2021229304A1 (zh) 2021-11-18

Family

ID=72329278

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/IB2021/000354 WO2021229304A1 (zh) 2020-05-11 2021-05-11 智能合约的更新

Country Status (2)

Country Link
CN (1) CN111639127B (zh)
WO (1) WO2021229304A1 (zh)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115996130A (zh) * 2023-03-23 2023-04-21 安徽中科晶格技术有限公司 基于预置合约的dao治理方法、装置、设备及存储介质
CN117478299A (zh) * 2023-12-27 2024-01-30 湖南天河国云科技有限公司 区块链共识算法切换方法、装置和计算机设备

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112269838B (zh) * 2020-11-18 2023-07-25 网易(杭州)网络有限公司 基于区块链的监管方法、装置、电子设备及存储介质
CN112801661B (zh) * 2021-02-02 2023-06-30 深圳前海益链网络科技有限公司 区块链跨链规则管理方法及系统

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109885612A (zh) * 2018-12-26 2019-06-14 联动优势科技有限公司 区块链智能合约的同步生效方法及装置
US20190253239A1 (en) * 2018-11-30 2019-08-15 Alibaba Group Holding Limited Blockchain smart contract updates using decentralized decision
CN110413304A (zh) * 2019-07-31 2019-11-05 中国工商银行股份有限公司 基于区块链网络的智能合约热升级方法及装置
CN110427385A (zh) * 2019-08-02 2019-11-08 中国工商银行股份有限公司 区块链数据更新方法、相关节点及区块链

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US11176519B2 (en) * 2016-11-11 2021-11-16 International Business Machines Corporation Smart contract admission check and fault tolerance in a blockchain
CN109962779A (zh) * 2017-12-22 2019-07-02 中国电信股份有限公司 用于实现合约更新的方法、装置和系统
CN108769173B (zh) * 2018-05-21 2021-11-09 阿里体育有限公司 运行智能合约的区块链实现方法及设备
CN108833398B (zh) * 2018-06-08 2020-12-15 深圳智链未来科技有限公司 一种区块链智能合约更新方法、装置及设备
CN109451061B (zh) * 2018-12-20 2021-06-01 全链通有限公司 区块链的合约调整处理方法和系统
CN110766554A (zh) * 2019-09-29 2020-02-07 南京金宁汇科技有限公司 基于多中心化管理的智能合约共识方法、系统及存储介质

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20190253239A1 (en) * 2018-11-30 2019-08-15 Alibaba Group Holding Limited Blockchain smart contract updates using decentralized decision
CN109885612A (zh) * 2018-12-26 2019-06-14 联动优势科技有限公司 区块链智能合约的同步生效方法及装置
CN110413304A (zh) * 2019-07-31 2019-11-05 中国工商银行股份有限公司 基于区块链网络的智能合约热升级方法及装置
CN110427385A (zh) * 2019-08-02 2019-11-08 中国工商银行股份有限公司 区块链数据更新方法、相关节点及区块链

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115996130A (zh) * 2023-03-23 2023-04-21 安徽中科晶格技术有限公司 基于预置合约的dao治理方法、装置、设备及存储介质
CN115996130B (zh) * 2023-03-23 2023-06-30 安徽中科晶格技术有限公司 基于预置合约的dao治理方法、装置、设备及存储介质
CN117478299A (zh) * 2023-12-27 2024-01-30 湖南天河国云科技有限公司 区块链共识算法切换方法、装置和计算机设备
CN117478299B (zh) * 2023-12-27 2024-03-01 湖南天河国云科技有限公司 区块链共识算法切换方法、装置和计算机设备

Also Published As

Publication number Publication date
CN111639127B (zh) 2022-05-13
CN111639127A (zh) 2020-09-08

Similar Documents

Publication Publication Date Title
WO2021229304A1 (zh) 智能合约的更新
JP6912583B2 (ja) サービス処理方法および装置
US10447814B2 (en) Joint servicing of software packages
WO2017219857A1 (zh) 一种数据处理方法和设备
JP2015520435A (ja) クラウド同期システムのためのテレメトリ・システム
TW202040459A (zh) 資料處理方法、裝置、區塊鏈客戶端和區塊鏈節點
US20220261797A1 (en) Method and apparatus for executing smart contract
CN111240732B (zh) 分布式微服务的发布方法、装置、设备及存储介质
WO2020199713A1 (zh) 数据验证方法、系统、装置及设备
CN113067900B (zh) 智能合约的部署方法及装置
WO2017035737A1 (zh) 一种网络服务描述符上架方法及装置
TWI762851B (zh) 塊鏈式帳本中的資料驗證方法、系統、裝置及設備
CN112364049B (zh) 数据同步脚本生成方法、系统、终端及存储介质
WO2023134159A1 (zh) 一种基于区块链网络的共识方法、装置、电子设备及存储介质
WO2023185059A1 (zh) 一种共识方法和区块链节点
TWI716822B (zh) 事務因果序的校正方法及裝置、電子設備
CN111669434B (zh) 一种通信群组的建立方法、系统、装置及设备
WO2023231335A1 (zh) 在区块链中执行交易的方法及区块链的主节点
WO2021169124A1 (zh) 安装软件包至目标主机的方法、装置和计算机设备
CN108132832B (zh) 应用程序启动方法和装置
WO2024001032A1 (zh) 在区块链系统中执行交易的方法、区块链系统和节点
WO2023134160A1 (zh) 一种基于区块链网络的共识方法、装置、电子设备及存储介质
CN113949632B (zh) 一种区块链的节点动态配置方法及装置
WO2018121652A1 (zh) 通过用户设备中的应用连接无线接入点的方法与设备
CN108667902A (zh) iOS设备的远程控制系统、方法、装置及设备

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 21803615

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 21803615

Country of ref document: EP

Kind code of ref document: A1