Movatterモバイル変換


[0]ホーム

URL:


CN113961211A - A method and system for realizing smart contract life cycle management based on external chaincode container - Google Patents

A method and system for realizing smart contract life cycle management based on external chaincode container
Download PDF

Info

Publication number
CN113961211A
CN113961211ACN202111273461.2ACN202111273461ACN113961211ACN 113961211 ACN113961211 ACN 113961211ACN 202111273461 ACN202111273461 ACN 202111273461ACN 113961211 ACN113961211 ACN 113961211A
Authority
CN
China
Prior art keywords
smart contract
proposal
contract
intelligent contract
version
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
CN202111273461.2A
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.)
Hangzhou Yunxiang Network Technology Co Ltd
Original Assignee
Hangzhou Yunxiang Network Technology 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 Hangzhou Yunxiang Network Technology Co LtdfiledCriticalHangzhou Yunxiang Network Technology Co Ltd
Priority to CN202111273461.2ApriorityCriticalpatent/CN113961211A/en
Publication of CN113961211ApublicationCriticalpatent/CN113961211A/en
Pendinglegal-statusCriticalCurrent

Links

Images

Classifications

Landscapes

Abstract

The invention provides a method and a system for realizing intelligent contract life cycle management based on an external chain code container, which specifically comprise the following steps: some organization in the channel initiates a proposal request for operating the intelligent contract, and the operation on the intelligent contract comprises the deployment, the upgrading, the freezing, the unfreezing, the version rollback, the version advancing and the parameter upgrading of the intelligent contract; if the proposal is successfully initiated and the resolution passes, executing the proposal, and carrying out the installation and instantiation operations of the related intelligent contract; the intelligent contract runs in an external chain code container after being installed, and the contract construction logic of the endorsement node hard coding is not relied on, so that the high availability of the chain code is ensured. The invention provides a complete life cycle for the intelligent contract, is convenient for organization in a channel to better manage the intelligent contract in real time aiming at specific services and complete service related logic.

Description

Method and system for realizing intelligent contract life cycle management based on external chain code container
Technical Field
The invention relates to the technical field of block chains, in particular to a method and a system for realizing intelligent contract life cycle management based on an external chain code container.
Background
In a blockchain network, multiple organizations perform the logic associated with a business by executing intelligent contracts (i.e., a piece of chain code). Because one organization can join a plurality of channels, and when the organization and the organization perform transactions, the types of completed services also have a plurality of types, and a plurality of intelligent contracts are often deployed in the channels according to requirements, the management of the intelligent contracts is very important.
In the existing intelligent contract management technology, the life cycle of an intelligent contract is not complete enough, but in a block chain network deployed by using k8s, a chain code is always stored inside the network, and when the contract is installed, the contract is excessively dependent on contract construction logic hard-coded by an endorsement node, so that the contract is not flexible to update. How to make each intelligent contract have a very complete life cycle, realize the real-time management to the contract, improve the availability of the contract, finally achieve the goal that the organization in the channel finishes every business better, it is the problem that needs to be solved at present.
Disclosure of Invention
Based on the problems proposed in the background art, the invention provides a method for realizing intelligent contract life cycle management based on an external chain code container, which specifically comprises the following steps:
acquiring an intelligent contract proposal request initiated by a proposal initiating organization in a channel, and judging whether the proposal request is successfully initiated, wherein the intelligent contract proposal is the life cycle management of an intelligent contract;
if the proposal request is successfully initiated, initiating a voting notification to enable all organizations in the channel to vote for the proposal request;
and if the vote exceeds half, generating a proposed to-be-executed message and sending the proposed to-be-executed message to the BaaS terminal.
Further, the lifecycle management includes at least one or more of deployment, upgrade, freeze, unfreeze, version rollback, version advance, and parameter upgrade;
the deployment is to obtain a new intelligent contract and upload the new intelligent contract to a channel, and install the new intelligent contract at an endorsement node needing to deploy the new intelligent contract;
the upgrading is to obtain an upgraded intelligent contract and install the upgraded intelligent contract, wherein the upgraded intelligent contract is an existing intelligent contract in a channel;
the freezing is carried out, all the calls of the current intelligent contract are modified to return that the contract is frozen, the endorsement strategy of the current intelligent contract is replaced by the endorsement strategy which needs all organizations, the ID of the endorsement strategy is set to be null, the intelligent contract obtained after the modification is the frozen contract, and the frozen contract is installed;
the unfreezing is carried out, an original intelligent contract before freezing is obtained, and the original intelligent contract is installed;
the version is returned and advanced, the current intelligent contract has the intelligent contract of the previous version/the next version, and the intelligent contract which meets the conditions is selected for installation;
upgrading the parameters, namely modifying the endorsement strategy and the private data set corresponding to the current intelligent contract without changing the version number of the current intelligent contract to obtain the modified intelligent contract and installing the modified intelligent contract;
the method comprises the steps of upgrading, freezing, unfreezing, version rollback, version advancing and parameter upgrading, and when a related intelligent contract is installed, an endorsement node where a current intelligent contract is installed is selected to be installed.
Further, there is also a possibility of failure of proposal initiation, including the following cases:
when the proposal is the deployment of the intelligent contract, if the new intelligent contract and the existing intelligent contract in the channel are renamed, the proposal initiation fails;
when the proposal is upgrading, freezing, unfreezing, version backing, version advancing and parameter upgrading of the intelligent contract, if the current intelligent contract has the proposal in the process, the proposal initiation fails;
and setting the permission for redeploying the intelligent contract for certain specific organizations in the channel, and when the proposal initiation fails and is the deployment of the intelligent contract, if the proposal initiation organization has the permission for redeploying, initiating a request for redeploying, and deploying the intelligent contract again.
Further, the proposal information includes:
the deployment and proposal information at least comprises the name and version number of the new intelligent contract, the channel name, initialization parameters, endorsement strategies and private data;
the upgrading and proposal information at least comprises the name and the version number of the current intelligent contract, the name and the version number of the upgraded intelligent contract, the channel name, the endorsement policy and private data;
freezing, unfreezing and proposing information at least comprises the name, the version number and the channel name of the current intelligent contract;
the version is returned and advanced, and the proposal information at least comprises the name of the current intelligent contract, the version number of the intelligent contract of the previous/next version and the channel name;
the parameter upgrading, the proposal information at least includes the name, version number, channel name, endorsement strategy and private data of the current intelligent contract;
on the other hand, the method for realizing intelligent contract life cycle management based on the external chain code container comprises the following steps:
the BaaS end receives a proposed to-be-executed message;
installing related intelligent contracts in endorsement nodes selected by a proposal initiating organization;
configuring Stateful and Service for the external chain code container;
and after the external chain code container is normally started, the current intelligent contract ID of the organization where the endorsement node is located points to the installed related intelligent contract ID, and the related intelligent contract is instantiated.
Further, the intelligent contract runs on an external chain code container;
if the related intelligent contract is about the first installation, uploading an intelligent contract chain code packet before the installation, otherwise, not uploading; if the intelligent contract chain code package needs to be uploaded, in order to enable the installed intelligent contract to run in an external chain code container, the original intelligent contract chain code package needs to be decompressed, a metadata configuration file and a connection configuration file are generated based on an index and a set uploaded during intelligent contract creation, the metadata configuration file and the connection configuration file are repackaged together with the decompressed file, and the new intelligent contract chain code package is uploaded after being obtained.
Further, the installation of the related intelligent contracts further comprises:
after the intelligent contract chain code packet is uploaded, calling an intelligent contract installation method of an SDK interface to carry out intelligent contract installation, after an external chain code container is deployed, creating a Pod based on StateUfSet and Service, and writing a chain code number and a corresponding chain code Service address into an environment variable;
when the intelligent contract is installed and instantiated, if the related intelligent contract is not installed for the first time, the initialization function in the instantiation is replaced by a null implementation.
Furthermore, the method also provides intelligent contract detail inquiry, and can check the intelligent contract information deployed in each channel and the historical version information thereof; when the intelligent contract proposal is operated, the current version information and the original version information of the intelligent contract are saved, and the saved information at least comprises the following information: the name, version number, path, initialization parameter, endorsement policy, state, MD5 value, channel name, set configuration, proposal initiating organization, initiating time and submitting time of the intelligent contract.
The invention also provides a system for realizing intelligent contract life cycle management based on the external chain code container, which comprises a proposal processing module, a message module and a proposal execution module;
the proposal processing module comprises proposal initiation and voting;
acquiring an intelligent contract proposal request initiated by a proposal initiating organization in a channel, and judging whether the proposal request is initiated successfully; the intelligent contract proposal request comprises deployment, upgrading, freezing, unfreezing, version rollback, version advancing and parameter upgrading of an intelligent contract;
if the proposal request is successfully initiated, initiating a voting notification to enable all organizations in the channel to vote for the proposal request;
and if the vote exceeds half, generating a proposed to-be-executed message and sending the proposed to-be-executed message to the BaaS terminal.
The message module comprises the steps of generating and processing a message, generating the message by an intelligent contract end, and processing the message by a BaaS end;
the type of the message comprises a proposal initiating result, a proposal voting result and a proposal executing result; if the proposal is initiated completely, newly adding an initiating result message in a database; if the proposal voting is finished, newly adding voting result information in a database; if the proposal is executed, adding an execution result message in the database;
the proposal execution module executes the installation and instantiation operations of different intelligent contracts according to different types of proposals, wherein the related intelligent contracts run in an external chain code container.
The system further comprises a BaaS end, wherein the BaaS end comprises a message receiving module, a selective installation module, a configuration module and a pointing example module when the message is processed;
the message receiving module receives a proposed plan message to be executed;
the selection installation module is used for installing related intelligent contracts at endorsement nodes selected by a proposal initiating organization;
the configuration module is used for configuring Stateresult and Service for the external chain code container;
and the pointing instance module is used for pointing the current intelligent contract ID of the organization where the endorsement node is located to the installed related intelligent contract ID and instantiating the related intelligent contract after the external chain code container is normally started.
A computer-readable storage medium, in which a computer program is stored which, when being executed by a processor, carries out the method steps of any of the above.
An apparatus for implementing intelligent contract lifecycle management based on external chain code containers, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, the processor implementing the method steps of any one of the above when executing the computer program.
For a better understanding of the present invention, certain terms of art referred to in this specification are explained below, including: the BaaS is a block chain, namely a service platform, provides a convenient and high-performance block chain ecological environment and ecological matching service for developers, and supports the business expansion and operation of the developers; the SDK is a software development kit, and is a set of related documents, paradigms and tools for assisting in developing certain software; k8s is an open source platform for automated container operation that can be used to deploy blockchain networks; pod is the smallest unit managed, created, planned in k8 s; the Stateful is designed for solving the service problem, and can realize stable persistent storage, stable network marks, ordered deployment, expansion, contraction, deletion and the like; service is an abstraction of a policy that defines a set of Pod, also called a macro Service; MD5 is a widely used cryptographic hash function that functions to ensure that information is transmitted in a complete and consistent manner.
Compared with the prior art, the invention provides a method for realizing intelligent contract life cycle management based on an external chain code container, when intelligent contract management is carried out and contracts are installed, the contracts are operated in the external chain code container, the contract construction logic of endorsement node hard coding is not relied on, and the high availability of chain codes is ensured. Meanwhile, the management of the intelligent contract is more perfect, the intelligent contract has a complete life cycle, and the intelligent contract comprises multiple operations of deployment, upgrading, freezing, unfreezing, version rollback, version forwarding and parameter upgrading of the intelligent contract, so that organizations in a channel can conveniently manage the contract in real time aiming at specific services, and the related logic of the services can be better completed.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings without creative efforts.
FIG. 1 is a schematic diagram illustrating an overall process flow of a smart contract lifecycle in one embodiment;
FIG. 2 is a schematic flow chart illustrating the execution of an intelligent contract proposal in one embodiment;
FIG. 3 is a schematic flow chart illustrating intelligent contract deployment in one embodiment;
FIG. 4 is a schematic diagram illustrating a process for intelligent contract upgrade in one embodiment;
FIG. 5 is a schematic flow chart illustrating intelligent contract freezing in one embodiment;
FIG. 6 is a schematic diagram illustrating a flow of intelligent contract unfreezing in one embodiment;
FIG. 7 is a flow diagram illustrating intelligent contract version rollback in an embodiment;
FIG. 8 is a schematic flow chart illustrating intelligent contract version progression in one embodiment;
fig. 9 is a schematic flow chart of upgrading intelligent contract parameters in a specific embodiment.
Detailed Description
To make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings, and it is apparent that the described embodiments are some, but not all embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
In the description herein, references to the description of "an embodiment," "a particular embodiment," "an embodiment," "for example," mean that a particular feature, structure, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the application. In this specification, the schematic representations of the terms used above do not necessarily refer to the same embodiment or example. Furthermore, the particular features, structures, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples. The sequence of steps involved in the embodiments is for illustrative purposes to illustrate the implementation of the present application, and the sequence of steps is not limited and can be adjusted as needed.
In a specific embodiment, as shown in fig. 1, a life cycle of an intelligent contract mainly includes deployment, upgrade, freezing, thawing, version rollback, version forwarding, and parameter upgrade of the intelligent contract, and a system back end thereof is logically divided into three modules including a proposal processing module, a message module, and a proposal execution module;
the proposal processing module comprises proposal initiation and voting; the message module comprises the generation and processing of messages; the proposal execution module executes the installation and instantiation operations of different intelligent contracts according to different types of proposals.
In this embodiment, as shown in fig. 2, the step of managing the intelligent contract specifically includes:
s1, acquiring an intelligent contract proposal request initiated by a proposal initiating organization in the channel;
s2, if the proposal initiating is successful, initiating a voting notification to make all organizations in the channel vote for the proposal request;
s3, if the vote exceeds half, generating a proposal to-be-executed message and sending the proposal to the BaaS terminal;
s4, executing proposal, and carrying out installation and instantiation operation of related intelligent contracts, wherein the related intelligent contracts run in an external chain code container;
s40, the BaaS end receives the proposed to-be-executed message; installing related intelligent contracts in endorsement nodes selected by a proposal initiating organization; configuring Stateful and Service for the external chain code container;
and S41, after the external chain code container is normally started, the current intelligent contract ID of the organization where the endorsement node is located points to the installed related intelligent contract ID, and the related intelligent contract is instantiated.
For all the passing operation intelligent contract proposals, the installation and instantiation operation of related intelligent contracts are required during the execution, the intelligent contracts are operated in an external chain code container, the influence of an isolated container on the overall scheduling under the k8s environment is reduced, the contract construction logic hard-coded by an endorsement node is not relied on, and the high availability of the chain code is ensured, and the method mainly comprises the following steps:
if the related intelligent contract is about the first installation, uploading an intelligent contract chain code packet before the installation, otherwise, not uploading; if the intelligent contract chain code package needs to be uploaded, in order to enable the installed intelligent contract to run in an external chain code container, the original intelligent contract chain code package needs to be decompressed, a metadata configuration file and a connection configuration file are generated based on an index and a set uploaded during intelligent contract creation, and the metadata configuration file and the connection configuration file are repackaged together with the decompressed file to obtain a new intelligent contract chain code package and then uploaded;
after the intelligent contract chain code packet is uploaded, calling an intelligent contract installation method of an SDK interface to carry out intelligent contract installation, after an external chain code container is deployed, creating a Pod based on StateUfSet and Service, and writing a chain code number and a corresponding chain code Service address into an environment variable;
when the intelligent contract is installed and instantiated, if the related intelligent contract is not installed for the first time, the initialization function in the instantiation is replaced by a null implementation.
For the specific steps of managing an intelligent contract (hereinafter referred to as a contract), the main behaviors of the three modules in the embodiment include:
in a first aspect, for a proposal for operating an intelligent contract, the proposal processing module first verifies whether the state of the intelligent contract meets the corresponding state requirement, and needs to meet the following rules:
1) for the contract deployment, the contract to be deployed cannot be identical to other contracts in the block chain network, and once the intelligent contracts with the same name and the same version number are repeatedly installed on the same endorsement node, an installation error can be caused;
2) if the proposal is to deploy other contract operations outside the contract, the current contract cannot have the proposal in process, and the condition that one contract is operated by a plurality of proposals simultaneously can cause confusion occurs; for example, if the current state of the contract is frozen and an upgrade request and a unfreeze request are initiated at the same time, the state of the contract is uncertain after the proposal is executed, and therefore transactional guarantee must be provided for contract operation;
3) a deployment contract must be one that does not exist; upgrading a contract must be upgrading an existing contract; freezing a contract must be freezing an existing and running contract; the thawing contract must be a contract that is in freezing; version rollback must be that the contract already exists and is running and there is the last version, and version advance must be that the contract already exists and is running and there is the next version.
After the proposal is successfully initiated, informing relevant organizations to carry out voting operation on the proposal, and if more than half of the organizations agree with the contract operation proposal, generating a proposal to-be-executed message and sending the proposal to the BaaS terminal; if half of organizations refuse contract operation proposal, the proposal voting state is marked as that the table fails;
particularly, the permission for redeploying the intelligent contract is set for certain specific organizations in the channel, when the proposal initiation fails and is the deployment of the intelligent contract, if the proposal initiation organization has the permission for redeploying, a request for redeploying is initiated, and the deployment of the intelligent contract is carried out again.
In this embodiment, unlike other management contract proposals, the deployment contract is the deployment of a new contract, and before deployment, a new contract needs to be created, and the creation of a new contract is also performed in the form of initiating a proposal.
In the second aspect, the message module is divided into two parts, including contract end message generation and BaaS end message processing;
the type of the message comprises a proposal initiating result, a proposal voting result and a proposal executing result;
the BaaS terminal acquires all state information with Message and MspID as prefixes when calling a function for acquiring the Message, wherein the MspID is acquired based on information of a caller; if the proposal is initiated completely, newly adding an initiating result message in a database; if the proposal voting is finished, newly adding voting result information in a database; and if the proposal is executed, newly adding an execution result message in the database.
In a third aspect, the proposal execution module performs installation and instantiation operations of related contracts;
the proposal execution is a part of the BaaS for carrying out actual operation on the contract, and the BaaS end can carry out actual operation on the contract when receiving a new proposal to be executed message;
the processing according to the different proposal types is as follows:
1) the contract deployment is to deploy a new contract, upload the new contract to the channel, and install the new contract at an endorsement node where the new contract needs to be deployed, wherein the proposal information at least comprises the name and the version number of the new contract, the channel name, the initialization parameter, the endorsement policy and the private data, and the specific flow is shown in fig. 3;
2) the contract upgrading is to upgrade the current contract, select the existing contract in the channel and install, wherein, the proposal information at least includes the name and version number of the current contract, the name and version number of the upgraded contract, the channel name, the endorsement policy and the private data, and the specific flow is as shown in fig. 4;
3) all the calls of the current contract are modified to return 'the contract is frozen', the endorsement policy of the current contract is replaced by the endorsement policy of all the organizations, the ID of the contract is set to be null, the modified contract is the frozen contract, and the frozen contract is installed, wherein the proposal information at least comprises the name, the version number and the channel name of the current contract, and the specific flow is shown in FIG. 5;
4) the unfreezing contract is the original contract before freezing is installed, wherein the proposal information at least comprises the name, the version number and the channel name of the current contract, the current contract is selected, and the specific flow is shown in figure 6;
5) the version rollback and version advance of the contract require that the current contract is in operation, and the contract with the previous version/the next version is available, and the contract meeting the conditions is selected for installation, wherein the proposal information at least comprises the name of the current contract, the version number of the contract with the previous/next version, and the channel name, and the specific flow is shown in fig. 7 and 8;
6) upgrading parameters of the contract, modifying the endorsement policy and the private data set of the contract without changing the version number of the current contract, and installing the modified contract, wherein the proposal information at least comprises the name, the version number, the channel name, the endorsement policy and the private data of the current contract, and the specific flow is shown in fig. 9;
note that the upgrading, freezing, unfreezing, version rollback, version advance, parameter upgrading, when installing the relevant contract, the endorsement node where the current contract is installed is selected for installation.
In addition to the above three modules, the BaaS end in this embodiment further includes a message receiving module, a selective installation module, a configuration module, and a direction instance module when performing message processing;
the message receiving module receives a proposed plan message to be executed; the selection installation module is used for installing related intelligent contracts at endorsement nodes selected by a proposal initiating organization; the configuration module is used for configuring Stateresult and Service for the external chain code container; and the pointing instance module is used for pointing the current intelligent contract ID of the organization where the endorsement node is located to the installed related intelligent contract ID and instantiating the related intelligent contract after the external chain code container is normally started.
In the embodiment, contract detail inquiry is also provided, and intelligent contract information and historical version information thereof deployed in each channel can be checked; when the intelligent contract proposal is operated, the current version information and the original version information of the intelligent contract are saved, and the saved information at least comprises the following information: the name, version number, path, initialization parameter, endorsement policy, state, MD5 value, channel name, set configuration, proposal initiating organization, initiating time and submitting time of the intelligent contract.
Other embodiments of the present disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the disclosure disclosed herein. This specification is intended to cover any variations, uses, or adaptations of the specification following, in general, the principles of the specification and including such departures from the present disclosure as come within known or customary practice within the art to which the specification pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the specification being indicated by the following claims.
It will be understood that the present description is not limited to the precise arrangements described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present description is to be limited only by the terms of the appended claims.

Claims (10)

Translated fromChinese
1.一种基于外部链码容器实现智能合约生命周期管理方法,其特征在于,包括以下步骤:1. a method for realizing smart contract life cycle management based on external chain code container, is characterized in that, comprises the following steps:获取通道内提案发起组织发起的智能合约提案请求,并判断提案请求是否发起成功,其中,所述智能合约提案为智能合约的生命周期管理;Obtain the smart contract proposal request initiated by the proposal initiating organization in the channel, and determine whether the proposal request is successfully initiated, wherein the smart contract proposal is the life cycle management of the smart contract;若提案请求发起成功,则发起投票通知以使得通道内的所有组织对所述提案请求进行投票;If the proposal request is successfully initiated, a voting notification is initiated to enable all organizations in the channel to vote on the proposal request;若投票超过半数,则生成提案待执行消息并发送至BaaS端。If more than half of the votes are cast, a proposal pending message will be generated and sent to the BaaS side.2.根据权利要求1所述的基于外部链码容器实现智能合约生命周期管理方法,其特征在于,所述生命周期管理至少包括部署、升级、冻结、解冻、版本回退、版本前进以及参数升级中的一种或多种;2. The method for implementing smart contract life cycle management based on an external chain code container according to claim 1, wherein the life cycle management at least includes deployment, upgrade, freezing, thawing, version rollback, version advance and parameter upgrade one or more of;所述部署,获取新智能合约并上传至通道,在需部署新智能合约的背书节点处安装所述新智能合约;For the deployment, obtain a new smart contract and upload it to the channel, and install the new smart contract at the endorsement node where the new smart contract needs to be deployed;所述升级,获取升级后智能合约,安装所述升级后智能合约,其中,所述升级后智能合约为通道内已有的智能合约;For the upgrade, the upgraded smart contract is obtained, and the upgraded smart contract is installed, wherein the upgraded smart contract is an existing smart contract in the channel;所述冻结,对于当前智能合约的所有调用都修改为返回“合约已冻结”,将所述当前智能合约的背书策略替换成需要所有组织的背书,并将其ID置为空,修改后得到的智能合约为冻结合约,安装所述冻结合约;For the freezing, all calls to the current smart contract are modified to return "contract has been frozen", replace the endorsement policy of the current smart contract with the endorsement of all organizations, and set its ID to empty, the modified The smart contract is a frozen contract, and the frozen contract is installed;所述解冻,获取冻结前的原智能合约,安装所述原智能合约;For the unfreezing, obtain the original smart contract before freezing, and install the original smart contract;所述版本回退及版本前进,当前智能合约有上一个版本/下一个版本的智能合约,选择符合条件的智能合约进行安装;The version rollback and version forward, the current smart contract has the previous version/next version of the smart contract, select the smart contract that meets the conditions for installation;所述参数升级,不改变当前智能合约的版本号,将所述当前智能合约对应的背书策略、私密数据集合进行修改,得到修改后的智能合约并安装;The parameter upgrade does not change the version number of the current smart contract, and modifies the endorsement policy and private data set corresponding to the current smart contract to obtain the modified smart contract and install it;所述升级、冻结、解冻、版本回退、版本前进、参数升级,在安装相关智能合约时,选择已安装当前智能合约的背书节点处进行安装。The upgrade, freeze, thaw, version rollback, version forward, parameter upgrade, when installing the relevant smart contract, select the endorsement node that has installed the current smart contract for installation.3.根据权利要求1所述的基于外部链码容器实现智能合约生命周期管理方法,其特征在于,还包括提案发起失败的可能,包括以下情况:3. The method for implementing smart contract lifecycle management based on an external chaincode container according to claim 1, further comprising the possibility of failure of proposal initiation, including the following situations:当提案为智能合约的部署时,若所述新智能合约与通道内已有智能合约重名,则提案发起失败;When the proposal is the deployment of a smart contract, if the new smart contract has the same name as an existing smart contract in the channel, the proposal fails to be initiated;所述提案为智能合约的升级、冻结、解冻、版本回退、版本前进以及参数升级时,若当前智能合约有正在处理中的提案,则提案发起失败;When the proposal is smart contract upgrade, freeze, thaw, version rollback, version forward, and parameter upgrade, if the current smart contract has a proposal being processed, the proposal fails to be initiated;为通道内的某些特定组织设置重新部署智能合约的权限,提案发起失败且提案为智能合约的部署时,若提案发起组织有重新部署的权限,则发起重新部署的请求,再次进行智能合约的部署。Set the permission to redeploy smart contracts for some specific organizations in the channel. When the proposal fails and the proposal is the deployment of smart contracts, if the organization that initiated the proposal has the permission to redeploy, it will initiate a redeployment request and execute the smart contract again. deploy.4.一种基于外部链码容器实现智能合约生命周期管理方法,其特征在于,包括以下步骤:4. A method for realizing smart contract life cycle management based on an external chain code container, characterized in that it comprises the following steps:BaaS端接收提案待执行消息;The BaaS side receives the proposal pending message;在提案发起组织已选择的背书节点中安装相关智能合约;Install the relevant smart contract in the endorsement node selected by the proposal sponsoring organization;为外部链码容器配置Statefulset和Service;Configure Statefulset and Service for external chaincode container;当外部链码容器正常启动后,将背书节点所在组织的当前智能合约ID指向已安装相关智能合约ID,并进行相关智能合约的实例化。When the external chaincode container starts normally, point the current smart contract ID of the organization where the endorsement node is located to the ID of the relevant smart contract installed, and instantiate the relevant smart contract.5.根据权利要求4所述的基于外部链码容器实现智能合约生命周期管理方法,其特征在于,还包括:所述智能合约运行在外部链码容器;5. The method for implementing smart contract lifecycle management based on an external chain code container according to claim 4, further comprising: the smart contract runs in an external chain code container;若相关智能合约为首次安装,则在安装前,上传智能合约链码包,否则不上传;若要上传智能合约链码包,则将原本的智能合约链码包解压,基于智能合约创建时上传的索引和集合,生成元数据配置文件和连接配置文件,与解压后的文件一起,重新打包,得到新智能合约链码包后再上传。If the relevant smart contract is being installed for the first time, upload the smart contract chaincode package before installation, otherwise it will not be uploaded; if you want to upload the smart contract chaincode package, unzip the original smart contract chaincode package and upload it when the smart contract is created index and collection, generate metadata configuration files and connection configuration files, and repackage them together with the decompressed files to obtain a new smart contract chain code package and then upload it.6.根据权利要求5所述的基于外部链码容器实现智能合约生命周期管理方法,其特征在于,所述相关智能合约的安装,还包括:6. The method for implementing smart contract life cycle management based on an external chain code container according to claim 5, wherein the installation of the relevant smart contract further comprises:智能合约链码包上传后,调用SDK接口的智能合约安装方法进行智能合约安装,外部链码容器部署后,基于StatefulSet和Service创建Pod,将链码号和对应的链码服务地址写入环境变量;After the smart contract chaincode package is uploaded, call the smart contract installation method of the SDK interface to install the smart contract. After the external chaincode container is deployed, create a Pod based on StatefulSet and Service, and write the chaincode number and the corresponding chaincode service address into the environment variable. ;进行智能合约的安装和实例化时,若相关智能合约非首次安装,则将实例化中的初始化函数替换成一个空的实现。When installing and instantiating a smart contract, if the relevant smart contract is not installed for the first time, replace the initialization function in the instantiation with an empty implementation.7.一种基于外部链码容器实现智能合约生命周期管理系统,其特征在于,包括提案处理模块、消息模块、提案执行模块;7. A smart contract life cycle management system based on an external chain code container, characterized in that it includes a proposal processing module, a message module, and a proposal execution module;所述提案处理模块,包括提案的发起和表决;The proposal processing module, including proposal initiation and voting;获取通道内提案发起组织发起的智能合约提案请求,并判断提案请求是否发起成功;其中,所述智能合约提案请求包括智能合约的部署、升级、冻结、解冻、版本回退、版本前进以及参数升级;Obtain the smart contract proposal request initiated by the proposal initiating organization in the channel, and judge whether the proposal request is successfully initiated; wherein, the smart contract proposal request includes smart contract deployment, upgrade, freezing, thawing, version rollback, version forward and parameter upgrade ;若提案请求发起成功,则发起投票通知以使得通道内的所有组织对所述提案请求进行投票;If the proposal request is successfully initiated, a voting notification is initiated to enable all organizations in the channel to vote on the proposal request;若投票超过半数,则生成提案待执行消息并发送至BaaS端;If more than half of the votes are cast, a proposal pending message will be generated and sent to the BaaS side;所述消息模块,包括消息的生成和处理,智能合约端生成消息,BaaS端对消息进行处理;The message module includes message generation and processing, the smart contract side generates the message, and the BaaS side processes the message;消息的类型包括提案发起结果、提案表决结果、提案执行结果;若所述提案发起完成,在数据库中新增发起结果消息;若所述提案表决完成,在数据库中新增表决结果消息;若所述提案执行完成,在数据库中新增执行结果消息;The types of messages include proposal initiation results, proposal voting results, and proposal execution results; if the proposal initiation is completed, the initiation result message is added to the database; if the proposal voting is completed, the voting result message is added to the database; When the above proposal is executed, a new execution result message will be added to the database;所述提案执行模块,根据不同类型的提案,执行不同智能合约的安装、实例化操作,其中,相关智能合约运行在外部链码容器。The proposal execution module performs installation and instantiation operations of different smart contracts according to different types of proposals, wherein the relevant smart contracts run in an external chaincode container.8.一种基于外部链码容器实现智能合约生命周期管理系统,其特征在于,还包括BaaS端,所述BaaS端包括消息接收模块、选择安装模块、配置模块及指向实例模块;8. A system for realizing a smart contract life cycle management system based on an external chain code container, further comprising a BaaS end, the BaaS end comprising a message receiving module, a selection installation module, a configuration module and a pointing instance module;所述消息接收模块接收提案待执行消息;The message receiving module receives a proposal to be executed message;所述选择安装模块,用于在提案发起组织已选择的背书节点处安装相关智能合约;The selection and installation module is used to install relevant smart contracts at the endorsement nodes selected by the proposal sponsoring organization;所述配置模块,用于为外部链码容器配置Statefulset和Service;The configuration module is used to configure Statefulset and Service for the external chaincode container;所述指向实例模块,用于当外部链码容器正常启动后,将背书节点所在组织的当前智能合约ID指向已安装相关智能合约ID,并进行相关智能合约的实例化。The pointing-to-instance module is used to point the current smart contract ID of the organization where the endorsement node is located to the installed relevant smart contract ID when the external chaincode container is normally started, and instantiate the relevant smart contract.9.一种计算机可读存储介质,所述计算机可读存储介质存储有计算机程序,其特征在于,所述计算机程序被处理器执行时实现如权利要求1至6任意一项所述的方法步骤。9. A computer-readable storage medium storing a computer program, characterized in that, when the computer program is executed by a processor, the method steps according to any one of claims 1 to 6 are implemented .10.一种基于外部链码容器实现智能合约生命周期管理装置,包括存储器、处理器以及存储在所述存储器中并可在所述处理器上运行的计算机程序,其特征在于,所述处理器执行所述计算机程序时实现如权利要求1至6任意一项所述的方法步骤。10. A device for implementing smart contract lifecycle management based on an external chaincode container, comprising a memory, a processor, and a computer program stored in the memory and running on the processor, characterized in that the processor The method steps of any one of claims 1 to 6 are implemented when the computer program is executed.
CN202111273461.2A2021-10-292021-10-29 A method and system for realizing smart contract life cycle management based on external chaincode containerPendingCN113961211A (en)

Priority Applications (1)

Application NumberPriority DateFiling DateTitle
CN202111273461.2ACN113961211A (en)2021-10-292021-10-29 A method and system for realizing smart contract life cycle management based on external chaincode container

Applications Claiming Priority (1)

Application NumberPriority DateFiling DateTitle
CN202111273461.2ACN113961211A (en)2021-10-292021-10-29 A method and system for realizing smart contract life cycle management based on external chaincode container

Publications (1)

Publication NumberPublication Date
CN113961211Atrue CN113961211A (en)2022-01-21

Family

ID=79468501

Family Applications (1)

Application NumberTitlePriority DateFiling Date
CN202111273461.2APendingCN113961211A (en)2021-10-292021-10-29 A method and system for realizing smart contract life cycle management based on external chaincode container

Country Status (1)

CountryLink
CN (1)CN113961211A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN114995828A (en)*2022-06-242022-09-02上海万向区块链股份公司 Smart contract online invocation method, system, medium and device

Citations (3)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN109087104A (en)*2018-08-292018-12-25北京京东尚科信息技术有限公司Block chain intelligence contract administration method and system, computer readable storage medium
US20210042851A1 (en)*2019-08-072021-02-11International Business Machines CorporationAutomonous multi-cloud solution design and fulfillment via crowdsourcing
CN112907250A (en)*2021-03-312021-06-04中国建设银行股份有限公司Block chain-based electronic warehouse bill management method, device, medium and electronic equipment

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN109087104A (en)*2018-08-292018-12-25北京京东尚科信息技术有限公司Block chain intelligence contract administration method and system, computer readable storage medium
US20210042851A1 (en)*2019-08-072021-02-11International Business Machines CorporationAutomonous multi-cloud solution design and fulfillment via crowdsourcing
CN112907250A (en)*2021-03-312021-06-04中国建设银行股份有限公司Block chain-based electronic warehouse bill management method, device, medium and electronic equipment

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
中国人民银行: "中华人民共和国金融行业标准", 《中华人民共和国金融行业标准》, 10 July 2020 (2020-07-10), pages 4 - 92*
马永亮: "《KUbernetes进阶实战第2版》", 28 February 2021, 机械工业出版社, pages: 301 - 307*

Cited By (1)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN114995828A (en)*2022-06-242022-09-02上海万向区块链股份公司 Smart contract online invocation method, system, medium and device

Similar Documents

PublicationPublication DateTitle
CN107562513B (en)Intelligent contract life cycle management method based on JAVA
US9367301B1 (en)Dynamic update of a distributed message processing system
CN107391104B (en)Client and reactive native code update dependence management method, device and system
US9852220B1 (en)Distributed workflow management system
WO2019028992A1 (en)Multi-module version dependency relationship construction method, device, server and storage medium
US20230229413A1 (en)Intelligent management of software deployment based on code change
CN1936844A (en)Method and system for updating software
CN112114894B (en) Process processing method, device and electronic device based on Activiti process engine
CN109729075B (en) A cloud platform component security policy implementation method
CN112470119A (en)Service upgrading method and device in distributed system and distributed system
CN111414189A (en) A method and device for determining version compatibility
US20250077262A1 (en)Cluster management method, electronic device, and storage medium
CN113741923A (en)Application updating method, device, equipment and medium
CN118170431B (en)Cross-operating system service migration method and device and electronic equipment
CN111459530B (en) Patching method, device and storage medium
CN116610493A (en)Checkpoint-based application dump and recovery method, checkpoint-based application dump and recovery equipment and storage medium
CN113961211A (en) A method and system for realizing smart contract life cycle management based on external chaincode container
CN107463390B (en)Software upgrading method and upgrading server
US12112154B2 (en)Automated software deployment techniques
CN108920171A (en)Firmware update and device, electronic equipment
CN119718385A (en)Operating system updating method, electronic device, storage medium and program product
US12039473B2 (en)Software development project infrastructure builder tool
CN108536447B (en) Operation and maintenance management method
CN111008035B (en)Software operation and maintenance method, electronic equipment and storage medium
CN114416131B (en) Application upgrade method, application upgrade platform, electronic device and storage medium

Legal Events

DateCodeTitleDescription
PB01Publication
PB01Publication
SE01Entry into force of request for substantive examination
SE01Entry into force of request for substantive examination
RJ01Rejection of invention patent application after publication
RJ01Rejection of invention patent application after publication

Application publication date:20220121


[8]ページ先頭

©2009-2025 Movatter.jp