A method, apparatus, and terminal device for deploying blockchain nodes.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-05
- Publication Date
- 2026-08-14
AI Technical Summary
[0003]有鉴于此,本申请实施例提供了一种区块链节点的部署方法、装置及终端设备,可以解决区块链业务与环境耦合度高、难以定位排查、适配性差的问题
[0037]本申请实施例与现有技术相比存在的有益效果是:终端设备通过创建区块链节点对应的运行环境的主机驱动;调用主机驱动中的创建逻辑主机命令,创建与运行环境对应的进程间通信服务进程;调用进程间通信服务进程的启动接口,创建运行环境的主进程;其中,进程间通信服务进程包括运行环境的主进程对应的标准接口。通过该标准接口能够满足区块链节点在不同运行环境上进行部署,以及,该方法将运行环境从上层应用中分离,具有便于维护,具有较强的兼容性、适配性;该方法具有实用性及易用性。
Smart Images

Figure CN116010118B_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the field of data processing technology, and in particular relates to methods, apparatus and terminal equipment for deploying blockchain nodes. Background Technology
[0002] As an infrastructure, deploying blockchain in different resource environments typically requires adjusting the underlying blockchain to adapt to different host types. In existing technologies, blockchain business code and environment technology code are intertwined and highly coupled, making troubleshooting and troubleshooting complex for developers. Summary of the Invention
[0003] In view of this, the embodiments of this application provide a method, apparatus and terminal device for deploying blockchain nodes, which can solve the problems of high coupling between blockchain business and environment, difficulty in locating and investigating, and poor adaptability.
[0004] The first aspect of this application provides a method for deploying a blockchain node, including:
[0005] Create the host driver for the runtime environment corresponding to the blockchain node;
[0006] The system invokes the "Create Logical Host" command in the host driver to create an inter-process communication service process corresponding to the runtime environment.
[0007] The startup interface of the inter-process communication service process is invoked to create the main process of the runtime environment;
[0008] The inter-process communication service process includes the standard interface corresponding to the main process of the runtime environment.
[0009] In one possible implementation of the first aspect, after the main process that creates the runtime environment, the method further includes:
[0010] Based on the setting instructions of the upper-layer application, the attribute information of the main process is generated; the attribute information is used to instruct the upper-layer application to perform business operations.
[0011] In one possible implementation of the first aspect, generating the attribute information of the main process based on the setting instructions of the upper-layer application includes:
[0012] Receive the setting command input by the upper-layer application calling the standard interface;
[0013] The attribute information is generated based on the setting instructions.
[0014] In one possible implementation of the first aspect, the attribute information includes network routing information; generating the attribute information of the main process based on the setting instructions of the upper-layer application includes:
[0015] Based on the setting command input by the upper-layer application through the standard interface of the network routing port setting, the request network routing port in the network routing information of the main process is set.
[0016] In one possible implementation of the first aspect, before setting the requested network routing port in the network routing information of the main process, the method includes:
[0017] The host driver detects whether the requested network routing port is in use.
[0018] If so, output an error message;
[0019] If not, output the internal routing information and external routing information of the requested network routing port; wherein the network routing information includes the internal routing information and the external routing information.
[0020] In one possible implementation of the first aspect, the attribute information includes environment variables; generating the attribute information of the main process based on the setting instructions of the upper-layer application includes:
[0021] Based on the setting instructions input by the upper-layer application calling the standard interface, the environment variables of the main process are set, and the environment variable information is saved locally through the host driver.
[0022] In one possible implementation of the first aspect, the attribute information includes file pre-download information; generating the attribute information of the main process based on the setting instructions of the upper-layer application includes:
[0023] Based on the setting instructions input by the upper-layer application calling the standard interface, the file pre-download information of the main process is set;
[0024] The main process pre-downloads the file corresponding to the file pre-download information to obtain the pre-downloaded file;
[0025] The host driver saves the pre-downloaded file to local storage, and the pre-downloaded file includes a certificate and credentials.
[0026] In one possible implementation of the first aspect, the attribute information includes a working path; after the main process that creates the runtime environment, the method includes:
[0027] Based on the startup request command input by the upper-layer application calling the standard interface, the file is saved locally according to the working path;
[0028] In the local storage corresponding to the working path, the environment variables of the main process are set based on the setting instructions input by the upper-layer application calling the standard interface;
[0029] The main process of the runtime environment is started based on the startup command input by the upper-layer application calling the standard interface.
[0030] A second aspect of this application provides a blockchain node deployment apparatus, comprising:
[0031] The first processing module is used to create the host driver for the runtime environment corresponding to the blockchain node;
[0032] The second processing module is used to call the create logical host command in the host driver to create an inter-process communication service process corresponding to the running environment.
[0033] The third processing module is used to call the startup interface of the inter-process communication service process to create the main process of the runtime environment; wherein, the inter-process communication service process includes the standard interface corresponding to the main process of the runtime environment.
[0034] A third aspect of this application provides a terminal device, the terminal device including a memory and a processor, the memory storing a computer program executable on the processor, the processor executing the computer program to implement the steps of the blockchain node deployment method as described in any of the first aspects above.
[0035] A fourth aspect of this application provides a computer-readable storage medium, comprising: storing a computer program, which, when executed by a processor, implements the steps of the deployment method for a blockchain node as described in any of the first aspects above.
[0036] The fifth aspect of this application provides a computer program product that, when run on a terminal device, causes the terminal device to execute the deployment method of the blockchain node described in any of the first aspects above.
[0037] The beneficial effects of this application embodiment compared with the prior art are as follows: The terminal device creates a host driver for the runtime environment corresponding to the blockchain node; it calls the create logical host command in the host driver to create an inter-process communication service process corresponding to the runtime environment; and it calls the startup interface of the inter-process communication service process to create the main process of the runtime environment. The inter-process communication service process includes a standard interface corresponding to the main process of the runtime environment. This standard interface enables the deployment of blockchain nodes in different runtime environments. Furthermore, this method separates the runtime environment from the upper-layer application, facilitating maintenance and providing strong compatibility and adaptability. The method is practical and easy to use. Attached Figure Description
[0038] To more clearly illustrate the technical solutions in the embodiments of this application, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0039] Figure 1 This is a schematic diagram illustrating the implementation process of the blockchain node deployment method provided in the embodiments of this application;
[0040] Figure 2 This is a schematic diagram illustrating the implementation process of the blockchain node deployment method provided in the embodiments of this application;
[0041] Figure 3 This is a schematic diagram of the structure of the blockchain node deployment device provided in the embodiments of this application;
[0042] Figure 4 This is a schematic diagram of the terminal device provided in the embodiments of this application. Detailed Implementation
[0043] In the following description, specific details such as particular system architectures and techniques are set forth for illustrative purposes and not for limitation, in order to provide a thorough understanding of the embodiments of this application. However, those skilled in the art will understand that this application may also be implemented in other embodiments without these specific details. In other instances, detailed descriptions of well-known systems, apparatuses, circuits, and methods have been omitted so as not to obscure the description of this application with unnecessary detail.
[0044] To illustrate the technical solution described in this application, specific embodiments are provided below.
[0045] Figure 1 and Figure 2A flowchart illustrating the implementation of the blockchain node deployment method provided in Embodiment 1 of this application is shown, and is described in detail below: A blockchain node deployment method, the method comprising:
[0046] Step S101: Create the host driver for the runtime environment corresponding to the blockchain node.
[0047] For example, the runtime environment is a runtime resource environment; specifically, the runtime environment can be a physical machine, an application container engine (Docker), a container cluster management system (Kubernetes, k8s), or a cloud environment. Correspondingly, the host driver is a host driver corresponding to the runtime environment; specifically, the host driver can be a physical machine driver, an application container engine driver, or a k8s driver. The host driver can be compiled into an executable file, and the executable file includes adaptation implementation methods for different runtime environments, thereby adapting to different runtime environments. In the above steps, host drivers corresponding to different runtime environments are developed; by adapting different host drivers to different runtime environments, the blockchain node can be adapted to different runtime environments.
[0048] For example, before a blockchain node is started, a host driver for the runtime environment corresponding to the blockchain node is created. Specifically, the blockchain node can be a single blockchain node. This step enables the deployment of corresponding host drivers for different blockchain nodes on different runtime environments, so that the blockchain nodes can be started and used subsequently.
[0049] Step S102: Invoke the Create Logical Host command in the host driver to create an inter-process communication service process corresponding to the operating environment.
[0050] For example, the host driver includes an adaptation implementation method corresponding to the runtime environment, wherein the adaptation implementation method corresponding to the runtime environment includes the command to create a logical host. By calling the adaptation implementation method corresponding to the runtime environment and then executing the command to create a logical host, an inter-process communication service process corresponding to the runtime environment is created. In the above steps, by creating a logical host and creating an inter-process communication service process corresponding to the runtime environment, different runtime environments are adapted through the inter-process communication service process of the logical host.
[0051] Specifically, the inter-process communication service process (RPC process, Remote Procedure Call process) is an agent process on the logical host. In the above steps, since the inter-process communication service process is a process of the logical host, and considering that the host driver in step S101 corresponds to different operating environments, the logical host of the host driver can create inter-process communication service processes according to the differences in different operating environments. In practical implementation, there is no need to change the overall code of the upper-layer application and operating environment, and this method has good adaptability.
[0052] Step S103: Call the startup interface of the inter-process communication service process to create the main process of the runtime environment.
[0053] The inter-process communication service process includes the standard interface corresponding to the main process of the runtime environment. For example, the standard interface is a standard communication interface.
[0054] For example, the terminal device receives a setting instruction from an upper-layer application calling a standard communication interface. Based on the setting instruction, attribute information of the main process is generated. This attribute information includes startup parameters. Based on these startup parameters, the blockchain is started.
[0055] Specifically, the system receives setting instructions from upper-layer applications calling standard interfaces, and generates attribute information for the main process based on these instructions. Based on the main process's attribute information, a pre-download file is set for each blockchain node. This pre-download file includes a certificate and credentials. For example, the credentials are network credentials, including account information and password information; the certificate is a network security certificate, such as a Transport Layer Security (TLS) certificate or a Membership Service Provider (MSP) certificate.
[0056] The system invokes the "Create Logical Host" command in the host driver to create an inter-process communication (IPC) service process corresponding to the runtime environment. This IPC service process includes the standard interface corresponding to the main process of the runtime environment. Based on the attribute information of the main process, a startup file is generated in each blockchain node by invoking the setting instructions of the standard interface. This startup file may include a network configuration file and a node startup configuration file. Based on the startup file and the runtime environment corresponding to the blockchain node, an Internet Protocol address (IP) and a network routing port are allocated. In the runtime environment of each blockchain node, the blockchain node is started according to the startup file to generate a blockchain network.
[0057] In step S103, the standard interface enables operations such as creating the main process, setting environment variables for the main process, and setting network information for the main process. Upper-layer applications can utilize the standard interface in different operating environments to achieve multi-environment deployment of blockchain nodes.
[0058] In the steps described above, this method separates the runtime environment code from the upper-layer application code. Therefore, when deploying blockchain nodes in different runtime environments, it eliminates the need to write differentiated code for the upper-layer application for each environment, and also eliminates the need to write implementation methods for different physical environments. Through this method, the upper-layer application can obtain the program package to be downloaded, the startup command to start the main process, configure the environment variables required for the main process to run, and start the process by calling the startup interface. This method saves development costs for the upper-layer application and enables the deployment of blockchain nodes to adapt to different runtime environments.
[0059] In the above steps, steps S101 to S103 involve creating the host driver for the runtime environment corresponding to the blockchain node; calling the create logical host command in the host driver to create an inter-process communication service process corresponding to the runtime environment; and calling the startup interface of the inter-process communication service process to create the main process of the runtime environment. The inter-process communication service process includes the standard interface corresponding to the main process of the runtime environment. This method uses the standard interface of the inter-process communication service process to enable the deployment of blockchain nodes on different runtime environments, meeting the needs of different physical environments. Subsequently, this standard interface enables the normal execution of upper-layer applications in different runtime environments. This method separates the runtime environment from the upper-layer application, facilitating the separation of the business code of the upper-layer application and the technical code of the runtime environment, and making it easier for users to locate and troubleshoot anomalies during execution.
[0060] In one embodiment, after creating the main process of the runtime environment, the method includes: determining whether the main process exists through the core layer of the host driver. Specifically, the existence of the main process is determined through the interface functions of the core layer. The interface functions of the core layer can be Application Programming Interfaces (APIs). In the above embodiment, verifying the existence of the main process through the core layer further ensures the stability of upper-layer applications in different runtime environments and reduces the occurrence of anomalies.
[0061] In one embodiment, after creating the main process of the runtime environment, the method further includes: generating attribute information of the main process based on the setting instructions of the upper-layer application; the attribute information is used to instruct the upper-layer application to perform business operations.
[0062] For example, the attribute information includes: main program information, environment variables, network routing information, working path, file pre-download information, resource limit information, health check configuration information, tag information, and log information. The attribute information of the main process is configured through setting instructions from the upper-layer application so that the main process can adapt to different operating environments.
[0063] In this embodiment, a main process for the runtime environment is created to meet the deployment requirements of blockchain nodes in different runtime environments, making the code logic of the upper-layer application concise and clear. Furthermore, based on the setting instructions of the upper-layer application, the attribute information of the main process is generated; by setting this attribute information, the main process meets the requirements of different runtime environments, improving adaptability. In addition, the upper-layer application can operate on the main process, making it adaptable to different runtime environments, facilitating the configuration and maintenance of the main process, and exhibiting strong compatibility and adaptability.
[0064] In one embodiment, generating the attribute information of the main process based on the setting instructions of the upper-layer application includes:
[0065] Step S201: Receive the setting instructions input by the upper-layer application calling the standard interface. For example, the upper-layer application obtains a program package; based on the program package, the upper-layer application calls the standard interface to input setting instructions, wherein the program package contains program setting information. Specifically, the standard interface may be an Application Programming Interface (API). The setting instructions may be main process tag setting instructions, main process environment variable setting instructions, main process network routing port setting instructions, main process file storage directory setting instructions, main process file download address setting instructions, main process resource limit setting instructions, main process health check rule setting instructions, and main process log setting instructions.
[0066] Step S202: Generate the attribute information based on the setting instructions. For example, the attribute information of the main process can be generated based on the program setting information in the program package and the setting instructions. The attribute information includes: main program information, environment variables, network routing information, working path, file pre-download information, resource limit information, health check configuration information, tag information, and log information. The attribute information of the main process is configured through the setting instructions of the upper-layer application so that the main process can adapt to different operating environments.
[0067] Specifically, tag information is generated based on the main process's tag setting instructions. Specifically, environment variables for the main process are generated based on the main process's environment variable setting instructions. Specifically, network routing information is generated based on the main process's network routing port setting instructions. Specifically, file pre-download information is generated based on the main process's file download address setting instructions. Specifically, resource limit information is generated based on the main process's resource limit setting instructions. Specifically, health check configuration information is generated based on the main process's health check rule setting instructions. Specifically, log information is generated based on the main process's log setting instructions. Specifically, the working path is set based on the main process's file storage directory setting instructions. In the above steps, steps S201 and S202 can set the main program's attribute information through a standard interface.
[0068] In one embodiment, the attribute information includes network routing information; generating the attribute information of the main process based on the setting instructions of the upper-layer application includes: setting the requested network routing port in the network routing information of the main process based on the setting instructions input by the upper-layer application through the standard interface for setting the network routing port.
[0069] For example, the upper-layer application obtains a program package; based on the program setting information of the program package, the upper-layer application calls a standard interface to input setting instructions; and sets the attribute information of the main process through the setting instructions. Specifically, the network routing information of the main process is set through the setting instructions, and the requested network routing port in the network routing information of the main process is set through the setting instructions. For example, the network routing port can be port 21, port 22, port 23, or port 111. Specifically, port 21 is a File Transfer Protocol (FTP) service port, used for uploading and downloading files. Specifically, port 22 is a Secure Shell Protocol (SSH) port, used for remotely connecting to a Linux cloud server. Specifically, port 23 is a Telnet service port, used for remotely logging into the server. Specifically, port 111 is a Remote Procedure Call (RPC) service port, used for internal process communication. In the above steps, the upper-layer application inputs setting instructions through a standard interface to set the network routing information of the main process in different runtime environments, so that the upper-layer application can control the main process in different runtime environments and facilitate data interaction between the main process in different runtime environments and the upper-layer application.
[0070] In one embodiment, before setting the requested network routing port in the network routing information of the main process, the method includes:
[0071] Step S301: Detect whether the requested network routing port is in a occupied state.
[0072] For example, the host driver detects whether the requested network routing port is in use. Specifically, the host driver can obtain the status of the requested network routing port. When the requested network routing port is in a Closing, Time Wait, or Established state, the requested network routing port is in use. When the requested network routing port is in a Listening state, the requested network routing port is not in use.
[0073] Step S302: If yes, output an error message. For example, the error message indicates that the requested network routing port is in use, thereby reducing the occurrence of exceptions when configuring the main process's requested network routing port.
[0074] Step S303: If not, output the internal routing information and external routing information of the requested network routing port.
[0075] For example, the internal routing information may include: the destination address of the internal route, the network mask of the internal route, the priority of the internal route, the next-hop Internet Protocol address (IP) of the internal route, the output interface of the internal route, and the cost of the internal route. The external routing information may include: the destination address of the external route, the network mask of the external route, the priority of the external route, the next-hop Internet Protocol address of the external route, the output interface of the external route, and the cost of the external route.
[0076] In the above steps, steps S301 to S303 verify the occupancy status of the requested network routing port before setting network routing information for the main process, thereby ensuring the smooth completion of setting network routing information for the main process and reducing anomalies.
[0077] In one embodiment, the attribute information includes environment variables; generating the attribute information of the main process based on the setting instructions of the upper-layer application includes: setting the environment variables of the main process based on the setting instructions input by the upper-layer application calling the standard interface, and saving the environment variable information to the local machine through the host driver.
[0078] For example, the environment variables are parameters corresponding to the operating environment. Specifically, the environment variables may include system variables and user variables. The environment variable information includes the environment variables and the directory path corresponding to the environment variables. In this embodiment, the setting instruction is an environment variable setting instruction. For example, the upper-layer application obtains the program package; according to the program setting information of the program package, the upper-layer application calls the standard interface to input the environment variable setting instruction; sets the environment variables of the main process; and saves the environment variable information to the local storage directory through the host driver according to the preset target path.
[0079] In the above embodiments, the environment variables of the main process are configured through a standard interface so that the main process can perform corresponding operations in different runtime environments; and the environment variable information is saved locally to back up the environment variable information of the main process in different runtime environments for subsequent maintenance.
[0080] In one embodiment, the attribute information includes file pre-download information; the generation of the main process's attribute information based on the setting instructions of the upper-layer application includes:
[0081] Step S401: Based on the setting instruction input by the upper-layer application calling the standard interface, set the file pre-download information of the main process. For example, the setting instruction is a file download address setting instruction. Receive a program package obtained by the upper-layer application, wherein the program package includes program setting information; receive the file download address setting instruction input by the upper-layer application calling the standard interface. Set the file pre-download information of the main process according to the file download address in the program setting information.
[0082] Step S402: The main process pre-downloads the file corresponding to the file pre-download information to obtain the pre-downloaded file. For example, based on the file download address in the program settings information, the main process pre-downloads the file corresponding to the file pre-download information, thereby downloading the pre-downloaded file to the directory corresponding to the file download address.
[0083] Step S403: Save the pre-downloaded file to the local machine via the host driver. The pre-downloaded file includes a certificate and credentials. For example, the credentials are network credentials, including account information and password information. For example, the certificate is a network security certificate. For example, the pre-downloaded file is saved to the local machine via the host driver based on the file download address.
[0084] In the above steps, steps S401 to S403 configure the file pre-download information of the main process through a standard interface, enabling the pre-download of files corresponding to the file pre-download information according to the file download address, realizing data interaction between the runtime environment and the local machine; and saving the pre-downloaded files to the local storage directory for backup to ensure data security.
[0085] In one embodiment, the attribute information includes a working path; after the main process that creates the runtime environment, the method includes:
[0086] Step S501: Based on the startup request instruction input by the upper-layer application calling the standard interface, save the file to the local machine according to the working path. For example, receive the startup request instruction input by the upper-layer application; obtain the file pointed to by the startup request instruction; and save the file to the local machine according to the working path of the main process.
[0087] Step S502: In the local storage corresponding to the working path, the environment variables of the main process are set based on the setting instructions input by the upper-layer application calling the standard interface. For example, the setting instructions are environment variable setting instructions for the main process. In the local storage directory corresponding to the working path, the environment variables of the main process are set based on the environment variable setting instructions input by the upper-layer application calling the standard interface.
[0088] Step S503: Based on the startup command input by the upper-layer application calling the standard interface, start the main process of the runtime environment. For example, receive the startup command input by the upper-layer application; start the main process of the runtime environment. Thus, corresponding main processes can be started in different runtime environments; and multiple main processes can be started in the same runtime environment to improve the efficiency of subsequent data communication and data interaction.
[0089] In the above steps, through steps S501 to S503, the file is saved locally before starting the main process to achieve data backup and ensure data security; and, before starting the main process, environment variables are set so that the main process can run normally in the runtime environment and reduce the occurrence of anomalies.
[0090] In one embodiment, after the main process of the runtime environment is created, the method includes: managing the main process of the runtime environment based on management operation instructions from the upper-layer application.
[0091] For example, the management operation instructions include start instructions, stop instructions, delete instructions, and update instructions. Accordingly, based on the start instruction from the upper-layer application, the main process of the runtime environment is started. Based on the stop instruction from the upper-layer application, the main process of the runtime environment is stopped. Based on the delete instruction from the upper-layer application, the main process of the runtime environment is deleted. Based on the update instruction from the upper-layer application, the main process of the runtime environment is updated. In this embodiment, by calling the management operation instructions through the upper-layer application, the lifecycle of the main process can be managed, facilitating user maintenance of the main process's lifecycle.
[0092] For example, the system receives management operation instructions from an upper-layer application calling a standard interface to manage the main process of the runtime environment. In this embodiment, by using management operation instructions from an upper-layer application calling a standard interface, the lifecycle of the main process can be managed, making it easier for users to maintain the lifecycle of the main process.
[0093] It should be understood that the sequence number of each step in the above embodiments does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.
[0094] Corresponding to the method in the above embodiments, Figure 3 A structural block diagram of a blockchain node deployment apparatus provided in an embodiment of this application is shown. For ease of explanation, only the parts related to the embodiments of this application are shown. Figure 3 The example blockchain node deployment device can be the execution entity of the blockchain node deployment method provided in the aforementioned embodiment one.
[0095] Reference Figure 3 The deployment device 30 for the blockchain node includes:
[0096] The first processing module 31 is used to create the host driver for the running environment corresponding to the blockchain node;
[0097] The second processing module 32 is used to call the create logical host command in the host driver to create an inter-process communication service process corresponding to the running environment.
[0098] The third processing module 33 is used to call the startup interface of the inter-process communication service process to create the main process of the runtime environment; wherein, the inter-process communication service process includes the standard interface corresponding to the main process of the runtime environment.
[0099] The process by which each module in the blockchain node deployment device provided in this application implements its respective function can be specifically referred to the foregoing. Figure 1 The description of Embodiment 1 shown will not be repeated here.
[0100] It should be understood that, when used in this application specification and the appended claims, the term "comprising" indicates the presence of the described features, integrals, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integrals, steps, operations, elements, components and / or a collection thereof.
[0101] It should also be understood that the term “and / or” as used in this application specification and the appended claims means any combination of one or more of the associated listed items and all possible combinations, and includes such combinations.
[0102] As used in this application specification and the appended claims, the term "if" may be interpreted, depending on the context, as "when," "once," "in response to determination," or "in response to detection." Similarly, the phrase "if determined" or "if detected [the described condition or event]" may be interpreted, depending on the context, as meaning "once determined," "in response to determination," "once detected [the described condition or event]," or "in response to detection [the described condition or event]."
[0103] Furthermore, in the description of this application and the appended claims, the terms "first," "second," "third," etc., are used only for distinguishing descriptions and should not be construed as indicating or implying relative importance. It should also be understood that although the terms "first," "second," etc., are used in the text to describe various elements in some embodiments of this application, these elements should not be limited by these terms. These terms are merely used to distinguish one element from another. For example, a first table may be named a second table, and similarly, a second table may be named a first table, without departing from the scope of the various described embodiments. Both the first table and the second table are tables, but they are not the same table.
[0104] References to "one embodiment" or "some embodiments" as described in this specification mean that one or more embodiments of this application include a specific feature, structure, or characteristic described in connection with that embodiment. Therefore, the phrases "in one embodiment," "in some embodiments," "in other embodiments," "in still other embodiments," etc., appearing in different parts of this specification do not necessarily refer to the same embodiment, but rather mean "one or more, but not all, embodiments," unless otherwise specifically emphasized. The terms "comprising," "including," "having," and variations thereof mean "including but not limited to," unless otherwise specifically emphasized.
[0105] Figure 4 This is a schematic diagram of the structure of a terminal device provided in an embodiment of this application. For example... Figure 4As shown, the terminal device 40 of this embodiment includes: at least one processor 41 ( Figure 4 (Only one is shown in the image) A memory 42 stores a computer program 43 that can run on the processor 41. When the processor 41 executes the computer program 43, it implements the steps in the deployment method embodiments of the various blockchain nodes described above, for example... Figure 1 The steps S101 to S103 are shown. Alternatively, when the processor 41 executes the computer program 43, it implements the functions of each module / unit in the above-described device embodiments, for example... Figure 3 The functions of modules 31 to 33 are shown.
[0106] The terminal device 40 can be a desktop computer, laptop, handheld computer, cloud server, or other computing device. The terminal device 40 may include, but is not limited to, a processor 41 and a memory 42. Those skilled in the art will understand that... Figure 4 This is merely an example of terminal device 40 and does not constitute a limitation on terminal device 40. It may include more or fewer components than shown, or combine certain components, or different components. For example, the terminal device may also include input transmitting devices, network access devices, buses, etc.
[0107] The processor 41 may be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor.
[0108] In some embodiments, the memory 42 may be an internal storage unit of the terminal device 40, such as a hard disk or memory of the terminal device 40. The memory 42 may also be an external storage device of the terminal device 40, such as a plug-in hard disk, smart media card (SMC), secure digital card (SD), flash card, etc., equipped on the terminal device 40. Furthermore, the memory 42 may include both internal and external storage units of the terminal device 40. The memory 42 is used to store the operating system, applications, boot loader, data, and other programs, such as the program code of the computer program. The memory 42 can also be used to temporarily store data that has been sent or will be sent.
[0109] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0110] This application also provides a terminal device, which includes at least one memory, at least one processor, and a computer program stored in the at least one memory and executable on the at least one processor. When the processor executes the computer program, it causes the terminal device to implement the steps in any of the above method embodiments.
[0111] This application also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps described in the various method embodiments above.
[0112] This application provides a computer program product that, when run on a terminal device, enables the terminal device to implement the steps described in the various method embodiments above.
[0113] If the integrated module / unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the methods of the above embodiments can also be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. The computer-readable medium can include: any entity or device capable of carrying the computer program code, a recording medium, a USB flash drive, a portable hard drive, a magnetic disk, an optical disk, a computer memory, a read-only memory (ROM), a random access memory (RAM), an electrical carrier signal, a telecommunication signal, and a software distribution medium, etc.
[0114] In the above embodiments, the descriptions of each embodiment have different focuses. For parts that are not described in detail or recorded in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0115] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0116] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0117] The above-described embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application, and should all be included within the protection scope of this application.
Claims
1. A method for deploying blockchain nodes, characterized in that, The method includes: Create host drivers for the runtime environment corresponding to the blockchain node; adapt the blockchain node to different runtime environments by using different host drivers; The host driver invokes the "Create Logical Host" command to create an inter-process communication service process corresponding to the runtime environment; the inter-process communication service process is a proxy process on the logical host, and the host driver creates inter-process communication service processes differently according to different runtime environments. The startup interface of the inter-process communication service process is invoked to create the main process of the runtime environment; The inter-process communication service process includes the standard interface corresponding to the main process of the runtime environment; After the main process that creates the runtime environment is completed, the method further includes: Based on the setting instructions of the upper-layer application, the attribute information of the main process is generated; the attribute information is used to instruct the upper-layer application to perform business operations. The attribute information of the main process is generated based on the setting instructions of the upper-layer application, including: Receive the setting command input by the upper-layer application calling the standard interface; The attribute information is generated based on the setting instructions.
2. The method as described in claim 1, characterized in that, The attribute information includes network routing information; the generation of the main process's attribute information based on the setting instructions of the upper-layer application includes: Based on the setting command input by the upper-layer application through the standard interface of the network routing port setting, the request network routing port in the network routing information of the main process is set.
3. The method as described in claim 2, characterized in that, Before setting the requested network routing port in the network routing information of the main process, the method includes: The host driver detects whether the requested network routing port is in use. If so, output an error message; If not, output the internal routing information and external routing information of the requested network routing port; wherein the network routing information includes the internal routing information and the external routing information.
4. The method as described in claim 1, characterized in that, The attribute information includes environment variables; the generation of the main process's attribute information based on the setting instructions of the upper-layer application includes: Based on the setting instructions input by the upper-layer application calling the standard interface, the environment variables of the main process are set, and the environment variable information is saved locally through the host driver.
5. The method as described in claim 1, characterized in that, The attribute information includes file pre-download information; the generation of the main process's attribute information based on the upper-layer application's setting instructions includes: Based on the setting instructions input by the upper-layer application calling the standard interface, the file pre-download information of the main process is set; The main process pre-downloads the file corresponding to the file pre-download information to obtain the pre-downloaded file; The pre-downloaded file, including a certificate and credentials, is saved locally via the host driver.
6. The method as described in claim 1, characterized in that, The attribute information includes the working path; after the main process that creates the runtime environment is executed, the method includes: Based on the startup request command input by the upper-layer application calling the standard interface, the file is saved locally according to the working path; In the local storage corresponding to the working path, the environment variables of the main process are set based on the setting instructions input by the upper-layer application calling the standard interface; The main process of the runtime environment is started based on the startup command input by the upper-layer application calling the standard interface.
7. A deployment device for a blockchain node, characterized in that, include: The first processing module is used to create the host driver for the runtime environment corresponding to the blockchain node; By adapting different host drivers to different operating environments, blockchain nodes can be adapted to different operating environments. The second processing module is used to call the create logical host command in the host driver to create an inter-process communication service process corresponding to the running environment; the inter-process communication service process is a proxy process on the logical host, and the host driver creates inter-process communication service processes differently according to different running environments; The third processing module is used to call the startup interface of the inter-process communication service process to create the main process of the runtime environment; wherein, the inter-process communication service process includes the standard interface corresponding to the main process of the runtime environment. Following the main process that creates the runtime environment, the process also includes: Based on the setting instructions of the upper-layer application, the attribute information of the main process is generated; the attribute information is used to instruct the upper-layer application to perform business operations. The attribute information of the main process is generated based on the setting instructions of the upper-layer application, including: Receive the setting command input by the upper-layer application calling the standard interface; The attribute information is generated based on the setting instructions.
8. A terminal device, characterized in that, The terminal device includes a memory and a processor. The memory stores a computer program that can run on the processor. When the processor executes the computer program, it implements the steps of the method as described in any one of claims 1 to 6.
9. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method as described in any one of claims 1 to 6.