Chain code container management method, device, equipment and storage medium of alliance chain

By using a remote docker server to run the chain code container of the alliance chain in the k8s environment, the problem that k8s cannot manage the chain code container is solved, and the effective management and operation of the chain code container is realized, which simplifies the operation process and reduces resource consumption.

CN112631728BActive Publication Date: 2025-02-18HANGZHOU QULIAN TECHNOLOGY CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202011584400.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-12-28
Publication Date
2025-02-18
Estimated Expiration
2040-12-28

AI Technical Summary

Technical Problem

When using k8s for alliance chain deployment, k8s cannot manage the chain code container created by peer nodes, causing peer nodes to drift in the k8s environment and unable to establish communication with the chain code.

Method used

Run the chain code container through the remote docker server, without modifying the source code of the alliance chain, and configure the access address information of the chain code container to establish a communication connection with the node.

Benefits of technology

It realizes the management and operation of chain code containers, avoids tedious operations, simplifies processes, reduces resource consumption, and provides a good operating environment.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112631728B_ABST
    Figure CN112631728B_ABST
Patent Text Reader

Abstract

The present application provides a chain code container management method, device, equipment and storage medium of a consortium chain, wherein the consortium chain is deployed in an open source containerized application, including: establishing a remote docker server corresponding to the node to be deployed in the container cluster of the open source containerized application; running the chain code container of the consortium chain through the remote docker server, wherein the chain code container is configured with access address information about the node; and establishing a communication connection between the chain code container and the node based on the access address information. The present application can run the chain code container through a remote docker server without modifying the source code of the consortium chain, eliminating tedious and complicated operations, and the implementation method is simple and practical, takes less time, and provides a good operating environment.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of communication technology, and in particular to a chain code container management method, device, computer equipment and storage medium for a consortium chain. Background Art

[0002] In the process of developing and deploying applications, there are always various inexplicable problems when the test environment is clearly good, especially for some applications with complex deployment. Sometimes you need to deploy multiple identical applications, and you have to invest a lot of manpower, time and other resources in this repetitive work. When faced with applications with thousands or even tens of thousands of deployments, the problem is even more prominent, and a lot of resources are swallowed up by these operation and maintenance costs. So engineers are wondering if they can include all the environments (environmental variables, hosts, data storage locations, etc.) required by the application into the application. Form a self-contained, self-sufficient small ecosystem. Deployment only requires running the whole without configuring (or configuring a small amount of) various environment variables. Copying virtual machines and running multiple virtual machines can indeed meet the needs, but the virtual machine images range from a few G (such as Ubuntu CentOS) to dozens of G (Windows), which consumes too much storage resources, and virtual machines have a large loss of resources. So container technology came into being. Containers are a lightweight, portable, self-contained software packaging technology that allows applications to run in the same way almost anywhere.

[0003] Kubernetes, also known as k8s, can provide orchestration and management functions to easily complete large-scale container deployment. With the orchestration function of k8s, users can build application services across multiple containers, implement cross-cluster scheduling, expand containers, and manage the health of these containers in the long term, etc. It also integrates network, storage, security, monitoring and other services to provide a comprehensive container infrastructure. However, when using k8s for alliance chain deployment, k8s cannot manage the chain code container created by the peer node. The peer node will drift in the k8s environment and cannot establish communication with the chain code. Summary of the invention

[0004] The present application provides a chain code container management method, device, computer equipment and storage medium for a consortium chain, which can run the chain code container through a remote Docker server without modifying the source code of the consortium chain, eliminating tedious and complicated operations, and the implementation method is simple and practical, takes less time, and provides a good operating environment.

[0005] According to one aspect of the present application, a chaincode container management method for a consortium chain is provided, wherein the consortium chain is deployed in an open source containerized application, and the method includes:

[0006] Establishing a remote Docker server corresponding to the node to be deployed in the container cluster of the open source containerized application;

[0007] Running the chain code container of the alliance chain through the remote Docker server, wherein the chain code container is configured with access address information about the node;

[0008] A communication connection between the chain code container and the node is established based on the access address information.

[0009] According to one aspect of the present application, a chain code container management device for a consortium chain is provided, wherein the consortium chain is deployed in an open source containerized application, and the device includes:

[0010] An establishment module is used to establish a remote Docker server corresponding to the node to be deployed in the container cluster of the open source containerized application;

[0011] A running module, used to run the chain code container of the alliance chain through the remote Docker server, wherein the chain code container is configured with access address information about the node;

[0012] A communication module is used to establish a communication connection between the chain code container and the node based on the access address information.

[0013] According to one aspect of the present application, a chain code container management device for a consortium chain is also provided, the device comprising:

[0014] one or more processors;

[0015] Memory; and

[0016] One or more applications, wherein the one or more applications are stored in the memory and configured to be executed by the processor to perform the operations of any of the methods described above.

[0017] According to one aspect of the present application, a computer-readable storage medium is further provided, on which a computer program is stored, and the computer program is loaded by a processor to execute the operation of any of the methods described above.

[0018] In this application, the chain code container is run through a remote docker server, and there is no need to modify the source code of the alliance chain, which saves tedious and complicated operations. The implementation method is simple and practical, takes less time, and provides a good operating environment. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.

[0020] Figure 1 A method flow chart showing a chain code container management method of a consortium chain provided in an embodiment of the present application is shown;

[0021] Figure 2 An example of an embodiment provided in the embodiments of the present application is shown;

[0022] Figure 3 The functional modules of the chain code container management device provided in the embodiment of the present application are shown;

[0023] Figure 4 An exemplary system is shown that can be used to implement the various embodiments described in this application.

[0024] The same or similar reference numerals in the drawings represent the same or similar components. DETAILED DESCRIPTION

[0025] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.

[0026] In the description of the present invention, it should be understood that the terms "center", "longitudinal", "lateral", "length", "width", "thickness", "up", "down", "front", "back", "left", "right", "vertical", "horizontal", "top", "bottom", "inside", "outside" and the like indicate positions or positional relationships based on the positions or positional relationships shown in the accompanying drawings, which are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as limiting the present invention. In addition, the terms "first" and "second" are only used for descriptive purposes, and cannot be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Therefore, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features. In the description of the present invention, the meaning of "multiple" is two or more, unless otherwise clearly and specifically defined.

[0027] In this application, the word "exemplary" is used to mean "serving as an example, illustration, or illustration." Any embodiment described in this application as "exemplary" is not necessarily to be construed as being preferred or advantageous over other embodiments. The following description is given to enable any person skilled in the art to implement and use the invention. In the following description, details are listed for the purpose of explanation. It should be understood that a person of ordinary skill in the art can recognize that the invention can be implemented without using these specific details. In other instances, well-known structures and processes are not elaborated in detail to avoid obscuring the description of the invention with unnecessary details. Therefore, the present invention is not intended to be limited to the embodiments shown, but is consistent with the widest scope consistent with the principles and features disclosed in this application.

[0028] It should be noted that since the method of the embodiment of the present application is executed in a computing device, the processing objects of each computing device exist in the form of data or information. For example, time is actually time information. It can be understood that if size, quantity, position, etc. are mentioned in subsequent embodiments, they are all corresponding data for processing by the electronic device. The details will not be elaborated here.

[0029] In a typical configuration of the present application, a terminal or a trusted party includes one or more processors, such as a central processing unit (CPU), an input / output interface, a network interface, and a memory. The memory may include non-permanent memory in a computer-readable medium, a random access memory (RAM) and / or a non-volatile memory in the form of a read-only memory (ROM) or a flash memory. The memory is an example of a computer-readable medium.

[0030] Computer readable media include permanent and non-permanent, removable and non-removable media that can be used to store information by any method or technology. Information can be computer readable instructions, data structures, modules of programs or other data. Examples of computer storage media include, but are not limited to, Phase-Change Memory (PCM), Programmable Random Access 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, Compact Disc Read-Only Memory (CD-ROM), Digital Versatile Disc (DVD) or other optical storage, magnetic cassettes, tape disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device.

[0031] The devices referred to in this application include but are not limited to user devices, network devices, or devices formed by integrating user devices and network devices through a network. The user devices include but are not limited to any mobile electronic products that can interact with users (for example, interact with users through a touchpad), such as smart phones, tablet computers, etc. The mobile electronic products can use any operating system, such as Android operating system, iOS operating system, etc. Among them, the network device includes an electronic device that can automatically perform numerical calculations and information processing according to pre-set or stored instructions, and its hardware includes but is not limited to microprocessors, application specific integrated circuits (Application Specific Integrated Circuit, ASIC), programmable logic devices (Programmable Logic Device, PLD), field programmable gate arrays (Field Programmable Gate Array, FPGA), digital signal processors (Digital Signal Processor, DSP), embedded devices, etc. The network devices include but are not limited to computers, network hosts, single network servers, multiple network server sets or multiple servers. The cloud is composed of a large number of computers or network servers based on cloud computing (Cloud Computing), wherein cloud computing is a type of distributed computing, a virtual supercomputer composed of a group of loosely coupled computer sets. The network includes but is not limited to the Internet, a wide area network, a metropolitan area network, a local area network, a VPN network, a wireless self-organizing network (Ad Hoc network), etc. Preferably, the device may also be a program running on the user device, the network device, or a device formed by integrating the user device and the network device, the network device, the touch terminal, or the network device and the touch terminal through a network.

[0032] Of course, those skilled in the art should understand that the above-mentioned devices are only examples, and other existing or future devices that are applicable to the present application should also be included in the scope of protection of the present application and are included here by reference.

[0033] The present application provides a chain code container management method for a consortium chain, wherein the consortium chain is deployed in an open source containerized application, such as a k8s environment. The following embodiments are described below using the k8s environment as an example. Those skilled in the art should understand that the embodiments are also applicable to other open source containerized applications. Among them, the core concepts of k8s include Pod, Volume, Deployment, Service, Namespaces, etc. Among them, pod is the minimum scheduling and resource unit of k8s, consisting of one or more containers. Pod defines the container operation mode (Command, environment variables, etc.) and provides a shared operating environment (network, process space) for containers; volume declares the file directory accessible to the container in the pod, and the directory is mounted under the specified path of one or more containers in the pod, supporting multiple backend storage abstractions (local storage, distributed storage, cloud storage); deployment defines the number of copies and versions of a group of pods, and maintains the number of pods through a controller. The controller controls the version (rolling upgrade, regeneration, rollback, etc.) with a specified strategy; service provides a stable access address for accessing one or more pod instances. Supports multiple access methods (ClusterIP, NodePort, LoadBalancer); Namespaces is a logical isolation mechanism within the cluster (authentication, resource quota). Each resource belongs to a namespace. Resources in the same namespace are uniquely named, and different namespaces can have the same name.

[0034] The consortium chain is a distributed system composed of many nodes that communicate with each other. The consortium chain runs a program called chaincode, saves state and ledger data, and executes transactions. Chaincode is an intermediate element because transactions are operations called on chaincode. Transactions must be "approved", and only approved transactions may be submitted and have an impact on the state. Nodes are the communication entities of the consortium chain. In the sense that multiple nodes of different types can run on the same physical server, a "node" is just a logical function. What is important is how to group nodes into "trust domains" and associate them with the logical entities that control them.

[0035] Usually in the k8s environment, the k8s cluster cannot manage the chain code container created by the peer node. For example, the peer node will drift in the k8s environment, and the communication connection with the chain code container will be interrupted after the drift. This difficulty can be solved by modifying the source code of the alliance chain, replacing the native docker API, integrating the k8s API, and handing over the creation, start, and stop of the chain code to k8s. However, this method requires very proficient knowledge of the source code of the alliance chain, which is very difficult to implement and takes a long time.

[0036] The method can be applied to a corresponding computer device, in which a corresponding chain code container management device is integrated. In the application embodiment, the computer device is mainly used to manage the chain code container management of the alliance chain.

[0037] In the embodiments of the present application, the computer device may be an independent server, or a server network or server cluster composed of servers. For example, the computer device described in the embodiments of the present application includes but is not limited to a computer, a network host, a single network server, a plurality of network server sets or a cloud server composed of a plurality of servers. The cloud server is composed of a large number of computers or network servers based on cloud computing.

[0038] See also Figure 1 , a chaincode container management method of a consortium chain according to one aspect of the present application is shown, the consortium chain is deployed in an open source containerized application, and the method includes steps S101, S102, and S103. In step S101, a remote docker server corresponding to a node to be deployed in a container cluster of the open source containerized application is established; in step S102, the chaincode container of the consortium chain is run through the remote docker server, wherein the chaincode container is configured with access address information about the node; in step S103, a communication connection between the chaincode container and the node is established based on the access address information.

[0039] Specifically, in step S101, a remote docker server corresponding to the node to be deployed in the container cluster of the open source containerized application is established. For example, the open source containerized application includes k8s, and the k8s alliance chain includes three types of nodes, such as clients, accounting nodes (peer nodes) or sorting nodes (or consensus nodes), etc., wherein the client refers to a client that submits an actual transaction call to a supporter and broadcasts the transaction proposal to the subscription service; the peer is used to receive ordered state updates in the form of blocks from the subscription server and maintain the state and ledger; the subscription service node refers to the subscriber forming the subscription service, that is, the communication structure that provides delivery guarantee. The subscription service can be implemented in different ways: from centralized services (for example, used in development and testing) to distributed protocols for different network and node failure models.

[0040] The nodes include peer nodes, and the blockchain network is mainly composed of a series of peer nodes. Peers are the foundation of the entire network because they are the carriers of ledgers and smart contracts. Through smart contracts, the ledger records the entire process of the transaction in an unalterable way. In the blockchain, smart contracts and ledgers are used to encapsulate shared processing projects and shared information in the entire network. From this perspective, Peer is a good entry point to understand the Hyperledger. A blockchain network consists of peer nodes, each of which holds one or more ledgers and one or more smart contracts. Since peers hold ledgers and chain codes, administrators and applications must access these resources through peers. For this reason, peers are called the most basic modules in the Hyperledger blockchain network. When a peer is created, there is neither a ledger nor a chain code in it. In fact, since a peer may hold multiple ledgers and multiple chain codes, channels in the Hyperledger are particularly important.

[0041] Simply put, the interaction between applications and peer nodes mainly includes ledger query and ledger update. Ledger query only requires three simple sessions; while ledger update requires two additional sessions. Applications always access ledgers and chain codes through peers. The SDK provided by Hyperledger allows applications to connect to peers, call chain codes to generate transactions, submit transactions to the entire network, and receive events generated during the processing.

[0042] Docker is an open source application container engine that allows developers to package their applications and dependent packages into a portable image, and then publish it to any popular Linux or Windows machine, and can also achieve virtualization. A complete Docker consists of the following parts: Docker Client, Docker Daemon, Docker Image, and Docker Container. By modifying the server configuration, you can specify multiple connection methods, including remote access to the Docker server, such as configuring the corresponding Docker on the remote device and configuring the remote access method to establish a remote Docker server corresponding to the node to be deployed.

[0043] In some embodiments, in step S101, an external access method corresponding to the node to be deployed in the container cluster is created, wherein the external access method includes the server access address information of the corresponding remote docker server; the access address information of the node is obtained, and the corresponding environment variables are configured according to the access address information and the server access address information; the node is deployed using the container cluster based on the configured environment variables to establish the remote docker server corresponding to the node. For example, an external access method is first created for the node to be deployed, wherein the external access method includes the server access address information of the remote docker server, and the access address information includes the corresponding computer communication identification (internet protocol, ip) address information, port configuration, etc.; then, the access address information of the node external access method is obtained, such as the ip address information, port configuration, etc. of the node. The environment variables are configured according to the access address information of the node and the server access address information of the remote docker server, thereby providing a basis for the deployment of the k8s node. The environment variables are deployed in a yaml file. After the yaml file is completed, the corresponding node can be deployed according to the yaml file through the kubectl command. In some embodiments, the environment variable includes a chain code address parameter and an endpoint parameter, and the chain code address parameter and the endpoint parameter are included in a corresponding node configuration file; wherein, configuring the corresponding environment variable according to the access address information and the server access address information includes: configuring the chain code address parameter in the node configuration file based on the access address information, and configuring the endpoint parameter in the node configuration file based on the server access address information, so as to complete the configuration of the environment variable. For example, the chain code address parameter includes a CORE_PEER_CHAINCODEADDRESS parameter, the endpoint parameter includes a CORE_VM_ENDPOINT parameter, the node configuration file includes a corresponding peer.yaml file, and the CORE_PEER_CHAINCODEADDRESS parameter and the CORE_VM_ENDPOINT parameter are included in the corresponding peer.yaml file. For example, the peer.yaml file is a node configuration file for configuring relevant parameters of the node to be deployed, including corresponding environment variable related parameters, such as CORE_PEER_CHAINCODEADDRESS parameter and CORE_VM_ENDPOINT parameter.Among them, the CORE_PEER_CHAINCODEADDRESS parameter is used to configure the access address information of the node, such as configuring the IP address information and port configuration of the node's external access method to the CORE_PEER_CHAINCODEADDRESS parameter of the peer.yaml file to configure the corresponding environment variables; the CORE_VM_ENDPOINT parameter is used to configure the server access address information of the remote docker server, such as configuring the IP address information and port configuration of the remote docker server to the CORE_VM_ENDPOINT parameter of the peer.yaml file to configure the corresponding environment variables, etc. Based on the configured environment variables, k8s can be used to deploy peer nodes, etc.

[0044] In step S102, the chain code container of the alliance chain is run through the remote docker server, wherein the chain code container is configured with access address information about the node. For example, the purpose of the chain code container is to ensure that the execution of the smart contract is isolated from the alliance chain node itself. When instantiating the chain code, the peer populates the container image with the chain code and calls the Docker management API to deploy the image. If the container does not exist, the image is used to create and start the container, if the container is stopped, the container is started, etc. Once running, all transactions and proposals received by the alliance chain node will be transferred to the container for execution. The chain code initialization of the node can be achieved through the docker service of the remote docker server, and the corresponding chain code image is generated. For example, the docker service on the remote docker server is called to generate a chain code image, and the corresponding chain code container is created, started, and stopped, and the external access mode of the node (such as IP address information, port configuration, etc.) is configured in the chain code container, so as to ensure that the chain code container can actively establish a communication connection with the node. Since the communication connection is determined based on the access address information of the node in the chain code container, the communication state is good and not easily interrupted.

[0045] In some embodiments, in step S102, a corresponding chaincode image is constructed according to a creation instruction received by the remote docker server and sent by the node, wherein the creation instruction includes the chaincode source code corresponding to the chaincode container; and the chaincode container is created and started according to a startup instruction received by the remote docker server and sent by the node, and the chaincode image. For example, in a native k8s environment, the node will use the docker program (such as docker service, etc.) installed on the local docker server to create and start the chaincode container of the alliance chain. This method uses a remote docker server to initialize the chaincode. Compared with the local docker server, even if the node drifts in the k8s cluster, it will always use the same remote docker server. Specific chaincode initialization includes image construction and starting the chaincode container. Figure 2 As shown in the figure, the specific image building process is started based on the creation instruction sent by the node. The creation instruction contains the chain code source code. The creation instruction is sent by the node to the remote docker server. For example, when the peer is started, the startChaincodeServer function is called in the serve function to start the server, and the image building is completed through the chain code source code. Subsequently, the node will send the corresponding startup instruction to the remote docker server, and the docker server will create and start the chain code container according to the built image.

[0046] In some cases, the creation instruction also includes environment variables for starting the chaincode container. For example, in some embodiments, the creation instruction also includes environment variables corresponding to starting the chaincode container; wherein, the creation and starting of the chaincode container according to the startup instruction received by the remote docker server and sent by the node, and the chaincode image, includes: creating the chaincode container according to the startup instruction received by the remote docker server and sent by the node, and the chaincode image, and passing the environment variables to the chaincode container to start the chaincode container. For example, the creation instruction also includes corresponding environment variables, and the remote docker server first creates the corresponding chaincode container according to the chaincode image through the remote docker service, and then passes parameters such as environment variables to the chaincode container to start the chaincode container.

[0047] In step S103, a communication connection is established between the chain code container and the node based on the access address information. For example, based on the IP address information and port configuration of the node's external access method, the chain code container first calls the Start function after startup, which calls userChaincodeStreamGetter to establish a communication connection with the node and calls NewChaincodeSupportClient to create a grpcClient to obtain the communication stream between the two parties. Finally, the Start function starts the communication connection and sends a chain code registration message to the node for registration and starts to continuously receive communication information sent by the node in a for loop. When the client of the chain code container calls the Register function, the node end will also call the corresponding Register function, and then call ProcessStream to start receiving the communication information of the chain code container.

[0048] In some embodiments, the startup instruction further includes access address information of the node, and the access address information is used to configure the environment variable; wherein, establishing a communication connection between the chain code container and the node based on the access address information includes: establishing a communication connection between the chain code container and the node according to the access address information in the environment variable. For example, the access address information of the node may be sent by the node when sending a startup instruction to a remote docker server, and the access address information of the node is included in the startup instruction, which is used to create and start a chain code container, and establish a communication connection between the chain code container and the node after starting the chain code container.

[0049] In some embodiments, the method further includes step S104 (not shown), when the node drifts, the communication connection is kept in a connected state based on the access address information. For example, in a k8s environment, due to restart or other reasons, the node drifts from host A to host B. Due to the characteristics of the remote docker service, the ip address information and port configuration in the previous external access method remain unchanged, and the node can still be accessed through the corresponding access address information, etc., and the communication connection between the chain code container and the node is re-established, thereby keeping the communication connection in a connected state.

[0050] For example, in some embodiments, in step S103, a remote server of the same level as the server of the open source containerized application is configured; a communication connection between the chain code container and the node is established according to the server access address information of the remote server and the access address information. For example, load balancing (LB for short) is a cluster technology for servers or network devices. Load balancing shares specific services (network services, network traffic, etc.) to multiple servers or network devices, thereby improving the service processing capability and ensuring the high availability of the service. The basic concepts of load balancing include: real service, real service group, virtual service, scheduling algorithm, persistence, etc. Its common application scenarios are mainly server load balancing and link load balancing. A server access address information is assigned to the node by loadbalance, and the server access address information can be accessed outside the k8s cluster. The communication connection between the chain code container in the remote docker server and the node can be established through the server access address information of the remote server and the access address information of the node, such as creating an IP address information of the same level as the k8s server for the container corresponding to the node outside the current application, and forwarding all traffic accessing the IP address information to the container corresponding to the node.

[0051] For example, in some embodiments, in step S103, a nodeport port is created on the server of the container cluster of the open source containerized application; the cluster service access address information of the container cluster is obtained, and the nodeport port is added to the cluster service access address information as the server access address information of the remote server corresponding to the node to be deployed; and a communication connection between the chain code container and the node is established according to the server access address information of the remote server and the access address information. For example, the NodePort service is the most primitive way to direct external traffic to your service. NodePort, as the name suggests, opens a specific port on all nodes (virtual machines), and any traffic sent to the port is forwarded to the corresponding service. The computer device can open a nodeport port on the k8s server (such as the k8s host, etc.), and add the nodeport port to the access address information of other servers that access the k8s host at will (such as other IP address information, etc.), so as to forward the corresponding traffic to the container corresponding to the node, etc., and establish a communication connection between the chain code container and the node based on this.

[0052] The above mainly introduces the various implementation methods of the chain code container management method of the alliance chain of the present application. In addition, the present application also provides a chain code container management device that can implement the above implementation methods. Figure 3 Make an introduction.

[0053] See also Figure 3, shows a chaincode container management device for a consortium chain according to one aspect of the present application, wherein the consortium chain is deployed in an open source containerized application, and the device includes an establishment module 101, an operation module 102, and a communication module 103. The establishment module 101 is used to establish a remote docker server corresponding to the node to be deployed in the container cluster of the open source containerized application; the operation module 102 is used to run the chaincode container of the consortium chain through the remote docker server, wherein the chaincode container is configured with access address information about the node; the communication module 103 is used to establish a communication connection between the chaincode container and the node based on the access address information. Here, the Figure 3 The establishment module 101, the operation module 102 and the communication module 103 shown correspond to the specific implementation manners described above. Figure 1 The illustrated embodiments of step S101 , step S102 , and step S103 are the same or similar, and thus are not described in detail and are included herein by reference.

[0054] In some embodiments, a module 101 is established to create an external access method corresponding to the node to be deployed in the container cluster, wherein the external access method includes the server access address information of the corresponding remote docker server; obtain the access address information of the node, and configure the corresponding environment variables according to the access address information and the server access address information; deploy the node using the container cluster based on the configured environment variables to establish the remote docker server corresponding to the node. In some embodiments, a module 103 is established to configure a remote server at the same level as the server of the open source containerized application; use the server access address information of the remote server as the server access address information of the remote docker server corresponding to the node to be deployed. In some embodiments, a module 103 is established to create a nodeport port on the server of the container cluster of the open source containerized application; obtain other server access address information of other servers, add the nodeport port to the other server access address as the server access address information of the remote docker server corresponding to the node to be deployed, wherein the other servers include servers accessing the open source containerized application. In some embodiments, the environment variables include chain code address parameters and endpoint parameters, and the chain code address parameters and the endpoint parameters are included in the corresponding node configuration file; wherein, configuring the corresponding environment variables according to the access address information and the server access address information includes: configuring the chain code address parameters in the node configuration file based on the access address information, and configuring the endpoint parameters in the node configuration file based on the server access address information, so as to complete the configuration of the environment variables. Here, the further specific implementation method corresponding to the establishment module 101 is the same or similar to the further embodiment of the aforementioned step S101, and thus will not be repeated, and is included herein by reference.

[0055] In some embodiments, in step S102, a corresponding chain code image is constructed according to a creation instruction received by the remote docker server and sent by the node, wherein the creation instruction includes a chain code source code corresponding to the chain code container; the chain code container is created and started according to a startup instruction received by the remote docker server and sent by the node, and the chain code image. For example, in some embodiments, the creation instruction also includes starting an environment variable corresponding to the chain code container; wherein the creation and starting of the chain code container according to the startup instruction received by the remote docker server and sent by the node, and the chain code image, includes: creating the chain code container according to the startup instruction received by the remote docker server and sent by the node, and the chain code image, and passing the environment variable to the chain code container to start the chain code container. In some embodiments, the startup instruction also includes access address information of the node, and the access address information is used to configure the environment variable; wherein the establishment of a communication connection between the chain code container and the node based on the access address information includes: establishing a communication connection between the chain code container and the node according to the access address information in the environment variable. Here, the further specific implementation method corresponding to the operation module 102 is the same as or similar to the further embodiment of the aforementioned step S102, and thus will not be described in detail and is included herein by reference.

[0056] In some embodiments, the device further includes a drift module (not shown) for maintaining the communication connection in a connected state based on the access address information when the node drifts. Here, the specific implementation of the drift module is the same or similar to the embodiment of the aforementioned step S104, and thus will not be described in detail, but is included herein by reference.

[0057] In addition to the methods and devices described in the above embodiments, the present application also provides a computer-readable storage medium, which stores computer code. When the computer code is executed, the method described in any of the preceding items is executed.

[0058] The present application also provides a computer program product. When the computer program product is executed by a computer device, the method described in any of the preceding items is executed.

[0059] The present application also provides a computer device, the computer device comprising:

[0060] one or more processors;

[0061] a memory for storing one or more computer programs;

[0062] When the one or more computer programs are executed by the one or more processors, the one or more processors are caused to implement the method as described in any of the preceding items.

[0063] Figure 4 An exemplary system that can be used to implement various embodiments described in this application is shown;

[0064] like Figure 4 In some embodiments shown, the system 400 can be used as any of the above-mentioned devices in each of the described embodiments. In some embodiments, the system 400 may include one or more computer-readable media (e.g., system memory or non-volatile memory (NonVolatile Memory) VNM / storage device 420) with instructions and one or more processors (e.g., (one or more) processors 405) coupled to the one or more computer-readable media and configured to execute instructions to implement modules to perform the actions described in this application.

[0065] For one embodiment, system control module 410 may include any suitable interface controller to provide any suitable interface to at least one of processor(s) 405 and / or any suitable device or component in communication with system control module 410 .

[0066] The system control module 410 may include a memory controller module 430 to provide an interface to the system memory 415. The memory controller module 430 may be a hardware module, a software module, and / or a firmware module.

[0067] The system memory 415 may be used, for example, to load and store data and / or instructions for the system 400. For one embodiment, the system memory 415 may include any suitable volatile memory, such as a suitable DRAM. In some embodiments, the system memory 415 may include double data rate type four synchronous dynamic random access memory (DDR4 SDRAM).

[0068] For one embodiment, system control module 410 may include one or more input / output (I / O) controllers to provide interfaces to NVM / storage device 420 and communication interface(s) 425 .

[0069] For example, NVM / storage device 420 may be used to store data and / or instructions. NVM / storage device 420 may include any suitable non-volatile memory (e.g., flash memory) and / or may include any suitable non-volatile storage device(s) (e.g., one or more hard disk drives (HDDs), one or more compact disc (CD) drives, and / or one or more digital versatile disc (DVD) drives).

[0070] NVM / storage device 420 may include storage resources that are physically part of the device on which system 400 is installed, or it may be accessible to the device without being part of the device. For example, NVM / storage device 420 may be accessed over a network via communication interface(s) 425.

[0071] Communication interface(s) 425 may provide an interface for system 400 to communicate over one or more networks and / or with any other suitable devices. System 400 may wirelessly communicate with one or more components of a wireless network in accordance with any of one or more wireless network standards and / or protocols.

[0072] For one embodiment, at least one of the processor(s) 405 may be packaged together with the logic of one or more controllers (e.g., memory controller module 430) of the system control module 410. For one embodiment, at least one of the processor(s) 405 may be packaged together with the logic of one or more controllers of the system control module 410 to form a system in a package (SiP). For one embodiment, at least one of the processor(s) 405 may be integrated on the same die with the logic of one or more controllers of the system control module 410. For one embodiment, at least one of the processor(s) 405 may be integrated on the same die with the logic of one or more controllers of the system control module 410 to form a system on chip (SoC).

[0073] In various embodiments, the system 400 may be, but is not limited to: a server, a workstation, a desktop computing device, or a mobile computing device (e.g., a laptop computing device, a handheld computing device, a tablet computer, a netbook, etc.). In various embodiments, the system 400 may have more or fewer components and / or different architectures. For example, in some embodiments, the system 400 includes one or more cameras, a keyboard, a liquid crystal display (LCD) screen (including a touch screen display), a non-volatile memory port, multiple antennas, a graphics chip, an application specific integrated circuit (ASIC), and a speaker.

[0074] It should be noted that the present application can be implemented in software and / or a combination of software and hardware, for example, can be implemented using an application specific integrated circuit (ASIC), a general purpose computer or any other similar hardware device. In one embodiment, the software program of the present application can be executed by a processor to implement the steps or functions described above. Similarly, the software program of the present application (including relevant data structures) can be stored in a computer-readable recording medium, for example, a RAM memory, a magnetic or optical drive or a floppy disk and similar devices. In addition, some steps or functions of the present application can be implemented using hardware, for example, as a circuit that cooperates with a processor to perform each step or function.

[0075] In addition, a part of the present application may be applied as a computer program product, such as a computer program instruction, which, when executed by a computer, can call or provide the method and / or technical solution according to the present application through the operation of the computer. Those skilled in the art should understand that the existence of computer program instructions in computer-readable media includes but is not limited to source files, executable files, installation package files, etc., and accordingly, the way in which computer program instructions are executed by a computer includes but is not limited to: the computer directly executes the instruction, or the computer compiles the instruction and then executes the corresponding compiled program, or the computer reads and executes the instruction, or the computer reads and installs the instruction and then executes the corresponding installed program. Here, the computer-readable medium can be any available computer-readable storage medium or communication medium accessible to the computer.

[0076] Communication media include media by which communication signals containing, for example, computer readable instructions, data structures, program modules, or other data are transmitted from one system to another. Communication media may include guided transmission media such as cables and wires (e.g., fiber optic, coaxial, etc.) and wireless (unguided transmission) media that can propagate energy waves, such as acoustic, electromagnetic, RF, microwave, and infrared. Computer readable instructions, data structures, program modules, or other data may be embodied as a modulated data signal in, for example, a wireless medium such as a carrier wave or similar mechanism such as embodied as part of spread spectrum technology. The term "modulated data signal" refers to a signal whose one or more characteristics are changed or set in such a manner as to encode information in the signal. Modulation may be analog, digital, or a hybrid modulation technique.

[0077] By way of example and not limitation, computer-readable storage media may include volatile and nonvolatile, removable and non-removable media implemented in any method or technology for storing information such as computer-readable instructions, data structures, program modules or other data. For example, computer-readable storage media include, but are not limited to, volatile memory, such as random access memory (RAM, DRAM, SRAM); and non-volatile memory, such as flash memory, various read-only memories (ROM, PROM, EPROM, EEPROM), magnetic and ferromagnetic (Magnetoresistive Random Access Memory, MRAM) / Ferroelectric RAM, FeRAM); and magnetic and optical storage devices (hard disks, magnetic tapes, CDs, DVDs); or other media now known or later developed that can store computer-readable information / data for use by computer systems.

[0078] Here, according to one embodiment of the present application, a device is included, which includes a memory for storing computer program instructions and a processor for executing the program instructions, wherein, when the computer program instructions are executed by the processor, the device is triggered to run the methods and / or technical solutions based on the aforementioned multiple embodiments of the present application.

[0079] It is obvious to those skilled in the art that the present application is not limited to the details of the above exemplary embodiments, and that the present application can be implemented in other specific forms without departing from the spirit or basic features of the present application. Therefore, from any point of view, the embodiments should be regarded as exemplary and non-restrictive, and the scope of the present application is defined by the attached claims rather than the above description, and it is intended that all changes falling within the meaning and scope of the equivalent elements of the claims are included in the present application. Any figure mark in the claims should not be regarded as limiting the claims involved. In addition, it is obvious that the word "comprising" does not exclude other units or steps, and the singular does not exclude the plural. Multiple units or devices stated in the device claim can also be implemented by one unit or device through software or hardware.

[0080] The above is a detailed introduction to the method, device, computer equipment and storage medium for chain code container management of a consortium chain provided in the embodiments of the present application. Specific examples are used in this article to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. At the same time, for those skilled in the art, according to the idea of ​​the present invention, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as limiting the present invention.

Claims

1. A chain code container management method for a consortium chain, characterized in that: The alliance chain is deployed in an open source containerized application, and the method includes: Establishing a remote Docker server corresponding to the node to be deployed in the container cluster of the open source containerized application; the establishing a remote Docker server corresponding to the node to be deployed in the container cluster of the open source containerized application includes: Creating an external access method corresponding to the node to be deployed in the container cluster, wherein the external access method includes server access address information of the corresponding remote Docker server; Obtaining the access address information of the node, and configuring corresponding environment variables according to the access address information and the server access address information; Deploy the node using the container cluster based on the configured environment variables to establish a remote Docker server corresponding to the node; Running the chain code container of the alliance chain through the remote Docker server, wherein the chain code container is configured with access address information about the node; A communication connection between the chain code container and the node is established based on the access address information.

2. The method according to claim 1, characterized in that The method comprises: When the node drifts, the communication connection is kept in a connected state based on the access address information.

3. The method according to claim 1, characterized in that The environment variables include chain code address parameters and endpoint parameters, and the chain code address parameters and the endpoint parameters are included in the corresponding node configuration file; wherein, configuring the corresponding environment variables according to the access address information and the server access address information includes: The chain code address parameter in the node configuration file is configured based on the access address information, and the endpoint parameter in the node configuration file is configured based on the server access address information to complete the configuration of the environment variables.

4. The method according to claim 1, characterized in that The step of running the chaincode container through the remote Docker server includes: Building a corresponding chain code image according to the creation instruction received by the remote Docker server and sent by the node, wherein the creation instruction includes the chain code source code corresponding to the chain code container; The chain code container is created and started according to the startup instruction received by the remote Docker server and sent by the node, and the chain code image.

5. The method according to claim 4, characterized in that The creation instruction also includes starting the environment variables corresponding to the chain code container; wherein, creating and starting the chain code container according to the start instruction received by the remote Docker server and sent by the node, and the chain code image, includes: The chain code container is created according to the startup instruction received by the remote Docker server and sent by the node, and the chain code image, and the environment variable is passed to the chain code container to start the chain code container.

6. The method according to claim 5, characterized in that The startup instruction also includes access address information of the node, and the access address information is used to configure the environment variable; wherein, establishing a communication connection between the chain code container and the node based on the access address information includes: Establish a communication connection between the chain code container and the node according to the access address information in the environment variable.

7. The method according to claim 1, characterized in that The establishing a communication connection between the chain code container and the node based on the access address information includes: Configure a remote server of the same level as the server of the open source containerized application; use the server access address information of the remote server as the server access address information of the remote Docker server corresponding to the node to be deployed; A communication connection between the chain code container and the node is established according to the server access address information of the remote server and the access address information.

8. The method according to claim 1, characterized in that: The establishing a communication connection between the chain code container and the node based on the access address information includes: Create a nodeport port on a server of a container cluster of the open source containerized application; Obtain cluster service access address information of the container cluster, add the nodeport port to the cluster service access address information, and use it as server access address information of the remote Docker server corresponding to the node to be deployed; A communication connection between the chain code container and the node is established according to the server access address information of the remote Docker server and the access address information.

9. A chain code container management device for a consortium chain, characterized in that: The alliance chain is deployed in an open source containerized application, and the device includes: An establishment module is used to establish a remote Docker server corresponding to the node to be deployed in the container cluster of the open source containerized application; the establishment of the remote Docker server corresponding to the node to be deployed in the container cluster of the open source containerized application includes: Creating an external access method corresponding to the node to be deployed in the container cluster, wherein the external access method includes server access address information of the corresponding remote Docker server; Obtaining the access address information of the node, and configuring corresponding environment variables according to the access address information and the server access address information; Deploy the node using the container cluster based on the configured environment variables to establish a remote Docker server corresponding to the node; A running module, used to run the chain code container of the alliance chain through the remote Docker server, wherein the chain code container is configured with access address information about the node; A communication module is used to establish a communication connection between the chain code container and the node based on the access address information.

10. A chain code container management device for a consortium chain, characterized in that: The device comprises: one or more processors; Memory; and One or more applications, wherein the one or more applications are stored in the memory and are configured to be executed by the processor to perform the operations of the method according to any one of claims 1 to 8.

11. A computer-readable storage medium, characterized in that: A computer program is stored thereon, and the computer program is loaded by a processor to perform the operations of the method as claimed in any one of claims 1 to 8.

Citation Information

Patent Citations

  • Block chain network service platform and chain code installing method thereof, storage medium

    CN108965468A

  • Pod communication connection method and device, electronic equipment and storage medium

    CN111786984A