Detailed Description
Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, like numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with one or more embodiments of the present specification. Rather, they are merely examples of apparatus and methods consistent with certain aspects of one or more embodiments of the specification, as detailed in the claims which follow.
It should be noted that: in other embodiments, the steps of the corresponding methods are not necessarily performed in the order shown and described herein. In some other embodiments, the method may include more or fewer steps than those described herein. Moreover, a single step described in this specification may be broken down into multiple steps for description in other embodiments; multiple steps described in this specification may be combined into a single step in other embodiments.
Fig. 1 is a schematic diagram of a network architecture provided by an exemplary embodiment. As shown in fig. 1, after the service end 11 generates a processing request, the processing request is sent to the blockchain gateway 12, the blockchain gateway 12 creates a blockchain transaction for the processing request, and submits the blockchain transaction to the blockchain network 13, so that the blockchain node on the blockchain network 13 executes the blockchain transaction. When there is a requirement for a pressure test (referred to as "pressure test") for the blockchain network 13, the service end 11 may generate processing requests (including data for the pressure test) of a pressure test request type, and the blockchain gateway 12 may create corresponding blockchain transactions for the pressure test requests, and execute the blockchain transactions by the blockchain network 13 to perform the pressure test on the blockchain network 13; and the blockchain gateway 12 feeds back a transaction receipt generated by the blockchain network 13 executing the blockchain transaction to the service end 11, so that the service end 11 analyzes the transaction receipt and then determines a pressure measurement result of the blockchain network 13. In the production environment, the interaction process between the service end 11, the blockchain gateway 12 and the blockchain network 13 is similar to the pressure measurement process described above: the service terminal 11 generates processing requests of service request types, the blockchain gateway 12 creates corresponding blockchain transactions for the service requests, and the blockchain transactions are executed by the blockchain network 13; and the blockchain gateway 12 feeds back a transaction receipt generated by the blockchain network 13 executing the blockchain transaction to the service end 11.
Under the full link pressure test scene, the pressure test in the production environment is involved. In order to avoid the mutual interference between the pressure measurement request and the service request, the service end 11 may add a pressure measurement tag in the service request to distinguish the service request; of course, a service tag may be added to the service request to distinguish it from the pressure measurement request. However, when creating a blockchain transaction, the blockchain gateway 12 needs to comply with the relevant regulations such as the existing transaction format, and therefore cannot distinguish blockchain transactions corresponding to different processing requests, that is, cannot bring the above feature tags such as the pressure measurement tag or the service tag into the blockchain network 13, so that the transaction receipt generated by the blockchain network 13 also cannot carry the above feature tags, so that the service end 11 cannot effectively distinguish the source of the transaction receipt, and cannot accurately obtain the pressure measurement result of the blockchain network 13.
The pressure testing protocol of the present specification is described below with reference to examples.
The pressure test system of the block chain network in the specification comprises a service end, a service block chain network and a pressure test block chain network. The service end initiates block chain transaction to the service block chain network in a production state; a service blockchain node in the service blockchain network forwards the pressure measurement transaction to a pressure measurement blockchain network equivalent to the service blockchain network under the condition that the blockchain transaction is the pressure measurement transaction, and executes the service transaction under the condition that the blockchain transaction is the service transaction; and the pressure measurement blockchain nodes in the pressure measurement blockchain network execute the pressure measurement transaction forwarded by the service blockchain link nodes.
The operations performed by the parties in the pressure testing system of the blockchain network are described in detail below.
Referring to fig. 2, fig. 2 is a flowchart illustrating a method for testing a stress of a blockchain network according to an exemplary embodiment. As shown in fig. 2, the method applied to a service blockchain node in a service blockchain network in a production state may include the following steps:
Step 202, identifying a transaction type of a blockchain transaction initiated by a service terminal.
In this embodiment, the blockchain client is configured to create a blockchain transaction and submit the created blockchain transaction to the business blockchain network. Thus, the service end may initiate a blockchain transaction to the service blockchain network through the blockchain client.
In one case, the blockchain client may be deployed on the service end, and the service end directly interacts with the service blockchain network through the blockchain client, and creates a corresponding blockchain transaction to be submitted to the service blockchain network to meet actual requirements. When a pressure test requirement exists for the service blockchain network, the service end can create a pressure test type blockchain transaction (namely, the pressure test transaction, which contains data used for pressure test) through the blockchain client, and when the service requirement exists for the service blockchain network, the service end can create a service type blockchain transaction (namely, the service transaction, which contains data used for realizing service) through the blockchain client.
As an exemplary embodiment, the pressure test transaction and the business transaction can be distinguished by adding a type identifier in the blockchain transaction. For example, a first type of identifier may be added to a pressure measurement transaction and a second type of identifier may be added to a business transaction. Then, after receiving the blockchain transaction submitted by the service end, the service blockchain node in the service blockchain network may read the type identifier included in the received blockchain transaction. And under the condition that the type identifier is a first type identifier, judging the received blockchain transaction as a pressure measurement transaction, and under the condition that the type identifier is a second type identifier, judging the received blockchain transaction as a service transaction.
Accordingly, when the first transaction receipt is generated by executing the pressure test transaction, a first type identifier may be added to the first transaction receipt to indicate that the first transaction receipt corresponds to the pressure test transaction. Similarly, when executing the business transaction to generate a second transaction receipt, a second type identifier may be added to the second transaction receipt to indicate that the second transaction receipt corresponds to the business transaction. That is, the first transaction reply segment corresponding to the pressure measurement transaction contains the first type identifier, and the second transaction reply segment corresponding to the business transaction contains the second type identifier. Then, after the service end acquires the returned transaction receipt, the type of the transaction receipt can be identified according to the type identifier in the transaction receipt, and then the first transaction receipt is stored in the pressure measurement database, and the second transaction receipt is stored in the service database, so that subsequent analysis is facilitated. Therefore, by improving the mode of establishing the block chain transaction, the characteristic tags such as the pressure measurement tag and the service tag can be brought into the block chain network, so that the transmission of the pressure measurement attribute in the block chain network is realized.
As to the manner of adding the type identifier, in one case, a type field (or any other field) may be added in the blockchain transaction to mark the blockchain transaction as a business transaction or a pressure measurement transaction. For example, when the value of any blockchain transaction type field is a first value, it indicates that the blockchain transaction belongs to a business transaction, and when the value of any blockchain transaction type field is a second value (different from the first value), it indicates that the blockchain transaction belongs to a pressure measurement transaction. Correspondingly, a type field can be added in the transaction receipt for marking whether the transaction receipt is generated by executing the business transaction or the pressure measurement transaction, so that the business terminal can identify the type of the transaction receipt according to the mode of identifying the value of the type field after acquiring the transaction receipt, and then perform differentiation processing. In another case, existing fields in blockchain transactions and transaction receipts may also be multiplexed, with type identifications added to the existing fields. For example, the "reserved field" in the blockchain transaction is multiplexed to indicate the transaction type of the blockchain transaction; for example, a traffic label may be added in the "reserved field" so that a blockchain node on the blockchain network may identify blockchain transactions that contain a traffic label as traffic transactions and blockchain transactions that do not contain a traffic label as pressure-measured transactions. Alternatively, a pressure tag may be added in the "reserved field" so that the blockchain node may identify a blockchain transaction including the pressure tag as a pressure transaction and identify a blockchain transaction not including the pressure tag as a service transaction. Or, a service tag and a pressure tag can be added in the reserved field at the same time, so that the blockchain node can identify the blockchain transaction containing the service tag as the service transaction and identify the blockchain transaction containing the pressure tag as the pressure transaction. It should be noted that the manner for adding the type identifier in the transaction response is similar to that described above, and is not described herein again.
In another case, the blockchain client is deployed on a service blockchain node in a service blockchain network. For example, two sets of logic codes are deployed on node devices in a service block chain network. The first set of logic codes corresponds to a blockchain client, and the node device enables a service end under the chain to perform data interaction with a service blockchain network through the blockchain client by running the first set of logic codes. The second set of logical codes corresponds to a service blockchain network (i.e., a chain code of the service blockchain network), and the node device operates the second set of logical codes as a service blockchain node in the service blockchain network.
For example, the service end may send a processing request to a node device in the service blockchain network to implement interaction with the service blockchain network. The processing request may include a pressure test request for invoking a pressure test blockchain network to perform a pressure test, a service request for invoking a service blockchain network to perform a production service, and the like. And after receiving a processing request of a service end, the node equipment identifies the request type of the processing request through the blockchain client, further creates blockchain transaction corresponding to the request type and submits the blockchain transaction to a service blockchain network. Meanwhile, the node device is used as a service blockchain node in the service blockchain network, obtains blockchain transactions submitted by blockchain clients, and identifies transaction types of the blockchain transactions.
The processing request of the service end can include a type identifier, and the block chain client can identify the request type of the processing request according to the type identifier. Further, when creating a blockchain transaction corresponding to the processing request, the blockchain client may also add a type identifier to the blockchain transaction for marking the transaction type of the blockchain transaction. Therefore, the transaction type of the blockchain transaction can be determined according to the type identifier included in the acquired blockchain transaction. Taking the example that the processing request is divided into the pressure measurement request and the service request, the pressure measurement request includes the first type identifier, and the service request includes the second type identifier, then, after recognizing that the received processing request is the pressure measurement request according to the first type identifier, the block chain client can create the pressure measurement transaction corresponding to the first type identifier, and add the first type identifier in the pressure measurement transaction. Similarly, after recognizing that the received processing request is a service request according to the second type identifier, the blockchain client may create a service transaction corresponding to the received processing request, and add the second type identifier to the service transaction.
And 204, forwarding the pressure measurement transaction to a pressure measurement blockchain network which is equivalent to the service blockchain network under the condition that the blockchain transaction is the pressure measurement transaction.
In this embodiment, in order to avoid mutual interference between the pressure test and the production service, a pressure measurement blockchain network for responding to the pressure measurement transaction and a service blockchain network for responding to the service transaction may be respectively deployed. The pressure measurement block chain network is a block chain network which is equivalent to the service block chain network.
Furthermore, a block chain link point in the service block chain network is matched with the service end and the block chain network, so that data interaction between the service end and the service block chain network and between the service end and the pressure measurement block chain network is realized. Specifically, when the received blockchain transaction is a pressure measurement transaction, a service blockchain node in the service blockchain network in the production state forwards the pressure measurement transaction to the pressure measurement blockchain network, so that the pressure measurement blockchain node in the pressure measurement blockchain network responds to the pressure measurement transaction. And when the received blockchain transaction is a service transaction, the service blockchain node directly executes the service transaction to realize a corresponding service. It can be seen that in the pressure measurement scheme in this specification, a service-side initiated blockchain transaction is directly obtained by a service blockchain link node in a service blockchain network and a transaction type of the blockchain transaction is identified. Those skilled in the art will understand that: under the condition that the service end needs to perform data interaction with the service blockchain network (namely, the service end needs to call the service blockchain network to realize production service), if a blockchain gateway independent of the service end and the blockchain network (including the service blockchain network and the pressure-measuring blockchain network) receives blockchain transactions created by the service end and identifies the transaction types to distribute the blockchain transactions to the corresponding blockchain network, or the blockchain gateway creates a corresponding blockchain transaction in response to a processing request sent by the service terminal, and then the created blockchain transaction is distributed to the corresponding blockchain network, one more hop is provided between the service end and the service blockchain network, and a certain delay is caused by the distribution of the blockchain gateway, so that the service blockchain network cannot acquire the service transaction in time to respond, thereby reducing the efficiency of service implementation.
In the pressure measurement scheme in this specification, the blockchain gateway for performing data interaction with the service end and the blockchain network is eliminated, and the service blockchain node in the service blockchain network is used to perform the distribution operation instead. Under the condition that the service end needs to perform data interaction with the service block chain network, one hop is omitted between the service end and a service block chain node in the service block chain network, and the service transaction initiated by the service end can be directly acquired, so that the delay can be reduced, the speed of responding to the service transaction is improved, and the efficiency of realizing the service is further improved. Meanwhile, the service end may initiate a pressure measurement transaction within a specified time period, for example, the specified time period may be a time period in which a service peak is avoided, for example, a time period in which service data traffic is in a low valley at night. Even if the operation of distributing blockchain transactions is performed by a service blockchain node in the service blockchain network, no processing burden is imposed on the service blockchain network.
And step 206, executing the business transaction under the condition that the blockchain transaction is a business transaction.
For ease of understanding, in the following description, referring to fig. 3, a scheme in which the blockchain client is deployed on the service side (i.e., the blockchain transaction is created by the service side) is described as an example, and the blockchain client is deployed on a service blockchain link point similarly.
As shown in fig. 3, a peer-to-peer pressure measurement blockchain network 33 may be deployed for the service blockchain network 32 in production state, such that the service blockchain network 33 is used to implement production services and the pressure measurement blockchain network 33 is used to implement pressure tests. The pressure measurement blockchain network 33 is completely equivalent to the service blockchain network 32, and has the same network structure and network configuration (including hardware and software configuration), so that the pressure test performed on the pressure measurement blockchain network 33 can reflect the real condition of the service blockchain network 32. For example, the machine resources, network resources, computing resources, and storage resources of the tonality chain network 33 are the same as those of the service blockchain network 32. Meanwhile, since the pressure measurement blockchain network 33 is completely equivalent to the service blockchain network 32, the existing blockchain network does not need to be modified when the pressure measurement blockchain network 33 is configured, for example, the pressure measurement blockchain network 33 is directly deployed in a manner of deploying the service blockchain network 32, which is simpler in technical implementation and avoids the problem of increasing deployment cost due to more complex technical implementation.
When there is a pressure test requirement for the service blockchain network 32, the service end 31 may create a pressure test transaction, where the pressure test transaction includes a first type identifier (for example, a pressure test tag) and data for performing a pressure test. When there is a service requirement for the service blockchain network 32, the service end 31 may create a service transaction, which includes the second type identifier (such as a service tag) and data for implementing the production service. The service end 31 may then submit the created blockchain transaction to the service blockchain network 32. In fact, no matter whether the service end 31 creates a service transaction or a pressure measurement transaction, the service end 31 directly interacts with the service blockchain network 32, that is, the service end 31 only senses the service blockchain network 32, and does not need to sense the pressure measurement blockchain network 33. For example, the service end 31 may sense the IP address of the service blockchain node in the service blockchain network 32 to communicate with the service end, without sensing the IP address of the pressure blockchain node in the pressure blockchain network.
After receiving the blockchain transaction, the service blockchain node in the service blockchain network 32 needs to read the type identifier included in the blockchain transaction to identify the transaction type thereof, so as to perform differentiated processing on blockchain transactions of different transaction types. When the received blockchain transaction is a service transaction, the service blockchain node in the service blockchain network 32 performs operations such as consensus, execution, uplink and the like on the service transaction, and generates a corresponding transaction receipt. For example, the service end 31 may send the created blockchain transaction to a certain service blockchain node 32n in the service blockchain network 32, and the service blockchain node 32n needs to identify the transaction type of the received blockchain transaction to determine whether the blockchain transaction is a service transaction or a pressure measurement transaction. When it is determined that the blockchain transaction is a service transaction, the blockchain link point 32n may further transmit the service transaction to other blockchain nodes in the service blockchain network 32, so that all service blockchain link points in the service blockchain network 32 may perform operations of consensus, execution, uplink and the like on the service transaction, and generate a corresponding transaction receipt (including the second type identifier, i.e., the service label).
When the service block chain link point in the service block chain network 32 recognizes that the received block chain transaction is a pressure measurement transaction, the service block chain node in the service block chain network 32 forwards the pressure measurement transaction to the pressure measurement block chain network 33, so that the pressure measurement block chain node in the pressure measurement block chain network 33 performs operations such as common identification, execution, chain winding and the like on the pressure measurement transaction, and generates a corresponding transaction receipt (including the first type identifier, i.e., the pressure measurement label).
For real data generated by the physical world, the real data can be constructed into a standard transaction (transaction) format supported by a blockchain network, then the real data is issued to the blockchain network, node equipment in the blockchain network performs consensus processing on the received transaction, after the consensus is achieved, the node equipment serving as an accounting node in the blockchain network (namely, blockchain link points) packages the transaction into a block, and persistent evidence storage is performed in the blockchain network. Specifically, the service blockchain network 32 performs consensus processing on the received service transaction by all service blockchain link points in the service blockchain network 32, so as to perform the service transaction after the consensus is passed and package the service transaction into blocks. Similarly, the network 33 performs consensus on the received pressure measurement transaction by all the nodes in the network 33, so as to execute the pressure measurement transaction and pack the transaction into blocks after the consensus is passed.
The consensus algorithm supported in the blockchain network may include:
The first kind of consensus algorithm, namely the consensus algorithm that the node device needs to contend for the accounting right of each round of accounting period; consensus algorithms such as Proof of Work (POW), Proof of equity (POS), Proof of commission rights (DPOS), etc.;
The second kind of consensus algorithm, namely the consensus algorithm which elects accounting nodes in advance for each accounting period (without competing for accounting right); for example, a consensus algorithm such as a Practical Byzantine Fault Tolerance (PBFT) is used.
In a blockchain network employing a first type of consensus algorithm, node devices competing for billing rights can execute a transaction upon receipt. One of the node devices competing for the accounting right may win in the process of competing for the accounting right in the current round, and become an accounting node. The accounting node may package the received transaction with other transactions to generate a latest block and send the generated latest block or a block header of the latest block to other node devices for consensus.
In the block chain network adopting the second type of consensus algorithm, the node equipment with the accounting right is agreed before accounting in the current round. Thus, the node device, after receiving the transaction, may send the transaction to the accounting node if it is not the accounting node of its own round. For the accounting node of the current round, the transaction may be performed during or before packaging the transaction with other transactions to generate the latest block. After generating the latest block, the accounting node may send the latest block or a block header of the latest block to other node devices for consensus.
As described above, regardless of which consensus algorithm is used by the blockchain network, the accounting node of the current round may package the received transaction to generate the latest block and send the generated latest block or the block header of the latest block to other node devices for consensus verification. If no problem is verified after other node equipment receives the latest block or the block header of the latest block, the latest block can be added to the tail of the original blockchain network, so that the accounting process of the blockchain network is completed. The transaction contained in the block may also be performed during the verification of a new block or block header from the accounting node by other nodes.
The manner in which the service blockchain node in the service blockchain network 32 forwards the pressure measurement transaction to the pressure measurement blockchain network 33 is different according to the manner in which the service blockchain node and the pressure measurement blockchain node are configured.
On the one hand, there are two situations for the way of forwarding the pressure measurement traffic to the pressure measurement blockchain network. In one case, since the voltage measuring blockchain network 33 is a blockchain network equivalent to the service blockchain network 32, the number of voltage measuring blockchain nodes in the voltage measuring blockchain network 33 is the same as the number of service blockchain nodes in the service blockchain network 32, that is, the voltage measuring blockchain nodes and the service blockchain nodes are in a one-to-one correspondence relationship. Therefore, the service blockchain node in the service blockchain network 32 can send the pressure measurement transaction to the pressure measurement blockchain node corresponding to the service blockchain node in the pressure measurement blockchain network 33, so that each service blockchain node can forward the pressure measurement transaction to the corresponding pressure measurement blockchain node in an equivalent manner.
For example, it is assumed that the correspondence between the service blockchain node in the service blockchain network 32 and the voltage-measuring blockchain node in the voltage-measuring blockchain network 33 is as shown in table 1.
Then, the service blockchain node a forwards the pressure measurement transaction to the pressure measurement blockchain node a, the service blockchain node B forwards the pressure measurement transaction to the pressure measurement blockchain node B, the service blockchain node C forwards the pressure measurement transaction to the pressure measurement blockchain node C, and the service blockchain node D forwards the pressure measurement transaction to the pressure measurement blockchain node D.
In another case, different from the above peer-to-peer forwarding manner, the service blockchain node in the service blockchain network 32 sends the pressure measurement transaction to all the pressure measurement blockchain nodes in the pressure measurement blockchain network 33. For example, the example shown in table 1 above is adopted, where the service blockchain node a forwards the pressure measurement transactions to the pressure measurement blockchain nodes a to D, the service blockchain node B forwards the pressure measurement transactions to the pressure measurement blockchain nodes a to D, the service blockchain node C forwards the pressure measurement transactions to the pressure measurement blockchain nodes a to D, and the service blockchain node D forwards the pressure measurement transactions to the pressure measurement blockchain nodes a to D.
On the other hand, the service end 31 submits the pressure measurement transaction to the service blockchain nodes in the service blockchain network 32, and when submitting multiple pressure measurement transactions, the service end 31 (which may exist in multiple numbers) may submit the pressure measurement transactions to different service blockchain nodes respectively. Thus, for forwarded pressure measurement transactions, there are two cases. In one case, any service blockchain node in the service blockchain network 32 may forward the pressure measurement transaction received by the service blockchain node from the service end 31 to the pressure measurement blockchain network 33. Taking the above-mentioned one-to-one correspondence between the pressure measurement block chain node and the service block chain node as an example, the service block chain node a may forward 50 pressure measurement transactions received by the service block chain node a from the service end 31 to the pressure measurement block chain node a, the service block chain node B may forward 40 pressure measurement transactions received by the service block chain node B from the service end 31 to the pressure measurement block chain node B, the service block chain node C may forward 30 pressure measurement transactions received by the service block chain node C from the service end 31 to the pressure measurement block chain node C, and the service block chain node D may forward 20 pressure measurement transactions received by the service block chain node D from the service end 31 to the pressure measurement block chain node D. After each pressure measurement block chain node receives the pressure measurement transaction, the pressure measurement transaction received by the pressure measurement block chain node can be broadcasted in the pressure measurement block chain network, so that all the pressure measurement block chain nodes can obtain the same pressure measurement transaction, and further all the pressure measurement block chain nodes can perform the operations of consensus, execution, chain winding and the like aiming at the same pressure measurement transaction. For example, the pressure measurement blockchain node a may broadcast 50 pressure measurement transactions received by itself in the pressure measurement blockchain network, that is, the pressure measurement blockchain nodes b, c, and d may obtain the 50 pressure measurement transactions. Similarly, the pressure measurement blockchain node b may broadcast the 40 pressure measurement transactions received by itself in the pressure measurement blockchain network, that is, the pressure measurement blockchain nodes a, c, d may obtain the 40 pressure measurement transactions. The pressure measurement block chain node c may broadcast the 30 pressure measurement transactions received by itself in the pressure measurement block chain network, that is, the pressure measurement block chain nodes a, b, d may obtain the 30 pressure measurement transactions. The pressure measurement blockchain node d may broadcast 20 pressure measurement transactions received by itself in the pressure measurement blockchain network, that is, the pressure measurement blockchain nodes a, b, and c may acquire the 20 pressure measurement transactions. Through the broadcasting process, the pressure measurement block chain nodes a-d can all obtain 140 same pressure measurement transactions, and further perform operations such as consensus, execution, chain winding and the like on the 140 pressure measurement transactions.
In another case, any service blockchain node in the service blockchain network 32 may forward the pressure measurement transaction received by all service blockchain link points in the service blockchain network 32 from the service end 31 to the pressure measurement blockchain network 33. After receiving the pressure measurement transaction from the service end 31, each service block chain node in the service block chain network 32 may broadcast the pressure measurement transaction received by itself in the service block chain network 32, so that the pressure measurement transactions received synchronously between all the service block chain link points in the service block chain network 32 may be obtained, that is, each service block chain link point may obtain the pressure measurement transactions received by all the service block chain link points from the service end, and then the pressure measurement transactions are forwarded to the service block chain network.
Alternatively, a forwarding node for forwarding the pressure measurement transaction may be configured in the service blockchain network 32, and then the service blockchain node forwards the pressure measurement transaction to the pressure measurement blockchain network 33 when a certain service blockchain node in the service blockchain network 32 is the forwarding node. Each service block chain node in the service block chain network 32 may send the pressure measurement transaction received from the service end to the forwarding node, and the forwarding node collectively forwards the pressure measurement transaction received from the service end by all the service block chain link points to the pressure measurement block chain network 33. For example, the forwarding node may establish a connection with a certain voltage measuring blockchain node in the voltage measuring blockchain network 33, so as to forward all voltage measuring transactions to the voltage measuring blockchain node, and the voltage measuring blockchain node broadcasts the voltage measuring transactions from the forwarding node in the voltage measuring blockchain network 33, so that all voltage measuring blockchain nodes in the voltage measuring blockchain network 33 can obtain the voltage measuring transactions from the forwarding node, and further perform operations such as consensus, execution, and uplink. For another example, the forwarding node may establish a connection with each of the pressure measurement blockchain nodes in the pressure measurement blockchain network 33, so as to forward all the pressure measurement transactions to each of the pressure measurement blockchain nodes, so that all the pressure measurement blockchain nodes in the pressure measurement blockchain network 33 may obtain the pressure measurement transactions from the forwarding node, and further perform operations such as consensus, execution, uplink, and the like.
Among them, the forwarding node can be selected by negotiation among all service blockchain nodes in the service blockchain network 32. Or, the forwarding node is selected at the stage of deploying the service block chain network 32, so that the node information of the forwarding node is written into the chain code, and each service block chain node confirms the service block chain node corresponding to the node information recorded in the chain code as the forwarding node.
The service end 31 may submit the created blockchain transaction to a service blockchain link point, which may be a service blockchain node 32n as shown in fig. 3, by establishing a connection with a certain service blockchain node in the service blockchain network 32. Taking the service blockchain node 32n as an example, the connection established between the service end 31 and the service blockchain node 32n may be a long connection, so that the service blockchain node 32n executes a service transaction to generate a second transaction receipt, and after obtaining a first transaction receipt from the tonometric blockchain network 33, a corresponding transaction receipt generation event may be generated, and the service end 31 may know that a transaction receipt has been generated by monitoring the transaction receipt generation event (i.e., an event monitoring mechanism), and obtain a corresponding transaction receipt (the first transaction receipt or the second transaction receipt) based on the long connection. Of course, the service block chain node 32n may monitor the transaction receipt generation event through the above event monitoring mechanism, and feed back the corresponding transaction receipt to the service end 31 through the above long connection, so that the service end 31 obtains the transaction receipt. Or, if the connection established between the service end 31 and the service blockchain node 32n is not a long connection or the established long connection is disconnected, the service end 31 needs to additionally initiate an inquiry transaction to inquire the transaction receipt corresponding to the submitted blockchain transaction. The query transaction may be a conventional blockchain transaction, so that all blockchain nodes in the service blockchain network 32 need to perform operations such as acquisition, consensus, execution, uplink and the like on the query transaction, and the service end 31 may establish a long connection with a certain service blockchain node in the manner described above, and obtain a corresponding transaction receipt from the service blockchain node based on the event monitoring mechanism described above; alternatively, the query transaction may be a special transaction, for example, the service end 31 may only establish a long connection with the service blockchain node 32n and send the query transaction, and then the query transaction is only acquired and executed by the service blockchain node 32n, the query transaction does not need to participate in consensus and does not need to be uplink, and even does not need to be acquired by other blockchain nodes, and then the service end 31 may acquire a corresponding transaction receipt based on the event monitoring mechanism as described above.
For the first transaction receipt generated after the pressure measurement block chain node in the pressure measurement block chain network 33 performs the pressure measurement transaction, the service block chain link point in the service block chain network 32 may also obtain the second transaction receipt based on the event monitoring mechanism as described above, which is not described herein again. For example, a connection may be established between service blockchain node 32n and pressure blockchain node 33n to obtain a second transaction receipt based on the event listening mechanism as previously described.
Accordingly, after acquiring the transaction receipt, the service end 31 may identify whether the acquired transaction receipt corresponds to the pressure test transaction or the service transaction according to the type identifier included in the transaction receipt. When the acquired transaction receipt contains the first type identification, determining that the transaction receipt is a first transaction receipt (namely corresponding to the pressure measurement transaction); when the obtained transaction receipt contains the second type identifier, the transaction receipt is determined to be a second transaction receipt (i.e. corresponding to the business transaction). And further. The service end 31 may store the first transaction receipt in the pressure measurement database, store the second transaction receipt in the service database, and subsequently may obtain the first transaction receipt from the pressure measurement database to analyze and determine the pressure measurement result for the service block chain network 32.
In this specification, corresponding to the above embodiment at the service blockchain node side, this specification also provides an embodiment at the pressure measuring blockchain node side in the pressure measuring blockchain network, and the description related to the embodiment at the service blockchain node side may also be applied to the embodiment at the pressure measuring blockchain node side, which is not described in detail below.
Referring to fig. 4, fig. 4 is a flowchart illustrating another method for testing the stress of the blockchain network according to an exemplary embodiment. As shown in fig. 4, the method applied to a voltage measuring blockchain node in a voltage measuring blockchain network equivalent to a service blockchain network in a production state may include the following steps:
Step 402, receiving a pressure measurement transaction forwarded by a service block chain link point in the service block chain network, wherein the pressure measurement transaction is forwarded by the service block chain link point under the condition that a block chain transaction initiated by a service end is a pressure measurement transaction;
Step 404, executing the pressure measurement transaction; wherein the business transaction is executed by the business blockchain link node if the blockchain transaction is a business transaction.
As described above, a pressure measurement blockchain node may receive a pressure measurement transaction forwarded by a service blockchain link point corresponding to the pressure measurement blockchain node in the service blockchain network.
As described above, a pressure measurement blockchain node may receive a pressure measurement transaction forwarded by a service blockchain link point serving as a forwarding node in the service blockchain network.
As described above, a pressure measurement blockchain node may receive a pressure measurement transaction received from the service end forwarded by a service blockchain link point in the service blockchain network; or,
And receiving the pressure measurement transaction which is forwarded by the service block chain link point in the service block chain network and is received by all the service block chain nodes in the service block chain network from the service end.
As mentioned above, the pressure test transaction includes a first type identifier, and the service transaction includes a second type identifier.
As mentioned above, the first transaction receipt corresponding to the pressure measurement transaction includes the first type identifier, and the second transaction receipt corresponding to the business transaction includes the second type identifier.
As previously described, the first transaction receipt is stored to a pressure measurement database and the second transaction receipt is stored to a business database.
As mentioned above, the voltage measuring blockchain network and the service blockchain network have the same network structure and network configuration.
As described above, the blockchain transaction is initiated by the business terminal to the business blockchain network through a blockchain client.
As mentioned above, the blockchain client is deployed on the service end; or, the blockchain client is deployed on a service blockchain node in the service blockchain network.
FIG. 5 is a schematic block diagram of an apparatus provided in an exemplary embodiment. Referring to fig. 5, at the hardware level, the apparatus includes a processor 502, an internal bus 504, a network interface 506, a memory 508 and a non-volatile memory 510, but may also include hardware required for other services. The processor 502 reads a corresponding computer program from the non-volatile memory 510 into the memory 508 and runs it, forming a stress testing device of the blockchain network on a logical level. Of course, besides software implementation, the one or more embodiments in this specification do not exclude other implementations, such as logic devices or combinations of software and hardware, and so on, that is, the execution subject of the following processing flow is not limited to each logic unit, and may also be hardware or logic devices.
Referring to fig. 6, in a software implementation, the apparatus for stress testing of a blockchain network applied to a service blockchain node in a service blockchain network in a production state may include:
An identifying unit 602, configured to identify a transaction type of a blockchain transaction initiated by a service end;
A forwarding unit 604, configured to forward the pressure measurement transaction to a pressure measurement blockchain network equivalent to the service blockchain network when the blockchain transaction is a pressure measurement transaction;
The execution unit 606 executes the business transaction when the blockchain transaction is a business transaction.
Optionally, the forwarding unit 604 is specifically configured to:
Sending the pressure measurement transaction to a pressure measurement blockchain node corresponding to the service blockchain node in the pressure measurement blockchain network; or,
And respectively sending the pressure measurement transaction to all pressure measurement block chain nodes in the pressure measurement block chain network.
Optionally, the forwarding unit 604 is specifically configured to:
And forwarding the pressure measurement transaction to the pressure measurement blockchain network under the condition that the service blockchain node is a forwarding node in the service blockchain network.
Optionally, the forwarding unit 604 is specifically configured to:
Forwarding the pressure measurement transaction received by the service blockchain node from the service end to the pressure measurement blockchain network; or,
And forwarding the pressure measurement transaction received by all service block chain nodes in the service block chain network from the service end to the pressure measurement block chain network.
Optionally, the identifying unit 602 is specifically configured to:
Reading a type identifier contained in the blockchain transaction;
And under the condition that the type identifier is a first type identifier, judging the block chain transaction as the pressure measurement transaction, and under the condition that the type identifier is a second type identifier, judging the block chain transaction as the service transaction.
Optionally, the first transaction receipt corresponding to the pressure measurement transaction includes the first type identifier, and the second transaction receipt corresponding to the business transaction includes the second type identifier.
Optionally, the first transaction receipt is stored in a pressure measurement database, and the second transaction receipt is stored in a service database.
Optionally, the network of the pressure measurement block chain and the network of the service block chain have the same network structure and network configuration.
Optionally, the blockchain transaction is initiated by the service end to the service blockchain network through a blockchain client.
Optionally, the blockchain client is deployed on the service end; or, the blockchain client is deployed on a service blockchain node in the service blockchain network.
Referring to fig. 7, in another software implementation, the apparatus for pressure testing of a blockchain network applied to a pressure-measuring blockchain node in a pressure-measuring blockchain network equivalent to a business blockchain network in a production state may include:
A receiving unit 702, configured to receive a pressure measurement transaction forwarded by a service block link point in the service block chain network, where the pressure measurement transaction is forwarded by the service block link point when a block chain transaction initiated by a service end is a pressure measurement transaction;
An execution unit 704 that executes the pressure measurement transaction; wherein the business transaction is executed by the business blockchain link node if the blockchain transaction is a business transaction.
Optionally, the receiving unit 702 is specifically configured to:
And receiving the pressure measurement transaction forwarded by the service block chain link point corresponding to the pressure measurement block chain node in the service block chain network.
Optionally, the receiving unit 702 is specifically configured to:
And receiving the pressure measurement transaction forwarded by the service block chain link point serving as the forwarding node in the service block chain network.
Optionally, the receiving unit 702 is specifically configured to:
Receiving a pressure measurement transaction received from the service end forwarded by a service block link node in the service block chain network; or,
And receiving the pressure measurement transaction which is forwarded by the service block chain link point in the service block chain network and is received by all the service block chain nodes in the service block chain network from the service end.
Optionally, the pressure test transaction includes a first type identifier, and the service transaction includes a second type identifier.
Optionally, the first transaction receipt corresponding to the pressure measurement transaction includes the first type identifier, and the second transaction receipt corresponding to the business transaction includes the second type identifier.
Optionally, the first transaction receipt is stored in a pressure measurement database, and the second transaction receipt is stored in a service database.
Optionally, the network of the pressure measurement block chain and the network of the service block chain have the same network structure and network configuration.
Optionally, the blockchain transaction is initiated by the service end to the service blockchain network through a blockchain client.
Optionally, the blockchain client is deployed on the service end; or, the blockchain client is deployed on a service blockchain node in the service blockchain network.
The systems, devices, modules or units illustrated in the above embodiments may be implemented by a computer chip or an entity, or by a product with certain functions. A typical implementation device is a computer, which may take the form of a personal computer, laptop computer, cellular telephone, camera phone, smart phone, personal digital assistant, media player, navigation device, email messaging device, game console, tablet computer, wearable device, or a combination of any of these devices.
In a typical configuration, a computer includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include forms of volatile memory in a computer readable medium, Random Access Memory (RAM) and/or non-volatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). Memory is an example of a computer-readable medium.
Computer-readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), Read Only Memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), Digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic disk storage, quantum memory, graphene-based storage media or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, a computer readable medium does not include a transitory computer readable medium such as a modulated data signal and a carrier wave.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
The foregoing description has been directed to specific embodiments of this disclosure. Other embodiments are within the scope of the following claims. In some cases, the actions or steps recited in the claims may be performed in a different order than in the embodiments and still achieve desirable results. In addition, the processes depicted in the accompanying figures do not necessarily require the particular order shown, or sequential order, to achieve desirable results. In some embodiments, multitasking and parallel processing may also be possible or may be advantageous.
The terminology used in the description of the one or more embodiments is for the purpose of describing the particular embodiments only and is not intended to be limiting of the description of the one or more embodiments. As used in one or more embodiments of the present specification and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It should also be understood that the term "and/or" as used herein refers to and encompasses any and all possible combinations of one or more of the associated listed items.
It should be understood that although the terms first, second, third, etc. may be used in one or more embodiments of the present description to describe various information, such information should not be limited to these terms. These terms are only used to distinguish one type of information from another. For example, first information may also be referred to as second information, and similarly, second information may also be referred to as first information, without departing from the scope of one or more embodiments herein. The word "if" as used herein may be interpreted as "at … …" or "when … …" or "in response to a determination", depending on the context.
The above description is only for the purpose of illustrating the preferred embodiments of the one or more embodiments of the present disclosure, and is not intended to limit the scope of the one or more embodiments of the present disclosure, and any modifications, equivalent substitutions, improvements, etc. made within the spirit and principle of the one or more embodiments of the present disclosure should be included in the scope of the one or more embodiments of the present disclosure.