A hierarchical weakly centralized blockchain browser generation method and its related components

Through the hierarchical weakly centralized blockchain browser generation method, consensus nodes and load balancing strategies are used to process blockchain transactions, which solves the problem of centralized browsers lagging behind in parsing data under high transaction volume, and improves efficiency and stability. , reducing the risk of failure.

CN112699322BActive Publication Date: 2024-08-27华润数字科技有限公司
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202110012504.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-01-06
Publication Date
2024-08-27
Estimated Expiration
2041-01-06

Smart Images

  • Figure CN112699322B
    Figure CN112699322B
Patent Text Reader

Abstract

The present invention discloses a hierarchical weakly centralized blockchain browser generation method and its related components, wherein the method includes: obtaining consensus nodes in the consensus layer and electing them to obtain a consensus master node and a consensus slave node; the consensus master node receives the block account event broadcast by the blockchain, and pushes a parsing task instruction to multiple parsing nodes of the parsing layer based on a load balancing strategy, obtains the parsing results returned by multiple parsing nodes of the parsing layer, and compares whether the parsing results are consistent; if the parsing results are consistent, the parsing results are saved in the consensus master node, and the parsing results are pushed to the front-end browser for content display. The present invention pushes the parsing task instruction to multiple parsing nodes through the consensus master node, and pushes the parsing results to the front-end browser for content display when the returned parsing results are consistent, which effectively improves the parsing efficiency, reduces the occurrence of parsing errors, and reduces the risk of centralization.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of blockchain on-chain data display, and in particular to a hierarchical weakly centralized blockchain browser generation method and related components thereof. Background Art

[0002] Most consortium chain projects are based on the transformation of the original business of enterprises. In order to better reflect the characteristics of blockchain, blockchain browsers need to display blockchain-related parameters and business-related transaction information. A block on the blockchain can pack hundreds or even more transactions. The transaction content is related to the business. Listening to the blockchain to obtain block information and parsing the transactions in the block requires a lot of time and calculation. Centralized browsers will face bottlenecks in parsing transaction performance. In the case of a large number of transactions, the browser may lag behind in parsing data, and if the centralized browser fails, other alliance access parties will not be able to access the blockchain browser, which seriously affects the user experience. Summary of the invention

[0003] The embodiment of the present invention provides a hierarchical weakly centralized blockchain browser generation method and related components thereof, aiming to solve the problem in the prior art that browser parsing data lags due to a large number of transactions.

[0004] In a first aspect, an embodiment of the present invention provides a method for generating a hierarchical weakly centralized blockchain browser, which includes:

[0005] Obtain the consensus nodes in the consensus layer and elect them to obtain the consensus master node and consensus slave node;

[0006] The consensus master node receives the block account event broadcast by the blockchain, and pushes the parsing task instructions to the multiple parsing nodes of the parsing layer based on the load balancing strategy, obtains the parsing results returned by the multiple parsing nodes of the parsing layer, and compares whether the parsing results are consistent;

[0007] If the analysis results are consistent, the analysis results are saved in the consensus master node and pushed to the front-end browser for content display.

[0008] In a second aspect, an embodiment of the present invention provides a hierarchical weakly centralized blockchain browser generation system, which includes:

[0009] The node election unit is used to obtain the consensus nodes in the consensus layer and elect them to obtain the consensus master node and consensus slave node;

[0010] A parsing task instruction pushing unit is used for the consensus master node to receive the block account event broadcast by the blockchain, and push the parsing task instruction to multiple parsing nodes of the parsing layer based on the load balancing strategy, obtain the parsing results returned by the multiple parsing nodes of the parsing layer, and compare whether the parsing results are consistent;

[0011] The content display unit is used to save the analysis results to the consensus master node if the analysis results are consistent, and push the analysis results to the front-end browser for content display.

[0012] In the third aspect, an embodiment of the present invention further provides a computer device, which includes a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein when the processor executes the computer program, the method for generating a hierarchical weakly centralized blockchain browser described in the first aspect is implemented.

[0013] In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the processor executes the hierarchical weakly centralized blockchain browser generation method described in the first aspect above.

[0014] The embodiment of the present invention provides a hierarchical weakly centralized blockchain browser generation method and its related components. The method includes obtaining the consensus nodes in the consensus layer and electing them to obtain the consensus master node and the consensus slave node; the consensus master node receives the block account event broadcast by the blockchain, and pushes the parsing task instructions to the multiple parsing nodes of the parsing layer based on the load balancing strategy, obtains the parsing results returned by the multiple parsing nodes of the parsing layer, and compares whether the parsing results are consistent; if the parsing results are consistent, the parsing results are saved in the consensus master node, and the parsing results are pushed to the front-end browser for content display. The embodiment of the present invention pushes the parsing task instructions to multiple parsing nodes through the consensus master node, and pushes the parsing results to the front-end browser for content display when the returned parsing results are consistent, which effectively improves the parsing efficiency, reduces the occurrence of parsing errors, and reduces the risk of centralization. BRIEF DESCRIPTION OF THE DRAWINGS

[0015] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying any creative work.

[0016] Figure 1 A schematic diagram of a process for generating a hierarchical weakly centralized blockchain browser provided by an embodiment of the present invention;

[0017] Figure 2 A message flow diagram of a hierarchical weakly centralized blockchain browser generation method provided by an embodiment of the present invention;

[0018] Figure 3 A schematic block diagram of a hierarchical weakly centralized blockchain browser generation system provided in an embodiment of the present invention. DETAILED DESCRIPTION

[0019] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0020] It should be understood that when used in this specification and the appended claims, the terms "include" and "comprises" indicate the presence of described features, integers, steps, operations, elements and / or components, but do not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or combinations thereof.

[0021] It should also be understood that the terms used in this specification of the present invention are only for the purpose of describing specific embodiments and are not intended to limit the present invention. As used in the specification of the present invention and the appended claims, unless the context clearly indicates otherwise, the singular forms "a", "an" and "the" are intended to include plural forms.

[0022] It should be further understood that the term "and / or" used in the present description and the appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes these combinations.

[0023] See also Figure 1 and Figure 2 , Figure 1 A schematic flow chart of a method for generating a hierarchical weakly centralized blockchain browser provided in an embodiment of the present invention, the method comprising steps S101 to S103.

[0024] S101. Obtain the consensus nodes in the consensus layer and elect them to obtain the consensus master node and consensus slave node;

[0025] In this step, after obtaining the consensus node in the consensus layer, the consensus node is started and initialized, and the election operation is performed through the election algorithm to elect the consensus master node and the consensus slave node. The consensus node is designed to support a weakly centralized method that supports crash tolerance, and the failure of less than half of the nodes does not affect the work of the browser. The work distribution and accounting of the consensus layer are performed by the selected consensus master node, and the consensus slave node synchronizes the results of the consensus master node.

[0026] In one embodiment, the step S101 includes:

[0027] The consensus master node periodically sends a liveness detection message to the consensus slave node to detect the survival status of the consensus master node;

[0028] If the consensus slave node does not receive the liveness detection message sent by the consensus master node within the specified time, a new election is performed to obtain a new consensus master node.

[0029] In this embodiment, in order to ensure that the consensus master node can run smoothly, the consensus master node can periodically send a liveness detection message to the consensus slave node. If the consensus slave node does not receive the liveness detection message sent by the consensus slave node within the specified time, it means that the consensus master node is unavailable and needs to be re-elected to obtain a new consensus master node. Through regular liveness detection, it is ensured that after the consensus master node is inactivated, a new consensus master node can be obtained in time in the consensus layer to ensure the normal operation of the consensus layer.

[0030] S102, the consensus master node receives the block account event broadcast by the blockchain, and pushes the parsing task instructions to the multiple parsing nodes of the parsing layer based on the load balancing strategy, obtains the parsing results returned by the multiple parsing nodes of the parsing layer, and compares whether the parsing results are consistent;

[0031] In this step, after receiving the block account event broadcast by the blockchain, the consensus master node distributes the work to multiple parsing nodes in the parsing layer according to the load balancing strategy, obtains the parsing results of multiple parsing nodes, and compares whether the multiple parsing results are consistent, so as to obtain the accuracy of the work of this parsing node. Among them, the load balancing strategy supports polling, last processing waiting time and other strategies.

[0032] In one embodiment, the pushing of parsing task instructions to multiple parsing nodes of the parsing layer based on the load balancing strategy includes:

[0033] The consensus master node receives registration information of multiple nodes of the resolution layer, and registers the multiple nodes of the resolution layer as corresponding multiple resolution nodes;

[0034] The consensus master node sends a live detection message to the registered parsing nodes, saves the surviving parsing nodes into a survival table and the unavailable parsing nodes into an unavailable table according to the live detection result, and pushes parsing task instructions to the parsing nodes in the survival table.

[0035] In this embodiment, the nodes of the parsing layer are first registered with the consensus master node, so that the nodes of the parsing layer are converted to corresponding parsing nodes. The consensus master node sends a detection message to the corresponding parsing node, saves the parsing node to the corresponding table according to the detection result, and then pushes the parsing task instruction to the parsing node in the survival table. Since the parsing node may fail during operation, before pushing the parsing task instruction, the parsing nodes need to be classified, and the executable parsing nodes are saved in the survival table, and the inoperable parsing nodes are saved in the unavailable table. In this way, when the parsing task instruction needs to be pushed, it is only necessary to push the parsing task instruction to the parsing node in the survival table, which reduces the task push time and makes the whole process simpler and more effective.

[0036] In a specific embodiment, the step of saving the surviving parsing nodes into a surviving table and saving the unavailable parsing nodes into an unavailable table comprises:

[0037] Periodically sending a liveness detection message to the parsing node in the survival table, if no liveness detection result is returned within a predetermined time, the parsing node is transferred to the unavailable table;

[0038] Periodically send a detection message to the resolution node in the unavailable table, and if a detection result is received, transfer the resolution node to the survival table.

[0039] In this embodiment, after saving the parsing nodes of different states to the corresponding survival table or unavailable table, it is necessary to regularly check whether the state of the parsing nodes in the survival table or unavailable table has changed. If the parsing node in the survival table is unavailable, the parsing node is transferred to the unavailable table. Correspondingly, if the parsing node in the unavailable table is available, the parsing node is transferred to the survival table. This ensures that the available parsing nodes can be discovered and used in a timely manner, and also avoids the consensus node sending the parsing task instructions to the unavailable parsing nodes, thereby delaying the process.

[0040] In one embodiment, the consensus master node receives the block account event broadcast by the blockchain, and pushes the parsing task instructions to the multiple parsing nodes of the parsing layer based on the load balancing strategy, and obtains the parsing results returned by the multiple parsing nodes of the parsing layer, including:

[0041] The consensus master node pushes parsing task instructions to the multiple parsing nodes, so that the parsing nodes parse the corresponding business according to the preset business rules, and summarizes the parsing results and returns them to the consensus master node.

[0042] In this embodiment, the consensus node pushes the same parsing task instruction to multiple parsing nodes in the parsing layer, and each of the parsing nodes parses the corresponding business according to the preset business rules, and then summarizes all the parsing results and returns them to the consensus node. When the parsing node returns the parsing result, the parsing result is returned to the consensus slave node for summary, and then the consensus slave node sends the summarized parsing result to the consensus master node.

[0043] In one embodiment, comparing whether the parsing results are consistent includes:

[0044] Determine whether the analysis results are more than 2;

[0045] If there are more than two analysis results, compare whether the analysis results are consistent;

[0046] If the parsing result is less than 2, the parsing task instruction is resent to the multiple parsing nodes.

[0047] In one embodiment, the consensus node sends a parsing task instruction to multiple parsing nodes. After receiving the parsing results returned by the parsing nodes, the number of parsing results returned is judged. If the parsing results returned are more than 2, it means that the number of the parsing results meets the comparison condition. The parsing results are further compared to see if they are consistent. If the returned result is less than 2, the number of the parsing results does not meet the comparison condition. At this time, it is necessary to resend the parsing task instruction to another parsing node to reacquire the corresponding parsing result. The consensus node will receive the parsing results returned by the parsing node within a predetermined time. After the predetermined time is reached, the parsing results that have not been returned will not be adopted.

[0048] S103. If the analysis results are consistent, the analysis results are saved in the consensus master node, and the analysis results are pushed to the front-end browser for content display.

[0049] In this step, since all parsing nodes perform parsing according to the same preset business rules, when the returned parsing results are consistent, it means that the parsing results are correct, and the corresponding parsing results are saved in the consensus master node. The consensus master node pushes the parsing results to the front-end browser through the websocket protocol (the WebSocket protocol is a new network protocol based on TCP, which realizes full-duplex communication between the browser and the server-allowing the server to actively send information to the client), and the front-end browser displays the content according to the business rules.

[0050] In one embodiment, the hierarchical weakly centralized blockchain browser generation method further includes:

[0051] If the analysis results are inconsistent, the analysis task instruction is resent to the multiple analysis nodes until the analysis results returned by the multiple analysis nodes are consistent.

[0052] In this embodiment, when the returned parsing results are inconsistent, it means that an error occurred in the parsing of a parsing node during the parsing process. At this time, it is necessary to resend the corresponding parsing task instructions to the new parsing node and obtain new parsing results. If the new parsing results are consistent, the parsing results are pushed. If they are inconsistent, continue to send the corresponding parsing task instructions to the new parsing node until the returned parsing results are consistent, then stop.

[0053] See also Figure 3 , Figure 3 A schematic block diagram of a hierarchical weakly centralized blockchain browser generation system provided in an embodiment of the present invention, the hierarchical weakly centralized blockchain browser generation system 200 includes:

[0054] The node election unit 201 is used to obtain the consensus nodes in the consensus layer and elect them to obtain the consensus master node and the consensus slave node;

[0055] The parsing task instruction pushing unit 202 is used for the consensus master node to receive the block account event broadcast by the blockchain, and push the parsing task instruction to the multiple parsing nodes of the parsing layer based on the load balancing strategy, obtain the parsing results returned by the multiple parsing nodes of the parsing layer, and compare whether the parsing results are consistent;

[0056] The content display unit 203 is used to save the analysis results to the consensus master node if the analysis results are consistent, and push the analysis results to the front-end browser for content display.

[0057] In one embodiment, the parsing task instruction pushing unit 202 includes:

[0058] A resolution node registration unit, used for the consensus master node to receive registration information of multiple nodes of the resolution layer, and register the multiple nodes of the resolution layer as corresponding multiple resolution nodes;

[0059] The parsing node live detection unit is used for the consensus master node to send live detection messages to the registered parsing nodes. According to the live detection results, the surviving parsing nodes are saved in the survival table, the unavailable parsing nodes are saved in the unavailable table, and the parsing task instructions are pushed to the parsing nodes in the survival table.

[0060] In one embodiment, the parsing node detection unit includes:

[0061] A survival table node detection unit, used to periodically send a detection message to the resolution node in the survival table, and if no detection result is returned within a predetermined time, the resolution node is transferred to the unavailable table;

[0062] The unavailable table node liveness detection unit is used to periodically send liveness detection messages to the resolution nodes in the unavailable table, and if a liveness detection result is received, transfer the resolution node to the survival table.

[0063] In one embodiment, the parsing task instruction pushing unit 202 includes:

[0064] The analysis result summary unit is used for the consensus master node to push the analysis task instructions to the multiple analysis nodes, so that the analysis nodes analyze the corresponding business according to the preset business rules, and summarize the analysis results and return them to the consensus master node.

[0065] In one embodiment, the parsing task instruction pushing unit 202 includes:

[0066] A unit for determining the number of analysis results, used to determine whether the number of analysis results is more than 2;

[0067] An analysis result judgment unit, used for judging whether the analysis results are consistent if there are more than two analysis results;

[0068] The parsing task instruction resending unit is used to resend the parsing task instruction to the plurality of parsing nodes if the parsing result is less than 2.

[0069] In one embodiment, the hierarchical weakly centralized blockchain browser generation system 200 includes:

[0070] The parsing result comparison unit is used to resend the parsing task instruction to the multiple parsing nodes if the parsing results are inconsistent, until the parsing results returned by the multiple parsing nodes are consistent.

[0071] In one embodiment, the node election unit 201 includes:

[0072] A consensus master node liveness detection unit, used for the consensus master node to periodically send liveness detection messages to the consensus slave nodes to detect the survival status of the consensus master node;

[0073] The consensus master node re-election unit is used to re-elect and obtain a new consensus master node if the consensus slave node does not receive the liveness detection message sent by the consensus master node within a specified time.

[0074] An embodiment of the present invention also provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the method for generating a hierarchical weakly centralized blockchain browser as described above is implemented.

[0075] An embodiment of the present invention also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the method for generating a hierarchical weakly centralized blockchain browser as described above is implemented.

[0076] The various embodiments in the specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same and similar parts between the various embodiments can be referred to each other. For the system disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part description. It should be pointed out that for ordinary technicians in this technical field, without departing from the principle of the present invention, several improvements and modifications can be made to the present invention, and these improvements and modifications also fall within the scope of protection of the claims of the present invention.

[0077] It should also be noted that, in this specification, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "comprises", "comprising" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the statement "comprising a ..." does not exclude the presence of other identical elements in the process, method, article or device including the element.

Claims

1. A hierarchical weakly centralized blockchain browser generation method, It is characterized in that include: Obtain the consensus nodes in the consensus layer and elect them to obtain the consensus master node and consensus slave node; The consensus master node receives the block account event broadcast by the blockchain, and pushes the parsing task instructions to the multiple parsing nodes of the parsing layer based on the load balancing strategy, obtains the parsing results returned by the multiple parsing nodes of the parsing layer, and compares whether the parsing results are consistent; If the analysis results are consistent, the analysis results are saved in the consensus master node, and the analysis results are pushed to the front-end browser for content display; The method of pushing parsing task instructions to multiple parsing nodes of the parsing layer based on the load balancing strategy includes: The consensus master node receives registration information of multiple nodes of the resolution layer, and registers the multiple nodes of the resolution layer as corresponding multiple resolution nodes; The consensus master node sends a live detection message to the registered parsing nodes, saves the surviving parsing nodes into a survival table and the unavailable parsing nodes into an unavailable table according to the live detection result, and pushes parsing task instructions to the parsing nodes in the survival table.

2. According to the method for generating a hierarchical weakly centralized blockchain browser according to claim 1, It is characterized in that After the surviving parsing nodes are saved in the surviving table and the unavailable parsing nodes are saved in the unavailable table, the method includes: Periodically sending a liveness detection message to the parsing node in the survival table, if no liveness detection result is returned within a predetermined time, the parsing node is transferred to the unavailable table; Periodically send a detection message to the resolution node in the unavailable table, and if a detection result is received, transfer the resolution node to the survival table.

3. According to the method for generating a hierarchical weakly centralized blockchain browser according to claim 1, It is characterized in that The consensus master node receives the block account event broadcast by the blockchain, and pushes the parsing task instructions to the multiple parsing nodes of the parsing layer based on the load balancing strategy, and obtains the parsing results returned by the multiple parsing nodes of the parsing layer, including: The consensus master node pushes parsing task instructions to the multiple parsing nodes, so that the parsing nodes parse the corresponding business according to the preset business rules, and summarizes the parsing results and returns them to the consensus master node.

4. The hierarchical weakly centralized blockchain browser generation method according to claim 1, It is characterized in that The comparing and comparing the parsing results to see whether they are consistent includes: Determine whether the analysis results are more than 2; If there are more than two analysis results, compare whether the analysis results are consistent; If the parsing result is less than 2, the parsing task instruction is resent to the multiple parsing nodes.

5. The hierarchical weakly centralized blockchain browser generation method according to claim 1, It is characterized in that Also includes: If the analysis results are inconsistent, the analysis task instruction is resent to the multiple analysis nodes until the analysis results returned by the multiple analysis nodes are consistent.

6. The hierarchical weakly centralized blockchain browser generation method according to claim 1, It is characterized in that The step of obtaining the consensus nodes in the consensus layer and electing them to obtain the consensus master node and the consensus slave node includes: The consensus master node periodically sends a liveness detection message to the consensus slave node to detect the survival status of the consensus master node; If the consensus slave node does not receive the liveness detection message sent by the consensus master node within the specified time, a new election is performed to obtain a new consensus master node.

7. A hierarchical weakly centralized blockchain browser generation system, It is characterized in that include: The node election unit is used to obtain the consensus nodes in the consensus layer and elect them to obtain the consensus master node and consensus slave node; A parsing task instruction pushing unit is used for the consensus master node to receive the block account event broadcast by the blockchain, and push the parsing task instruction to multiple parsing nodes of the parsing layer based on the load balancing strategy, obtain the parsing results returned by the multiple parsing nodes of the parsing layer, and compare whether the parsing results are consistent; A content display unit, for saving the analysis results to the consensus master node if the analysis results are consistent, and pushing the analysis results to the front-end browser for content display; The parsing task instruction pushing unit includes: A resolution node registration unit, used for the consensus master node to receive registration information of multiple nodes of the resolution layer, and register the multiple nodes of the resolution layer as corresponding multiple resolution nodes; The parsing node live detection unit is used for the consensus master node to send live detection messages to the registered parsing nodes. According to the live detection results, the surviving parsing nodes are saved in the survival table, the unavailable parsing nodes are saved in the unavailable table, and the parsing task instructions are pushed to the parsing nodes in the survival table.

8. A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, It is characterized in that When the processor executes the computer program, the method for generating a hierarchical weakly centralized blockchain browser according to any one of claims 1 to 6 is implemented.

9. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores a computer program, which, when executed by a processor, causes the processor to execute the hierarchical weakly centralized blockchain browser generation method as described in any one of claims 1 to 6.