Test method and device for block chain monitoring system and program product
By initializing the test environment in the blockchain monitoring system, obtaining transaction samples, determining test targets and configuring test plug-ins, executing transaction samples to obtain monitoring data and analyzing data, and generating test conclusions, the problem of lack of end-to-end integration verification in the existing technology is solved, and systematic testing and flexible configuration are achieved.
Patent Information
- Application Number
- CN202411998361.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-31
- Publication Date
- 2025-05-23
AI Technical Summary
When the existing technology conducts integration testing of blockchain monitoring systems, it lacks end-to-end integration verification of the entire system from on-chain to off-chain, making it difficult to meet the needs of different application scenarios.
Provide a testing method, including initializing the test environment, obtaining transaction samples, determining test targets, and configuring the test plug-in based on the test targets, executing transaction samples to obtain monitoring data and analyzing data, and generating test conclusions.
The systemic testing of the blockchain monitoring system is realized, and it can be flexibly configured for different test goals, ensuring end-to-end integrated verification of the entire system, and improving testing efficiency and coverage.
Smart Images

Figure CN120029905A_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of blockchain technology, and in particular, relates to a testing method, equipment and program product for a blockchain monitoring system. Background Art
[0002] The blockchain monitoring system consists of two parts: the on-chain monitoring node and the off-chain analysis and monitoring platform. The monitoring node is responsible for collecting on-chain data, and the off-chain platform analyzes transaction behavior and provides real-time monitoring. However, in the integration test of the blockchain monitoring system, in response to the needs of different application scenarios, the existing testing methods usually only focus on the functional verification of a single module, lacking end-to-end integrated verification of the entire system from on-chain to off-chain. Summary of the invention
[0003] In view of this, the embodiments of the present application provide a testing method, device and program product for a blockchain monitoring system, so as to implement systematic testing of the blockchain monitoring system.
[0004] A first aspect of an embodiment of the present application provides a testing method for a blockchain monitoring system, including:
[0005] Initializing a test environment and obtaining a plurality of transaction samples for testing, wherein the test environment includes a test blockchain;
[0006] Determine a test target, where the test target is a monitoring node, a monitoring platform, or a blockchain monitoring system, and the blockchain monitoring system includes the monitoring node and the monitoring platform;
[0007] Based on the test target, controlling the monitoring platform to configure a test plug-in, wherein the test plug-in is used to test the function of the blockchain;
[0008] In the test environment, executing each of the transaction samples through the test blockchain to obtain monitoring data of the monitoring node and analysis data of the monitoring platform;
[0009] A test conclusion is generated based on the monitoring data and the analysis data.
[0010] In a possible implementation, controlling the monitoring platform to configure the test plug-in based on the test target includes:
[0011] If the test target is the monitoring node, determining a target test plug-in, wherein the target test plug-in includes a test plug-in that has passed the test;
[0012] The information of the target test plug-in is sent to the monitoring platform to control the monitoring platform to load the target test plug-in.
[0013] In a possible implementation, controlling the monitoring platform to configure the test plug-in based on the test target includes:
[0014] If the test target is the monitoring platform, determining the function to be tested of the monitoring platform;
[0015] According to the function to be tested, the monitoring platform is controlled to perform test plug-in configuration.
[0016] In a possible implementation, controlling the monitoring platform to perform test plug-in configuration according to the function to be tested includes:
[0017] If there is a corresponding test plug-in for the function to be tested, the test plug-in corresponding to the function to be tested is used as the target test plug-in;
[0018] The information of the target test plug-in is sent to the monitoring platform to control the monitoring platform to load the target test plug-in.
[0019] In a possible implementation, controlling the monitoring platform to configure the test plug-in based on the test target includes:
[0020] If the test target is the blockchain monitoring system, the monitoring platform is controlled to deploy a test plug-in corresponding to a transaction monitoring function, and the transaction monitoring function is used to obtain transaction data from the monitoring node and send it to the monitoring platform.
[0021] In a possible implementation, executing each of the transaction samples through the test blockchain in the test environment to obtain the monitoring data of the monitoring node and the analysis data of the monitoring platform includes:
[0022] Receiving a contract call request from the blockchain monitoring system, where the contract call request is generated by the blockchain monitoring system according to a call scenario required for testing;
[0023] Respond to the contract call request and record the call information of the contract call request, the monitoring data including the call information.
[0024] In a possible implementation, the monitoring data includes first monitoring information obtained by the monitoring node from the test blockchain, the analysis data includes second monitoring information obtained from the monitoring node and an analysis result generated based on the second monitoring information, and generating a test conclusion according to the monitoring data and the analysis data includes:
[0025] Compare the first monitoring information with the target monitoring information corresponding to the transaction sample to obtain a first test result, wherein the first monitoring information includes transaction information, block information, and event information, and the first test result is used to indicate whether the monitoring node passes the test;
[0026] Comparing the first monitoring information with the second monitoring information to obtain a second test result, where the second test result is used to indicate whether the interaction function between the monitoring node and the monitoring platform passes the test;
[0027] Determining a target analysis result corresponding to the second monitoring information;
[0028] The analysis result is compared with the target analysis result to obtain a third test result, and the test result is used to indicate whether the monitoring platform has passed the functional test.
[0029] In a possible implementation, the obtaining of a plurality of transaction samples for testing includes:
[0030] Acquire historical transaction data from a sample database, where the sample database is used to store historical transaction data of the blockchain;
[0031] Parameters of the historical transaction data are adjusted to obtain the transaction sample.
[0032] A second aspect of an embodiment of the present application provides a testing device for a blockchain monitoring system, including:
[0033] A test environment deployment module, used to initialize a test environment and obtain multiple transaction samples for testing, wherein the test environment includes a test blockchain;
[0034] A test target determination module, used to determine a test target, wherein the test target is a monitoring node, a monitoring platform or a blockchain monitoring system, and the blockchain monitoring system includes the monitoring node and the monitoring platform;
[0035] A plug-in configuration module, used to control the monitoring platform to configure a test plug-in based on the test target, and the test plug-in is used to test the function of the blockchain;
[0036] A testing module, configured to execute each of the transaction samples through the test blockchain in the test environment to obtain monitoring data of the monitoring node and analysis data of the monitoring platform;
[0037] A generation module is used to generate a test conclusion based on the monitoring data and the analysis data.
[0038] A third aspect of an embodiment of the present application provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the method described in the first aspect when executing the computer program.
[0039] A fourth aspect of an embodiment of the present application 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 method described in the first aspect above is implemented.
[0040] A fifth aspect of the embodiments of the present application provides a computer program product. When the computer program product is run on a computer device, the computer device executes the method described in the first aspect.
[0041] Compared with the prior art, the embodiments of the present application have the following advantages:
[0042] The method in the embodiment of the present application can be used to test the blockchain monitoring system. When testing the blockchain monitoring system, different test plug-ins can be loaded for different test targets. Based on the test plug-in, the test function can be flexibly configured in the blockchain monitoring system, so as to flexibly implement the test of the blockchain monitoring system. The method in the embodiment of the present application can deploy the test chain in the test environment and obtain transaction samples for testing. By executing the transaction samples in the test chain, the blockchain monitored by the blockchain monitoring system can be simulated. The blockchain monitoring system monitors the test chain, so that the monitoring node can obtain the monitoring data, and the monitoring data will be sent to the monitoring platform, and the monitoring platform can obtain the analysis data based on the monitoring data. Since the transaction samples and the test chain are known, the data obtained by the test chain executing the transaction samples is also known. Therefore, based on the monitoring data, it can be obtained whether the data monitoring of the monitoring node is correct. Since the test chain and the transaction samples are known, the analysis results of the monitoring platform can be predetermined. Therefore, the test conclusion can be generated based on the monitoring data and the analysis data. Based on the method in the embodiment of the present application, systematic testing can be achieved when testing. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art.
[0044] Figure 1 It is a schematic diagram of a blockchain monitoring system provided by an embodiment of the present application;
[0045] Figure 2 This is a schematic diagram of the steps of a testing method for a blockchain monitoring system provided in an embodiment of the present application;
[0046] Figure 3 This is a test flow diagram for a blockchain monitoring system provided by an embodiment of the present application;
[0047] Figure 4 It is a schematic diagram of a blockchain monitoring system device provided in an embodiment of the present application;
[0048] Figure 5 It is a schematic diagram of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0049] In the following description, specific details such as specific system structures, technologies, etc. are proposed for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application can also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from hindering the description of the present application.
[0050] The blockchain monitoring system consists of two parts: the on-chain monitoring node and the off-chain analysis and monitoring platform. The monitoring node is responsible for collecting on-chain data, and the off-chain platform analyzes transaction behavior and provides real-time monitoring. However, in system integration testing, in response to the needs of different application scenarios, existing testing methods usually only focus on the functional verification of a single module, lacking end-to-end integrated verification of the entire system from on-chain to off-chain.
[0051] In addition, faced with the ever-changing blockchain ecosystem, the monitoring system needs to support multiple functional expansions (such as data analysis, security auditing, abnormal transaction detection, etc.). Traditional testing solutions are difficult to quickly adapt to new functions and have low testing efficiency.
[0052] For blockchain monitoring systems, existing technologies verify the basic functions of the monitoring system through manual or automated scripts, including node monitoring, data analysis, and event alarms. The test cases in existing systems are often based on static transaction data sample libraries, which cannot cover the complex scenarios and anomalies in real transactions, and it is difficult to fully verify the performance of the system in high-concurrency and abnormal transaction scenarios.
[0053] At the stress testing level, existing technologies use simulation tools to generate large amounts of transaction data and verify system performance indicators (such as processing throughput and response time) through stress testing. They usually only focus on a single dimension of performance (such as throughput or latency) and are unable to effectively test performance in a cross-chain environment (such as data consistency and transaction rollback).
[0054] In addition, the testing of blockchain systems mainly relies on testers to manually run the supervision system and analyze the running results through log files, which is time-consuming and prone to missing problems; the log analysis method lacks automation.
[0055] The technical solution of the present application is described below through specific embodiments.
[0056] The blockchain monitoring system can be used to monitor blockchain nodes. The blockchain monitoring system can include monitoring nodes on the chain and monitoring platforms off the chain. The monitoring nodes on the chain are used to monitor the blockchain, thereby obtaining monitoring data of the blockchain. The monitoring nodes on the chain can send the acquired data to the monitoring platform off the chain. The monitoring platform can perform data analysis and generate test reports based on the monitoring data.
[0057] Figure 1 is a schematic diagram of a blockchain monitoring system provided in an embodiment of the present application, such as Figure 1 As shown, the blockchain monitoring system can include an on-chain monitoring Geth node and an off-chain analysis and monitoring platform. Figure 1 As shown, the off-chain analysis and monitoring platform can have the functions of data monitoring and collection, transaction analysis and statistics, log and abnormal alarm, data aggregation and reporting. Figure 1 Only some functions are shown in the figure. People skilled in the art should understand that the off-chain analysis and monitoring platform also has other functions.
[0058] Basic test functions can be deployed in the monitoring platform, and other test functions can be integrated by loading test plug-ins. After the test passes, the test plug-in can be stored in the plug-in library.
[0059] In the embodiment of the present application, the monitoring platform, the monitoring node and the computer device for testing can be deployed on different devices respectively. As an example, the monitoring platform can be deployed on a server, the monitoring node can be deployed on a device, and the computing device for testing can be another server.
[0060] In one possible implementation, when there is an update to the blockchain monitoring system, a test of the blockchain monitoring system can be triggered. As an example, a developer can submit the code to be tested on the test platform. The code to be tested can be used to update the monitoring node, the monitoring platform, and the system framework. Based on the code to be tested, the test platform can generate a test task and send the test task to the test server. After receiving the test task, the test server can determine the test target according to the target updated by the code to be tested, so as to perform different tests based on different test targets.
[0061] However, if a certain function of the blockchain monitoring system is updated, a comprehensive test must be performed, which is likely to cause a waste of resources and reduce development efficiency. Therefore, the test of the blockchain testing system can be triggered by the user. For example, the test can be set to be performed after a preset time, or after integrating multiple functions. In the embodiment of the present application, the test timing of the blockchain monitoring system can be set by itself, and is not limited here.
[0062] Reference Figure 2 , shows a schematic diagram of the steps of a method for a blockchain monitoring system provided by an embodiment of the present application, which may specifically include the following steps:
[0063] S201, initialize a test environment and obtain multiple transaction samples for testing, wherein the test environment includes a test blockchain.
[0064] The method in this embodiment can be applied in a computer device, which can be a test server. The test server is an independent server, that is, the test server is not interfered by the external environment, thereby ensuring stability during the test process. The test server can ensure that the network status and memory status during the test process are sufficient, thereby reducing the impact of the test environment on the test results.
[0065] In one possible implementation, the test server can be deployed in a test system. The test system may include a test platform and a test server, wherein the test platform can generate a test task for the blockchain monitoring system according to user settings, and send the test task to the test server. The test server performs the test of the blockchain monitoring system. It should be noted that the test platform can generate multiple test tasks, and send each test task to each test server for testing. In this embodiment, the test method in this application is described by taking the test process of a test task as an example.
[0066] The test system may include a sample database, and the transaction data of the blockchain may be stored in the sample database. The transaction data stored in the sample database may be updated in a timely manner. For example, at a preset time interval, new transaction data in the blockchain may be obtained to update the sample database. The sample database may be a remote database, and the remote database may be deployed on a remote device, such as a cloud server. For example, the sample database may be deployed in GitHub. The sample database may include a variety of different transaction data, for example, normal transaction data, abnormal transaction data, and transaction data of different scenarios.
[0067] When testing, transaction data can be obtained from the sample database, so as to generate transaction samples for testing based on the transaction data. Transaction samples can include original transactions in the blockchain, and transactions generated based on transactions. Dynamic adjustment of transaction parameters can generate new transactions, where adjustable parameters can include sender and receiver addresses, transaction amount, gas fees, contract call data and other parameters. Transaction samples can include normal transactions, abnormal transactions and attack transactions. Attack transactions can be transaction samples that simulate attacks. For example, attack transactions can attack the blockchain, overflow attacks, etc.
[0068] As an example, a transaction sample generation script can be deployed in the test server. When executing a test task, in response to the test task, the transaction sample generation script can request the latest transaction data from the sample database. The acquired transaction data is dynamically adjusted to generate a transaction sample for testing. The transaction sample can be saved in the test server. Based on the transaction sample, the test server can provide rich transaction data, thereby facilitating the verification of the robustness and comprehensiveness of the blockchain monitoring system.
[0069] A test chain can be deployed in the test server, and the test chain can include blockchain nodes. The test chain can be configured consistent with the actual blockchain, so that the same functions as the actual blockchain can be achieved. The test server can configure the test environment. For example, according to the test requirements, the node role, network connection configuration, synchronization mode, consensus mechanism (such as PoW or PoS), blockchain status (such as main network or test network) and other parameters in the test blockchain can be configured to ensure that the node configuration is consistent with the actual application scenario to ensure the start of the test task.
[0070] S202, determine the test target, the test target is a monitoring node, a monitoring platform or a blockchain monitoring system, and the blockchain monitoring system includes the monitoring node and the monitoring platform.
[0071] The above test targets may include monitoring nodes, monitoring platforms, and blockchain monitoring systems. According to the test requirements, the test server may determine the test targets.
[0072] As an example, when it is necessary to test whether the on-chain data collected by the blockchain monitoring system is accurate, the test target can be the monitoring node. When it is necessary to test whether the blockchain monitoring system can achieve the monitoring function, the test target can be the monitoring platform. When it is necessary to test whether the data transmission in the blockchain monitoring system is accurate, the test target can be determined to be the blockchain monitoring system.
[0073] After the monitoring node code is updated, the monitoring node can be tested. When testing the monitoring node, the target node can be configured to the test chain to simulate real transaction activities, so as to check whether the monitoring node correctly captures new blocks, transaction information, event logs, etc. The test plug-in verifies whether the node supports abnormal transaction detection, cross-chain call monitoring and other functions.
[0074] Testing of the monitoring platform can include testing of the basic functions of the monitoring platform and testing of test plug-ins. According to the functional requirements of the monitoring system, define test plug-ins, including transaction monitoring, anomaly detection, data analysis and other functions. The plug-in interacts with the object under test through a standardized interface (JSON-RPC). Check whether the platform correctly parses, stores and visualizes the on-chain data. And verify the performance of the platform under different load conditions (such as high-frequency trading monitoring).
[0075] The monitoring target is the blockchain monitoring system, and the integration test of the blockchain monitoring system can be carried out to verify the integrity and performance of the collaboration between different components: execute the full-process testing task: execute transaction activities on the chain specified by the configuration file, and verify whether the functions of the monitoring node are executed normally; the test framework calls the plug-in function to collect on-chain data, transaction logs, event information, etc.; pass the results to the off-chain analysis and monitoring platform for processing.
[0076] S203, based on the test target, controlling the monitoring platform to configure a test plug-in, wherein the test plug-in is used to test the function of the blockchain.
[0077] The test plug-in can be used to perform the corresponding test functions. For example, the test plug-in can include an abnormal transaction identification plug-in and an alarm generation plug-in. Among them, the abnormal transaction identification plug-in is used to capture abnormal transactions on the chain; the alarm generation plug-in is used to generate alarm information of abnormal transactions off the chain.
[0078] If the test target is a monitoring node, it is necessary to test whether the monitoring node is compatible with each test plug-in. Therefore, the test plug-in that has passed the test can be used as the target test plug-in; and the information of the target test plug-in is sent to the monitoring platform to control the monitoring platform to load the target test plug-in.
[0079] If the test target is a monitoring platform, the function to be tested of the monitoring platform can be determined; according to the function to be tested, the monitoring platform is controlled to configure the test plug-in. If there is no corresponding test plug-in for the function to be tested, the test plug-in may not be loaded. If there is a corresponding test plug-in for the function to be tested, the test plug-in corresponding to the function to be tested is used as the target test plug-in; the information of the target test plug-in is sent to the monitoring platform to control the monitoring platform to load the target test plug-in.
[0080] If the test target is a blockchain monitoring system, the monitoring platform is controlled to deploy a test plug-in corresponding to the transaction monitoring function. The transaction monitoring function is used to obtain transaction data from the monitoring node and send it to the monitoring platform.
[0081] S204: In the test environment, each of the transaction samples is executed through the test blockchain to obtain monitoring data of the monitoring node and analysis data of the monitoring platform.
[0082] The monitoring data may be data acquired by the monitoring node, and the analysis data may include analysis results of the monitoring platform. The analysis results may be obtained by the monitoring platform from the monitoring node.
[0083] In one possible implementation, the blockchain monitoring system can generate a contract call request according to the test requirements to obtain the node data in the blockchain. As an example, the test server can receive a contract call request from the blockchain monitoring system, respond to the contract call request, and record the call information of the contract call request, and the monitoring data can include the call information.
[0084] Generate on-chain call scenarios through the test framework, execute transactions, collect execution results and event logs to compare the processing results of on-chain nodes and off-chain platforms to ensure data consistency and integrity.
[0085] It also supports the setting of monitoring nodes and data flow, verifies that the on-chain monitoring nodes can interact normally with the off-chain analysis platform, and reports on-chain events and transaction data to the analysis platform in a timely manner.
[0086] S205: Generate a test conclusion based on the monitoring data and the analysis data.
[0087] The monitoring data includes first monitoring information obtained by the monitoring node from the test blockchain, and the analysis data includes second monitoring information obtained from the monitoring node and an analysis result generated based on the second monitoring information.
[0088] Compare the first monitoring information with the target monitoring information corresponding to the transaction sample to obtain a first test result, where the first monitoring information includes transaction information, block information, and event information, and the first test result is used to indicate whether the monitoring node passes the test;
[0089] Comparing the first monitoring information with the second monitoring information to obtain a second test result, where the second test result is used to indicate whether the interaction function between the monitoring node and the monitoring platform passes the test;
[0090] Determining a target analysis result corresponding to the second monitoring information;
[0091] The analysis result is compared with the target analysis result to obtain a third test result, which is used to characterize whether the monitoring platform has passed the functional test.
[0092] The system collects information related to the contract operation status by executing test cases, monitoring transactions and verifying contract behavior. This data will be passed to the audit report module to generate relevant audit reports, reflecting the execution status of the contract, potential vulnerabilities or non-compliant behaviors. The running results of each test plug-in are summarized and a test report is generated, indicating the system function verification status, performance indicators and problem list.
[0093] The test solution proposed in this application can expand the functions of the object under test in a plug-in manner, supporting flexible customization and efficient testing of system functions. Through modular design and systematic testing process, the interaction logic, data consistency and overall system performance between the on-chain monitoring node and the off-chain analysis and monitoring platform are verified, while supporting rapid integration testing of new functional modules to improve the overall reliability and robustness of the test system.
[0094] It should be noted that the size of the serial numbers of the steps in the above embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
[0095] Figure 3 This is a schematic diagram of a test flow for a blockchain monitoring system provided by an embodiment of the present application. Figure 3 As shown, when testing the blockchain monitoring system, the test target can be identified and configured according to the identified test target. As an example, at the beginning of the test, the system can automatically identify the test target. If the test target is an on-chain monitoring node, it will enter the node-oriented configuration. The oriented configuration includes confirming the function and version of the target plug-in; automatically matching or generating test cases to adapt to the target plug-in; and parameterizing the plug-in to ensure compatibility in different operating environments. Through plug-in design, dynamic loading of functional modules can be achieved.
[0096] If the target is an off-chain analysis and monitoring platform or plug-in, enter the plug-in loading directional configuration. For the off-chain analysis and monitoring platform, load the corresponding plug-in according to the target function (such as monitoring, security protection, data analysis).
[0097] When performing integration testing, you can determine the test plug-in based on the functions that need to be tested, and then load the corresponding plug-in.
[0098] Then the test chain is initialized, test cases are executed based on the configuration files, data analysis is performed, and a test report is generated.
[0099] In order to better illustrate the scheme in the present application, the scheme in the present application is described below with specific examples.
[0100] If the test server identifies the test target as: integration test of transaction monitoring function, then the test target can be determined as blockchain monitoring system, and the collaboration function between on-chain monitoring node and off-chain analysis platform needs to be verified. Test tasks include: testing whether on-chain monitoring node can capture and forward transaction data in real time, and testing whether off-chain monitoring platform can perform statistical analysis on-chain data and generate reports.
[0101] When testing, you can use a plug-in to load the on-chain transaction monitoring function, capture transaction data in real time and forward it to the off-chain analysis platform.
[0102] Create a local test chain in the test server, deploy necessary smart contracts, load the transaction sample library, and construct multiple transaction scenarios to cover typical situations and boundary conditions. Verify whether the monitoring node correctly captures transaction details, including transaction hash, amount, Gas usage, etc. Compare the transaction statistics generated by the off-chain platform with the on-chain data to ensure data consistency. The system generates a detailed audit report based on the test results.
[0103] If the test target is to verify the blockchain transaction system's ability to identify and respond to abnormal transactions on the chain, then the test target can be determined as the monitoring platform.
[0104] According to the functions to be tested, the blockchain monitoring system can load "abnormal transaction detection plug-ins", such as abnormal transaction identification plug-ins and alarm generation plug-ins. The abnormal transaction identification plug-in is used to capture abnormal transactions on the chain; the alarm generation plug-in is used to generate alarm information of abnormal transactions off the chain.
[0105] Initialize the test chain to simulate various abnormal transaction scenarios, use preset scripts to send abnormal transactions in batches, and mix in normal transactions to ensure test coverage.
[0106] Execute test cases. The abnormal transaction detection plug-in monitors on-chain transactions in real time, captures abnormal transactions and records them through preset rules (such as amount threshold, transaction hash comparison). The analysis platform generates alerts based on abnormal transaction data and stores them in the alert log or database.
[0107] Summarize the test records and record key data, such as the ratio of captured abnormal transactions to sent abnormal transactions, the ratio of the number of alarms generated off-chain to captured abnormal transactions, the correct identification ratio of captured abnormal types, system response time and throughput in high-frequency trading scenarios, and other data to form an audit report.
[0108] The method in the embodiment of the present application can support end-to-end testing between on-chain monitoring nodes and off-chain analysis and monitoring platforms, ensuring the full-link correctness and performance stability of data collection, transmission, and processing.
[0109] The testing method in the embodiment of the present application can provide a plug-in testing framework to flexibly expand the functional modules of the object under test. The embodiment of the present application realizes flexible expansion and rapid verification of the functional modules of the monitoring system through the plug-in testing framework to adapt to diverse testing needs.
[0110] The testing method in the embodiment of the present application can efficiently verify the functional integrity, scalability and reliability of the monitoring system. The embodiment of the present application uses an end-to-end testing method to fully verify the interaction logic and data consistency between the on-chain monitoring node and the off-chain analysis platform.
[0111] In the embodiment of the present application, the transaction data used for testing can be regularly updated based on the transaction data sample library to ensure that the test covers diverse scenarios and the latest business needs. The embodiment of the present application uses the transaction data sample library regularly updated by the laboratory to enrich the test scenarios, cover the latest blockchain ecological changes and business needs, and improve the comprehensiveness and practicality of the test.
[0112] The test method in the embodiment of the present application has strong adaptability. The test method in the embodiment of the present application supports the expansion of multi-chain networks (such as Ethereum, BSC, Polygon, etc.) and various monitoring functions (such as compliance auditing, anomaly detection), improving system compatibility and reliability.
[0113] Reference Figure 4 , shows a schematic diagram of a test device for a blockchain monitoring system provided by an embodiment of the present application, which may specifically include a test environment deployment module 41, a test target determination module 42, a plug-in configuration module 43, a test module 44 and a generation module 45, wherein:
[0114] A test environment deployment module 41, used to initialize a test environment and obtain multiple transaction samples for testing, wherein the test environment includes a test blockchain;
[0115] A test target determination module 42 is used to determine a test target, wherein the test target is a monitoring node, a monitoring platform or a blockchain monitoring system, and the blockchain monitoring system includes the monitoring node and the monitoring platform;
[0116] A plug-in configuration module 43, used to control the monitoring platform to configure a test plug-in based on the test target, and the test plug-in is used to test the function of the blockchain;
[0117] A testing module 44 is used to execute each of the transaction samples through the test blockchain in the test environment to obtain monitoring data of the monitoring node and analysis data of the monitoring platform;
[0118] The generating module 45 is used to generate a test conclusion according to the monitoring data and the analysis data.
[0119] In a possible implementation, controlling the monitoring platform to configure the test plug-in based on the test target includes:
[0120] If the test target is the monitoring node, determining a target test plug-in, wherein the target test plug-in includes a test plug-in that has passed the test;
[0121] The information of the target test plug-in is sent to the monitoring platform to control the monitoring platform to load the target test plug-in.
[0122] In a possible implementation, controlling the monitoring platform to configure the test plug-in based on the test target includes:
[0123] If the test target is the monitoring platform, determining the function to be tested of the monitoring platform;
[0124] According to the function to be tested, the monitoring platform is controlled to perform test plug-in configuration.
[0125] In a possible implementation, controlling the monitoring platform to perform test plug-in configuration according to the function to be tested includes:
[0126] If there is a corresponding test plug-in for the function to be tested, the test plug-in corresponding to the function to be tested is used as the target test plug-in;
[0127] The information of the target test plug-in is sent to the monitoring platform to control the monitoring platform to load the target test plug-in.
[0128] In a possible implementation, controlling the monitoring platform to configure the test plug-in based on the test target includes:
[0129] If the test target is the blockchain monitoring system, the monitoring platform is controlled to deploy a test plug-in corresponding to a transaction monitoring function, and the transaction monitoring function is used to obtain transaction data from the monitoring node and send it to the monitoring platform.
[0130] In a possible implementation, executing each of the transaction samples through the test blockchain in the test environment to obtain the monitoring data of the monitoring node and the analysis data of the monitoring platform includes:
[0131] Receiving a contract call request from the blockchain monitoring system, where the contract call request is generated by the blockchain monitoring system according to a call scenario required for testing;
[0132] Respond to the contract call request and record the call information of the contract call request, the monitoring data including the call information.
[0133] In a possible implementation, the monitoring data includes first monitoring information obtained by the monitoring node from the test blockchain, the analysis data includes second monitoring information obtained from the monitoring node and an analysis result generated based on the second monitoring information, and generating a test conclusion according to the monitoring data and the analysis data includes:
[0134] Compare the first monitoring information with the target monitoring information corresponding to the transaction sample to obtain a first test result, wherein the first monitoring information includes transaction information, block information, and event information, and the first test result is used to indicate whether the monitoring node passes the test;
[0135] Comparing the first monitoring information with the second monitoring information to obtain a second test result, where the second test result is used to indicate whether the interaction function between the monitoring node and the monitoring platform passes the test;
[0136] Determining a target analysis result corresponding to the second monitoring information;
[0137] The analysis result is compared with the target analysis result to obtain a third test result, and the test result is used to indicate whether the monitoring platform has passed the functional test.
[0138] In a possible implementation, the obtaining of a plurality of transaction samples for testing includes:
[0139] Acquire historical transaction data from a sample database, where the sample database is used to store historical transaction data of the blockchain;
[0140] Parameters of the historical transaction data are adjusted to obtain the transaction sample.
[0141] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the description of the method embodiment part.
[0142] Figure 5 This is a schematic diagram of the structure of a computer device provided in an embodiment of the present application. Figure 5 As shown, the computer device 500 of this embodiment includes: at least one processor 50 ( Figure 5Only one is shown in the figure), a memory 51, and a computer program 52 stored in the memory 51 and executable on the at least one processor 50, wherein the processor 50 implements the steps of any of the above-mentioned method embodiments when executing the computer program 52.
[0143] The computer device 500 may be a computing device such as a desktop computer, a notebook, a PDA, or a cloud computing device. The computer device may include, but is not limited to, a processor 50 and a memory 51. Those skilled in the art will appreciate that Figure 5 This is only an example of the computer device 500 and does not constitute a limitation on the computer device 500 . The computer device 500 may include more or fewer components than shown in the figure, or a combination of certain components, or different components. For example, it may also include input and output devices, network access devices, etc.
[0144] The processor 50 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.
[0145] In some embodiments, the memory 51 may be an internal storage unit of the computer device 500, such as a hard disk or memory of the computer device 500. In other embodiments, the memory 51 may also be an external storage device of the computer device 500, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the computer device 500. Further, the memory 51 may also include both an internal storage unit of the computer device 500 and an external storage device. The memory 51 is used to store an operating system, an application program, a boot loader (BootLoader), data, and other programs, such as the program code of the computer program. The memory 51 may also be used to temporarily store data that has been output or is to be output.
[0146] An embodiment of the present application 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 steps in the above-mentioned method embodiments can be implemented.
[0147] An embodiment of the present application provides a computer program product. When the computer program product is run on a computer device, the computer device can implement the steps in the above-mentioned method embodiments when executing the computer program product.
[0148] The above-described embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application is described in detail with reference to the above-mentioned embodiments, a person skilled in the art should understand that the technical solutions described in the above-mentioned embodiments can still be modified, or some of the technical features can be replaced by equivalents; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application, and should be included in the protection scope of the present application.
Claims
1. A testing method for a blockchain monitoring system, characterized in that: include: Initializing a test environment and obtaining a plurality of transaction samples for testing, wherein the test environment includes a test blockchain; Determine a test target, where the test target is a monitoring node, a monitoring platform, or a blockchain monitoring system, and the blockchain monitoring system includes the monitoring node and the monitoring platform; Based on the test target, controlling the monitoring platform to configure a test plug-in, wherein the test plug-in is used to test the function of the blockchain; In the test environment, executing each of the transaction samples through the test blockchain to obtain monitoring data of the monitoring node and analysis data of the monitoring platform; A test conclusion is generated based on the monitoring data and the analysis data.
2. The method according to claim 1, characterized in that The controlling the monitoring platform to configure the test plug-in based on the test target includes: If the test target is the monitoring node, determining a target test plug-in, wherein the target test plug-in includes a test plug-in that has passed the test; The information of the target test plug-in is sent to the monitoring platform to control the monitoring platform to load the target test plug-in.
3. The method according to claim 1, characterized in that The controlling the monitoring platform to configure the test plug-in based on the test target includes: If the test target is the monitoring platform, determining the function to be tested of the monitoring platform; According to the function to be tested, the monitoring platform is controlled to perform test plug-in configuration.
4. The method according to claim 3, characterized in that The step of controlling the monitoring platform to configure the test plug-in according to the function to be tested includes: If there is a corresponding test plug-in for the function to be tested, the test plug-in corresponding to the function to be tested is used as the target test plug-in; The information of the target test plug-in is sent to the monitoring platform to control the monitoring platform to load the target test plug-in.
5. The method according to claim 1, characterized in that The controlling the monitoring platform to configure the test plug-in based on the test target includes: If the test target is the blockchain monitoring system, the monitoring platform is controlled to deploy a test plug-in corresponding to a transaction monitoring function, and the transaction monitoring function is used to obtain transaction data from the monitoring node and send it to the monitoring platform.
6. The method according to any one of claims 1 to 5, characterized in that: In the test environment, executing each of the transaction samples through the test blockchain to obtain the monitoring data of the monitoring node and the analysis data of the monitoring platform includes: Receiving a contract call request from the blockchain monitoring system, where the contract call request is generated by the blockchain monitoring system according to a call scenario required for testing; Respond to the contract call request and record the call information of the contract call request, the monitoring data including the call information.
7. The method according to claim 6, characterized in that The monitoring data includes first monitoring information obtained by the monitoring node from the test blockchain, the analysis data includes second monitoring information obtained from the monitoring node and an analysis result generated based on the second monitoring information, and the generating of a test conclusion based on the monitoring data and the analysis data includes: Compare the first monitoring information with the target monitoring information corresponding to the transaction sample to obtain a first test result, wherein the first monitoring information includes transaction information, block information, and event information, and the first test result is used to indicate whether the monitoring node passes the test; Comparing the first monitoring information with the second monitoring information to obtain a second test result, where the second test result is used to indicate whether the interaction function between the monitoring node and the monitoring platform passes the test; Determining a target analysis result corresponding to the second monitoring information; The analysis result is compared with the target analysis result to obtain a third test result, and the third test result is used to indicate whether the monitoring platform has passed the functional test.
8. The method according to any one of claims 1 to 5 or 7, characterized in that: The obtaining of multiple transaction samples for testing includes: Acquire historical transaction data from a sample database, where the sample database is used to store historical transaction data of the blockchain; Parameters of the historical transaction data are adjusted to obtain the transaction sample.
9. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the method according to any one of claims 1 to 8 is implemented.
10. A computer program product, characterized in that When the computer program product is executed on a computer device, the computer device is caused to execute the method according to any one of claims 1 to 8.