Block chain network detection method and related equipment
The detection information is set through the operation interface, and the client is built using a simulation program to automatically detect the functions and performance of the blockchain network, solving the problem that existing tools cannot detect functions and high thresholds, and achieving efficient detection of the blockchain network.
Patent Information
- Application Number
- CN202310575166.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-05-19
- Publication Date
- 2024-11-22
AI Technical Summary
The existing blockchain network performance detection tools cannot detect the functions of the blockchain network, and users need to write detection scripts, which has a high threshold, is inconvenient to operate and is inefficient in efficiency.
Provide a blockchain network detection method and device, set detection information through the operation interface, obtain characteristic information and detection dimensions of the blockchain network, use simulation programs to build a client, send transaction requests and respond, and automatically detect the blockchain network functions and performance.
It lowers the threshold for detection operations, improves convenience and efficiency, supports integrated automated detection of functions and performance, and is suitable for different blockchain networks, such as Ethereum and Changan Chain.
Smart Images

Figure CN119011433A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a blockchain network detection method, a blockchain network detection device, a computer device, a computer-readable storage medium, and a computer program product. Background Art
[0002] In the process of establishing the quality system of the blockchain network, it is very necessary to test the functions and performance of the blockchain network. The functions of the blockchain network cover the various basic capabilities that the blockchain network can serve for applications, while the performance of the blockchain network determines the amount of business that the upper-level applications carried in the blockchain network can handle during peak hours.
[0003] At present, the performance of blockchain networks can only be tested with the help of performance testing tools such as Caliper and Hyperbench, but the functions of blockchain networks cannot be tested. In addition, when using performance testing tools, users need to manually write some testing scripts, which not only makes it impossible for users without technical background to use these performance testing tools to test the performance of blockchain networks, but also makes the testing threshold high; it also leads to problems such as inconvenient testing operations for blockchain networks and low testing efficiency. Summary of the invention
[0004] The embodiments of the present application provide a blockchain network detection method and related equipment, which can enrich the detection dimension of the blockchain network and effectively improve the operational convenience and detection efficiency of the blockchain network.
[0005] On the one hand, an embodiment of the present application provides a method for detecting a blockchain network, the method comprising:
[0006] Obtaining blockchain detection information set based on the operation interface, the blockchain detection information including: feature information of a target blockchain network to be detected, and at least one detection dimension of the target blockchain network; the at least one detection dimension including one or more of a functional dimension and a performance dimension;
[0007] According to the characteristic information, respectively obtain transaction requests required for detecting the target blockchain network in each detection dimension;
[0008] Constructing a client through a simulation program, and sending each acquired transaction request to the target blockchain network through the constructed client, so that the target blockchain network responds to each transaction request;
[0009] According to the results obtained by the target blockchain network responding to each transaction request, the target blockchain network is detected under the corresponding detection dimension to obtain the detection result of the target blockchain network under the corresponding detection dimension.
[0010] On the one hand, an embodiment of the present application provides a detection device for a blockchain network, the device comprising:
[0011] An acquisition unit, configured to acquire blockchain detection information set based on an operation interface, wherein the blockchain detection information includes: feature information of a target blockchain network to be detected, and at least one detection dimension of the target blockchain network; the at least one detection dimension includes one or more of a functional dimension and a performance dimension;
[0012] A processing unit, configured to obtain, according to the feature information, transaction requests required for detecting the target blockchain network in each detection dimension;
[0013] The processing unit is further configured to construct a client through a simulation program, and send each acquired transaction request to the target blockchain network through the constructed client, so that the target blockchain network responds to each transaction request;
[0014] The processing unit is also used to detect the target blockchain network under the corresponding detection dimension according to the results obtained by the target blockchain network responding to each transaction request, so as to obtain the detection result of the target blockchain network under the corresponding detection dimension.
[0015] In one aspect, an embodiment of the present application provides a computer device, the computer device comprising:
[0016] a processor suitable for executing a computer program;
[0017] A computer-readable storage medium, wherein a computer program is stored in the computer-readable storage medium. When the computer program is executed by a processor, the detection method of the blockchain network as described above is implemented.
[0018] On the one hand, an embodiment of the present application provides a computer-readable storage medium, which stores a computer program, and the computer program is loaded by a processor and executes the detection method of the blockchain network as described above.
[0019] On the one hand, an embodiment of the present application provides a computer program product, which includes a computer program or computer instructions, and when the computer program or computer instructions are executed by a processor, the above-mentioned blockchain network detection method is implemented.
[0020] In an embodiment of the present application, blockchain detection information set based on the operation interface can be obtained, and the blockchain detection information includes: feature information of the target blockchain network to be detected, and at least one detection dimension of the target blockchain network. Among them, at least one detection dimension includes one or more of the functional dimension and the performance dimension. It can be seen that based on the detection dimensions supported and set in the operation interface, the detection of the target blockchain network not only supports the detection of the functional dimension, but also supports the detection of the performance dimension, thereby enriching the dimensions of the target blockchain network detected by the same detection tool. Then, according to the feature information, the transaction requests required to detect the target blockchain network under each detection dimension are obtained respectively. Then, the client is constructed through the simulation program, and the constructed client sends each acquired transaction request to the target blockchain network, so that the target blockchain network responds to each transaction request. Further, according to the results obtained by the target blockchain network responding to each transaction request, the target blockchain network is detected under the corresponding detection dimension to obtain the detection result under the corresponding detection dimension. In the above process, you only need to simply set the blockchain detection information through the operation interface to start the automatic detection of the target blockchain network without writing a detection script. In this way, even users without a technical background can detect the blockchain network, which effectively reduces the threshold for detection operations and improves the convenience of detection operations. Provide a client construction function, and send transaction requests to the target blockchain network through the constructed client, so as to achieve interaction with the target blockchain network, thereby ensuring the authenticity of the detection results. In addition, multiple detection dimensions can be detected in one operation, and the detection integration is high. When the set detection dimensions include functional dimensions and performance dimensions, the functions and performance of the target blockchain network can be detected based on the transaction requests corresponding to each of these two detection dimensions, thereby achieving integrated and fully automated detection of functions and performance. The process of detecting the target blockchain network based on blockchain detection information does not require human participation, which can greatly reduce the detection time and thus greatly improve the detection efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] Figure 1a This is an architecture diagram of a blockchain network detection system provided in an embodiment of the present application;
[0022] Figure 1b This is an architecture diagram of a blockchain system provided by an embodiment of the present application;
[0023] Figure 1c is a schematic diagram of a block structure provided in an embodiment of the present application;
[0024] Figure 2 It is a flowchart of a blockchain network detection method provided in an embodiment of the present application;
[0025] Figure 3a is a schematic diagram of a function detection operation interface provided in an embodiment of the present application;
[0026] Figure 3b This is an interactive schematic diagram of a blockchain network detection system provided in an embodiment of the present application;
[0027] Figure 4 It is a flowchart of another blockchain network detection method provided in an embodiment of the present application;
[0028] Figure 5a It is a schematic diagram of the contents of a test case provided in an embodiment of the present application;
[0029] Figure 5b This is a schematic diagram of interaction in a function detection process provided by an embodiment of the present application;
[0030] Figure 6 It is a flowchart of another blockchain network detection method provided in an embodiment of the present application;
[0031] Figure 7a is a schematic diagram of a performance detection operation interface provided in an embodiment of the present application;
[0032] Figure 7b This is a schematic diagram of a blockchain node consensus provided by an embodiment of the present application;
[0033] Figure 7c This is a schematic diagram of an interaction in a performance testing process provided by an embodiment of the present application;
[0034] Figure 8 It is a structural schematic diagram of a blockchain network detection device provided in an embodiment of the present application;
[0035] Fig. 9 It is a structural diagram of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0036] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0037] The present application proposes a detection scheme for a blockchain network, which involves a detection system, method and related equipment for a blockchain network. In a specific implementation, the blockchain detection information set based on the operation interface can be obtained, and according to the characteristic information contained in the blockchain detection information, the transaction request required for detecting the target blockchain network under each detection dimension set can be obtained, and then the client can be constructed through the simulation program, and the constructed client sends each acquired transaction request to the target blockchain network, so that the target blockchain network responds to each transaction request; finally, according to the results obtained by the target blockchain network responding to each transaction request, the target blockchain network is detected under the corresponding detection dimension. There is no need to manually detect the whole process. The operator only needs to set the blockchain detection information based on the operation interface, and when the computer device receives the detection request sent by the operator's device, the computer device executes the detection process of the above-mentioned blockchain network, and performs a comprehensive and rapid detection of the content to be detected under the corresponding detection dimension. The setting of multiple detection dimensions makes the detection of the target blockchain network more integrated and can improve the detection efficiency.
[0038] The following will introduce the architecture of the blockchain network detection system provided in the embodiment of the present application in conjunction with the accompanying drawings.
[0039] See also Figure 1a , is an architecture diagram of a blockchain network detection system provided by an embodiment of the present application. Figure 1a As shown, the detection system of the blockchain network includes a database 101, a computer device 102 and a target blockchain network 103; the database 101 can establish a communication connection with the computer device 102 by wired or wireless means, and the computer device 102 can establish a connection with the target blockchain network 103 by wired or wireless means. Among them, the computer device 102 is used to execute the detection process of the blockchain network; the database 101 is used to provide data support and storage services for the detection process of the blockchain network of the computer device 102. The target blockchain network 103 is any blockchain network to be detected.
[0040] According to the deployment location, the database 101 can be a local database of the computer device 102, or a cloud database that can establish a connection with the computer device 102. According to the attributes, the database 101 can be a public database, that is, a database open to all computer devices; or it can be a private database, that is, a database open only to specific computer devices (such as the computer device 102). According to the storage content, the database 101 can include a use case library (or a use case database) and a test result library (also called a test result database, or a test report library). Among them, the use case library is used to store the test cases required for functional testing of the blockchain. These test cases can be used as test cases in the use case pool. The use case pool can also include test cases uploaded by users, or customized test cases, and any test case can be used to detect a function of the target blockchain network. Each test case carries a use case label. The use case label can be the name of the use case, or the key content in the use case. For example: the use case label carried by the solidity contract use case is "solidity". For another example: the use case label carried by the BFT consensus use case is "BFT". The test result library can be used to store the test results of testing the target blockchain network. Based on the corresponding detection dimension, the detection result may include one or more of the function detection result and the performance detection result, wherein the function detection result is the detection result obtained by detecting the function of the target blockchain network under the function dimension, and the performance detection result is the detection result obtained by detecting the performance of the target blockchain network under the performance dimension. The performance detection result may include parameter information through performance detection, such as stress testing parameters for stress testing, such as the number of stress testing concurrency. The detection result library can be used to store the detection results of each blockchain network. In an achievable manner, all detection results can be stored in the detection result library in the form of a test report. The storage format of the test report can be: a combination of one or more of a document format, a picture format, a video format, etc., such as a test report in a graphic format. Based on the content stored in the detection result library, the external system can obtain the detection results in the result database and provide deployment references for other blockchain networks based on the detection results. For example, if the target blockchain network under the BFT consensus algorithm can achieve optimal performance, then the same BFT consensus algorithm can also be used in similar blockchain networks.
[0041] The computer device 102 performs the detection process of the blockchain network, including: ① obtaining blockchain detection information based on the operation interface setting, and the blockchain detection information includes characteristic information of the target blockchain network and at least one detection dimension. The at least one detection dimension includes one or more of the functional dimension and the performance dimension. The characteristic information may include a chain tag for describing the characteristics of the target blockchain network, such as a keyword for describing the type, name, method, etc. of the smart contract used by the target blockchain network. ② According to the characteristic information, the transaction request required for detecting the target blockchain network under each detection dimension is obtained respectively. If the detection dimension includes the functional dimension, the obtained transaction request is used to detect the function of the target blockchain network. If the detection dimension includes the performance dimension, the obtained transaction request is used to detect the performance of the target blockchain network. ③ Constructing a client through a simulation program, and sending each obtained transaction request to the target blockchain network through the constructed client, so that the target blockchain network responds to each transaction request. Thus, the client can be run in the computer device 102, and the connection between the computer device 102 and the target blockchain network specifically refers to the connection between the running client and each node in the target blockchain network. During the detection process, the computer device 102 can send a transaction request to the target blockchain network through the client, so that the target blockchain network responds to the transaction request. ④ Further, based on the result obtained by the target blockchain network responding to each transaction request, the target blockchain network can be detected under the corresponding detection dimension.
[0042] In one feasible manner, the simulation program used to build the client may be a program provided by a blockchain SDK (Software Development Kit), which is a software development tool used to interact with a blockchain (e.g., sending transactions, subscribing). The constructed client may be a chain client (ChainClient), which may provide an operation interface for all interactive clients to interact with chain nodes (i.e., nodes in a blockchain network), thereby simulating multiple interactive clients to interact with a target blockchain network. Among them, an interactive client is a client that actually initiates a transaction with a target blockchain network. This application does not limit the number of clients running in the computer device 102. The client and multiple nodes may be connected to form a blockchain system through network communication. A blockchain system is a distributed system, which may be specifically described as follows. Figure 1bAs shown in the figure. It is formed by multiple nodes (any form of computing devices in the access network, such as servers and terminal devices) and clients, and the nodes form a peer-to-peer (P2P) network. The P2P protocol is an application layer protocol running on the Transmission Control Protocol (TCP). In a distributed system, any machine such as a server or a terminal can join and become a node. The node includes the hardware layer, the middle layer, the operating system layer, and the application layer.
[0043] See also Figure 1b The functions of each node in the blockchain system shown include:
[0044] 1) Routing: a basic function of a node, used to support communication between nodes.
[0045] In addition to the routing function, the node can also have the following functions:
[0046] 2) Applications are deployed in the blockchain to implement specific businesses based on actual business needs, record data related to the implementation of functions to form record data, carry digital signatures in the record data to indicate the source of the task data, and send the record data to other nodes in the blockchain system for other nodes to add the record data to a temporary block when they successfully verify the source and integrity of the record data.
[0047] For example, the services implemented by the application include:
[0048] 2.1) Wallet, used to provide the function of conducting electronic currency transactions, including initiating transactions (i.e., sending the transaction record of the current transaction to other nodes in the blockchain system. After the other nodes successfully verify the transaction, as a response to acknowledge the validity of the transaction, the transaction record data is stored in the temporary block of the blockchain; of course, the wallet also supports querying the remaining electronic currency in the electronic currency address;
[0049] 2.2) Shared ledger, which is used to provide functions such as storage, query and modification of account data. The record data of the operation on the account data is sent to other nodes in the blockchain system. After other nodes verify the validity, as a response to acknowledging the validity of the account data, the record data is stored in a temporary block, and a confirmation can also be sent to the node that initiated the operation.
[0050] 2.3) Smart contracts are computerized protocols that can execute the terms of a contract. They are implemented by deploying code on a shared ledger that is executed when certain conditions are met. The code is used to complete automated transactions based on actual business needs, such as querying the logistics status of the goods purchased by the buyer and transferring the buyer's electronic currency to the merchant's address after the buyer signs for the goods. Of course, smart contracts are not limited to executing contracts for transactions, but can also execute contracts for processing received information.
[0051] 3) Blockchain, including a series of blocks that are connected in the order of their generation. Once a new block is added to the blockchain, it will not be removed. The block records the data submitted by the nodes in the blockchain system. The target blockchain network contains at least one blockchain, which is a distributed ledger formed by appending consensus-confirmed blocks in sequence using cryptographic technology. The blockchain can record executed transactions.
[0052] See also Figure 1c , Figure 1c This is an optional schematic diagram of the block structure provided by an embodiment of the present invention. Each block includes the hash value of the transaction record stored in this block (the hash value of this block) and the hash value of the previous block. Each block is connected by the hash value to form a blockchain. In addition, the block can also include information such as the timestamp when the block was generated. Blockchain is essentially a decentralized database, a string of data blocks generated by cryptographic methods. Each data block contains relevant information for verifying the validity of its information (anti-counterfeiting) and generating the next block.
[0053] In the present application, the computer device 102 may include a server. The server may be an independent physical server, or a server cluster or distributed system composed of multiple physical servers. It may also be a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN (Content Delivery Network), as well as big data and artificial intelligence platforms, but is not limited to these.
[0054] The target blockchain network 103 may include multiple nodes. In this application, the term "multiple" means two or more nodes; for example, multiple nodes refer to the two or more nodes. Figure 1aThe target blockchain network shown in contains 4 nodes. A node is any form of computer device connected to the network, such as a server or terminal device. The nodes in the target blockchain network can also be referred to as chain nodes or blockchain nodes. Terminal devices include but are not limited to: smart phones, tablet computers, smart wearable devices, smart voice interaction devices, smart home appliances, personal computers, vehicle terminals, smart cameras and other devices, which are not limited in this application. This application does not limit the number of terminal devices.
[0055] The detection system of the blockchain network provided in the embodiment of the present application can realize a general solution for automatic detection of the blockchain network. In a specific implementation, the computer device can automatically create a client through a simulation program, and establish a connection between the client and the target blockchain network to be detected. Through the client, a transaction request can be sent to the target blockchain network to interact with the target blockchain network. In terms of functional detection, the transaction request required for functional detection can be sent to the target blockchain network, and the target blockchain network can respond to each transaction request to obtain the result, and the operating status of the target blockchain network can be automatically detected to determine whether the function of the target blockchain network can operate normally. In terms of performance detection, the transaction request required for performance detection can be sent to the target blockchain network, and the target blockchain network can respond to each transaction request to obtain the result, and the performance of the target blockchain network can be detected. The whole process does not require human participation, can be quickly detected, and improves detection efficiency. In addition, both functional detection and performance detection can provide a visual test report, so that developers and users can quickly understand the quality status of the blockchain network.
[0056] In addition, the detection system of the blockchain network provided by the present application is an automatic detection system that can quickly detect one or two of the functions and performances of the blockchain network. The detection system based on the blockchain network detects the target blockchain network, which can help the detector (such as developers, quality testers, etc.) quickly understand the quality status of the blockchain network. Through the detection system of the blockchain network, an integrated automatic detection solution for the functions and performance of the blockchain network can be provided, which can not only improve the convenience of the detection operation of the blockchain network, but also reduce the time and cost of the blockchain network detection process, and improve the detection efficiency. In addition, the detection solution of the blockchain network provided by the present application is designed based on the general detection method of the blockchain, has universality, and can support the detection of blockchain networks such as Ethereum, fabric, and Changan Chain.
[0057] Next, the detection method of the blockchain network provided in the embodiment of the present application is introduced.
[0058] See also Figure 2, is a flowchart of a blockchain network detection method provided by an embodiment of the present application. The blockchain network detection method can be performed by a computer device (such as Figure 1a The detection method of the blockchain network may include the following steps S201-S204.
[0059] S201, obtaining blockchain detection information set based on the operation interface, the blockchain detection information including: characteristic information of the target blockchain network to be detected, and at least one detection dimension of the target blockchain network; the at least one detection dimension includes one or more of a functional dimension and a performance dimension.
[0060] Blockchain detection information refers to the information required to detect the target blockchain network to be detected. The target blockchain network to be detected refers to any blockchain network to be detected, which can be specified by the detection operator. The target blockchain network can be a blockchain network of the type of Ethereum, Fabric, Changan Chain, etc., and this application does not limit this.
[0061] The characteristic information of the target blockchain network is information used to describe the characteristics of the target blockchain network. The characteristics of the target blockchain network include, for example: the certificates used by the blockchain in the target blockchain network, the consensus algorithm used by the target blockchain network, the number of nodes that can tolerate downtime in the target blockchain network, the smart contracts used in the target blockchain network, etc. The characteristics of different blockchain networks are different. Based on the operating mechanism of the blockchain network, the categories of characteristics are similar. For example, different blockchain networks need to set the certificate mode and use the consensus algorithm.
[0062] The detection dimension of the target blockchain network can be understood as a dimension determined according to the detection direction of the target blockchain network. If the detection direction is the direction of the detection function, the detection dimension can be called the functional dimension. If the detection direction is the direction of the detection performance, the detection dimension can be called the performance dimension. The operation interface can be used to set at least one detection dimension, and then the computer device can detect the target blockchain network under the set detection dimension. At least one detection dimension includes one or both of the functional dimension and the performance dimension. Under the functional dimension, the function of the target blockchain network can be detected, and under the performance detection dimension, the performance of the target blockchain network can be detected. Among them, the function of the target blockchain network determines whether the blockchain network can serve the application normally, such as whether each node in the node management can participate in the operation normally, whether the node will affect the normal execution of the transaction when joining or exiting the target blockchain network, whether a new node can be added, etc., all belong to the scope of detecting the function of the target blockchain network. Given that the essence of interacting with the blockchain network is to send transactions, therefore, the performance of the target blockchain network in this application refers to the performance of the target blockchain network in processing transactions, including the complete process from the client initiating transactions, signing, node packaging, consensus, and finally data landing. The performance of the target blockchain network can be used to reflect the results of the combination of software and hardware configurations in the blockchain network, including hardware conditions such as the central processing unit, memory, disk, bandwidth, and factors such as the contract type, transaction size, and node networking mode of the stress test, which will affect the performance results.
[0063] The operation interface may be a visual interface provided by the detection system of the blockchain network (for ease of description, it may be referred to as the detection system), which may be used to display the set blockchain detection information. As an achievable method, the operation interface may include a function detection operation interface and a performance detection operation interface. These two operation interfaces may be independent operation interfaces, which are used to set the information required for the detection of the blockchain network in the functional dimension and the information required for the detection of the performance dimension. In this way, the same set of detection systems can provide operation interfaces for different detection dimensions, and then independently set the information required for the corresponding detection dimensions. As another achievable method, the operation interface may also include a function detection operation area and a performance detection operation area. The function detection operation area is used to set the information required for detection under the function dimension, and the performance detection operation area is used to set the information required for detection under the performance dimension. In this way, the setting area for the information required for different detection dimensions can be integrated through the same operation interface, making it more convenient to set the information required for the detection of the target blockchain network in the functional dimension and the detection of the performance dimension. In particular, when the function and performance of the target blockchain network need to be detected, there is no need to switch the operation interface, which can improve the setting efficiency of the blockchain detection information, thereby speeding up the process of entering the detection of the target blockchain network to a certain extent.
[0064] In one embodiment, the method of setting blockchain detection information based on the operation interface includes:
[0065] The target device (such as a terminal device) displays an operation interface, which includes a detection information setting area. The target device displays the detection information in the operation interface based on the input operation in the detection information setting area. Based on the confirmation operation of the detection information, a detection request is sent to the computer device, and the detection request carries the detection information, and the detection information includes the characteristic information of the target blockchain network and at least one detection dimension. The blockchain detection information obtained by the computer device is the detection information carried by the received detection request. Among them, the target device refers to any one of the one or more devices in the initiating detection request. It is understandable that if only one device requests to detect the target blockchain network, then the device is the target device. The operation interface here can be a functional detection operation interface or a performance detection operation interface.
[0066] For example, the tester has a need to test one or more functions of the target blockchain network A. After the corresponding settings in the operation interface, the terminal device used by the tester can send a test request to the server. The test request contains the characteristic information of the target blockchain network A and the functional dimension of the target blockchain network. The server can then test each function of the target blockchain network A that needs to be tested under the functional dimension based on the characteristic information. Figure 3a The operation interface shown is a function detection operation interface, in which you can select a test module (function for testing) and provide the corresponding function and use case name. For example, in the gasCommon module, you need to detect functions such as gasEnable and setGasAdmin. Gas is a unit used to measure the amount of computing work required to perform a specific operation on the Ethereum blockchain. The confirmation operation of the detection information is, for example, clicking Figure 3a By clicking the Run button in the operation interface shown, it can be confirmed that a functional test is required, so that the target device can send a test request to the computer device to request a test of the function of the target blockchain network.
[0067] Through the provided operation interface, the detection of the blockchain network only needs to be set up simply, and the subsequent detection process can be automatically realized based on the set blockchain detection information, without manual detection, so that the operation of blockchain network detection is more convenient. Based on the operation interface, the two detection dimensions of function dimension and performance dimension can also be set, so that according to these two detection dimensions, the function and performance of the target blockchain network can be integrated in the same detection system, so as to achieve more efficient detection of the target blockchain network, thereby effectively improving the detection efficiency.
[0068] In one embodiment, the detection system in the embodiment of the present application can be provided to multiple objects (i.e., detection operators) for use. When multiple objects concurrently initiate detection of the target blockchain network, the specific implementation of obtaining blockchain detection information set based on the operation interface may include the following steps 1-3.
[0069] Step 1: Receive detection requests sent by multiple devices.
[0070] In the scenario where multiple objects initiate detection of the target blockchain network, the computer device can receive detection requests sent by multiple devices. One device corresponds to one object, and one device can send a detection request to the computer device, so that the computer device can receive multiple detection requests. Any device can be a terminal device, and the computer device in this application can be a server. For example: 10 testers all use their respective terminal devices to request to detect the functions of the target blockchain network A. Then, the computer device can receive 10 detection requests.
[0071] Each of the multiple devices can display an operation interface and set detection information in the operation interface. When any device receives a confirmation operation for the detection information, it can send a detection request carrying the detection information to the computer device. Therefore, each detection request received by the computer device carries the detection information set based on the operation interface in the corresponding device. Any detection information includes: feature information of the target blockchain network to be detected, and at least one detection dimension of the target blockchain network.
[0072] Step 2: If the detection information carried in the detection requests sent by multiple devices contains the same detection dimension, the multiple detection requests are scheduled by the detection scheduler to select a target detection request from the multiple detection requests.
[0073] If the detection information carried by each detection request contains the same detection dimension, for example, it contains performance detection or function detection, it indicates that multiple objects have the need to detect the target blockchain network under the same detection dimension, for example: 10 testers all request to detect the function of the target blockchain network A. Then, the computer device can schedule multiple detection requests through the detection scheduler, and select the target detection request from multiple detection requests through scheduling, for example: select one detection request from 10 detection requests as the target detection request. Among them, in terms of selection logic, it can be random selection, or sequential selection according to the role priority of the object, and the role priority is, for example, the identity level of the tester in the team. This application does not limit this. If the detection dimension is function detection, then the detection scheduler can be a use case scheduler, and if the detection dimension is performance detection, then the detection scheduler can be a task scheduler.
[0074] Step 3: Parse the target detection request, and determine the detection information obtained by the analysis as the blockchain detection information set based on the operation interface.
[0075] After selecting the target detection request, the computer device can parse the target detection request, and then obtain the detection information carried by the target detection request, and determine the detection information as the blockchain detection information set based on the operation interface. Figure 2 In the illustrated embodiment, S201-S204 perform detection of the target blockchain network.
[0076] Based on the method of obtaining the blockchain detection information set based on the operation interface described in the above steps 1 to 3, when receiving detection requests sent by different devices, the detection scheduler can schedule multiple detection requests to select the target detection request, and then determine the blockchain detection information set based on the operation interface to detect the target blockchain network. Scheduling can make the detection of the target blockchain network proceed in an orderly manner, and can reasonably use resources for detection processing, so as to better cope with the scenario of multiple concurrent detections.
[0077] S202, based on the feature information, respectively obtain the transaction requests required for detecting the target blockchain network in each detection dimension.
[0078] Based on the setting of the detection dimension and characteristic information for the target blockchain network, the following contents are included: If the detection dimension is the functional dimension, it means that the function of the target blockchain network needs to be detected, then the transaction request required for detecting the target blockchain network under the functional dimension can be obtained according to the characteristic information, that is, the transaction request required for detecting the function of the target blockchain network. In principle, the transaction request required for detecting the target blockchain network under the functional dimension may include: creating a contract transaction request, calling a contract transaction request, freezing a contract transaction request, node management transaction request, etc.
[0079] In one implementation, the general logic of obtaining the transaction request required for detecting the target blockchain network in the functional dimension according to the feature information can be: select the test case whose use case label matches the content in the feature information from the use case pool according to the feature information, and then map the selected test case to a transaction request of different transaction request types, that is, the transaction request required for detecting the target blockchain network in the functional dimension. Among them, the test case in the use case pool mentioned here can be a test case in the use case library built based on the general blockchain characteristics provided by the detection system, or a test case uploaded by the user, without restriction.
[0080] If the detection dimension is the performance dimension, which means that the performance of the target blockchain network needs to be detected, then the transaction request required for detecting the target blockchain network under the performance dimension can be obtained according to the characteristic information, that is, the transaction request required for detecting the performance of the target blockchain network. Exemplarily, the transaction request required for detecting the target blockchain network under the performance dimension may include: a transaction request for calling a deposit contract, or a transfer transaction request, or other customized transaction requests. For customized transaction requests, the detection operator may provide transaction parameters to construct the corresponding transaction request.
[0081] If the detection dimension includes the functional dimension and the performance dimension, it means that the content of the performance and function dimensions of the target blockchain network needs to be detected. Then, according to the feature information, the transaction request required for detecting the target blockchain network under the functional dimension and the transaction request required for detecting the target blockchain network under the performance dimension can be used. It should be noted that for the transaction request required for detecting the target blockchain network under the functional dimension and the transaction request required for detecting the target blockchain network under the performance dimension, the feature information used may contain the same feature information or different feature information. For example, the feature information contains information indicating the type of smart contract. In addition, in the process of detecting the function and performance of the target blockchain network, the detection logic involved in the function detection and performance detection is independent of each other and does not interfere with each other. Based on the independent detection logic, when the function and performance of the target blockchain network need to be detected, the acquisition of the transaction requests required for the above two detection dimensions is independent of each other and can be executed in parallel.
[0082] The transaction request carries the transaction, and the acquired transaction request can be used to request the target blockchain network to execute the carried transaction. Specifically, after the target blockchain network completes the execution of the transaction based on the transaction request, the transaction and the transaction execution result can be stored on the corresponding blockchain.
[0083] S203, constructing a client through a simulation program, and sending each acquired transaction request to the target blockchain network through the constructed client, so that the target blockchain network responds to each transaction request.
[0084] A simulator is a program used to simulate a client that interacts with a blockchain network. Exemplarily, the simulator may be a program provided by a blockchain SDK (Software Development Kit). A client built using a blockchain SDK may be a chain client. After the client is built, a connection between the client and the target blockchain network must be established. In one achievable manner, the constructed client may send an RPC (Remote Procedure Call) to the blockchain network to establish a connection with the target blockchain network. Optionally, when building the client, the blockchain SDK may be used to configure the connection according to the information required to connect to the target blockchain network, where the information required for the connection includes, but is not limited to, the address of the node in the target blockchain network, the certificate used in the target blockchain network, etc., so as to facilitate determination of the target blockchain network to be connected and send a corresponding request to establish a connection.
[0085] After the client establishes a connection with the target blockchain network, the constructed client can send each acquired transaction request to the target blockchain network, so that the target blockchain network (specifically, the nodes contained therein) responds to each transaction request and returns the result of responding to each transaction request to the client. The result obtained by the target blockchain network in responding to the transaction request can be called a response result, and one transaction request can correspond to one response result.
[0086] In one embodiment, the target blockchain network may be a blockchain network actually used. In order to achieve the purpose of detecting the target blockchain network without affecting the operation of the target blockchain network, a blockchain network identical to the target blockchain network may be pre-built before detection, or a blockchain network specifically used for detection may be rebuilt during the detection phase, and the rebuilt blockchain network has the same functions as the target blockchain network. By rebuilding the blockchain network, the impact on the actual blockchain network to be detected can be avoided. The rebuilt blockchain network may also be referred to as a test blockchain network, and the blockchain contained therein may also be referred to as a test chain, while the blockchain in the target blockchain network is referred to as a main chain.
[0087] Based on this, the constructed client sends the acquired transaction request to the target blockchain network, so that the target blockchain network responds to the transaction request, which may include the following: First, according to the characteristic information of the target blockchain network, a blockchain network with the same characteristic information as the target blockchain network is reconstructed. For example, the characteristic information includes the relevant content of the smart contract, such as the type of smart contract, the specific content of the smart contract, etc., then the same smart contract is also deployed in the reconstructed blockchain network. The reconstructed blockchain network and the target blockchain network can be in different environments or in the same environment. The environment includes software and hardware devices used to support the operation of the blockchain network. Then, the constructed client sends each acquired transaction request to the reconstructed blockchain network, so that the reconstructed blockchain network responds to each transaction request; wherein, the result obtained by the target blockchain network responding to each transaction request refers to: the result obtained by the reconstructed blockchain network responding to each transaction request. The acquired transaction request is specifically sent to the reconstructed blockchain network, and the reconstructed blockchain network responds to each transaction request to obtain the corresponding result. Then, the result of responding to the transaction request can be returned based on the reconstructed blockchain network, and the reconstructed blockchain network can be tested. Since the reconstructed blockchain network is constructed by simulating the target blockchain network, the test results obtained by testing the reconstructed blockchain network can also directly reflect the quality of the target blockchain network. For example, in the functional dimension test, it can reflect whether the functions of the target blockchain network can be used normally. In the performance dimension test, it can reflect the stress test performance that the target blockchain network can achieve, such as how many concurrent transaction requests it can carry, and how long the corresponding concurrent transactions can last.
[0088] S204, respectively detect the target blockchain network under the corresponding detection dimension according to the result obtained by the target blockchain network responding to each transaction request, and obtain the detection result under the corresponding detection dimension.
[0089] The client can receive the result of the target blockchain network's response to each transaction request. According to the result, the target blockchain network can be tested in the corresponding detection dimension to obtain the detection result in the corresponding detection dimension. If the detection dimension is the functional dimension, the target blockchain network can be tested in the functional dimension, so as to detect the function of the target blockchain network and obtain the detection result in the functional dimension (which can be referred to as the functional detection result). Based on the functional detection result, it can be known whether the function in the target blockchain network can be used normally. If the detection dimension is the performance dimension, the target blockchain network can be tested in the performance dimension, so as to detect the performance of the target blockchain network and obtain the detection result in the performance dimension (which can be referred to as the performance detection result). The result of the target blockchain network's response to different transaction requests includes the transaction execution result.
[0090] It is understandable that when at least one detection dimension includes a functional dimension, the computer device may detect one or more functions of the target blockchain network under the functional dimension, and the characteristic information may include information related to one or more functions of the target blockchain network. If multiple functions of the target blockchain network need to be detected, the transaction request required for detecting each of the multiple functions of the target blockchain network can be obtained according to the characteristic information, and then each function to be detected can be detected based on these transaction requests. In this way, in one functional detection, multiple functions of the target blockchain network can be detected at one time and in parallel. Through the combined detection of multiple functions, not only can the convenience of operation be improved, but also the detection results can be obtained quickly, and more efficient detection can be achieved.
[0091] Since the target blockchain network is a decentralized distributed network, it may span multiple subnets, multiple data centers, multiple participating entities, and even multiple regions, and the detection of the target blockchain network is a test of the underlying blockchain, which not only includes the test between the client and each node in the target blockchain network, but also involves a large number of node-to-node tests in the target blockchain network. In addition, the target blockchain network involves multiple characteristics such as detecting the identity of the operator, node management, virtual machine type, and the effectiveness of the consensus mechanism, all of which need to be detected. In the face of so much content detection, the detection scheme of the blockchain network provided by this application can specify the dimensions and characteristics to be detected, and the automation of the subsequent detection process can provide more efficient detection. In addition, the blockchain network can also be automatically detected in an integrated manner for functions and performance, making the operation of the function and performance detection of the blockchain network simpler, and the detection process is time-consuming, which is conducive to the relevant personnel to quickly evaluate the operating status of the blockchain network.
[0092] The detection method of the target blockchain network introduced in S201-S204 of the present application implementation example can obtain the blockchain detection information set based on the operation interface, and the blockchain detection information includes: the characteristic information of the target blockchain network to be detected, and at least one detection dimension of the target blockchain network; at least one detection dimension includes one or more of the functional dimension and the performance dimension. It can be seen that based on the detection dimension supported and set in the operation interface, the detection of the target blockchain network not only supports the detection of the functional dimension, but also supports the detection of the performance dimension, thereby enriching the dimension of the same detection tool to detect the target blockchain network. In addition, multiple detection dimensions can be detected in one operation, making the detection operation more convenient. Then, according to the characteristic information, the transaction requests required for detecting the target blockchain network under each detection dimension are obtained respectively. Then, the client is constructed through the simulation program, and the acquired transaction requests are sent to the target blockchain network through the constructed client, so that the target blockchain network responds to each transaction request. Further, according to the results obtained by the target blockchain network responding to each transaction request, the target blockchain network is detected under the corresponding detection dimension to obtain the detection result under the corresponding detection dimension. In the above process, you only need to simply set the blockchain detection information through the operation interface to start the automatic detection of the target blockchain network without writing a detection script. In this way, even users without a technical background can detect the blockchain network, which effectively lowers the threshold for detection operations and improves the convenience of detection operations. Provide a client construction function, and send transaction requests to the target blockchain network through the constructed client, so as to achieve interaction with the target blockchain network, thereby ensuring the authenticity of the detection results. When the set detection dimensions include functional dimensions and performance dimensions, the functions and performance of the target blockchain network can be detected based on the transaction requests corresponding to each of these two detection dimensions, so as to achieve the purpose of integrated and fully automated detection of functions and performance. The process of detecting the target blockchain network based on blockchain detection information does not require human participation, which can greatly reduce the detection time and thus greatly improve the detection efficiency.
[0093] In a feasible implementation, for the contents introduced in S201-S204 above, the following may be provided: Figure 3bThe detection system shown in FIG. It includes: operation interface, function detection module, performance detection module, test report generator, use case pool, client (ChainClient), and report database. The functions of each module are as follows: ① Operation interface, which can trigger the chain environment construction, function and performance automatic detection process; ② Function detection module: used to detect the function of the blockchain network, and the function detection module interacts with the use case pool, client and report database. ③ Performance detection module: used to detect the performance of the blockchain network. ④ Use case pool: used to store marked test cases that match the characteristics of the blockchain network. ⑤ Report database: used for test report archiving, performance test parameter information storage, etc.
[0094] Based on the above modules, the interaction process between the modules is introduced exemplarily below, taking the need to detect the functions and performance of the target blockchain network as an example.
[0095] Pre-operation: The terminal device can set the detection information through the operation interface, such as entering the keywords of the characteristic information of the target blockchain network, such as BFT consensus, solidity contract, certificate mode, etc., and confirm the set detection information, such as clicking the button: "One-click build and test". Send a detection request to the server, which carries the set detection information.
[0096] 1.1 When the server receives the detection request, it will automatically build the blockchain in the target blockchain network.
[0097] 2.1 The terminal device synchronizes the detection information to the function detection module and performance detection module in the detection system. The detection information includes the chain tag. The server starts the function detection process and the performance detection process respectively.
[0098] 3.1 The server uses the blockchain SDK to build the client and sends a remote procedure call request RPC to establish a connection with the target blockchain network.
[0099] 4.1 The function detection module sends the chain tag received to describe the characteristics of the target blockchain network to the use case pool module, and the use case pool module selects the test case matching the chain tag from the use case pool. The use case pool stores a set of general test cases for detecting the blockchain network, and each test case carries the labeled use case tag.
[0100] 4.2 The test case pool module returns the filtered test cases to the functional detection module, and the functional detection module starts the case scheduling and case execution. Case scheduling can constrain how often a test case is executed, and case execution refers to one execution of a test case. In the scenario of multiple concurrent detections, case scheduling selects the corresponding test case by scheduling the corresponding detection request.
[0101] 5.1 The function detection module maps different types of transaction requests according to the selected use cases, and continuously calls the created client to send transaction requests to the nodes in the target blockchain network. The target blockchain network responds to the transaction request and obtains the transaction execution result. The transaction execution result is returned to the function detection module through the client for result verification. The test report generator then generates a function test report based on the verification result.
[0102] 6.1 The performance detection module obtains the transaction request for performance detection based on the detection information, builds a client, and establishes a connection with each node in the target blockchain network. Through the client, a transaction request can be sent to the specified stress node in the target blockchain network as stress test traffic. In the process of the target blockchain network responding to the transaction request, the resource consumption and average transaction on-chain rate of the target blockchain network are detected, so as to determine the performance detection result of the target blockchain network based on whether the resource monitoring results and the average transaction on-chain rate meet expectations, and the test report generator generates a performance test report based on the performance detection results.
[0103] It is understandable that the sequence number of the corresponding steps in this application does not necessarily constitute a restriction on the execution order. For example, the steps introduced in 3.1 and 4.1 above can be executed in parallel, and the contents executed by the function detection module and the performance detection module can also be executed in parallel. Through the above scheme, based on the function detection module in the detection system (also referred to as the automated simulation system), the automatic construction of the client can be triggered, and then the connection between the client and the blockchain network can be established, based on the characteristic information of the target blockchain network entered in the operation interface and the detection dimension, such as: certificate mode, BFT consensus, solidity contract and other keywords, the detection dimension is the function dimension, then the test case set that meets the scenario can be selected from the use case pool, and the use case scheduling, execution, result verification and report generation can be automatically triggered, which can make the complex blockchain function test that takes several days to complete the verification in hours or even minutes. If the detection dimension is the performance dimension, the function of automatic detection of resources and transaction processing capabilities can be provided, so that the performance detection process is universal. In addition, the whole process does not require human participation, and the function verification and performance detection can be automatically realized after one-click triggering. The test results after program analysis can also be stored in the database to support data collection of other external systems.
[0104] See also Figure 4 , is a flow chart of another blockchain network detection method provided by an embodiment of the present application. The blockchain network detection method can be performed by a computer device (such as Figure 1a The detection method of the blockchain network may include the following steps S401-S404.
[0105] S401, obtaining blockchain detection information set based on the operation interface, the blockchain detection information including: feature information of the target blockchain network to be detected, and at least one detection dimension of the target blockchain network, at least one detection dimension including a functional dimension.
[0106] In one embodiment, the operation interface includes a function detection operation interface, which can be used to set the feature information required for detecting the function of the target blockchain. Figure 3a In the function detection operation interface shown, the test content of the gas management function can be set accordingly. Therefore, the blockchain detection information obtained by the computer device may include the feature information required for detecting the function of the target blockchain based on the function detection operation interface setting.
[0107] The characteristic information includes at least one chain tag, and a chain tag is used to describe a characteristic of the target blockchain network. The chain tag is a tag used to describe the characteristics of the target blockchain network. Schematically, the chain tag can be keywords such as: certificate mode, BFT (Byzantine Fault Tolerance, BFT, Byzantine, a consensus algorithm) consensus, solidity (a contract programming language) contract, etc. Based on this, the implementation method of the transaction request required for detecting the blockchain in the functional dimension can be obtained according to the characteristic information, which can be referred to the content introduced in S402-S405 below.
[0108] S402: Filter out a first chain tag from at least one chain tag included in the feature information.
[0109] The first chain tag refers to: a chain tag used to describe the characteristics related to the functions of the target blockchain network. Specifically, it is a chain tag required to detect the target blockchain network in the functional dimension. The functions of the target blockchain network include but are not limited to: consensus function and fault tolerance, smart contract function, account and transaction type, data storage and transmission, encryption module availability, chain stability, etc. A first chain tag may include: one or more keywords used to describe a function of the target blockchain network; for example, the first chain tag selected includes: gas management, smart contract management and other keywords, among which gas management includes one or more of whether gas is turned on, setting a gas management account, whether gas is repeatedly measured, etc., and smart contract management includes one or more of creating contracts, calling contracts and freezing contracts.
[0110] If the set detection dimension includes the function dimension and the performance dimension, the chain tags included in the set feature information may cover the chain tags required for the function dimension and the chain tags required for the performance dimension, and the chain tags required for the function dimension and the performance dimension may overlap, and the first chain tags selected may include part or all of the chain tags in the feature information. If the detection dimension only includes the function dimension, the first chain tags selected include all the chain tags in the feature information.
[0111] It should also be noted that if there are multiple chain tags in the feature information, the number of first chain tags screened out by step S402 may be one or more. When there are multiple first chain tags, different first chain tags describe different functions of the target blockchain network. For each first chain tag, subsequent steps S403-S407 may be executed to detect the functions of the target blockchain network described by each first chain tag, thereby realizing combined detection of multiple functions of the target blockchain network.
[0112] S403, determining a use case pool, the use case pool includes multiple test cases, one test case is used to detect a function of the blockchain network, and each test case has a use case label.
[0113] The test case pool stores a collection of common test cases for testing blockchain networks, such as contract test cases, consensus test cases, node management test cases, etc. These test cases can include one or more of the test cases for common blockchain features provided by the test system, and the test cases uploaded by the operator. Test cases can be used to describe one or more of the following: functional verification steps, verification scenarios. Contains parameters for constructing transaction requests, and some statement execution results. For example, Figure 5a The test case shown. This test case is a solidity contract case, which contains the parameters required to create a contract and the functions implemented by each function. Through the execution of the solidity contract case, basic functions such as contract creation function and contract call function can be verified, and personalized functions in the solidity contract case, such as the transfer function, can also be verified.
[0114] In one achievable manner, the use case label of any test case is obtained by labeling the corresponding test case according to the function detected by the corresponding test case. Each test case in the use case pool is a labeled test case and matches the characteristics of the target blockchain network. For example, a test case is related to solidity contract testing. Since the test case can be used to detect the contract transaction function of the target blockchain, the test case is labeled with the use case label "solidity".
[0115] Different blockchain networks may have the same type of functions, but different functional characteristics. Schematically, different blockchain networks all have fault tolerance, but one blockchain network has a fault tolerance of 3, while another blockchain network has a fault tolerance of 4. The functional characteristics of different blockchain networks may also be the same, that is, there are some common characteristics. The test cases in the test case pool also have a certain degree of commonality when testing different blockchain networks.
[0116] S404, according to the use case labels of the respective test cases in the use case pool, filter out the test cases matching the first chain label from the use case pool.
[0117] In one implementation, the use case label of each test case can be matched with the first chain label for consistency. If the use case label is consistent with the first chain label, it is determined that the test case carrying the corresponding use case label is a test case that matches the first chain label. Otherwise, it is determined that the test case carrying the corresponding use case label is not a test case that matches the first chain label. According to the above method, one or more test cases can be screened out from the use case pool, and each test case matches the first chain label.
[0118] S405: Construct at least one first transaction request based on the screened test cases.
[0119] The first transaction request refers to: the transaction request required to detect the target blockchain network in the functional dimension.
[0120] The computer device can execute the test case to detect the function of the target blockchain network, and the process of executing the test case includes constructing the transaction request required for the function detection according to the test case, so as to realize the function detection of the target blockchain network by interacting with the target blockchain network. Therefore, after screening out each test case, at least one first transaction request can be constructed according to the test case, and the first transaction request can carry a transaction. A test case can correspond to one or more first transaction requests. Exemplarily, the test case is a node management case, and the constructed first transaction request includes a new node request to add a new node; the test case is a contract life cycle case, then the constructed first transaction request includes a contract creation request, a contract call request, and a contract freeze request. Based on the first transaction request, the target blockchain network can be detected in the functional dimension, and specifically, whether the function of the target blockchain network is abnormal can be detected. If the screened test cases contain multiple, based on the different functions tested by the test cases, the constructed first transaction requests can also be used to detect different functions of the target blockchain network.
[0121] In one embodiment, taking any of the screened test cases as an example, the construction logic of the transaction request is described, and any of the test cases includes: request parameters for constructing a first transaction request. The request parameters are parameters related to the content of the function verification. Based on the screened test cases, at least one first transaction request is constructed, including: first, the computer device can obtain the mapping relationship between the test case and the transaction request type; according to the mapping relationship, the screened test case is mapped to obtain the target transaction request type. Specifically, the mapping relationship between the obtained test case and the transaction request type can be used to indicate: there is a mapping between a test case and a transaction request type, or there is a mapping between a transaction request type and at least one test case. According to the mapping relationship, the screened test case can be mapped to obtain the target transaction request type corresponding to the test case. The transaction request type can match the characteristics of the target blockchain network, for example, calling a solidity contract transaction request, and the transaction request type is a solidity type. Further, under the target transaction request type, at least one first transaction request is constructed using the request parameters in the screened test case. It can be seen that the transaction request type of at least one transaction request is the same, but the request parameters contained in the transaction request may be different.
[0122] For each of the screened test cases, the screened test cases can be mapped to the first transaction requests of the corresponding type in the above manner, thereby obtaining at least one first transaction request corresponding to each test case, so as to detect the target blockchain network based on each first transaction request in the functional dimension. At this point, in the functional dimension, the acquired transaction requests can include at least one first transaction request.
[0123] S406, constructing a client through a simulation program, and sending each first transaction request to the target blockchain network through the constructed client, so that the target blockchain network responds to each first transaction request.
[0124] The target blockchain network may return the result obtained by responding to each first transaction request to the client. The result obtained by the target blockchain network responding to the first transaction request (i.e., the response result) is the verification result of the relevant function. Exemplarily, if the first transaction request is a request to create a contract, then the response result is a contract creation response result, which may be the result of successful contract creation or failed contract creation. The computer device detects the relevant functions of the target blockchain network based on each response result.
[0125] S407, detecting the target blockchain network in the functional dimension according to the results obtained by the target blockchain network responding to each first transaction request, and obtaining the detection result of the target blockchain network in the functional dimension.
[0126] Since at least one detection dimension includes a functional dimension, and the acquired transaction requests include a first transaction request, the target blockchain network is detected according to the result obtained by the target blockchain network responding to each first transaction request, and the functional detection result of the target blockchain network can be obtained.
[0127] The logic of performing functional detection of the target blockchain network according to the response result is exemplified by taking any first transaction request as an example. Any first transaction request is recorded as the i-th first transaction request. When the computer device detects the target blockchain network in the functional dimension according to the results obtained by the target blockchain network responding to each first transaction request, the following steps ① to ③ can be specifically performed.
[0128] Step ①: For the i-th first transaction request, the computer device can obtain the expected response result of the i-th first transaction request from the test case used when constructing the i-th first transaction request; i is a positive integer and is less than or equal to the number of first transaction requests. The expected response result is used to reflect that the function of the target blockchain network corresponding to the detection of the i-th first transaction request is normal.
[0129] Step ②, the computer device performs a consistency check on the result obtained by the target blockchain network in response to the i-th first transaction request and the expected response result to obtain a consistency check result. Specifically, the consistency check can be to compare whether the result obtained by the response is consistent with the expected response result, and the consistency check result obtained can be used to indicate the consistency between the result obtained by the response and the expected response result.
[0130] Step ③: According to the consistency check result, perform anomaly detection on the target function of the target blockchain network in the functional dimension to obtain the detection result of the target function. The target function refers to the function detected by the test case used when constructing the i-th first transaction request.
[0131] When the consistency check result indicates that the corresponding two results are inconsistent, the detection result of the target function indicates that the target function is abnormal. For ease of description, the result obtained by responding to the i-th first transaction request can be referred to as the actual response result. Specifically, if the consistency check result indicates that the actual response result is inconsistent with the expected response result, it means that the transaction execution result obtained by the target blockchain network in response to the i-th first transaction request does not meet expectations, so that it can be determined that the detection result of the target function indicates that the target function of the target blockchain is abnormal. On the contrary, when the consistency check result indicates that the corresponding two results are consistent, the detection result of the target function indicates that the target function is normal. That is, if the consistency check result indicates that the actual response result is consistent with the expected response result, it can be explained that the transaction execution result obtained by the target blockchain network in response to the i-th first transaction request is in line with expectations, so that it can be determined that the detection result indicates that the target function of the target blockchain network is normal. It can be understood that each function of the target blockchain network can be detected in the above manner to determine whether each function of the target blockchain network is abnormal.
[0132] Based on the results obtained by the target blockchain network responding to each first transaction request introduced in the above steps ① to ③, the logic of detecting the target blockchain network in the functional dimension is specifically based on the results obtained by the target blockchain network responding to each first transaction request, and the expected response results in the test case are compared for consistency, thereby detecting whether the target function of the target blockchain network is abnormal. Based on the expected response results provided by the test case, the accuracy of the function detection can be guaranteed.
[0133] Furthermore, the computer device can also generate a functional test report based on the test results obtained by performing abnormal detection on the target function of the target blockchain network in the functional dimension. The functional test report can include the abnormal / normal status of each function, as well as the specific fault point when the function is abnormal. The computer device can store the functional test report in the test result database, so that the system outside the detection system (referred to as the external system) can obtain the corresponding functional test results from the test result database to check the quality status of the corresponding target blockchain network.
[0134] Based on the contents introduced in S401-S407 above, the following can be provided: Figure 5bThe diagram of the interaction of each module in the function detection process shown in FIG. The function detection module includes a use case scheduler, a use case executor, a result detector, and a test report generator. If at least one detection dimension includes a function dimension, the computer device can call the function detection module to execute the contents introduced in S401-S407. Figure 5b The interaction process between each submodule in the function detection module and other modules in the detection system is exemplarily described as follows.
[0135] 1.1 The function detection module can send a use case acquisition request to the use case pool module, and the use case acquisition request carries the first chain label.
[0136] 1.2 The use case pool module can perform consistency comparison with the use case labels carried by each test case stored in the use case pool based on the first chain label in the use case acquisition request, and select the test case that matches the first chain label. The selected test case can be added to the use case set, so that the use case set contains multiple test cases, and the use case label of each test case matches one of the multiple first chain labels. Exemplarily, the use case set may include: contract lifecycle management use cases, solidity contract use cases, consensus test cases, node management use cases, and gas management use cases, etc.
[0137] 1.3 The use case pool module returns the use case set to the function detection module, and then the use case scheduler in the function detection module starts the use case scheduling, sorts each test case into a use case list, and then calls the use case executor to build each first transaction request according to each test case.
[0138] 2.1 The use case executor sends the use case list and the first transaction request corresponding to each test case to the client.
[0139] 3.1 The client creates a remote procedure call connection request to establish a connection with the target blockchain network.
[0140] 3.2 The target blockchain network returns an indication of successful connection.
[0141] 3.3 The client sends the first transaction request corresponding to each test case to the target blockchain network according to the test case in the use case list. Among them, the first transaction request includes: create contract request, create call request, contract freeze request, ..., add node request, gas enable request, certificate freeze request. The response results returned by the target blockchain network include: contract creation response, contract call response, freeze request response, ..., add node response, gas enable response, certificate freeze response. In one implementation, the first transaction request for verifying a function can be sent sequentially, specifically after receiving the result of the target blockchain network's response to the transaction request, the next transaction request is sent. Exemplarily, after receiving the contract creation response, the create call request is sent, and after receiving the contract call response, the contract freeze request is sent.
[0142] 3.4 The function detection module can receive the result returned by the target blockchain network, and then the result detector performs consistency check with the returned result according to the expected response result in the test case, obtains the function detection result and sends it to the test report generator. The test report generator then generates a function test report based on the function detection result.
[0143] The interactive process described in 1.1-3.3 above can realize the functional detection of the target blockchain. The detection system provides a use case library built based on the general blockchain characteristics, and can also allow detection operators to upload customized test cases. After the detection operator initiates automatic verification, it can automatically schedule and execute the use case set, collect transaction execution results, perform automatic verification, and finally provide a visual test report.
[0144] The detection method of the blockchain network provided in the embodiment of the present application can be based on the chain tag of the characteristics related to the function of the target blockchain network, and the use case tag carried by the test case, and the test case for testing the function of the target blockchain network can be screened from the use case pool. For different functions of the target blockchain network, test cases can be quickly screened out from the use case pool, thereby accelerating the progress of the detection of the function of the target blockchain network. After the detection operator initiates the automatic verification of the function, the computer device can automatically schedule and execute the use case set, and specifically map the selected test case to the first transaction request of different transaction request types, and send each first transaction request to the target blockchain network through the client, thereby completing the execution of the test case. And it can also automatically collect the transaction execution results, that is, the result obtained by the target blockchain network in response to the first transaction request, and automatically check based on the transaction execution results, so as to detect whether there is an abnormality in the function of the target blockchain network, based on the automated function detection, it can improve the detection efficiency, and the provision of some common test cases and the automatic analysis of the test cases, while ensuring the accuracy of the detection, also have universality.
[0145] See also Figure 6 , is a flow chart of another blockchain network detection method provided by an embodiment of the present application. The blockchain network detection method can be performed by a computer device (such as Figure 1a The detection method of the blockchain network may include the following steps S601-S604.
[0146] S601, obtaining blockchain detection information set based on the operation interface, the blockchain detection information including: feature information of the target blockchain network to be detected, and at least one detection dimension of the target blockchain network; at least one detection dimension includes a performance dimension.
[0147] In one implementation, the operation interface includes a performance detection operation interface, and the performance detection operation interface may also support the setting of blockchain detection information. Therefore, the computer device can obtain blockchain detection information based on the setting of the performance detection operation interface.
[0148] The characteristic information includes at least one chain tag, and a chain tag is used to describe a characteristic of the target blockchain network. The detection of the target blockchain network under the performance dimension includes: stress testing of the target blockchain network. It can be referred to as performance stress testing, which is a type of test implemented and executed to describe the performance-related characteristics of the target blockchain network and evaluate it. Performance stress testing can achieve two purposes. On the one hand, it can stress the performance of the target blockchain network, and on the other hand, it can also find problems (bugs) in the code. For example, there is no bottleneck in the hardware such as CPU (Central Processing Unit) and memory, but the performance has not been improved. It may be that there is a problem with the logic implemented in the relevant code.
[0149] S602, filter out a second chain tag from at least one chain tag included in the feature information; the second chain tag refers to: a chain tag used to describe characteristics related to a smart contract of a target blockchain network.
[0150] If the operation interface is set to only detect the performance of the target blockchain network, the computer device can use all the chain tags contained in the acquired characteristic information as the second chain tag. If the operation interface is set to include detection of the performance and function of the target blockchain network, the computer device can select a part of the chain tags contained in the acquired characteristic information as the second chain tag.
[0151] The characteristics related to the smart contract of the target blockchain network described by the second chain tag include but are not limited to: the type of smart contract, the name of the smart contract, the method of the smart contract, etc. Smart contracts include but are not limited to: evidence storage contracts, transfer contracts, and some custom smart contracts. It should be noted that the number of the screened second chain tags can be one or more; when the number of second chain tags is multiple, different second chain tags describe different characteristics related to the smart contract. Stress testing data can be generated according to each second chain tag to verify the characteristics related to the smart contract described by each second chain tag, so as to detect the performance of the target blockchain network.
[0152] S603, generate stress testing data according to the second chain label, the stress testing data includes the following transactions: calling the operation of the smart contract indicated by the second chain label.
[0153] In one implementation, the computer device may obtain parameters of the smart contract that calls the target blockchain network, and then generate stress test data based on the second chain tag and the obtained parameters. The generated stress test data thus includes transactions that call the smart contract, wherein the second chain tag mainly determines the transaction request type corresponding to the transaction request required for stress testing the target blockchain network.
[0154] In this application, stress test data refers to stress test traffic, which can also be called stress test traffic. For example, evidence storage is one of the most common application scenarios in blockchain networks, and the smart contract of the target blockchain network can include an evidence storage contract. The example content of the evidence storage contract is shown in Table 1 below.
[0155] Table 1. Example of a deposit contract
[0156]
[0157]
[0158] In the case where the smart contract includes a proof contract, the transaction included in the stress test data is the operation of calling the proof contract, which can be specifically described by the parameters of calling the proof contract. For example, the parameters of initiating a contract call transaction are shown in Table 2 below.
[0159] Table 2 Example of stress test data
[0160]
[0161] It is understandable that in addition to the evidence storage contract, smart contracts also include other types of contracts, such as transfer contracts, custom contracts, etc. The operations of calling these smart contracts can also be included as transactions in the stress test data, and then the target blockchain network can be stress tested based on the sending of stress test data.
[0162] S604, obtaining a stress test command for the target blockchain network.
[0163] The stress test command is used to describe the strategy used to stress test the target blockchain network. For example, the strategy used to stress test the target blockchain network (also referred to as stress test) includes but is not limited to: how long the stress test lasts for the target blockchain network, how many concurrent threads are created to simulate the concurrent interaction between multiple devices and the target blockchain network, the number of transactions to be executed during the stress test, etc.
[0164] In one embodiment, when a computer device obtains a stress test command for a target blockchain network, it may specifically perform the following steps: Step 1, obtaining stress test parameters for the target blockchain network set based on an operation interface. Step 2, assembling a stress test command for the target blockchain network based on the stress test parameters.
[0165] The stress test parameters include at least one of the following: the number of stress test concurrency, the stress test duration, and the number of stress test transactions; wherein, the number of stress test concurrency refers to: the number of second transaction requests that need to be sent concurrently each time; the stress test duration refers to: the duration of the stress test on the target blockchain network; the number of stress test transactions refers to: the total number of second transaction requests sent to the target blockchain network. Both the stress test duration and the number of stress test transactions can determine when the stress test on the target blockchain network ends. For example, when the duration of the stress test on the target blockchain network reaches the duration indicated by the stress test duration, or the number of second transaction requests sent to the target blockchain network reaches the total number indicated by the stress test transaction number, the current stress test on the target blockchain network can be ended.
[0166] It is understandable that, in addition to the types mentioned above, stress testing parameters may also include: stress testing concurrency times, request sending time interval, thread ramp-up time, stress testing transaction type, etc. Among them, stress testing concurrency times refers to the number of times the target blockchain network is stress tested, request sending time interval refers to the interval length of the second transaction request sent concurrently to the target blockchain network, thread ramp-up time refers to the number of threads started at the end of the set time, and stress testing transaction type refers to the type of transaction request when performing stress testing. The stress testing transaction type can be determined based on the second chain tag, and can also be set when setting the stress testing parameters if the second chain tag is not specified.
[0167] In one implementation, the computer device may obtain stress testing parameters for the target blockchain from the target detection request. The target detection request carries detection information, which is used as blockchain detection information. When the target detection request includes stress testing parameters and the stress testing parameters are independent of the detection information, the computer device may parse the target detection request to obtain the detection information and the stress testing parameters. When the target detection request includes detection information and the stress testing parameters are included in the detection information, the computer device may parse the target detection request to obtain the detection information, and then obtain the stress testing parameters for the target blockchain from the detection information.
[0168] As an achievable method, the operation interface includes a performance detection operation interface, the performance detection operation interface includes a stress testing parameter setting area, and the method of setting the stress testing parameters based on the operation interface includes: the target device displays the performance detection operation interface, and based on the input operation in the stress testing parameter setting area, the configured stress testing parameters are displayed in the performance operation interface; based on the confirmation operation of the stress testing parameters, the stress testing parameters are added to the detection request, and the detection request is sent to the computer device.
[0169] For the performance test operation interface, such as Figure 7a As shown, the stress testing parameters that can be set in the performance testing operation interface include: stress testing concurrent times, request sending time interval, thread climbing time, etc. It is understandable that blockchain-related information can also be set in the performance testing operation interface, such as the target blockchain network can be determined through the uploaded chain and node configuration files, and the contract name, contract type, and contract method can be parsed through the uploaded contract file. In addition, the stress testing parameters can be automatically configured or manually configured. Among them, when the stress testing parameters are added to the detection information, the computer device can obtain the detection information and parse the detection information to obtain the stress testing parameters. When the stress testing parameters are added to the detection request independently of the detection information, the computer device can obtain the detection information and the stress testing parameters together.
[0170] In one implementation, a stress test subcommand can be generated according to a stress test parameter, and then the various stress test subcommands can be assembled to obtain a stress test command for the target blockchain network. For example, the stress test concurrency is 10, the stress test duration is 10 seconds, and the number of stress test transactions is 100. The assembled stress test command includes: a stress test duration subcommand for describing a 10-second stress test on the target blockchain network, a stress test concurrency subcommand for concurrently sending 10 second transaction requests to the target blockchain network each time, and a stress test transaction number subcommand for sending 100 second transaction requests to the target blockchain network before the stress test ends.
[0171] S605: Generate at least one second transaction request carrying stress testing data according to the stress testing command.
[0172] The second transaction request refers to a transaction request required to detect the target blockchain network in the performance dimension. In a specific implementation, at least one second transaction request carrying stress testing data can be generated according to the stress testing parameters contained in the stress testing command. Different second transaction requests can specifically carry different transactions contained in the stress testing data.
[0173] S606, constructing a client through the simulation program, and sending each acquired transaction request to the target blockchain network through the constructed client, so that the target blockchain network responds to each transaction request.
[0174] In the performance dimension, the transaction request obtained by the computer device is the second transaction request. The created client needs to establish a connection with the target blockchain network, and specifically, can establish a connection with each node in the target blockchain network, so that the node can receive the second transaction request sent by the client. Each second transaction request can be sent to the target blockchain network through the client, so that the target blockchain network responds to each second transaction request.
[0175] In one achievable manner, the stress testing parameters corresponding to the stress testing command include the stress testing concurrency number. The computer device can start the stress testing command, create threads equal to the stress testing concurrency number, and then call the created threads to send each second transaction request when sending each second transaction request through the client.
[0176] In one embodiment, the acquired transaction request includes at least one second transaction request, and the process of the target blockchain network responding to any second transaction request includes: the nodes in the target blockchain network parse the transaction from the corresponding second transaction request and store the parsed transaction in a block.
[0177] As a feasible method, the transactions in each second transaction request sent by the computer device to the target blockchain through the client can be cached in the transaction pool after being parsed, and the target blockchain network can select a preset number of transactions from the transaction pool, and then one or more nodes in the target blockchain network execute the parsed transactions to obtain the transaction execution result. The nodes that execute the transaction request parsing may include one or more nodes specified through the operation interface, or nodes automatically configured by the system to put pressure on the one or more nodes through the second transaction request. The client specifies to put pressure on a single node (i.e., one node) or multiple nodes, and the address of the node (e.g., IP address) can be provided. Exemplarily, there are two types of pressure on a single node and distributed multi-node pressure as shown in Table 3 below.
[0178] Table 3 Example of pressure node settings
[0179]
[0180] As shown in Table 3, in the single-node pressure mode, the address of a node in the target blockchain network is provided to exert pressure on the node, and in the multi-node pressure mode, the addresses of four nodes are provided to exert pressure on the four nodes. The pressure process includes submitting the second transaction request to the corresponding node for parsing, and storing the parsed transaction in the block.
[0181] The nodes in the target blockchain network store the transaction in the block, indicating that the transaction is on the chain through the consensus of each node in the target blockchain network. In addition, the transaction execution results obtained by the node executing the transaction can also be stored in the block. The nodes in the target blockchain network store the parsed transactions in the block during the block generation process. This is because before the blockchain implements accounting, the consensus algorithm can be used to select which node to generate a new block to initiate accounting. The process of generating a new block is called block generation. The following is a detailed description of the block generation process.
[0182] The nodes in the target blockchain network (hereinafter referred to as blockchain nodes for ease of description) can parse one or more second transaction requests to obtain transactions in each second transaction request. The transactions can then be cached in the transaction pool, and the node that packages the block can take out a preset number of transactions from the transaction pool, package each transaction to obtain a block, and then perform node consensus on the block to obtain a consensus result. After the consensus result indicates that the block has passed the consensus of each node in the target blockchain network, the block is added to the blockchain, which means that the transaction is stored in the block, and each transaction in the block is stored on the blockchain.
[0183] For the node consensus process, take the target blockchain network containing 4 nodes, and the consensus algorithm adopts the TBFT consensus algorithm (a Byzantine fault-tolerant algorithm that can ensure the safe operation of the system when the number of Byzantine nodes is less than 1 / 3 of the total) as an example, and combine it with Figure 7bThe blockchain node consensus process shown in FIG. 1 is illustrated as an example. In the specific implementation, 4 nodes can elect one node as the leader node (i.e., leader node), and the remaining nodes are follower nodes (follower nodes), among which the leader node can be rotated. After the blockchain node receives pressure, the leader node proposes a block and formally enters the consensus process. The consensus process is mainly divided into three stages: proposal stage (Proposal), pre-voting stage (Prevote) and pre-commit stage (Precommit). In the proposal stage, the leader node can package each transaction into a block and broadcast it to the follower node; in the pre-voting stage, after the follower node receives the proposal information (proposal, which contains the packaged block) and verifies that the proposal block (proposal) is legal, it broadcasts its own voting information (prevote vote) to other nodes; in the pre-commit stage, after the node receives the voting information (prevote) of more than 2 / 3 of the nodes for the proposal block (proposal), it broadcasts its own pre-commit voting information (precommit vote) to other nodes. Finally, in the commit phase, after receiving pre-commit votes from more than 2 / 3 of the nodes for the proposal, the node can submit the blocks in the proposal to the ledger, thereby storing each transaction on the blockchain. The transaction execution results can also be packaged into blocks and stored on the blockchain as the transaction is uploaded to the chain.
[0184] Based on the above processing, the result obtained by the target blockchain network responding to any second transaction request includes: the block corresponding to the transaction in the corresponding second transaction request. Transactions in different second transaction requests can be packaged into the same block, which is added to the blockchain (i.e., transactions are put on the chain, also known as block generation) after consensus is reached by each node in the target blockchain network, so that each transaction can be stored in the same block. Transactions in different second transaction requests can also be packaged into different blocks, so that transactions in different second transaction requests are stored in different blocks after consensus and on the chain.
[0185] In a feasible embodiment, before the nodes of the target blockchain network store the transactions parsed from the second transaction request into the block, they need to cache the parsed transactions into the transaction pool of the target blockchain network. From the perspective of the target blockchain network, the processing content performed by the target blockchain network includes the following parts: for each transaction request received, the transaction in the transaction request will be parsed and cached into the transaction pool, and then the corresponding node will obtain a preset number of transactions from the transaction pool, and each transaction will be packaged to obtain a block, and then the packaged block will be subjected to node consensus, and after passing the node consensus, the transaction in the block will be added to the blockchain. In one implementation, the transactions cached in the transaction pool can be cached in the form of a queue. Optionally, according to the first-in-first-out principle, the transaction that arrives at the transaction pool first can be taken out first for packaging.
[0186] If the pressure on the target blockchain network is too great, it will exceed the processing capacity of the target blockchain network, which may cause abnormal transaction request responses, which is manifested in the following two aspects: On the one hand, the target blockchain network can no longer continue to receive new transactions. On the other hand, when the transaction pool is full (that is, the transactions cached in the transaction pool reach the data capacity carried by the transaction pool), the transaction upload rate on the blockchain in the target blockchain network will be reduced, thereby affecting the detection effect. Therefore, in the process of stress testing the target blockchain network, by providing a function to detect whether the transaction pool of the target blockchain network is full, it is possible to better cope with stress testing abnormal scenarios.
[0187] Based on this, for any second transaction request, the implementation method of sending each acquired transaction request to the target blockchain network through the constructed client includes the contents introduced in the following S11-S13.
[0188] S11. For the kth second transaction request, detect the number of cached transactions in the transaction pool of the target blockchain network; k is a positive integer and is less than or equal to the number of second transaction requests.
[0189] The transactions cached in the transaction pool include transaction requests received by the target blockchain network, which may specifically include one or more of the first transaction request and the second transaction request. The kth second transaction request is the second transaction request that needs to be sent currently. Subsequently, based on the comparison between the number of transactions cached in the transaction pool and the cache capacity supported by the transaction pool, it can be determined whether the transaction pool is full.
[0190] S12. If the number of cached transactions reaches the cache capacity supported by the transaction pool, a full load prompt is output to prompt that the transaction pool has reached a full load state and the stress testing parameters need to be adjusted. The stress testing parameters are parameters used to generate stress testing commands for the target blockchain network.
[0191] If the number of transactions cached in the transaction pool (commonTxSize) is greater than or equal to the cache capacity supported by the transaction pool (MaxCommonTxPoolSize), then it can be determined that the transaction pool has reached a full load state (i.e., the transaction pool has been filled up). The transaction in the k-th second transaction request cannot be received by the target blockchain network. The computer device can output a full load prompt through the client, thereby feeding back the full transaction pool to the detection operator. Furthermore, since the full transaction pool will affect the results of the performance test during the stress test, the detection operator can also be prompted to adjust the stress test parameters to reduce the number of second transaction requests received by the target blockchain network, so that the target blockchain network can normally receive new transactions as the transactions in the transaction pool are processed.
[0192] S13. If the number of cached transactions does not reach the cache capacity supported by the transaction pool, the kth second transaction request is sent to the target blockchain network through the constructed client.
[0193] If the number of transactions cached in the transaction pool is less than the cache capacity supported by the transaction pool, it can be determined that the transaction pool is not fully loaded (i.e., the transaction pool is not full), and the target blockchain network can receive the transaction in the transaction request. Therefore, the computer device can send the kth second transaction request to the target blockchain network through the constructed client, so that the target blockchain network caches the transaction in the kth second transaction request into the transaction pool. The implementation logic described in S41-S43 above can be implemented using the logic code shown in Table x below, and the detection system provided by this application can include the logic code.
[0194] Table 4 Transaction pool full detection logic code
[0195]
[0196]
[0197] By detecting whether the transaction pool is full, we can better deal with abnormal stress testing scenarios, thereby reducing the impact on the performance detection effect of the target blockchain network.
[0198] S607, respectively detect the target blockchain network under the corresponding detection dimension according to the result obtained by the target blockchain network responding to each transaction request, and obtain the detection result of the target blockchain network under the corresponding detection dimension.
[0199] In the case where the detection dimension includes the performance dimension, the computer device may detect the target blockchain network under the performance dimension according to the result obtained by the target blockchain network responding to each second transaction request. Based on the corresponding process and the result obtained by the target blockchain network responding to the second transaction request, the computer device may specifically perform the following steps 21-23 when detecting the target blockchain network under the corresponding detection dimension according to the result obtained by the target blockchain network responding to each transaction request.
[0200] Step 21: Determine a blockchain constructed based on a result obtained by responding to at least one second transaction request, and select N blocks from the blockchain, where N is a positive integer.
[0201] The result obtained by the target blockchain network responding to at least one second transaction request includes blocks corresponding to each transaction, and the target blockchain network may include one or more blockchains. The computer device may determine the blockchain constructed by the blocks corresponding to the transactions in the second transaction request from one or more blockchains included in the target blockchain network, and perform performance detection with the blocks included in the blockchain. Based on this, the computer device may first select N blocks from the blockchain, and the selected blocks may be all or part of the blocks in the determined blockchain. Exemplarily, if the determined blockchain contains 100 blocks, then 20 blocks may be selected from the blockchain. Optionally, each selected block may be a block with a continuous block height, for example, 20 blocks with a block height of 1-20 in the blockchain are selected, where the block height refers to the position of the block in the blockchain.
[0202] As a feasible implementation method, the computer device may first select N blocks from the blockchain and the implementation method may include the following contents: first, the computer device may obtain block indication information; then, determine the block detection window according to the block indication information, and select each block located in the block detection window from the blockchain.
[0203] The block indication information is used to indicate: the starting block and the ending block on the blockchain for performance testing. The block indication information can be obtained through an operation interface (such as a performance testing operation interface) or can be the default configuration of the detection system. In one achievable method, the block indication information may include at least one of: block height information and time window information. Among them, the block height information may include the block height (blockHeightStart) of the starting block used for performance testing and the block height (blockHeightEnd) of the ending block. The time window information includes the timestamp of the starting block used for performance testing and the timestamp of the ending block. The timestamp can be the block timestamp of the block. Each block on the blockchain has information of two dimensions: timestamp and block height.
[0204] The block detection window determined according to the block indication information can constrain the range of blocks used for performance detection. If the block indication information includes block height information, the determined block detection window can constrain the height range of blocks used for performance detection; if the block indication information includes time window information, the determined block detection window can constrain the time range of blocks used for performance detection. Furthermore, each block in the blockchain that is within the block detection window can be selected and used as the blocks required for detecting the performance of the target blockchain network.
[0205] For example, the block detection window determined according to the block height information is [10,20], which means that the starting block for performance detection is the block with a block height of 10 in the blockchain, and the ending block for performance detection is the block with a block height of 20 in the blockchain. Then, all blocks between block heights 10 and 20 are used for performance detection. For another example, the time window information is [1s, 10s], where s represents seconds. Then, the block with a timestamp of 1 second can be used as the starting block for performance detection, and the block with a timestamp of 10s can be used as the ending block for performance detection. And blocks with timestamps between 1 second and 10 seconds can be used for performance detection.
[0206] In one implementation, the first block in the block detection window is the starting block indicated by the block indication information, while the last block in the block detection window is not necessarily the ending block indicated by the block indication information. In order to ensure that the detection of blocks in the blockchain does not exceed the upper limit of the block range, the block height of the latest block on the blockchain needs to be detected to determine the final block detection window. To this end, there are the following two situations:
[0207] Case 1: When the block height of the termination block indicated by the block indication information is less than or equal to the block height of the latest block on the blockchain, the last block in the block detection window is the termination block.
[0208] In this case, the block height of the end block indicated by the block indication information does not exceed the block height of the latest block on the blockchain, so the block detection window can be determined according to the block height of the start block and the block height of the end block indicated by the block indication information. In this way, the first block in the block detection window is the start block, and the last block is the end block, so as to facilitate subsequent effective detection.
[0209] Case 2: When the block height of the termination block indicated by the block indication information is greater than the block height of the latest block on the blockchain, the last block in the block detection window is the latest block.
[0210] In this case, since the block height of the end block indicated by the block indication information exceeds the block height of the latest block on the blockchain, all blocks corresponding to the block height exceeding the latest block on the blockchain cannot detect valid data. In order to ensure the effectiveness of the detection and avoid wasting detection resources, the block detection window can be determined based on the block height of the start block indicated by the block indication information and the block height of the latest block, so that the last block of the obtained block detection window is the latest block.
[0211] It can be seen that in the above manner, based on the block detection window determined above, the upper limit of the range of blocks used for performance detection can be made not to exceed the height of the latest block on the blockchain. When the block indication information does not match the height on the blockchain, the last block constituting the block detection window can be adjusted in a timely manner, thereby avoiding unnecessary block detection and improving resource utilization and detection effectiveness.
[0212] Step 22: Obtain the transaction on-chain rate corresponding to each block in the N blocks.
[0213] The transaction rate corresponding to any block refers to the number of transactions in the corresponding block that are added to the blockchain in the target blockchain network per unit time. The unit time here can be any of the following: per second, per millisecond, etc., and this application does not limit this. The transaction rate can be used to measure the transaction processing capacity of the target blockchain network, which can be the number of confirmed transactions per second (CTPS) or the number of transactions per second (TPS).
[0214] As a feasible method, when a computer device obtains the transaction chain rate corresponding to each block in N blocks, it can specifically perform the following steps: first, the computer device can traverse each block in the N blocks, and use the currently traversed block as the current block; then, according to the time consumed to generate the current block and the time consumed to process the current block through consensus on the chain, determine the block time of the current block; finally, according to the block time of the current block and the number of transactions in the current block, determine the transaction chain rate corresponding to the current block.
[0215] The time consumed to generate the current block refers to the time it takes for the nodes in the target blockchain network to package multiple transactions into the current block (also referred to as the packaging block interval), and the time consumed to process the current block on the blockchain through consensus refers to the time it takes for each node in the target blockchain network to reach a consensus on the current block and store the current block that has passed the consensus on the blockchain. The time spent on a round of consensus can also be referred to as the consensus interval, and the length of the consensus interval is affected by the consensus algorithm. In a specific implementation, the time consumed to generate the current block and the time consumed to process the current block on the blockchain through consensus can be summed to obtain the block time of the current block.
[0216] For each block on the blockchain, one or more transactions are stored. The computer device can obtain the number of transactions in the current block, and then use the number of transactions in the current block as the numerator and the block time of the current block as the denominator to calculate the ratio between the two, and use the calculated ratio as the transaction on-chain rate corresponding to the current block. For example, the current block is the i-th block in N blocks, and the number of the current block is recorded as txs blocki , the block time of the current block is recorded as txs intervali , then the transaction on-chain rate tps i The calculation expression of is as follows (1).
[0217]
[0218] The value range of i is 1 to N. It is understandable that for each of the N blocks, the transaction on-chain rate corresponding to each block can be determined in the above manner.
[0219] Determining the transaction on-chain rate corresponding to each block based on the above method can be a description of the average speed at which transactions in the block are stored on the blockchain. The transaction on-chain rate at each block granularity can more accurately detect the performance of the target blockchain network. In addition, the N blocks can be blocks selected from the blockchain based on the block detection window. Based on the block detection window, the on-chain transactions can be continuously monitored in real time, which can also make the detection process more accurate.
[0220] Step 23: According to the transaction on-chain rate corresponding to each block in the N blocks, the target blockchain network is tested in the performance dimension to obtain the test result of the target blockchain network in the performance dimension.
[0221] In one embodiment, the stress test command is generated based on the stress test parameters. The specific implementation of the above step 23 may include the following: First, the computer device may perform mean processing on the transaction on-chain rate corresponding to each block in the N blocks, and use the mean processing result as the average transaction on-chain rate of the target blockchain network. Then, based on the size relationship between the average transaction on-chain rate and the preset rate threshold, the performance parameters of the target blockchain network are obtained, or the stress test command is regenerated for performance testing.
[0222] When the computer device performs mean processing on the transaction on-chain rate corresponding to each block in N blocks, the transaction on-chain rate corresponding to each block can be summed up first, and then the ratio between the summed value and the number of blocks N is calculated. For example, based on the transaction on-chain rate shown in formula 1), the expression of mean processing can be shown in formula 2).
[0223]
[0224] Among them, tps avg Indicates the mean processing result, that is, the average transaction on-chain rate. Indicates the transaction rate of the i-th block in N blocks, i is 1-N. N is the number of blocks.
[0225] Based on the relationship between the average transaction on-chain rate and the preset rate threshold, the computer device can further execute any of the contents described in (1) and (2) below.
[0226] (1) If the average transaction on-chain rate reaches the preset rate threshold, the stress test parameters corresponding to the stress test command are used as the performance parameters of the target blockchain network and added to the detection results of the target blockchain network under the performance dimension.
[0227] The average transaction on-chain rate reaches the preset rate threshold, which means that the average transaction on-chain rate is greater than or equal to the preset rate threshold, indicating that the target blockchain network's ability to process transactions under stress testing meets or exceeds expectations, and thus the stress testing parameters corresponding to the stress testing command can be added to the test results of the target blockchain network under the performance dimension, and the stress testing parameters are performance parameters of the target blockchain network, which are used to describe the performance of the target blockchain network. Exemplarily, the stress testing parameters include the stress testing concurrency, stress testing duration, and the number of stress testing transactions. When the above conditions are met, these stress testing parameters can be used as performance parameters of the target blockchain network, thereby describing the number of concurrent accesses that the target blockchain network can carry, how long it can continue to run stably, and the total number of transactions that can be carried within that duration.
[0228] In a feasible implementation, if the average transaction rate reaches a preset threshold, the computer device can also determine whether to use the stress test parameters as performance parameters based on the results obtained by monitoring the resource consumption of the target blockchain network. Specifically, it may include the following ① and ②:
[0229] ①Computer equipment can obtain resource monitoring results for the target blockchain network.
[0230] The resource monitoring result is obtained by monitoring the resource consumption of the target blockchain network during the process of the target blockchain network responding to at least one second transaction request. Among them, the resource consumption refers to the resource consumption of each node in the target blockchain network, including but not limited to: CPU occupancy rate, memory usage rate, and hard disk read and write speed, etc. Optionally, the resource monitoring result is visible to the detection operator, that is, during the process of detecting the performance of the target blockchain network, the computer device can output the resource monitoring result to the result interface in real time to display the resource monitoring result through the result interface. Thereby, the resource consumption of the target blockchain network in the process of responding to the second transaction request is observed.
[0231] ② If the resource consumption indicated by the resource monitoring result is less than or equal to the preset resource consumption, the step of using the stress testing parameters corresponding to the stress testing command as the performance parameters of the target blockchain network and adding them to the detection results of the target blockchain network under the performance dimension is triggered.
[0232] Among them, the preset resource consumption can be set independently by the detection operator or based on the experience value. The preset resource consumption can be the upper limit of resource usage in the target blockchain network. This application does not limit this. Specifically, when the average transaction on-chain rate reaches the preset rate threshold, and the resource consumption indicated by the resource monitoring result is less than or equal to the preset resource consumption, it indicates that the target blockchain network is not overloaded in the process of responding to at least one second transaction request, and can respond well to each second transaction request, thereby triggering the execution of the stress test parameters corresponding to the stress test command as the performance parameters of the target blockchain network, and adding them to the detection results of the target blockchain network under the performance dimension. Exemplarily, the preset resource consumption is 80% memory utilization. If the monitored memory utilization of the target blockchain network is 70%, then the stress test parameters corresponding to the stress test command can be used as performance parameters.
[0233] In another achievable method, if the average transaction on-chain rate reaches a preset rate threshold, the computer device can also execute the contents described in ③ and ④ below based on the relationship between the resource consumption indicated by the resource monitoring results and the preset resource consumption.
[0234] ③ If the resource consumption indicated by the resource monitoring result is less than or equal to the preset resource consumption, the preset resource consumption will be used as the performance parameter of the target blockchain network and added to the test result of the target blockchain network under the performance dimension. In other words, if the average transaction on-chain rate reaches the preset rate threshold, and the monitored resource consumption is less than or equal to the preset resource consumption, it means that the stress test result of the target blockchain network meets expectations. Then the stress test parameters currently used for performance testing of the target blockchain network and the preset resource consumption can be used as performance parameters of the target blockchain network and then added to the performance test results. Furthermore, a performance test report can be automatically generated based on the performance test results and saved in the database.
[0235] ④ If the resource consumption indicated by the resource monitoring result is greater than the preset resource consumption, the stress test parameters are adjusted to regenerate the stress test command, and the target blockchain network is tested under the performance dimension according to the regenerated stress test command. In other words, if the average transaction on-chain rate reaches the preset rate threshold, and the monitored resource consumption is greater than the preset resource consumption, it indicates that the stress test result of the target blockchain network does not meet expectations. In the process of the target blockchain network responding to the second transaction request, the resource consumption in the target blockchain network may be overloaded, affecting the processing of the second transaction request. Therefore, it is necessary to adjust the stress test parameters, and then generate a new stress test command based on the adjusted stress test parameters, that is, regenerate the stress test command, and then test the target blockchain network under the performance dimension according to the regenerated stress test command.
[0236] In one achievable manner, the stress test on the target blockchain network is performed by a performance detection module, and specifically, the stress test can be initiated by a stressing machine. In the case where the stress test result does not meet expectations, the stress test result can be fed back to the stressing machine, and then the stressing machine adjusts the stress test parameters by itself. The adjustment logic of the stress test parameters can be: first determine the adjustment direction of the stress test parameters, and then adjust the stress test parameters according to the preset adjustment range based on the adjustment direction of the stress test parameters to obtain the adjusted stress test parameters. Among them, the adjustment direction includes any one of an increasing direction and a decreasing direction. The preset adjustment range can be set according to an empirical value or by a detection operator, and each stress test parameter can correspond to a preset adjustment range. Based on the fact that the monitored resource consumption is greater than the preset consumption, the computer device can determine that the adjustment direction is a decreasing direction, thereby reducing the number of second transaction requests sent to the target blockchain network, so that the resource consumption of the target blockchain network in the process of responding to the second transaction request is correspondingly reduced.
[0237] In the above method, by adjusting the stress test parameters in an automated manner, the degree of automation and intelligence of the detection process is increased. In another achievable method, the adjustment logic of the stress test parameters by the computer device can be: adjusting the stress test parameters based on the adjustment instructions initiated by the detection operator. That is, the adjustment of the stress test parameters can be provided to the detection operator to perform manually, so as to achieve more personalized adjustment.
[0238] In a specific implementation, the process in which a computer device detects a target blockchain network in a performance dimension according to a regenerated stress testing command includes: firstly generating at least one second transaction request carrying stress testing data according to the regenerated stress testing command, then calling a client to send each generated second transaction request to the target blockchain network, and then detecting the target blockchain network in a performance dimension according to a result obtained by the target blockchain network responding to each second transaction request.
[0239] (2) If the average transaction on-chain rate does not reach the preset rate threshold, the stress test parameters are adjusted to regenerate the stress test command, and the target blockchain network is tested under the performance dimension based on the regenerated stress test command.
[0240] The average transaction on-chain rate does not reach the preset rate threshold, which means that the average transaction on-chain rate is less than the preset rate threshold. In this case, it means that the transaction processing capacity of the target blockchain network has not reached the capacity limit, and the target blockchain network can also respond to more second transaction requests per unit time, and the stress testing parameters can also be adjusted. The specific adjustment logic can be found in the above introduction. However, it should be noted that the adjustment direction of the stress testing parameters in this step is the increase direction, by increasing the stress testing parameters. For the process of detecting the target blockchain network in the performance dimension according to the regenerated stress testing command, please refer to the above description, which will not be repeated here.
[0241] As an implementable method, the N blocks may be a portion of blocks selected from the determined blockchain through the block detection window. Under the condition of the specified block detection window, the process of detecting the CTPS of the target blockchain network is as described in 1)-4) in Table 5 below.
[0242] Table 5 The process of CTPS detection of the target blockchain network
[0243]
[0244]
[0245] In this way, since different detection operators can specify the starting block and the ending block of the detection, the personalized detection needs of the detection operators are met, and the granularity of the block detection window is smaller than that of the entire blockchain, more accurate detection can be performed through the block detection window, enhancing the effectiveness of the detection. Furthermore, in terms of performance detection, the detection operator can specify one or both of the time window (corresponding to the time window information) and the block window (corresponding to the block height information) used for performance detection. By observing the performance indicators (such as CTPS) in different time periods, a more accurate performance evaluation of the blockchain can be performed.
[0246] As an implementable method, the N blocks can be all the blocks on the determined blockchain. The computer device obtains the number of transactions in each of the N blocks and the block time of each block, and then calculates the total number of transactions (i.e., the total number of transactions on the chain) based on the number of transactions in each block, and calculates the total transaction time (i.e., the time it takes for all transactions to be completed on the chain) based on the block time of each block. The average transaction on-chain rate is then calculated based on the total number of transactions and the total transaction time. In this way, there is no need to specify the starting block and the ending block for performance testing. Instead, all blocks in the blockchain are used as the test objects to complete the performance test of the target blockchain network. It has corresponding versatility for different blockchain networks, and can also be used as a general performance testing solution when the test operator specifies which range of blocks to test.
[0247] Furthermore, a visual performance test report can be generated based on the detected average transaction on-chain rate and the monitored resource consumption. The generation of the performance test report can be executed according to the code logic shown in Table 6 below.
[0248] Table 6 Visual report generation for performance CTPS detection
[0249]
[0250]
[0251] For the performance test of the target blockchain network introduced in S601-S607 above, the following can be provided: Figure 7c The interactive diagram shown. The performance detection module includes: a pressure machine (including a pressure regulator), a task scheduler, a resource monitor, a transaction on-chain rate detector, and a report generator. Among them, the transaction on-chain rate is the core unit of the performance detection module and can be used to calculate CTPS. The pressure regulator is used to adjust the pressure test parameters, the task scheduler can be called in multiple concurrent detection scenarios, and the resource monitor can be used to monitor the system resources of the target blockchain network in real time. The monitored system resources include but are not limited to: CPU, Memory, hard disk read and write speed, etc., and by visualizing the monitored system resources, the detection operator can perceive the usage of system resources during the pressure test in real time. The interaction process involved in each unit based on the performance detection module is as follows:
[0252] 1.1 After obtaining the blockchain detection information including the performance dimension, the stress machine can assemble the stress test command according to the stress test parameters, then start the stress test command, and send the second transaction request (including the stress test transaction flow) to the target blockchain network based on the constructed client.
[0253] 2.1 The nodes in the target blockchain network can process stress test transaction traffic, and the transaction on-chain rate detector can monitor the process of the target blockchain network processing stress test transaction traffic, thereby detecting the CTPS of the target blockchain network based on the stress test transaction traffic processed by the nodes in the target blockchain network. The detection operator can independently specify the starting block and end block of the detection, thereby determining the block detection window of the CTPS detection. In the block detection window, the on-chain CTPS can be continuously monitored in real time, making the detection process more accurate.
[0254] 3.1 The resource monitor can monitor the system resources of the target blockchain network in real time and output the resource monitoring results visually.
[0255] 4.1 Comprehensively evaluate the system resource usage and CTPS during the stress test. If the stress test results do not meet expectations, they can be fed back to the stress machine for automatic adjustment of the stress test parameters (i.e., execute 5.1). If they meet expectations, a test report is automatically generated and stored in the database (i.e., execute 6.1).
[0256] 5.1 If the pressure test results do not meet expectations, they can be fed back to the pressure machine for automatic adjustment of the pressure test parameters.
[0257] 6.1 Automatically generate test reports and save them in the database.
[0258] The performance CTPS unit (i.e., transaction on-chain rate detector) is based on the general blockchain test solution, and on this basis, provides an enhanced detection function of CTPS based on time and block windows to make the CTPS detection results more accurate. Based on the interaction process provided in the above embodiments, based on the automated simulation and testing system through the blockchain network, covering function and performance detection, the entire detection process is completed automatically without manual intervention, and rapid feedback on the quality of the blockchain network can be achieved.
[0259] Next, the detection device of the blockchain network involved in the embodiment of the present application is described.
[0260] See also Figure 8 , Figure 8 It is a structural diagram of a detection device for a blockchain network provided in an embodiment of the present application. The detection device for the blockchain network can be set in a computer device provided in an embodiment of the present application, and the computer device can be the terminal device mentioned in the above method embodiment. Figure 8 The detection device of the blockchain network shown can be a computer program (including program code) running in a computer device, and the detection device of the blockchain network can be used to execute Figure 2 Some or all of the steps in the method embodiment shown. Figure 8 , the detection device of the blockchain network may include the following units:
[0261] An acquisition unit 801 is used to acquire blockchain detection information set based on an operation interface, where the blockchain detection information includes: feature information of a target blockchain network to be detected, and at least one detection dimension of the target blockchain network; the at least one detection dimension includes one or more of a functional dimension and a performance dimension;
[0262] The processing unit 802 is used to obtain, according to the characteristic information, the transaction requests required for detecting the target blockchain network in each detection dimension;
[0263] The processing unit 802 is further used to construct a client through a simulation program, and send each acquired transaction request to the target blockchain network through the constructed client, so that the target blockchain network responds to each transaction request;
[0264] The processing unit 802 is also used to detect the target blockchain network under the corresponding detection dimension according to the results obtained by the target blockchain network responding to each transaction request, so as to obtain the detection result of the target blockchain network under the corresponding detection dimension.
[0265] In one embodiment, at least one detection dimension includes a functional dimension, and the characteristic information includes at least one chain tag, where a chain tag is used to describe a characteristic of the target blockchain network;
[0266] The processing unit 802 is specifically configured to:
[0267] Filtering out a first chain tag from at least one chain tag included in the characteristic information; the first chain tag refers to: a chain tag used to describe characteristics related to functions of the target blockchain network;
[0268] Determine a test case pool, which contains multiple test cases. One test case is used to detect a function of the blockchain network, and each test case has a test case label. The test case label of any test case is obtained by labeling the corresponding test case according to the function detected by the corresponding test case.
[0269] According to the use case labels of each test case in the use case pool, the test cases matching the first chain labels are screened out from the use case pool;
[0270] Based on the screened test cases, at least one first transaction request is constructed; the first transaction request refers to: a transaction request required to detect the target blockchain network in the functional dimension.
[0271] In one embodiment, any test case includes: request parameters for constructing a first transaction request; a processing unit 802, specifically configured to:
[0272] Get the mapping relationship between test cases and transaction request types;
[0273] Map the screened test cases according to the mapping relationship to obtain the target transaction request type;
[0274] Under the target transaction request type, at least one first transaction request is constructed using request parameters in the filtered test case.
[0275] In one embodiment, the acquired transaction request includes at least one first transaction request, and any test case includes: an expected response result corresponding to the first transaction request constructed based on the corresponding test case; the processing unit 802 is specifically used to:
[0276] For the i-th first transaction request, obtaining an expected response result of the i-th first transaction request from a test case used when constructing the i-th first transaction request; i is a positive integer and is less than or equal to the number of first transaction requests;
[0277] Perform a consistency check on the result obtained by the target blockchain network responding to the i-th first transaction request and the expected response result to obtain a consistency check result;
[0278] According to the consistency check result, anomaly detection is performed on the target function of the target blockchain network in the functional dimension to obtain the detection result of the target function;
[0279] The target function refers to: the function detected by the test case used when constructing the i-th first transaction request; and when the consistency check result indicates that the corresponding two results are inconsistent, the detection result of the target function indicates that there is an abnormality in the target function.
[0280] In one embodiment, at least one detection dimension includes a performance dimension, and the detection of the target blockchain network under the performance dimension includes: a stress test on the target blockchain network; the characteristic information includes at least one chain tag, and a chain tag is used to describe a characteristic of the target blockchain network; the processing unit 802 is specifically used to:
[0281] Filtering out a second chain tag from at least one chain tag included in the characteristic information; the second chain tag refers to: a chain tag used to describe characteristics related to a smart contract of a target blockchain network;
[0282] Generate stress test data according to the second chain tag, and the stress test data includes the following transactions: call the operation of the smart contract indicated by the second chain tag;
[0283] Get the stress test command for the target blockchain network. The stress test command is used to describe: the strategy adopted for stress testing the target blockchain network;
[0284] At least one second transaction request carrying stress testing data is generated according to the stress testing command, where the second transaction request refers to a transaction request required to detect the target blockchain network in the performance dimension.
[0285] In one embodiment, the processing unit 802 is specifically configured to:
[0286] Obtain stress testing parameters for the target blockchain network set based on the operation interface, where the stress testing parameters include at least one of the following: stress testing concurrency number, stress testing duration, and stress testing transaction number; stress testing concurrency number refers to: the number of second transaction requests that need to be sent concurrently each time; stress testing duration refers to: the duration of stress testing on the target blockchain network; stress testing transaction number refers to: the total number of second transaction requests sent to the target blockchain network;
[0287] Based on the stress testing parameters, a stress testing command for the target blockchain network is assembled; wherein, when the stress testing parameters include the stress testing duration, a second transaction request is continuously generated according to the stress testing command, and the second transaction request is continuously sent to the target blockchain network.
[0288] In one embodiment, the acquired transaction request includes at least one second transaction request, and the process of the target blockchain network responding to any second transaction request includes: a node in the target blockchain network parses a transaction from the corresponding second transaction request, and stores the parsed transaction in a block; a result obtained by the target blockchain network responding to any second transaction request includes: a block corresponding to the transaction in the corresponding second transaction request; the processing unit 802 is specifically used to:
[0289] Determine a blockchain constructed based on a result obtained by responding to at least one second transaction request, and select N blocks from the blockchain, where N is a positive integer;
[0290] Get the transaction on-chain rate corresponding to each block in N blocks. The transaction on-chain rate corresponding to any block refers to the number of transactions in the corresponding block added to the blockchain in the target blockchain network per unit time;
[0291] According to the transaction on-chain rate corresponding to each block in the N blocks, the target blockchain network is tested in the performance dimension to obtain the test result of the target blockchain network in the performance dimension.
[0292] In one embodiment, the processing unit 802 is specifically configured to:
[0293] Obtain block indication information, where the block indication information is used to indicate: a starting block and an ending block on the blockchain for performance testing;
[0294] Determine a block detection window according to the block indication information, and select each block located in the block detection window from the blockchain;
[0295] Among them, the first block of the block detection window is the starting block indicated by the block indication information; and when the block height of the termination block indicated by the block indication information is less than or equal to the block height of the latest block on the blockchain, the last block of the block detection window is the termination block; when the block height of the termination block indicated by the block indication information is greater than the block height of the latest block on the blockchain, the last block of the block detection window is the latest block.
[0296] In one embodiment, the processing unit 802 is specifically configured to:
[0297] Traverse each block in N blocks, and use the currently traversed block as the current block;
[0298] The time taken to generate the current block is determined based on the time taken to generate the current block and the time taken to process the consensus on the current block.
[0299] According to the block generation time of the current block and the number of transactions in the current block, the transaction on-chain rate corresponding to the current block is determined.
[0300] In one embodiment, the stress test command is generated according to the stress test parameters; the processing unit 802 is specifically configured to:
[0301] Perform average processing on the transaction on-chain rate corresponding to each block in N blocks, and use the average processing result as the average transaction on-chain rate of the target blockchain network;
[0302] If the average transaction on-chain rate reaches the preset rate threshold, the stress test parameters corresponding to the stress test command are used as the performance parameters of the target blockchain network and added to the detection results of the target blockchain network under the performance dimension;
[0303] If the average transaction on-chain rate does not reach the preset rate threshold, the stress test parameters are adjusted to regenerate the stress test command, and the target blockchain network is tested in the performance dimension based on the regenerated stress test command.
[0304] In one embodiment, if the average transaction on-chain rate reaches a preset threshold, the acquisition unit 801 is used to obtain a resource monitoring result for the target blockchain network, where the resource monitoring result is obtained by monitoring the resource consumption of the target blockchain network during the process of the target blockchain network responding to at least one second transaction request;
[0305] Processing unit 802 is specifically used to: if the resource consumption indicated by the resource monitoring result is less than or equal to the preset resource consumption, trigger the execution of the step of using the stress testing parameters corresponding to the stress testing command as the performance parameters of the target blockchain network, and adding them to the detection results of the target blockchain network under the performance dimension.
[0306] In one embodiment, the processing unit 802 is specifically configured to:
[0307] If the resource consumption indicated by the resource monitoring result is less than or equal to the preset resource consumption, the preset resource consumption is used as the performance parameter of the target blockchain network and added to the detection result of the target blockchain network under the performance dimension;
[0308] If the resource consumption indicated by the resource monitoring result is greater than the preset resource consumption, the stress testing parameters are adjusted to regenerate the stress testing command, and the target blockchain network is tested under the performance dimension according to the regenerated stress testing command.
[0309] In one embodiment, before storing the transaction parsed from the second transaction request into the block, the node of the target blockchain network needs to cache the parsed transaction into the transaction pool of the target blockchain network; the processing unit 802 is specifically used to:
[0310] For the kth second transaction request, the number of cached transactions in the transaction pool of the target blockchain network is detected; k is a positive integer and is less than or equal to the number of second transaction requests;
[0311] If the number of cached transactions reaches the cache capacity supported by the transaction pool, a full load prompt will be output to indicate that the transaction pool has reached a full load state and that stress testing parameters need to be adjusted. Stress testing parameters are parameters used to generate stress testing commands for the target blockchain network.
[0312] If the number of cached transactions does not reach the cache capacity supported by the transaction pool, the kth second transaction request is sent to the target blockchain network through the constructed client.
[0313] In one embodiment, the processing unit 802 is specifically configured to:
[0314] According to the characteristic information of the target blockchain network, a blockchain network with the same characteristic information as the target blockchain network is rebuilt;
[0315] The constructed client sends each acquired transaction request to the reconstructed blockchain network, so that the reconstructed blockchain network responds to each transaction request;
[0316] The result obtained when the target blockchain network responds to each transaction request refers to the result obtained when the reconstructed blockchain network responds to each transaction request.
[0317] In one embodiment, the acquisition unit 801 is specifically configured to:
[0318] Receive detection requests sent by multiple devices, each detection request carries detection information set based on the operation interface in the corresponding device; any detection information includes: feature information of the target blockchain network to be detected, and at least one detection dimension of the target blockchain network;
[0319] If the detection information carried in the detection requests sent by multiple devices contains the same detection dimension, the multiple detection requests are scheduled by the detection scheduler to select a target detection request from the multiple detection requests;
[0320] Parse the target detection request, and determine the parsed detection information as the blockchain detection information set based on the operation interface.
[0321] It is understandable that the functions of each unit of the detection device of the blockchain network described in the embodiment of the present application can be specifically implemented according to the method in the above method embodiment, and its specific implementation process can refer to the relevant description of the above method embodiment, which will not be repeated here. In addition, the description of the beneficial effects of using the same method will not be repeated.
[0322] Next, the computer device provided in the embodiment of the present application is described.
[0323] See also Fig. 9 , Fig. 9 904. It is a schematic diagram of the structure of a computer device (i.e., the above-mentioned server) provided in an embodiment of the present application. The computer device may include an independent device (e.g., one or more of a server, a node, a terminal, etc.), or may include components inside an independent device (e.g., a chip, a software module, or a hardware module, etc.). The computer device may include at least one processor 901 and a communication interface 902. Further optionally, the computer device may also include at least one memory 903 and a bus 904. Among them, the processor 901, the communication interface 902, and the memory 903 are connected via a bus 904.
[0324] Among them, the processor 901 is a module that performs arithmetic operations and / or logical operations, and can specifically be a central processing unit (CPU), a graphics processing unit (GPU), a microprocessor (MPU), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA), a complex programmable logic device (CPLD), a coprocessor (assisting the central processing unit to complete corresponding processing and applications), a microcontroller unit (MCU) and other processing modules, or a combination of multiple of them.
[0325] The communication interface 902 may be used to provide information input or output for at least one processor. And / or, the communication interface 902 may be used to receive data sent externally and / or send data externally, and may be a wired link interface including an Ethernet cable, etc., or a wireless link (Wi-Fi, Bluetooth, general wireless transmission, vehicle-mounted short-range communication technology, and other short-range wireless communication technologies, etc.) interface. The communication interface 902 may be used as a network interface.
[0326] The memory 903 is used to provide a storage space, and the storage space can store data such as an operating system and a computer program. The memory 903 can be a random access memory (RAM), a read-only memory (ROM), an erasable programmable read only memory (EPROM), or a portable read only memory (CD-ROM) or a combination of multiple thereof.
[0327] In one possible implementation, the processor 901 in the computer device is used to call a computer program stored in at least one memory 903 to perform the following operations: obtain blockchain detection information set based on an operation interface, the blockchain detection information including: characteristic information of a target blockchain network to be detected, and at least one detection dimension of the target blockchain network; at least one detection dimension includes one or more of a functional dimension and a performance dimension; according to the characteristic information, respectively obtain transaction requests required for detecting the target blockchain network under each detection dimension; construct a client through a simulation program, and send each acquired transaction request to the target blockchain network through the constructed client, so that the target blockchain network responds to each transaction request; respectively, according to the results obtained by the target blockchain network responding to each transaction request, detect the target blockchain network under the corresponding detection dimension to obtain the detection result of the target blockchain network under the corresponding detection dimension.
[0328] In one embodiment, at least one detection dimension includes a functional dimension, and the characteristic information includes at least one chain tag, where a chain tag is used to describe a characteristic of a target blockchain network; the processor 901 is specifically configured to:
[0329] Filtering out a first chain tag from at least one chain tag included in the characteristic information; the first chain tag refers to: a chain tag used to describe characteristics related to functions of the target blockchain network;
[0330] Determine a test case pool, which contains multiple test cases. One test case is used to detect a function of the blockchain network, and each test case has a test case label. The test case label of any test case is obtained by labeling the corresponding test case according to the function detected by the corresponding test case.
[0331] According to the use case labels of each test case in the use case pool, the test cases matching the first chain labels are screened out from the use case pool;
[0332] Based on the screened test cases, at least one first transaction request is constructed; the first transaction request refers to: a transaction request required to detect the target blockchain network in the functional dimension.
[0333] In one embodiment, any test case includes: request parameters for constructing a first transaction request; a processor 901, specifically configured to:
[0334] Get the mapping relationship between test cases and transaction request types;
[0335] Map the screened test cases according to the mapping relationship to obtain the target transaction request type;
[0336] Under the target transaction request type, at least one first transaction request is constructed using request parameters in the filtered test case.
[0337] In one embodiment, the acquired transaction request includes at least one first transaction request, and any test case includes: an expected response result corresponding to the first transaction request constructed based on the corresponding test case; the processor 901 is specifically configured to:
[0338] For the i-th first transaction request, obtaining an expected response result of the i-th first transaction request from a test case used when constructing the i-th first transaction request; i is a positive integer and is less than or equal to the number of first transaction requests;
[0339] Perform a consistency check on the result obtained by the target blockchain network responding to the i-th first transaction request and the expected response result to obtain a consistency check result;
[0340] According to the consistency check result, anomaly detection is performed on the target function of the target blockchain network in the functional dimension to obtain the detection result of the target function;
[0341] The target function refers to: the function detected by the test case used when constructing the i-th first transaction request; and when the consistency check result indicates that the corresponding two results are inconsistent, the detection result of the target function indicates that there is an abnormality in the target function.
[0342] In one embodiment, at least one detection dimension includes a performance dimension, and the detection of the target blockchain network under the performance dimension includes: a stress test on the target blockchain network; the characteristic information includes at least one chain tag, and a chain tag is used to describe a characteristic of the target blockchain network; the processor 901 is specifically used to:
[0343] Filtering out a second chain tag from at least one chain tag included in the characteristic information; the second chain tag refers to: a chain tag used to describe characteristics related to a smart contract of a target blockchain network;
[0344] Generate stress test data according to the second chain tag, and the stress test data includes the following transactions: calling the operation of the smart contract indicated by the second chain tag;
[0345] Get the stress test command for the target blockchain network. The stress test command is used to describe: the strategy adopted for stress testing the target blockchain network;
[0346] At least one second transaction request carrying stress testing data is generated according to the stress testing command, where the second transaction request refers to a transaction request required to detect the target blockchain network in the performance dimension.
[0347] In one embodiment, the processor 901 is specifically configured to:
[0348] Obtain stress testing parameters for the target blockchain network set based on the operation interface, where the stress testing parameters include at least one of the following: stress testing concurrency number, stress testing duration, and stress testing transaction number; stress testing concurrency number refers to: the number of second transaction requests that need to be sent concurrently each time; stress testing duration refers to: the duration of stress testing on the target blockchain network; stress testing transaction number refers to: the total number of second transaction requests sent to the target blockchain network;
[0349] Based on the stress testing parameters, a stress testing command for the target blockchain network is assembled; wherein, when the stress testing parameters include the stress testing duration, a second transaction request is continuously generated according to the stress testing command, and the second transaction request is continuously sent to the target blockchain network.
[0350] In one embodiment, the acquired transaction request includes at least one second transaction request, and the process in which the target blockchain network responds to any second transaction request includes: a node in the target blockchain network parses a transaction from the corresponding second transaction request, and stores the parsed transaction in a block; a result obtained by the target blockchain network responding to any second transaction request includes: a block corresponding to the transaction in the corresponding second transaction request; the processor 901 is specifically configured to:
[0351] Determine a blockchain constructed based on a result obtained by responding to at least one second transaction request, and select N blocks from the blockchain, where N is a positive integer;
[0352] Get the transaction on-chain rate corresponding to each block in N blocks. The transaction on-chain rate corresponding to any block refers to the number of transactions in the corresponding block added to the blockchain in the target blockchain network per unit time;
[0353] According to the transaction on-chain rate corresponding to each block in the N blocks, the target blockchain network is tested in the performance dimension to obtain the test result of the target blockchain network in the performance dimension.
[0354] In one embodiment, the processor 901 is specifically configured to:
[0355] Obtain block indication information, where the block indication information is used to indicate: a starting block and an ending block on the blockchain for performance testing;
[0356] Determine a block detection window according to the block indication information, and select each block located in the block detection window from the blockchain;
[0357] Among them, the first block of the block detection window is the starting block indicated by the block indication information; and when the block height of the termination block indicated by the block indication information is less than or equal to the block height of the latest block on the blockchain, the last block of the block detection window is the termination block; when the block height of the termination block indicated by the block indication information is greater than the block height of the latest block on the blockchain, the last block of the block detection window is the latest block.
[0358] In one embodiment, the processor 901 is specifically configured to:
[0359] Traverse each block in N blocks, and use the currently traversed block as the current block;
[0360] The time taken to generate the current block is determined based on the time taken to generate the current block and the time taken to process the consensus on the current block.
[0361] According to the block generation time of the current block and the number of transactions in the current block, the transaction on-chain rate corresponding to the current block is determined.
[0362] In one embodiment, the stress test command is generated according to the stress test parameters; the processor 901 is specifically configured to:
[0363] Perform average processing on the transaction on-chain rate corresponding to each block in N blocks, and use the average processing result as the average transaction on-chain rate of the target blockchain network;
[0364] If the average transaction on-chain rate reaches the preset rate threshold, the stress test parameters corresponding to the stress test command are used as the performance parameters of the target blockchain network and added to the detection results of the target blockchain network under the performance dimension;
[0365] If the average transaction on-chain rate does not reach the preset rate threshold, the stress test parameters are adjusted to regenerate the stress test command, and the target blockchain network is tested in the performance dimension based on the regenerated stress test command.
[0366] In one embodiment, if the average transaction on-chain rate reaches a preset threshold, the processor 901 is used to obtain a resource monitoring result for the target blockchain network, where the resource monitoring result is obtained by monitoring the resource consumption of the target blockchain network during the process of the target blockchain network responding to at least one second transaction request;
[0367] Processor 901 is specifically used to: if the resource consumption indicated by the resource monitoring result is less than or equal to the preset resource consumption, trigger the execution of the step of using the stress testing parameters corresponding to the stress testing command as the performance parameters of the target blockchain network, and adding them to the detection results of the target blockchain network under the performance dimension.
[0368] In one embodiment, the processor 901 is specifically configured to:
[0369] If the resource consumption indicated by the resource monitoring result is less than or equal to the preset resource consumption, the preset resource consumption is used as the performance parameter of the target blockchain network and added to the detection result of the target blockchain network under the performance dimension;
[0370] If the resource consumption indicated by the resource monitoring result is greater than the preset resource consumption, the stress testing parameters are adjusted to regenerate the stress testing command, and the target blockchain network is tested under the performance dimension according to the regenerated stress testing command.
[0371] In one embodiment, before storing the transaction parsed from the second transaction request into the block, the node of the target blockchain network needs to cache the parsed transaction into the transaction pool of the target blockchain network; the processor 901 is specifically used to:
[0372] For the kth second transaction request, the number of cached transactions in the transaction pool of the target blockchain network is detected; k is a positive integer and is less than or equal to the number of second transaction requests;
[0373] If the number of cached transactions reaches the cache capacity supported by the transaction pool, a full load prompt will be output to indicate that the transaction pool has reached a full load state and that stress testing parameters need to be adjusted. Stress testing parameters are parameters used to generate stress testing commands for the target blockchain network.
[0374] If the number of cached transactions does not reach the cache capacity supported by the transaction pool, the kth second transaction request is sent to the target blockchain network through the constructed client.
[0375] In one embodiment, the processor 901 is specifically configured to:
[0376] According to the characteristic information of the target blockchain network, a blockchain network with the same characteristic information as the target blockchain network is rebuilt;
[0377] The constructed client sends each acquired transaction request to the reconstructed blockchain network, so that the reconstructed blockchain network responds to each transaction request;
[0378] The result obtained when the target blockchain network responds to each transaction request refers to the result obtained when the reconstructed blockchain network responds to each transaction request.
[0379] In one embodiment, the processor 901 is specifically configured to:
[0380] Receive detection requests sent by multiple devices, each detection request carries detection information set based on the operation interface in the corresponding device; any detection information includes: feature information of the target blockchain network to be detected, and at least one detection dimension of the target blockchain network;
[0381] If the detection information carried by the detection requests sent by multiple devices contains the same detection dimension, the multiple detection requests are scheduled by the detection scheduler to select a target detection request from the multiple detection requests;
[0382] Parse the target detection request, and determine the parsed detection information as the blockchain detection information set based on the operation interface.
[0383] It should be understood that the computer device described in the embodiments of the present application can execute the description of the detection method of the blockchain network in the corresponding embodiment above, and can also execute the above Figure 2 , Figure 4 as well as Figure 6 The description of the detection device of the blockchain network in the corresponding embodiment will not be repeated here. In addition, the description of the beneficial effects of using the same method will not be repeated here.
[0384] In addition, it should be noted that an exemplary embodiment of the present application also provides a computer-readable storage medium, in which a computer program of the aforementioned blockchain network detection method is stored. When the computer program is executed by a processor, the description of the blockchain network detection method in the embodiment of the present application is executed. That is, when one or more processors load and execute the computer program, the description of the blockchain network detection method in the embodiment can be implemented, which will not be repeated here, and the description of the beneficial effects of using the same method will not be repeated here.
[0385] The computer-readable storage medium may be a detection device of the blockchain network provided in any of the aforementioned embodiments or an internal storage unit of the computer device, such as a hard disk or memory of the computer device. The computer-readable storage medium may also be an external storage device of the computer device, such as a plug-in hard disk, a smart memory card (smart media card, SMC), a secure digital (secure digital, SD) card, a flash card (flashcard), etc. equipped on the computer device. Furthermore, the computer-readable storage medium may also include both an internal storage unit of the computer device and an external storage device. The computer-readable storage medium is used to store the computer program and other programs and data required by the computer device. The computer-readable storage medium may also be used to temporarily store data that has been output or is to be output.
[0386] In one aspect of the present application, a computer program product or a computer program is provided, wherein a processor of a computer device reads the computer program from a computer-readable storage medium, and the processor executes the computer program, so that the computer device performs a method for detecting a blockchain network provided in one aspect of an embodiment of the present application.
[0387] In one aspect of the present application, another computer program product or computer program is provided, which includes a computer program, which, when executed by a processor, implements the steps of the blockchain network detection method provided in an embodiment of the present application.
[0388] The steps in the method of the embodiment of the present application can be adjusted in order, combined and deleted according to actual needs.
[0389] The units in the device of the embodiment of the present application can be merged, divided and deleted according to actual needs.
[0390] The above disclosure is only part of the embodiments of the present application, which certainly cannot be used to limit the scope of rights of the present application. Therefore, equivalent changes made in the claims of the present application still fall within the scope covered by the present application.
Claims
1. A method for detecting a blockchain network. It is characterized in that include: Obtaining blockchain detection information set based on the operation interface, the blockchain detection information including: feature information of a target blockchain network to be detected, and at least one detection dimension of the target blockchain network; the at least one detection dimension including one or more of a functional dimension and a performance dimension; According to the characteristic information, respectively obtain transaction requests required for detecting the target blockchain network in each detection dimension; Constructing a client through a simulation program, and sending each acquired transaction request to the target blockchain network through the constructed client, so that the target blockchain network responds to each transaction request; According to the results obtained by the target blockchain network responding to each transaction request, the target blockchain network is detected under the corresponding detection dimension to obtain the detection result of the target blockchain network under the corresponding detection dimension.
2. The method according to claim 1, It is characterized in that The at least one detection dimension includes a functional dimension, and the characteristic information includes at least one chain tag, where a chain tag is used to describe a characteristic of the target blockchain network; The acquiring, according to the characteristic information, transaction requests required for detecting the target blockchain network in each detection dimension respectively includes: Filtering out a first chain tag from at least one chain tag included in the characteristic information; the first chain tag refers to: a chain tag used to describe characteristics related to the function of the target blockchain network; Determine a use case pool, wherein the use case pool includes multiple test cases, one test case is used to detect a function of the blockchain network, and each test case has a use case label; the use case label of any test case is obtained by labeling the corresponding test case according to the function detected by the corresponding test case; According to the use case label of each test case in the use case pool, filter out the test case matching the first chain label from the use case pool; Based on the screened test cases, at least one first transaction request is constructed; the first transaction request refers to: a transaction request required to detect the target blockchain network in the functional dimension.
3. The method according to claim 2, It is characterized in that Any test case includes: request parameters for constructing a first transaction request; said constructing at least one first transaction request based on the screened test case includes: Get the mapping relationship between test cases and transaction request types; Mapping the screened test cases according to the mapping relationship to obtain a target transaction request type; Under the target transaction request type, at least one first transaction request is constructed using the request parameters in the screened test case.
4. The method according to claim 2 or 3, It is characterized in that The acquired transaction request includes at least one first transaction request, and any test case includes: an expected response result corresponding to the first transaction request constructed based on the corresponding test case; According to the result obtained by the target blockchain network responding to each transaction request, the target blockchain network is detected under the corresponding detection dimension to obtain the detection result of the target blockchain network under the corresponding detection dimension, including: For the i-th first transaction request, obtaining an expected response result of the i-th first transaction request from a test case used when constructing the i-th first transaction request; i is a positive integer and is less than or equal to the number of first transaction requests; Performing a consistency check between a result obtained by the target blockchain network responding to the i-th first transaction request and the expected response result to obtain a consistency check result; According to the consistency check result, anomaly detection is performed on the target function of the target blockchain network in the functional dimension to obtain a detection result of the target function; Among them, the target function refers to: the function detected by the test case used when constructing the i-th first transaction request; and when the consistency check result indicates that the corresponding two results are inconsistent, the detection result of the target function indicates that there is an abnormality in the target function.
5. The method according to claim 1, It is characterized in that The at least one detection dimension includes a performance dimension, and the detection of the target blockchain network under the performance dimension includes: a stress test on the target blockchain network; the characteristic information includes at least one chain tag, and a chain tag is used to describe a characteristic of the target blockchain network; The acquiring, according to the characteristic information, transaction requests required for detecting the target blockchain network in each detection dimension respectively includes: Filtering out a second chain tag from at least one chain tag included in the characteristic information; the second chain tag refers to: a chain tag used to describe characteristics related to the smart contract of the target blockchain network; Generate stress test data according to the second chain tag, the stress test data including the following transactions: call the operation of the smart contract indicated by the second chain tag; Obtain a stress test command for the target blockchain network, where the stress test command is used to describe: a strategy adopted for stress testing the target blockchain network; At least one second transaction request carrying the stress testing data is generated according to the stress testing command, where the second transaction request refers to a transaction request required to detect the target blockchain network under the performance dimension.
6. The method according to claim 5, It is characterized in that The obtaining of the stress test command for the target blockchain network includes: Obtain stress testing parameters for the target blockchain network set based on the operation interface, wherein the stress testing parameters include at least one of the following: stress testing concurrency number, stress testing duration, and stress testing transaction number; the stress testing concurrency number refers to: the number of second transaction requests that need to be sent concurrently each time; the stress testing duration refers to: the duration of stress testing the target blockchain network; the stress testing transaction number refers to: the total number of second transaction requests sent to the target blockchain network; Based on the stress testing parameters, a stress testing command for the target blockchain network is assembled; wherein, when the stress testing parameters include the stress testing duration, a second transaction request is continuously generated according to the stress testing command, and the second transaction request is continuously sent to the target blockchain network.
7. The method according to claim 5 or 6, It is characterized in that The acquired transaction request includes at least one second transaction request, and the process of the target blockchain network responding to any second transaction request includes: a node in the target blockchain network parses a transaction from the corresponding second transaction request, and stores the parsed transaction in a block; a result obtained by the target blockchain network responding to any second transaction request includes: a block corresponding to the transaction in the corresponding second transaction request; According to the result obtained by the target blockchain network responding to each transaction request, the target blockchain network is detected under the corresponding detection dimension to obtain the detection result of the target blockchain network under the corresponding detection dimension, including: Determine a blockchain constructed based on a result obtained by responding to the at least one second transaction request, and select N blocks from the blockchain, where N is a positive integer; Obtaining a transaction on-chain rate corresponding to each of the N blocks, wherein the transaction on-chain rate corresponding to any block refers to: the number of transactions in the corresponding block added to the blockchain in the target blockchain network within a unit time; According to the transaction on-chain rate corresponding to each block in the N blocks, the target blockchain network is detected under the performance dimension to obtain the detection result of the target blockchain network under the performance dimension.
8. The method according to claim 7, It is characterized in that The selecting N blocks from the blockchain includes: Obtaining block indication information, where the block indication information is used to indicate: a starting block and an ending block for performance testing on the blockchain; Determine a block detection window according to the block indication information, and select each block located in the block detection window from the blockchain; Among them, the first block of the block detection window is the starting block indicated by the block indication information; and when the block height of the end block indicated by the block indication information is less than or equal to the block height of the latest block on the blockchain, the last block of the block detection window is the end block; when the block height of the end block indicated by the block indication information is greater than the block height of the latest block on the blockchain, the last block of the block detection window is the latest block.
9. The method according to claim 7, It is characterized in that The obtaining the transaction on-chain rate corresponding to each block in the N blocks includes: Traversing each block in the N blocks, and taking the currently traversed block as the current block; Determine the block generation time of the current block according to the time consumed to generate the current block and the time consumed to process the current block on the consensus chain; The transaction on-chain rate corresponding to the current block is determined according to the block generation time of the current block and the number of transactions in the current block.
10. The method according to claim 7, It is characterized in that The stress test command is generated according to the stress test parameters; the target blockchain network is tested under the performance dimension according to the transaction on-chain rate corresponding to each block in the N blocks, and the test result of the target blockchain network under the performance dimension is obtained, including: Performing average processing on the transaction on-chain rate corresponding to each block in the N blocks, and using the average processing result as the average transaction on-chain rate of the target blockchain network; If the average transaction on-chain rate reaches the preset rate threshold, the stress test parameter corresponding to the stress test command is used as the performance parameter of the target blockchain network and added to the detection result of the target blockchain network under the performance dimension; If the average transaction on-chain rate does not reach the preset rate threshold, the stress testing parameters are adjusted to regenerate the stress testing command, and the target blockchain network is tested under the performance dimension according to the regenerated stress testing command.
11. The method according to claim 10, It is characterized in that If the average transaction on-chain rate reaches a preset threshold, the method further includes: Obtaining a resource monitoring result for the target blockchain network, wherein the resource monitoring result is obtained by monitoring the resource consumption of the target blockchain network during a process in which the target blockchain network responds to the at least one second transaction request; If the resource consumption indicated by the resource monitoring result is less than or equal to the preset resource consumption, the step of using the stress testing parameters corresponding to the stress testing command as the performance parameters of the target blockchain network and adding them to the detection results of the target blockchain network under the performance dimension is triggered.
12. The method according to claim 11, It is characterized in that The method further comprises: If the resource consumption indicated by the resource monitoring result is less than or equal to the preset resource consumption, the preset resource consumption is used as the performance parameter of the target blockchain network and added to the detection result of the target blockchain network under the performance dimension; If the resource consumption indicated by the resource monitoring result is greater than the preset resource consumption, the stress testing parameters are adjusted to regenerate the stress testing command, and the target blockchain network is detected under the performance dimension according to the regenerated stress testing command.
13. The method according to claim 7, It is characterized in that Before storing the transaction parsed from the second transaction request into a block, the node of the target blockchain network needs to first cache the parsed transaction into a transaction pool of the target blockchain network; The constructed client sends each acquired transaction request to the target blockchain network, including: For the kth second transaction request, detecting the number of transactions cached in the transaction pool of the target blockchain network; k is a positive integer and is less than or equal to the number of second transaction requests; If the number of cached transactions reaches the cache capacity supported by the transaction pool, a full load prompt is output to prompt that the transaction pool has reached a full load state and that stress testing parameters need to be adjusted. Stress testing parameters are parameters used to generate stress testing commands for the target blockchain network; If the number of cached transactions does not reach the cache capacity supported by the transaction pool, the kth second transaction request is sent to the target blockchain network through the constructed client.
14. The method of claim 1, It is characterized in that The constructed client sends each acquired transaction request to the target blockchain network, so that the target blockchain network responds to each transaction request, including: According to the characteristic information of the target blockchain network, a blockchain network having the same characteristic information as the target blockchain network is reconstructed; Sending each acquired transaction request to the reconstructed blockchain network through the constructed client, so that the reconstructed blockchain network responds to each transaction request; The result obtained when the target blockchain network responds to each transaction request refers to the result obtained when the reconstructed blockchain network responds to each transaction request.
15. The method of claim 1, It is characterized in that The obtaining of blockchain detection information set based on the operation interface includes: Receive detection requests sent by multiple devices, each detection request carrying detection information set based on an operation interface in a corresponding device; any detection information includes: feature information of a target blockchain network to be detected, and at least one detection dimension of the target blockchain network; If the detection information carried by the detection requests sent by the multiple devices includes the same detection dimension, scheduling the multiple detection requests through the detection scheduler to select a target detection request from the multiple detection requests; Parse the target detection request, and determine the detection information obtained by the analysis as the blockchain detection information set based on the operation interface.
16. A detection device for a blockchain network, It is characterized in that include: An acquisition unit, configured to acquire blockchain detection information set based on an operation interface, wherein the blockchain detection information includes: feature information of a target blockchain network to be detected, and at least one detection dimension of the target blockchain network; the at least one detection dimension includes one or more of a functional dimension and a performance dimension; A processing unit, configured to obtain, according to the feature information, transaction requests required for detecting the target blockchain network in each detection dimension; The processing unit is further configured to construct a client through a simulation program, and send each acquired transaction request to the target blockchain network through the constructed client, so that the target blockchain network responds to each transaction request; The processing unit is also used to detect the target blockchain network under the corresponding detection dimension according to the results obtained by the target blockchain network responding to each transaction request, so as to obtain the detection result of the target blockchain network under the corresponding detection dimension.
17. A computer device, It is characterized in that include: a processor suitable for executing a computer program; A computer-readable storage medium, wherein a computer program is stored in the computer-readable storage medium, and when the computer program is executed by the processor, the method for detecting a blockchain network as described in any one of claims 1 to 15 is executed.
18. A computer-readable storage medium, It is characterized in that The computer storage medium stores a computer program, and when the computer program is executed by the processor, the blockchain network detection method as described in any one of claims 1 to 15 is executed.
19. A computer program product, It is characterized in that The computer program product includes a computer program or computer instructions, and the computer program or computer instructions are executed by a processor to implement the detection method of the blockchain network as described in any one of claims 1 to 15.
Citation Information
Patent Citations
Blockchain monitoring system
CN112787890A
Block chain system testing method and system, computer equipment and storage medium
CN114817038A
Block chain test method and system
CN115292174A
Block chain network pressure test method and related equipment
CN115987858A
Cross-blockchain communication method and apparatus, cross-chain service system and cross-chain transaction system
WO2021136251A1
