Block chain test system, method and device and storage medium
Through the blockchain testing system, the problem of poor flexibility of existing blockchain testing methods is solved through the blockchain testing system, and the performance stress test of a large number of nodes is realized, which reduces development costs and improves the test results. Show efficiency.
Patent Information
- Application Number
- CN202411113738.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-14
- Publication Date
- 2024-11-26
AI Technical Summary
The existing blockchain testing methods are poor in flexibility, unable to effectively perform performance stress testing of a large number of nodes, and are highly developed.
A blockchain testing system was designed, including a verification module, a server and a test blockchain. The test driver signal was generated through external clients, which drove the collective activities of the test blockchain and the blockchain to be tested, and the performance was performed using simulation technology. Test and Byzantine fault data correction, build virtual test scenarios to achieve performance stress testing.
It improves testing flexibility, can effectively perform performance stress testing of a large number of nodes, reduces development costs, and achieves efficient test results display through real-time data sorting and graphical display.
Smart Images

Figure CN119030894A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of blockchain testing technology, and in particular to a blockchain testing method, system, device and storage medium. Background Art
[0002] In recent years, blockchain testing technology has not kept up with the development of blockchain technology. Blockchain testing is very different from traditional software testing. For example, blockchain has node-to-node testing and Byzantine faults. As a result, blockchain testing cannot use traditional software testing tools or methods, has poor flexibility, and cannot implement performance stress testing of a large number of nodes. In addition, the cost of blockchain development is very high. Summary of the invention
[0003] The purpose of the present invention is to solve the problem that the existing blockchain testing method has poor flexibility and is not suitable for stress testing of a large number of nodes, and proposes a blockchain testing system, method, device and storage medium.
[0004] The blockchain testing system of the present invention comprises: a verification module, a server, and a test blockchain;
[0005] The test blockchain includes a basic blockchain framework, an external client and a test module;
[0006] The basic blockchain framework is combined with the test module to form a test blockchain and deployed to the server;
[0007] The external client is used to receive consensus information from multiple clients, generate test drive signals, and send the test drive signals to the test blockchain; drive the collective activities of the test blockchain and the blockchain to be tested;
[0008] The test module generates test data using the received drive signal, and reaches consensus on the test data with the blockchain to be tested; performs data interaction for the test operation, and sends the test results and test data of the blockchain to be tested to the verification module;
[0009] The verification module is used to use the test data to perform simulation, test and verify the test results of the blockchain to be tested, and obtain the performance identification information of each node of the blockchain to be tested;
[0010] The server is also used to send verification instructions to the verification module and test instructions to the test blockchain.
[0011] Further, in the present invention, the test module includes: a test data generation subunit, a data analysis subunit and a data consensus subunit;
[0012] The data analysis subunit is used to analyze and process the received drive signal of the external client to obtain a data analysis result including whether a Byzantine fault exists;
[0013] The test data generation subunit generates blockchain-specific test data based on the data analysis result, wherein the dedicated test data is data for testing multiple performance indicators one by one;
[0014] The data consensus subunit is used to share the dedicated test data with the blockchain to be tested, and to correct erroneous data of nodes with Byzantine fault data.
[0015] Furthermore, in the present invention, the verification module includes: a verification module, a query module and an update module;
[0016] The verification module is used to build a virtual test scenario to verify whether the test results of the test module in different scenarios are consistent; if they are consistent, the test module can test the blockchain to be tested; otherwise, the virtual test scenario is readjusted until the test results of the test module in different scenarios are consistent;
[0017] The query module is used to query the target performance key indicator data based on the test instructions issued by the server, generate a query mechanism, and send the query mechanism to the server, and the server returns k target performance key indicator data files as query results;
[0018] The update module is used to generate a correct blockchain node using the query result, and based on the verification result of the verification module, the correct blockchain node corresponds to the erroneous node of the blockchain to be tested to obtain identification information.
[0019] Furthermore, the present invention also includes: a comprehensive arrangement module;
[0020] The comprehensive arrangement module is used to comprehensively arrange the test results of the test module and the identification information, and display them in real time based on the server;
[0021] Among them, comprehensive sorting operations include: data format sorting, text conversion and graphic display.
[0022] A blockchain testing method, comprising:
[0023] Build a test blockchain on the server;
[0024] The test node of the test blockchain generates test data;
[0025] An external client in the test blockchain generates a driving signal to drive all nodes in the blockchain to be tested and the test blockchain to perform collective activities;
[0026] The client of the blockchain to be tested is connected to the test node to realize data interaction of the test operation;
[0027] Based on the test results of the test module, simulation technology is used to perform test verification to obtain identification information.
[0028] Preferably, the test node of the test blockchain generates test data, specifically including:
[0029] Analyze and process the consensus data received from multiple clients to obtain data analysis results including whether there are Byzantine faults;
[0030] Based on the data analysis results, generating dedicated test data; wherein the dedicated test data is data for testing multiple performance indicators one by one;
[0031] The dedicated test data is shared with the blockchain to be tested, and errors are corrected and correction results are detected for nodes connected to clients with Byzantine fault data.
[0032] Furthermore, it also includes:
[0033] Comprehensively organize the test results and the identification information, and display them in real time based on the server;
[0034] Among them, comprehensive sorting operations include but are not limited to: data format sorting, text conversion, and graphic display.
[0035] A terminal device comprises a memory, a processor, and a blockchain testing program stored in the memory and executable on the processor. When the processor executes the blockchain testing program, the steps of the blockchain testing method are implemented.
[0036] A computer-readable storage medium stores computer-readable instructions thereon. When the computer-readable instructions are executed by a computer, the computer performs the steps of the blockchain testing method.
[0037] The present invention utilizes the performance mechanism of blockchain consensus to build a test blockchain and connect it with the blockchain to be tested, and share consensus data. The blockchain to be tested is tested by sharing test data with the blockchain to be tested. Based on the construction of a virtual test scenario, performance stress testing of a large number of nodes is achieved, thereby improving test flexibility. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] Figure 1It is a principle block diagram of the blockchain testing system of the present invention; DETAILED DESCRIPTION
[0039] 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 only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0040] It should be noted that, in the absence of conflict, the embodiments of the present invention and the features in the embodiments may be combined with each other.
[0041] Specific implementation method 1: The following is combined Figure 1 This embodiment is described. The blockchain testing system described in this embodiment includes: a verification module 1, a server 2, and a test blockchain 3;
[0042] The test blockchain 3 includes a basic blockchain framework 301, an external client 302 and a test module 303;
[0043] The basic blockchain framework 301 is combined with the test module 303 to form a test blockchain deployed in the server (2);
[0044] The external client 302 is used to receive consensus information from multiple clients, generate a test drive signal, and send the test drive signal to the test blockchain; drive the collective activities of the test blockchain and the blockchain to be tested;
[0045] The test module 303 generates test data using the received driving signal, and reaches consensus on the test data with the blockchain to be tested; performs data interaction for the test operation, and sends the test results and test data of the blockchain to be tested to the verification module 1;
[0046] Verification module 1 is used to perform simulation using test data, test and verify the test results of the blockchain to be tested, and obtain performance identification information of each node of the blockchain to be tested;
[0047] The server 2 is also used to send verification instructions to the verification module 1 and send test instructions to the test blockchain 3.
[0048] Further, in the present invention, the test module includes: a test data generation subunit 3032, a data analysis subunit 3031 and a data consensus subunit 3033;
[0049] The data analysis subunit 3031 is used to analyze and process the received drive signal of the external client 302 to obtain a data analysis result including whether a Byzantine fault exists;
[0050] The test data generation subunit 3032 generates blockchain-specific test data based on the data analysis result, wherein the dedicated test data is data for testing multiple performance indicators one by one;
[0051] The data consensus subunit is used to share the dedicated test data with the blockchain to be tested, and to correct erroneous data of nodes with Byzantine fault data.
[0052] Furthermore, in the present invention, the verification module includes: a verification module 101, a query module 102 and an update module 103;
[0053] The verification module 101 is used to build a virtual test scenario to verify whether the test results of the test module in different scenarios are consistent; if they are consistent, the test module can test the blockchain to be tested; otherwise, the virtual test scenario is readjusted until the test results of the test module in different scenarios are consistent;
[0054] The query module 102 is used to query the target performance key indicator data based on the test instructions issued by the server, generate a query mechanism, and send the query mechanism to the server, and the server returns k target performance key indicator data files as query results;
[0055] The update module 103 is used to generate a correct blockchain node, and based on the verification result based on the verification module and the query result, the correct blockchain node corresponds to the node of the blockchain to be tested that has an error, to obtain identification information.
[0056] Specific implementation method 2: A blockchain testing method described in this implementation method includes the following steps:
[0057] Build a test blockchain on the server;
[0058] The test node of the test blockchain generates test data;
[0059] An external client in the test blockchain generates a driving signal to drive all nodes in the blockchain to be tested and the test blockchain to perform collective activities;
[0060] The client of the blockchain to be tested is connected to the test node to realize data interaction of the test operation;
[0061] Based on the test results of the test module, simulation technology is used to perform test verification to obtain identification information.
[0062] Preferably, the test node of the test blockchain generates test data, specifically including:
[0063] Analyze and process the consensus data received from multiple clients to obtain data analysis results including whether there are Byzantine faults;
[0064] Based on the data analysis results, generating dedicated test data; wherein the dedicated test data is data for testing multiple performance indicators one by one;
[0065] The dedicated test data is shared with the blockchain to be tested, and errors are corrected and correction results are detected for nodes connected to clients with Byzantine fault data.
[0066] Furthermore, the present invention also includes: a comprehensive arrangement module;
[0067] The comprehensive arrangement module is used to comprehensively arrange the test results of the test module and the identification information, and display them in real time based on the server;
[0068] Among them, comprehensive sorting operations include: data format sorting, text conversion and graphic display.
[0069] Specific implementation method three: A terminal device described in this implementation method includes a memory, a processor, and a blockchain testing program stored in the memory and executable on the processor. When the processor executes the blockchain testing program, the steps of the blockchain testing method are implemented.
[0070] Embodiment 3: This embodiment describes a computer-readable storage medium on which computer-readable instructions are stored. When the computer-readable instructions are executed by a computer, the computer executes the steps of the blockchain testing method.
[0071] Example 1
[0072] A blockchain testing system, comprising: an external client, a testing module, a basic blockchain architecture and a verification module;
[0073] External client, used to generate driving signals to drive all nodes in the blockchain under test and the test blockchain to perform collective activities;
[0074] The test module is used to generate test data and deploy multiple test modules as nodes for testing the blockchain.
[0075] The external client and the basic blockchain architecture are respectively connected to the test module to generate a test blockchain and deploy it on the server; the test blockchain is connected to the client in the blockchain to be tested through the test module to perform data interaction for the test operation; the client is the client in the blockchain to be tested, and the blockchain to be tested is connected to the test blockchain through the test module;
[0076] The verification module is used to verify the test results of the test module based on simulation technology to obtain identification information.
[0077] Specifically:
[0078] In this embodiment, the basic blockchain architecture includes: a basic configuration layer, a network control layer and a monitoring management layer. The basic configuration layer is used to build a blockchain network based on a preset engine; the network layer is used to control the network parameters between each virtual node in the blockchain network; the monitoring management layer is used to test the blockchain consensus performance of the blockchain network.
[0079] Among them, in this embodiment, the preset engine is Docker;
[0080] Further, in this embodiment, the test module includes: a test data generation subunit, a data analysis subunit, and a data consensus subunit;
[0081] A data analysis subunit is used to analyze and process the consensus data received from multiple clients to obtain data analysis results including whether there are Byzantine faults;
[0082] The test data generation subunit is used to generate special test data based on the data analysis results; wherein the special test data is data for testing multiple performances one by one;
[0083] The data consensus subunit is used to share the dedicated test data with the blockchain to be tested, and to perform error correction and correction result detection on the nodes connected to the client with Byzantine fault data. In actual use, the system randomly selects the transaction initiating account, transaction receiving account and transaction amount according to the configuration, and calls the data consensus subunit to send transaction requests at the time interval of the driving signal frequency until the test duration is reached. The latency and throughput data of each round of test transactions are recorded, and the average, maximum and minimum values of the latency and the average, maximum and minimum values of the throughput are calculated after the test.
[0084] Verification module, including: verification module, query module and update module;
[0085] The verification module is used to build a virtual test scenario, verify whether the test results of the test module in a specific scenario can test the blockchain to be tested, and whether the test results of the test module in different scenarios are consistent; when the results are consistent, it indicates that the test module can perform performance tests on blockchains in different scenarios. It should be noted that in this actual test, the blockchain performance index results of the blockchain to be tested in different stress test environments can realize performance stress tests on a large number of blockchain nodes to be tested, thereby improving test flexibility. In this embodiment, the virtual test scenario built is a scenario of different stress test environments. In this implementation, the performance index result is the principle that the verification module builds the test module to perform blockchain tests in different virtual test scenarios to perform self-test of the test module function: when the verification module builds the test module to perform blockchain tests in different stress test environments, there will also be correct blockchain performance indicators corresponding to the test module in different stress test environments. Therefore, whether the blockchain performance indicators meet the correct performance indicators in different stress test environments is detected, that is, the performance stress test of the test module in different environments.
[0086] The query module is used to query the target performance key indicator data based on the test instructions issued by the server (the server issues the corresponding keywords for the test instructions. The server issues the corresponding performance test instructions. The query module generates keywords based on this and sends them to the server to query the blockchain node data related to the performance test), generate query results, and send them to the server. The server returns the top k files with the strongest correlation with the target performance key indicator data (referring to the top k files with the strongest correlation with the keywords corresponding to the test instructions issued by the server, and k can be set by yourself) as the query results;
[0087] The update module is used to generate the correct blockchain node (the correct data of all blockchain nodes are stored in the server, and no judgment is required. Keywords can be directly generated by the query module according to the test instructions issued by the server, and obtained by querying in the server), and based on the verification results and query results of the verification module, the error nodes are accurately covered by the nodes of the blockchain to be tested (the blockchain to be monitored is obtained by the performance test of the test module and the verification module and the self-test of the system for the performance test), and the identification information is obtained. Among them, in this embodiment, the identification information includes the following contents: the verification result of the blockchain to be tested, the performance test result of the blockchain to be tested, and the virtual scene information.
[0088] In this embodiment, it also includes: a comprehensive arrangement module;
[0089] A comprehensive arrangement module is used to comprehensively arrange the test results and identification information of the test modules and display them in real time based on the server;
[0090] Among them, comprehensive sorting operations include but are not limited to: data format sorting, text conversion, and graphic display.
[0091] It should be noted that, in this embodiment, multiple test modules are connected to multiple clients.
[0092] Embodiment 2:
[0093] A blockchain testing method comprises the following steps:
[0094] Build a test blockchain on the server;
[0095] The test node of the test blockchain generates test data;
[0096] The external client in the test blockchain generates a driving signal to drive all nodes in the blockchain under test and the test blockchain to perform collective activities;
[0097] The client of the blockchain to be tested connects to the test node to realize data interaction of the test operation;
[0098] Based on the test results of the test module, simulation technology is used to perform test verification to obtain identification information.
[0099] Specifically:
[0100] In this embodiment, the test node of the test blockchain generates test data, which specifically includes:
[0101] Analyze and process the consensus data received from multiple clients to obtain data analysis results including whether there are Byzantine faults;
[0102] Generate dedicated test data based on the data analysis results; wherein the dedicated test data is data tested one by one for multiple performances;
[0103] The dedicated test data is shared with the blockchain to be tested, and errors are corrected and the correction results are detected for the nodes connected to the clients with Byzantine fault data.
[0104] In this embodiment, based on the test results of the test module, the simulation technology is used to perform test verification to obtain identification information, which specifically includes:
[0105] Build a virtual test scenario to verify whether the test results of the test data in a specific scenario can be used to test the blockchain to be tested and whether the test results of the test data in different scenarios are consistent;
[0106] Based on the test instructions issued by the server, the target performance key indicator data is queried, a query structure is generated, and sent to the server, and the server returns the top k files related to the target performance key indicator data as the query result;
[0107] Generate the correct blockchain node, and accurately cover the erroneous nodes of the blockchain to be tested based on the verification results and query results of the verification module to obtain the identification information.
[0108] In this embodiment, it also includes:
[0109] The test results and identification information are comprehensively organized and displayed in real time based on the server; in this embodiment, the throughput and latency performance data calculated by the above technical solution are integrated in the order of blockchain overall performance test and blockchain consensus performance test, and added to the test report, and finally the blockchain performance test report is output and displayed in real time.
[0110] Among them, comprehensive sorting operations include but are not limited to: data format sorting, text conversion, and graphic display.
[0111] Embodiment 3:
[0112] A terminal device includes a memory, a processor, and a blockchain test program stored in the memory and executable on the processor. When the processor executes the blockchain test program, the steps of Example 1 are implemented.
[0113] Embodiment 4:
[0114] A computer-readable storage medium stores computer-readable instructions. When the computer-readable instructions are executed by a computer, the computer executes the steps of embodiment 1.
[0115] Although the present invention is described herein with reference to specific embodiments, it should be understood that these embodiments are merely examples of the principles and applications of the present invention. It should therefore be understood that many modifications may be made to the exemplary embodiments and that other arrangements may be devised without departing from the spirit and scope of the present invention as defined by the appended claims. It should be understood that the various dependent claims and features described herein may be combined in a manner different from that described in the original claims. It should also be understood that features described in conjunction with individual embodiments may be used in other described embodiments.
Claims
1. A blockchain testing system, It is characterized in that include: Verification module (1), server (2), test blockchain (3); The test blockchain (3) includes a basic blockchain framework (301), an external client (302) and a test module (303); The basic blockchain framework (301) and the test module (303) are combined and connected to form a test blockchain deployed in the server (2); The external client (302) is used to receive consensus information from multiple clients, generate a test drive signal, and send the test drive signal to the test blockchain; drive the collective activities of the test blockchain and the blockchain to be tested; The test module (303) generates test data using the received drive signal, and reaches consensus on the test data with the blockchain to be tested; performs data interaction for the test operation, and simultaneously sends the test result and test data of the blockchain to be tested to the verification module (1); A verification module (1) is used to perform simulation using test data to verify the test results of the blockchain to be tested, and obtain performance identification information of each node of the blockchain to be tested; The server (2) is also used to send a verification instruction to the verification module (1) and send a test instruction to the test blockchain (3).
2. A blockchain testing system according to claim 1, It is characterized in that The test module includes: a test data generation subunit (3032), a data analysis subunit (3031) and a data consensus subunit (3033); The data analysis subunit (3031) is used to analyze and process the received drive signal of the external client (302) to obtain a data analysis result including whether a Byzantine fault exists; The test data generation subunit (3032) generates blockchain-specific test data based on the data analysis result, wherein the dedicated test data is data for testing multiple performance indicators one by one; The data consensus subunit is used to share the dedicated test data with the blockchain to be tested, and to correct erroneous data of nodes with Byzantine fault data.
3. A blockchain testing system according to claim 1 or 2, It is characterized in that The verification module comprises: a verification module (101), a query module (102) and an update module (103); The verification module (101) is used to build a virtual test scenario to verify whether the test results of the test module in different scenarios are consistent; if they are consistent, the test module can test the blockchain to be tested; otherwise, the virtual test scenario is readjusted until the test results of the test module in different scenarios are consistent; The query module (102) is used to query the target performance key indicator data based on the test instructions issued by the server, generate a query mechanism, and send the query mechanism to the server, and the server returns k target performance key indicator data files as query results; The update module (103) is used to generate a correct blockchain node using the query result, and based on the verification result of the verification module, the correct blockchain node corresponds to the erroneous node of the blockchain to be tested, to obtain identification information.
4. A blockchain testing system according to claim 1, It is characterized in that Also includes: comprehensive finishing module; The comprehensive arrangement module is used to comprehensively arrange the test results of the test module and the identification information, and display them in real time based on the server; Among them, comprehensive sorting operations include: data format sorting, text conversion and graphic display.
5. A blockchain testing method, It is characterized in that The verification module comprises: Build a test blockchain on the server; The test node of the test blockchain generates test data; An external client in the test blockchain generates a driving signal to drive all nodes in the blockchain to be tested and the test blockchain to perform collective activities; The client of the blockchain to be tested is connected to the test node to realize data interaction of the test operation; Based on the test results of the test module, simulation technology is used to perform test verification to obtain identification information.
6. A blockchain testing system according to claim 5, It is characterized in that The test node of the test blockchain generates test data, specifically including: Analyze and process the consensus data received from multiple clients to obtain data analysis results including whether there are Byzantine faults; Based on the data analysis results, generating dedicated test data; wherein the dedicated test data is data for testing multiple performance indicators one by one; The dedicated test data is shared with the blockchain to be tested, and errors are corrected and correction results are detected for nodes connected to clients with Byzantine fault data. The test node of the test blockchain generates test data, specifically including: Analyze and process the consensus data received from multiple clients to obtain data analysis results including whether there are Byzantine faults; Based on the data analysis results, generating dedicated test data; wherein the dedicated test data is data for testing multiple performance indicators one by one; The dedicated test data is shared with the blockchain to be tested, and errors are corrected and correction results are detected for nodes connected to clients with Byzantine fault data.
7. A blockchain testing system according to claim 5, It is characterized in that Also includes: Comprehensively organize the test results and the identification information, and display them in real time based on the server; Among them, comprehensive sorting operations include but are not limited to: data format sorting, text conversion, and graphic display.
8. A terminal device, It is characterized in that The terminal device includes a memory, a processor, and a blockchain testing program stored in the memory and executable on the processor. When the processor executes the blockchain testing program, the steps of the blockchain testing method are implemented.
9. A computer-readable storage medium, It is characterized in that Used to store computer-readable instructions. When the computer-readable instructions are executed by a computer, the computer performs the steps of the blockchain testing method.
