Block chain data analysis method and system based on container cloud
By employing container cloud technology in the blockchain system and utilizing images to make parallel RPC calls on multiple node containers, the problem of slow RPC function calls in existing technologies is solved, data parsing efficiency is improved, and the system's data security is enhanced.
Patent Information
- Application Number
- CN202411261757.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-09
- Publication Date
- 2026-02-24
AI Technical Summary
Existing blockchain systems are slow when making large-scale RPC function calls, and the lack of optimization in node programs leads to inefficiency.
By employing container cloud technology, parallel RPC calls are made on multiple node containers by creating images, leveraging the rapid deployment capabilities of container clouds to achieve parallel RPC function calls.
It improves the efficiency of blockchain data parsing, reduces the pressure on each node container, and quickly recovers data when problems occur in the local container, thereby improving the system's data security.
Smart Images

Figure CN121560964A_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to methods, systems, electronic devices, and readable media for parsing blockchain data based on container clouds. Background Technology
[0002] In blockchain systems, there is a widespread need for statistical analysis and interpretation of transaction information. The information requiring analysis typically includes the transaction's hash address, amount, initiator, and recipient. Blockchain data can be directly downloaded locally by establishing a full node and storing the binary block data. However, blockchain systems frequently undergo upgrades, causing changes in the locally stored data format. Therefore, using the RPC service provided by the blockchain system to obtain all transaction information is more universal and stable. However, because RPC function calls incur additional overhead, and most blockchain node programs are not optimized for RPC functions, large-scale RPC function calls can be very slow. Summary of the Invention
[0003] This disclosure provides a blockchain data parsing method, system, electronic device, and readable medium based on container cloud, which can realize parallel calls of RPC functions and improve the efficiency of blockchain data parsing.
[0004] To achieve the above technical objectives, the embodiments of this disclosure adopt the following technical solutions:
[0005] In a first aspect, embodiments of this disclosure provide a blockchain data parsing method based on container cloud, the method comprising:
[0006] The console creates the first image based on the data of the blockchain to be parsed in the first node container and uploads it to the image repository;
[0007] The image library stores the first image;
[0008] The console pulls the first image from the image repository and deploys it to N second-node containers, where N is a positive integer;
[0009] The first and second node containers respond to the first RPC call request initiated by the blockchain parser, generating response results to perform blockchain data parsing.
[0010] In some possible implementations, the console pulls the first image from the image repository and deploys it to N second-node containers, including:
[0011] The console receives large-scale parsing instructions, pulls the first image from the image repository by running a large-scale parsing job script, and deploys it to N second-node containers.
[0012] In some possible implementations, the method further includes, before the console pulls the first image from the image repository and deploys it to N second-node containers:
[0013] The first node container responds to the second RPC call request initiated by the blockchain parser and generates a response result to perform blockchain data parsing.
[0014] The console detects the network resource usage ratio of the first node container. When the network resource usage ratio is high, a large-scale parsing script is run to pull the first image from the image repository and deploy it to N second node containers.
[0015] In some possible implementations, the number N of the second node containers is determined based on the network resource occupancy ratio and / or the number of idle containers in the current node.
[0016] In some possible implementations, the first node container updates the first image and uploads it to the image repository after creating the first image and / or according to the first RPC call request and / or periodically synchronizing incremental blockchain data from the node to be resolved.
[0017] In some possible implementations, before performing blockchain data parsing, the first node container and the second node container synchronize incremental blockchain data from the nodes of the blockchain to be parsed, respectively, and generate response results based on the first mirror and the incremental blockchain data to perform blockchain data parsing.
[0018] In some possible implementations, before performing blockchain data parsing, the first node container synchronizes incremental blockchain data from the node of the blockchain to be parsed;
[0019] The second node container synchronizes incremental blockchain data from the first node container, and generates a response result based on the first image and the incremental blockchain data for blockchain data parsing.
[0020] In some possible implementations, before performing blockchain data parsing, the first node container synchronizes incremental blockchain data from the node of the blockchain to be parsed, generating an incremental second mirror;
[0021] The second node container synchronizes the second image from the first node container; based on the first and second images, it generates response results for blockchain data parsing.
[0022] In some possible implementations, the console sends the IP address of the second node container to the blockchain resolver.
[0023] In some possible implementations, the container cloud console also provides API functions, and the methods also include:
[0024] The API function receives the IP address query request from the blockchain parser and sends the IP address of the second node container to the blockchain parser.
[0025] In some possible implementations, after the console pulls the first image from the image repository and deploys it to N second-node containers, the method further includes:
[0026] Each second node container is assigned the same node container domain name as the first node container, and the first RPC call request includes the node container domain name.
[0027] In some possible implementations, the blockchain parser starts M*(N+1) concurrent threads to parse the blockchain data, where M is the number of concurrent RPC calls of a single node container and M is a positive integer.
[0028] In some possible implementations, the blockchain parsing program assigns tasks to concurrent threads for parsing the blocks of the blockchain to be parsed. Each thread first obtains all transaction data of a block, and then sequentially obtains all detailed data of each transaction and parses it.
[0029] In some possible implementations, the console receives a command from the blockchain parser to end the parsing task and deletes the first image from the second node container.
[0030] Secondly, embodiments of this disclosure provide a blockchain data parsing system based on container cloud, the system comprising:
[0031] The console is configured to create a first image based on the data of the blockchain to be parsed in the first node container, upload it to the image repository, pull the first image from the image repository, and deploy it to N second node containers, where N is a positive integer;
[0032] The image repository is configured to store the first image;
[0033] The first node container and the second node container are configured to generate response results in response to the first RPC call request initiated by the blockchain parser for blockchain data parsing.
[0034] Thirdly, embodiments of this application provide an electronic device, including: one or more processors; and a storage device for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the container cloud-based blockchain data parsing method as described in the first aspect.
[0035] Fourthly, embodiments of this application provide a computer-readable medium having a computer program stored thereon, which, when executed by a processor, implements the blockchain data parsing method based on container cloud as described in the first aspect.
[0036] The technical solution of the first aspect provided by the embodiments of this disclosure brings at least the following beneficial effects: The console creates a first image based on the data of the blockchain to be parsed in the first node container and uploads it to the image library; the image library stores the first image; the console pulls the first image from the image library and deploys it to N second node containers, where N is a positive integer; the first node containers and the second node containers respond to the first RPC call request initiated by the blockchain parsing program and generate response results for blockchain data parsing. The embodiments of this disclosure utilize the container image and rapid deployment characteristics of container cloud to place the locally deployed blockchain node system (including the data of the blockchain to be parsed) into containers, run it in a containerized manner, and manage it through the container cloud. When a large number of RPC functions need to be called for data parsing, the container cloud uses the created first image to quickly deploy it on the computing resources of N second node containers. The parsing program achieves parallel access to multiple node containers through the container cloud, enabling parallel RPC function calls, which helps reduce the pressure on each node container and improves the efficiency of blockchain data parsing. In addition to the above-mentioned efficient data parsing function, when the local first node container encounters a problem, the first image can be quickly pulled from the image library to restore the data, improving the data security of the system.
[0037] It should be noted that the technical effects of any of the implementation methods in the second to fourth aspects can be found in the technical effects of the corresponding implementation methods in the first aspect, and will not be repeated here.
[0038] The further effects of the aforementioned unconventional alternative methods will be explained below in conjunction with specific implementation methods. Attached Figure Description
[0039] To more clearly illustrate the technical solutions of the embodiments of this disclosure, the accompanying drawings of the embodiments of this disclosure will be briefly described below. Clearly, the drawings described below only relate to some embodiments of this disclosure and are not intended to limit the scope of this disclosure.
[0040] Figure 1 A schematic diagram illustrating the main steps of a container cloud-based blockchain data parsing method according to at least one embodiment of the present disclosure is shown.
[0041] Figure 2A-2B A schematic diagram illustrating the principle of a container cloud-based blockchain data parsing method according to at least one embodiment of the present disclosure is shown.
[0042] Figure 3 A system architecture diagram of a container cloud-based blockchain data parsing method according to at least one embodiment of the present disclosure is shown;
[0043] Figures 4A-4BA schematic diagram illustrating the image deployment steps of a container cloud-based blockchain data parsing method according to at least one embodiment of the present disclosure is shown.
[0044] Figure 5 A schematic diagram illustrating the data parsing steps of a container cloud-based blockchain data parsing method according to at least one embodiment of the present disclosure is shown.
[0045] Figures 6A-6D A schematic diagram illustrating the data update steps of a container cloud-based blockchain data parsing method according to at least one embodiment of the present disclosure is shown.
[0046] Figure 7 A flowchart illustrating a blockchain data parsing method based on container cloud according to at least one embodiment of the present disclosure is shown.
[0047] Figure 8 A flowchart illustrating a blockchain data parsing method based on container cloud according to at least another embodiment of the present disclosure is shown;
[0048] Figure 9 A schematic diagram of an electronic device according to at least one embodiment of the present disclosure is shown;
[0049] Figure 10 A schematic diagram of a readable storage medium according to at least one embodiment of the present disclosure is shown. Detailed Implementation
[0050] To make the objectives, technical solutions, and advantages of the embodiments of this disclosure clearer, the technical solutions of the embodiments of this disclosure will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this disclosure. All other embodiments obtained by those skilled in the art based on the described embodiments of this disclosure without creative effort are within the scope of protection of this disclosure.
[0051] In the following text, any methods, apparatus, examples, and contents that do not fully correspond to the scope defined by the claims are not derived from the present invention. Such methods, apparatus, examples, and contents, as well as all subsequent descriptions, are for illustrative purposes only, or to highlight specific aspects or features of the claims.
[0052] Note that the examples described below are merely specific examples and are not intended to limit the embodiments of this disclosure to the specific shapes, hardware, connections, operations, values, conditions, data, sequences, etc., shown and described. Those skilled in the art can utilize the concepts of this disclosure to construct further embodiments not mentioned herein by reading this specification.
[0053] The terminology used in this disclosure is that which is currently widely used in the art in consideration of the functionality of this disclosure; however, these terms may vary depending on the intent, precedent, or new technology of those skilled in the art. Furthermore, specific terms may be chosen by the applicant, and in such cases, their detailed meanings will be described in the detailed description of this disclosure. Therefore, the terminology used in this specification should not be construed as simple names, but rather based on the meaning of the terms and the overall description of this disclosure.
[0054] To better understand the embodiments of this disclosure, the relevant terms involved in this disclosure will first be defined and explained.
[0055] Blockchain: refers to a chain-like data structure that combines data blocks sequentially in chronological order, and is a distributed ledger that is cryptographically guaranteed to be immutable and unforgeable. Essentially, it is a decentralized database. The blockchain described in this disclosure can be applied to public blockchains, consortium blockchains, private blockchains, permissioned blockchains, etc.
[0056] Blockchain parsing refers to obtaining the desired field information from the binary block file, such as the version number, timestamp, previous block hash, and transaction information in the block header.
[0057] Containerization refers to the technology of packaging an application and its dependencies into a self-contained, portable container. This container contains all the components required for the application's runtime, such as code, runtime environment, libraries, and system tools. Unlike traditional deployment methods, the key idea of containers is to achieve consistency across different environments, whether deployed on a developer's local workstation or a production server, without worrying about differences in operating system configuration and underlying infrastructure.
[0058] Container cloud: refers to a cloud computing service that uses containerization technology to provide the ability to deploy, run, and manage applications. It allows developers to package applications and their dependencies into lightweight, portable containers and run them in a cloud environment. Container cloud is characterized by its lightweight nature, rapid deployment, ease of portability, and elastic scaling. Containers are the basic operating units in a container cloud.
[0059] A container image is a lightweight, executable software package that contains everything needed to run a container, including code, runtime environment, libraries, environment variables, and configuration files. Container images allow applications to run in the same way across different environments, improving development and deployment efficiency and consistency. Images can be stored in layers, typically consisting of multiple read-only layers, including the base operating system, runtime libraries, application code, and configuration files. When updates are needed, only the relevant layers are modified, rather than the entire image, reducing storage space and speeding up distribution.
[0060] An image repository is a centralized place for storing and managing container images. It can be public, like Docker Hub, or private. Developers can upload and download images to facilitate their sharing and distribution.
[0061] RPC (Remote Procedure Call) is a protocol that allows a program to call a subroutine or function in another address space (usually another computer). RPC technology enables developers to call remote functions as if they were local functions, without needing to concern themselves with the details of the underlying network communication. In the embodiments of this disclosure, it can be understood as requesting a node or node container to provide services.
[0062] It should be noted that the technical solutions in this disclosure, including the collection, updating, analysis, processing, use, transmission, and storage of user personal information, all comply with relevant laws and regulations, are used for legitimate purposes, and do not violate public order and good morals. Necessary measures are taken to prevent unauthorized access to user personal information data and to safeguard user personal information security, network security, and national security.
[0063] The exemplary embodiments of this disclosure are described below with reference to the accompanying drawings, including various details of the embodiments to aid understanding, and should be considered merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of this disclosure. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description.
[0064] Figure 2A-2B A schematic diagram illustrating the principle of a container cloud-based blockchain data parsing method 200 according to at least one embodiment of this disclosure is shown. Figure 2AAs shown, in the prior art, when a user needs to parse the data on the blockchain 220 to be parsed, the blockchain parsing program 210 can directly call any blockchain node on the blockchain 220 that supports the RPC interface by sending an RPC call request to obtain the blockchain's transaction information. After receiving the RPC call request, the blockchain node's RPC module will call the ledger management module or other necessary sub-modules (such as consensus module, synchronization module, block management module, etc.) according to the request content to obtain relevant response information and generate a response result. Since most blockchain node programs do not optimize RPC functions, the speed is very slow when performing large-scale RPC function calls. To solve the above problem, when large-scale RPC calls are required, this disclosure embodiment proposes the following... Figure 2B The blockchain data parsing method based on Container Cloud 230, as shown, involves rapidly deploying the first image created by Container Cloud 230 onto the computing resources of N second-node containers when large-scale RPC function calls are required for data parsing. The blockchain parsing program 210 uses Container Cloud 230 to achieve multi-threaded parallel access to multiple node containers (1+N), enabling parallel RPC function calls, which helps reduce the pressure on each node container and improves the efficiency of blockchain data parsing.
[0065] Figure 1 A schematic diagram illustrating the main steps of a container cloud-based blockchain data parsing method 100 according to at least one embodiment of the present disclosure is shown. Figure 3 A system architecture diagram of a container cloud-based blockchain data parsing method 300 according to at least one embodiment of the present disclosure is shown. The system includes a blockchain parser 210 and a container cloud 230, wherein the blockchain parser 210 is a local blockchain parser, such as BloSCi, and the container cloud 230 further includes node containers 320, a console 350, and an image library 330. Node containers 320 include multiple node containers; a first node container 321 is a locally started node container, and a second node container 322 is a node container started during the execution of the blockchain data parsing method 100. In addition to the first node container 321 and the second node container 322, node containers 320 may also include other unstarted node containers. The image library 330 is used to store one or more images 340. The console 350 can be used to allocate and manage resources on the container cloud 230. The console 350 and the blockchain parser 210 can be deployed in the same intranet, and the node containers can connect to each other via peer-to-peer (P2P).
[0066] Blockchain data parsing method 100 includes the following steps:
[0067] In step S101, console 350 creates a first image 341 based on the blockchain data to be parsed from the first node container 321, and uploads it to the image library 330. The first node container 321 is a locally started node container. It can be understood that before the initial blockchain data parsing, an initialization step may be included, i.e., deploying a local node based on container cloud and utilizing container technology, and starting the first node container 321. Figure 3 (S301). The startup process, for example, involves directly downloading a blockchain node through an installer. After the first node container 321 starts, the console 350 can create the first image 341 and upload it to the image repository 330 (S303). It is understood that the user can first configure the console 350 so that after the first node container 321 starts, the console 350 can create the first image 341. After creating the first image 341, the first node container 321 can synchronize incremental blockchain data from the blockchain 220 to be parsed, update the first image 341, and upload it to the image repository 330.
[0068] Alternatively, after starting the first node container 321, taking a public blockchain as an example, it can synchronize data from the entire network blockchain 220, such as synchronizing data with blockchain node 310 to update to the latest block height and obtain the latest blockchain data (S302). Based on the latest blockchain data obtained through synchronization, the first mirror 341 is created and uploaded to the mirror library 330 (S303). In other words, the latest blockchain data can be synchronized either before or after the creation of the first mirror 341.
[0069] When the first node container 321 is in normal operation, it can optionally synchronize the latest data from the blockchain 220, update the first image 341 based on the incremental blockchain data obtained through synchronization, and upload it to the image library 330. For example, it can synchronize data from the blockchain node 310 at 00:00 every day, or it can synchronize data based on user initiation (e.g., user instructions, such as RPC call requests), or it can use other data synchronization initiation methods conventional in the art.
[0070] In container technology, when incremental changes occur to data within a container, the incremental portion of the image can be generated separately. Specifically, each data addition operation generates an image, which users can use to perform incremental updates to the image, thus significantly reducing data synchronization time.
[0071] Step S102, the image library 330 stores the first image (i.e. Figure 3 S303).
[0072] In step S103, console 350 pulls the first image 341 from image repository 330 and deploys it to N second node containers 322, where N is a positive integer (S305). Preferably, N second node containers 322 are determined from idle node containers. It should be noted that console 350 can pull the first image 341 for deployment in several ways:
[0073] Figures 4A-4B A schematic diagram illustrating a mirror deployment step 400 of a container cloud-based blockchain data parsing method according to at least one embodiment of the present disclosure is shown. Figure 4A As shown, when large-scale parsing is required, a large-scale parsing command can be issued manually or automatically as needed. The console 350 receives the large-scale parsing command and starts the large-scale parsing working script (e.g., it can run on the console 350, step S1031). By running the large-scale parsing working script, the first image 341 is pulled from the image library 330 and deployed to N second node containers 322 (step S1032).
[0074] Optional, for example Figure 4B As shown, the blockchain parsing program 210 first sends a second RPC call request to the first node container 321. Figure 3 In step S304), the first node container 321 responds to the second RPC call request initiated by the blockchain parsing program 210 and generates a response result for blockchain data parsing (step S1031'). If the generated response result results in a high resource usage ratio, the console 350 will pull the first image 341 and perform the deployment step. For example, the console 350 detects the network resource usage ratio of the first node container 321 (step S1032'). When the network resource usage ratio is high, the first image 341 is pulled from the image library 330 by running a large-scale parsing script and deployed to N second node containers 322 (step S1033'). A high network resource usage ratio can be set in various ways, such as setting a threshold for the network resource usage ratio, for example, setting it to 50%. When the set threshold is exceeded, the network resource usage ratio is considered high.
[0075] It should be noted that the number of second node containers 322 can be N, and they are preferentially selected from other idle node containers besides the first node container 321. For example, node container 322 may have 10 node containers, including the started local first node container 321. When the first image 341 needs to be pulled for deployment based on the aforementioned situation, the number of second node containers 322 can be determined according to the current network resource utilization ratio of the first node container 321. For example, when the network resource utilization ratio reaches 50%, N is set to 1; when the network resource utilization ratio reaches 70%, N is set to 2; when the network resource utilization ratio reaches 90%, N is set to 3, and so on. Alternatively, it can be determined based on the current idle computing resources. For example, among the 9 node containers other than the first node container 321, there are 4 idle node containers, so N is set to 4, and these 4 idle node containers are determined as the second node containers 322. For another example, if a large-scale parsing instruction includes the setting of N, the second node container 322 is determined from the idle node containers according to the setting. It is understandable that the above setting methods can also be combined. For example, when N is determined to be 3 based on the network resource occupancy ratio, it can be further combined with the current number of idle node containers. When the number of idle nodes is greater than 3, N is 3; when the number of idle nodes is less than 3, N is the number of idle nodes.
[0076] In step S104, the first node container 321 and the second node container 322 respond to the first RPC call request initiated by the blockchain parsing program 210 and generate a response result to perform the blockchain parsing program 210. Specifically, the first node container 321 and the second node container 322 are invoked through the first RPC call request, and various methods supported in the art can be used to implement the invocation. The embodiments of this disclosure exemplarily list the following:
[0077] For example, console 350 obtains the IP address of the second node container 322 and sends it to the blockchain parsing program 210. Upon receiving the IP address of the second node container 322, the blockchain parsing program 210 generates a first RPC call request based on the IP address of the second node container 322, and accesses both the first node container 321 and the second node container 322. At this point, the first RPC call request can invoke the second node container 322.
[0078] For example, the console 350 of container cloud 230 also has API functions. Blockchain parsing program 210 sends an IP address query request to the API function. The API function receives this request and sends the IP address of the second node container 322 to blockchain parsing program 210. After receiving the IP address of the second node container 322 returned by the API function, blockchain parsing program 210 generates a first RPC call request based on the IP address of the second node container 322, accessing both the first node container 321 and the second node container 322. At this point, the first RPC call request can invoke the second node container 322.
[0079] For example, after the console 350 determines the second node container 322, the container cloud 230 includes a DNS service that assigns each second node container 322 the same node container domain name as the first node container 321. When the blockchain resolution program 210 sends the first RPC call request generated based on the node container domain name, the call to the second node container 322 can be realized synchronously.
[0080] Figure 5 A schematic diagram of data parsing steps 500 of a container cloud-based blockchain data parsing method according to at least one embodiment of the present disclosure is shown. Taking blockchain data parsing based on the IP address of the second node container 322 as an example, the specific steps include:
[0081] In step S1041, the blockchain parsing program 210 receives the IP addresses of N second node containers 322. Together with the first node container 321 that runs daily, there are a total of N+1 node containers that can provide RPC services.
[0082] In step S1042, the blockchain parsing program 210 starts M*(N+1) concurrent threads to obtain and parse blockchain data, where M is the number of concurrent RPC calls for a single node container, and M is a positive integer. To improve parsing efficiency, a reasonable number of concurrent calls should be set. It is understood that the blockchain parsing program 210 can also flexibly set the number of concurrent threads started as needed; for example, different numbers of concurrent RPC calls M can be started for different node containers x. x Optionally, the number of concurrent threads can also be set by the container cloud console 350, which can also be used for task allocation and dynamic adjustment.
[0083] In step S1043, the blockchain parsing program 210 allocates tasks to the concurrent threads for the blocks of the blockchain to be parsed. Each thread first obtains all transaction data of a block, and then sequentially obtains and parses the detailed data of each transaction. For example, the blockchain parsing program 210 performs blockchain data parsing based on the mirrors in the first node container 321 and the second node container 322, where the blocks to be parsed include all block data from block height 1 to height N. M*(N+1) concurrent threads are started to obtain the data of the aforementioned blockchain blocks. Optionally, for example, M*(N+1) concurrent threads are used for node container x. x One thread first allocates all transaction data for block n, then M x Each thread first parses the detailed data of transaction Z1 in block n, then parses the detailed data of transaction Z2, and so on, until all transaction data in block Y has been parsed. Understandably, other feasible methods can be chosen for the specific task allocation, meaning it can be flexibly configured by the blockchain parsing program 210.
[0084] By using the blockchain parser 210 to allocate thread tasks (compared to allocating thread tasks through the console of the container cloud 230), data parsing within the same block can be allocated to the same node container instead of being randomly allocated to different node containers, resulting in higher blockchain data parsing efficiency.
[0085] In step S1044, after each thread has parsed all transactions in a block, it processes the next unprocessed block until all accumulated blocks have been processed. When the large-scale parsing task is complete and multiple node containers are no longer needed to provide services, the blockchain parsing program 210 issues a parsing task termination command. The large-scale parsing script on the console 350 receives this command, invokes the container cloud 230 function, stops and deletes the additionally started second node container 322, deletes the first image 341 in the second node container 322, releases the occupied resources, and returns to normal operation. The large-scale parsing script then terminates.
[0086] This disclosed embodiment offers the following advantages: Leveraging the container images and rapid deployment capabilities of container clouds, locally deployed blockchain node systems are placed within containers for containerized operation and managed through the container cloud. When large-scale RPC function calls are required for data parsing, the container cloud utilizes the created first image to quickly deploy across the computing resources of N second-node containers. The parsing program achieves parallel access to multiple node containers through the container cloud, enabling parallel RPC function calls, which helps reduce the load on each node container and improves blockchain data parsing efficiency. In addition to the aforementioned efficient data parsing, when the local first-node container encounters a problem, the first image can be quickly retrieved from the image library to restore the data, enhancing system data security.
[0087] Figures 6A-6D This diagram illustrates the data update steps of a container cloud-based blockchain data parsing method according to at least one embodiment of the present disclosure. In normal operation, the first node container 321 periodically updates the first image 341 and sends it to the image repository 330. When the container cloud 230 starts a new container, it can pull an image from the image repository 340. This ensures that the started node container is up-to-date when the image in the image repository is the latest image. However, due to the limited update frequency, there are situations where the blockchain data is updated during two update processes. For example, the first node container 321 updates its data at 00:00 daily and synchronizes it to the image repository 330. However, a large-scale RPC call is needed at 7:00 AM. Between 00:00 and 7:00, the blockchain data is updated, generating new blocks, thus requiring data synchronization. Synchronization can be performed in various ways. Figures 6A-6D Four implementation methods are given as examples.
[0088] Optional, such as Figure 6A As shown, after creating the first image 341, the first node container 321 synchronizes incremental blockchain data from the blockchain node 310 according to the first RPC call request, updates the first image 341, and uploads it to the image library 330. Each second container node 322 obtains the latest blockchain data by synchronizing the updated first image 341 from the image library 330, and generates a response result based on the first image 341 to perform blockchain data parsing.
[0089] Optional, such as Figure 6B As shown, before performing blockchain data parsing, the first node container 321 and the second container node 322 synchronize incremental blockchain data from the blockchain node 310, and generate response results based on the first mirror 341 and the incremental blockchain data to perform blockchain data parsing.
[0090] Optional, such as Figure 6CAs shown, before performing blockchain data parsing, the first node container 321 synchronizes incremental blockchain data from the blockchain node 310 and generates an incremental second image, such as an image generated based on newly generated blocks. The second container node 322 synchronizes the second image from the first node container 321. Based on the first image 341 and the second image, a response result is generated to perform blockchain data parsing.
[0091] Optional, such as Figure 6D As shown, before performing blockchain data parsing, the first node container 321 synchronizes incremental blockchain data from the blockchain node 310; the second container node 322 synchronizes incremental blockchain data from the first node container 321, and generates a response result based on the first mirror 341 and the incremental blockchain data to perform blockchain data parsing.
[0092] Understandably, since the second container node 322 has already deployed the first image 341, and the first image 341 is updated regularly and contains newer data, each second container node 322 can complete the synchronization to the latest version in a short time and enter the service state.
[0093] Figure 7 A flowchart illustrating a blockchain data parsing method 700 based on a container cloud according to at least one embodiment of the present disclosure is shown. Specifically, it includes the following steps:
[0094] Step S701: Deploy a local blockchain node based on container cloud 230 and start the first node container 321;
[0095] In step S702, the data synchronization of the first node container 321 is completed, the console 350 creates the first image 341 and stores it in the image library 330;
[0096] In step S703, the first node container 321 periodically synchronizes data from other blockchain nodes 310, updates image 341, and uploads it to image library 330;
[0097] In step S704, the blockchain parsing program 210 initiates a second RPC call request, and the first node container 321 generates a response result;
[0098] Step S705: Console 350 checks whether the network resource usage ratio of the first node container 321 is high;
[0099] Step S706: When the network resource usage ratio is high, the console 350 starts a large-scale parsing work script, pulls the first image 341 from the image library 330, deploys it to N second node containers 322, and starts the second node containers 322.
[0100] Step S706': When the network resource utilization rate is low, continue to parse the blockchain data through the first node container 321;
[0101] Step S707: Console 350 obtains the IP address of the second node container 322 and sends the IP address to the blockchain parsing program 210;
[0102] In step S708, the blockchain parsing program 210 initiates the first RPC call request, simultaneously accessing the RPC services of multiple nodes. Each node's container updates the data, thereby completing the rapid blockchain parsing.
[0103] Step S709: After the large-scale parsing is completed, the blockchain parsing program 210 notifies the container cloud 230.
[0104] In step S710, container cloud 230 receives the message that the task has ended, stops and deletes the temporarily started second node container 322, releases the occupied resources, and enters the normal operation state.
[0105] Figure 8 A flowchart illustrating a blockchain data parsing method 800 based on a container cloud, according to at least another embodiment of the present disclosure, is shown. Figure 8 Zhongyu Figure 7 The same steps will not be repeated here. The difference is that the blockchain parsing program 210 does not issue a second RPC call request, but instead issues a large-scale parsing instruction. In this way, in step S705', the console 350 does not need to detect the network resource usage ratio of the first node container 321. Instead, in response to the large-scale parsing instruction issued by the blockchain parsing program 210, it directly starts the large-scale parsing working script to pull the first image 341 from the image library 330, deploy it to N second node containers 322, and start the second node containers 322.
[0106] This disclosure also discloses a blockchain data parsing system based on container cloud, the system comprising:
[0107] Console 350 is configured to create a first image 341 based on the data of the blockchain to be parsed in the first node container 321, upload it to the image library 330, and pull the first image 341 from the image library 330 and deploy it to N second node containers 322, where N is a positive integer;
[0108] Image library 330 is configured to store the first image 341;
[0109] The first node container 321 and the second node container 322 are configured to generate response results for blockchain data parsing in response to the first RPC call request initiated by the blockchain parser 210.
[0110] It should be noted that the above application scenarios are merely exemplary, intended to describe one or more aspects of this disclosure in specific scenarios. However, these aspects are not essential, and various modifications can be made to the application scenario. It is readily understood that the specific application scenarios described in this disclosure are not limited.
[0111] At least some embodiments of this disclosure also provide an electronic device. Figure 9 A schematic diagram of an electronic device 700 according to at least one embodiment of the present disclosure is shown.
[0112] like Figure 9 As shown, the electronic device 700 includes one or more processors 710 and a memory 720. The memory 720 includes one or more computer program modules 721. These computer program modules 721 are stored in the memory 720 and are executed by the processor 710. The one or more computer program modules 721 include instructions for executing the container cloud-based blockchain data parsing method 100 and its additional aspects according to at least one embodiment of the present disclosure. When executed by the processor 710, they can perform one or more steps of the container cloud-based blockchain data parsing method 100 and its additional aspects according to at least one embodiment of the present disclosure. The memory 720 and the processor 710 can be interconnected via a bus system and / or other forms of connection mechanisms (not shown). For example, the bus can be a Peripheral Component Interconnect Standard (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc.
[0113] For example, processor 710 may be a central processing unit (CPU), a digital signal processor (DSP), or other processing unit with data processing and / or program execution capabilities, such as a field-programmable gate array (FPGA). Processor 710 may be a general-purpose processor or a special-purpose processor, capable of controlling other components in electronic device 700 to perform desired functions.
[0114] Exemplarily, memory 720 may include any combination of one or more computer program products, which may include various forms of computer-readable storage media, such as volatile memory and / or non-volatile memory. Volatile memory may include, for example, random access memory (RAM) and / or cache memory. Non-volatile memory may include, for example, read-only memory (ROM), hard disk, erasable programmable read-only memory (EPROM), portable compact disc read-only memory (CD-ROM), USB memory, flash memory, etc. One or more computer program modules 721 may be stored on the computer-readable storage medium, and processor 710 may run one or more computer program modules 721 to implement various functions of electronic device 700. The computer program modules include multiple computer-executable instructions. Various application programs and various data, as well as various data used and / or generated by the application programs, may also be stored in the computer-readable storage medium.
[0115] For example, electronic device 700 may also include input devices such as touchscreens, touchpads, keyboards, mice, cameras, microphones, accelerometers, and gyroscopes; output devices such as liquid crystal displays, speakers, and vibrators; storage devices such as magnetic tapes and hard disks (HDDs or SDDs); and communication devices such as network interface cards like LAN cards and modems. The communication devices allow electronic device 700 to communicate wirelessly or wiredly with other devices to exchange data and perform communication processing via networks such as the Internet. A drive is connected to the I / O interface as needed. Removable storage media, such as disks, optical disks, magneto-optical disks, and semiconductor memories, are installed on the drive as needed so that computer programs read from them can be installed into the storage device as required.
[0116] For example, the electronic device 700 may further include a peripheral interface (not shown in the figure). This peripheral interface can be of various types, such as a USB interface, a Lightning interface, etc. The communication device can communicate wirelessly with networks and other devices, such as the Internet, intranets and / or wireless networks such as cellular telephone networks, wireless local area networks (LANs) and / or metropolitan area networks (MANs). Wireless communication can use any of a variety of communication standards, protocols, and technologies, including but not limited to Global System for Mobile Communications (GSM), Enhanced Data GSM Environment (EDGE), Wideband Code Division Multiple Access (W-CDMA), Code Division Multiple Access (CDMA), Time Division Multiple Access (TDMA), Bluetooth, Wi-Fi (e.g., based on IEEE 802.11a, IEEE 802.11b, IEEE 802.11g, and / or IEEE 802.11n standards), Voice over Internet Protocol (VoIP), Wi-MAX, protocols for email, instant messaging, and / or Short Message Service (SMS), or any other suitable communication protocol.
[0117] The electronic device 700 may be, for example, a system-on-a-chip (SoC) or a device including the SoC. For instance, it can be any device such as a mobile phone, tablet, laptop, e-reader, game console, television, digital photo frame, navigator, home appliance, communication base station, industrial controller, server, etc., or any combination of data processing devices and hardware. The embodiments of this disclosure do not limit this. The specific functions and technical effects of the electronic device 700 can be found in the foregoing description of the container cloud-based blockchain data parsing method 100 and its additional aspects according to at least one embodiment of this disclosure, and will not be repeated here.
[0118] Figure 10 A schematic diagram of a readable storage medium 800 according to at least one embodiment of the present disclosure is shown.
[0119] like Figure 10 As shown, a computer program 810 is stored on a readable storage medium 800, which is a computer-readable storage medium. When the computer program 810 is executed by a processor, it performs one or more steps of the container cloud-based blockchain data parsing method 100 and its additional aspects as described above.
[0120] For example, when the program code is read by a computer, the computer can execute the program code stored in the computer storage medium to perform one or more steps to implement, for example, the container cloud-based blockchain data parsing method 100 and its additional aspects according to at least one embodiment of the present disclosure.
[0121] For example, the readable storage medium may include a memory card of a smartphone, a storage component of a tablet computer, a hard disk of a personal computer, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM), portable compact disc read-only memory (CD-ROM), flash memory, and other readable storage media or any combination thereof. The readable storage medium 800 may be a non-transitory readable storage medium.
[0122] At least some of the embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other.
[0123] It should be noted that, in this disclosure, relational terms such as "first," "second," etc., are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. The terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising..." does not exclude the presence of additional identical elements in the process, method, article, or apparatus that includes the element.
[0124] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, or they may sometimes be executed in reverse order, depending on the functions involved; that is, the preceding or following operations are not necessarily executed precisely in sequence. Instead, various steps may be processed in reverse order or simultaneously as needed. Furthermore, other operations may be added to these processes, or one or more operations may be removed from these processes.
[0125] The units described in the embodiments of this disclosure can be implemented in software or hardware. The described units can also be located in a processor. The names of these units do not necessarily limit the specific unit itself.
[0126] The following points should be noted regarding this disclosure:
[0127] (1) The accompanying drawings of the embodiments of this disclosure only involve the structures involved in the embodiments of this disclosure. Other structures can be referred to the general design.
[0128] (2) Where there is no conflict, the embodiments of this disclosure and the features in the embodiments can be combined with each other to obtain new embodiments.
[0129] The above description is merely an exemplary embodiment of this disclosure and is not intended to limit the scope of protection of this disclosure, which is determined by the appended claims.
Claims
1. A blockchain data parsing method based on container cloud, characterized in that, The method includes: The console creates the first image based on the data of the blockchain to be parsed in the first node container and uploads it to the image repository; The image library stores the first image; The console pulls the first image from the image repository and deploys it to N second node containers, where N is a positive integer; The first node container and the second node container respond to the first RPC call request initiated by the blockchain parser and generate response results to perform blockchain data parsing.
2. The method according to claim 1, characterized in that, The console pulls the first image from the image repository and deploys it to N second-node containers, including: The console receives large-scale parsing instructions, pulls the first image from the image library by running a large-scale parsing script, and deploys it to N second-node containers.
3. The method according to claim 1, characterized in that, Before the console pulls the first image from the image repository and deploys it to N second-node containers, the method further includes: The first node container responds to the second RPC call request initiated by the blockchain parsing program and generates a response result to perform blockchain data parsing; The console detects the network resource usage ratio of the first node container. When the network resource usage ratio is high, it pulls the first image from the image library by running a large-scale parsing script and deploys it to N second node containers.
4. The method according to claim 3, characterized in that, The number N of the second node containers is determined based on the network resource occupancy ratio and / or the number of idle containers in the current node.
5. The method according to claim 1, characterized in that, After creating the first image and / or according to the first RPC call request and / or periodically, the first node container synchronizes incremental blockchain data from the node of the blockchain to be parsed, updates the first image, and uploads it to the image library.
6. The method according to claim 1, characterized in that, Before performing the blockchain data parsing, the first node container and the second node container respectively synchronize incremental blockchain data from the nodes of the blockchain to be parsed, and generate response results based on the first mirror and the incremental blockchain data to perform blockchain data parsing.
7. The method according to claim 1, characterized in that, Before performing the blockchain data parsing, the first node container synchronizes incremental blockchain data from the nodes of the blockchain to be parsed; The second node container synchronizes incremental blockchain data from the first node container, and generates a response result based on the first image and the incremental blockchain data to perform blockchain data parsing.
8. The method according to claim 1, characterized in that, Before performing the blockchain data parsing, the first node container synchronizes incremental blockchain data from the nodes of the blockchain to be parsed, generating an incremental second image; The second node container synchronizes the second image from the first node container; Response results are generated based on the first and second images to perform blockchain data parsing.
9. The method according to claim 1, characterized in that, The console sends the IP address of the second node container to the blockchain parsing program.
10. The method according to claim 9, characterized in that, The container cloud console also includes API functions, and the method further includes: The API function receives the IP address query request from the blockchain parsing program and sends the IP address of the second node container to the blockchain parsing program.
11. The method according to claim 1, characterized in that, After the console pulls the first image from the image repository and deploys it to N second-node containers, the method further includes: Each of the second node containers is assigned the same node container domain name as the first node container, and the first RPC call request includes the node container domain name.
12. The method according to claim 1, characterized in that, The blockchain parsing program starts M*(N+1) concurrent threads to parse the blockchain data, where M is the number of concurrent RPC calls of a single node container and M is a positive integer.
13. The method according to claim 12, characterized in that, The blockchain parsing program assigns tasks to the concurrent threads of the blockchain to be parsed. Each thread first obtains all transaction data of a block, and then sequentially obtains detailed data of each transaction and parses it.
14. The method according to claim 1, characterized in that, The console receives the end command for the parsing task issued by the blockchain parsing program and deletes the first image in the second node container.
15. A blockchain data parsing system based on container cloud, characterized in that, The system includes: The console is configured to create a first image based on the data of the blockchain to be parsed in the first node container, upload it to the image library, pull the first image from the image library, and deploy it to N second node containers, where N is a positive integer; The image library is configured to store the first image; The first node container and the second node container are configured to generate response results to perform blockchain data parsing in response to a first RPC call request initiated by the blockchain parser.
16. An electronic device, characterized in that, include: One or more processors; Storage device for storing one or more programs. When the one or more programs are executed by the one or more processors, the one or more processors implement the method as described in any one of claims 1-14.
17. A computer-readable medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the method as described in any one of claims 1-14.