CN110598446B - Block chain-based test method, device, storage medium and computer equipment - Google Patents

Block chain-based test method, device, storage medium and computer equipment Download PDF

Info

Publication number
CN110598446B
CN110598446B CN201910871913.3A CN201910871913A CN110598446B CN 110598446 B CN110598446 B CN 110598446B CN 201910871913 A CN201910871913 A CN 201910871913A CN 110598446 B CN110598446 B CN 110598446B
Authority
CN
China
Prior art keywords
service
block
current block
information
identifier
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201910871913.3A
Other languages
Chinese (zh)
Other versions
CN110598446A (en
Inventor
冯士乘
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen Co Ltd
Filing date
Publication date
Application filed by Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN201910871913.3A priority Critical patent/CN110598446B/en
Publication of CN110598446A publication Critical patent/CN110598446A/en
Application granted granted Critical
Publication of CN110598446B publication Critical patent/CN110598446B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Abstract

The application relates to a testing method, a testing device, a storage medium and computer equipment based on a blockchain, wherein the testing method comprises the following steps: receiving a service request sent by a service participant terminal, determining a corresponding target test chain identification from a plurality of block chains according to the service identification, and performing authority verification on the service request to obtain authority verification information; generating a current block corresponding to the request packet, distributing the current block to a consensus node corresponding to the target test chain identifier, and performing consensus verification on the current block; when the consensus verification is passed, storing the current block into a local cache library and writing the current block into a test chain; checking the current block in the local cache library and the test chain to obtain block checking information; and generating test result information according to the authority check information and the block check information, and returning the test result information to the service participant terminal for display. The scheme provided by the application can effectively generate the test information in the service request processing process so as to improve the application test efficiency.

Description

Block chain-based test method, device, storage medium and computer equipment
Technical Field
The present application relates to the field of computer technologies, and in particular, to a blockchain-based testing method, device, storage medium, and computer apparatus.
Background
Blockchains are novel application modes of computer technologies such as distributed data storage, point-to-point transmission, consensus mechanisms, encryption algorithms, and the like. As blockchain technology is widely used, the demands of enterprises for blockchain applications are increasing. In the process of creating the blockchain application based on the enterprise requirements, the creation process is complex, and generally, multiple tests are required to be carried out on the application, the scene and the like of the blockchain application, so that the resource consumption is high, and the cost of creating the blockchain application by the enterprise user is high. For the first creation of a blockchain application, this approach has the problems of higher testing costs and lower testing efficiency, resulting in lower blockchain application creation efficiency.
Disclosure of Invention
Based on this, it is necessary to provide a blockchain-based testing method, device, storage medium and computer equipment for the technical problem that the testing efficiency is low and the creation efficiency of the blockchain application is low.
A blockchain-based testing method, comprising:
receiving a service request triggered by a service participant terminal based on a test service entry page, wherein the service request carries a user identifier and a request packet;
Determining corresponding target test chain identifiers from a plurality of block chains according to service identifiers in the request packet, and performing authority verification on the request packet and the target test chain identifiers to obtain authority verification information;
Generating a current block corresponding to the request packet according to the target test chain identifier, and distributing the current block to a plurality of test chain nodes corresponding to the target test chain identifier, so that a consensus node in the test chain performs consensus verification on the current block;
when the common identification verification is passed, storing the current block into a local cache library, and writing the current block into the test chain;
checking the local cache library and the current block in the test chain to obtain block check information;
And generating test result information according to the authority verification information and the block verification information, and returning the test result information to a test page of the service participant terminal for display.
A blockchain-based testing device, the device comprising:
The request receiving module is used for receiving a service request triggered by the service participant terminal based on the test service entry page, wherein the service request carries a user identifier and a request packet;
The permission checking module is used for determining corresponding target test chain identifiers from a plurality of block chains according to service identifiers in the request packet, and performing permission checking on the request packet and the target test chain identifiers to obtain permission checking information;
The block processing module is used for generating a current block corresponding to the request packet according to the target test chain identifier, distributing the current block to a plurality of test chain nodes corresponding to the target test chain identifier, and enabling a consensus node in the test chain to perform consensus verification on the current block;
the data storage module is used for storing the current block into a local cache library and writing the current block into the test chain after the common identification verification is passed;
The block verification module is used for verifying the local cache library and the current block in the test chain to obtain block verification information;
and the test result generation module is used for generating test result information according to the authority verification information and the block verification information, and returning the test result information to the test page of the service participant terminal for display.
A computer readable storage medium storing a computer program which, when executed by a processor, causes the processor to perform the steps of the blockchain-based testing method described above.
A computer device comprising a memory and a processor, the memory storing a computer program that, when executed by the processor, causes the processor to perform the steps of the blockchain-based testing method described above.
According to the block chain-based testing method, the device, the storage medium and the computer equipment, after the service request sent by the service participant terminal is received, the corresponding target testing chain identification is determined according to the service identification, and the authority verification is carried out on the service request, so that the authority verification information of the service request can be effectively generated. After generating a current block corresponding to the request packet, distributing the current block to a plurality of test chain nodes in a target test chain, so that a consensus node in the test chain performs consensus verification on the current block; when the consensus verification is passed, storing the current block into a local cache library and writing the current block into a test chain; and verifying the current block in the local cache library and the test chain to obtain block verification information, and writing the current block into the target test chain after the current block is locally stored, so that the consistency of block storage can be effectively transacted. The method comprises the steps of generating test result information according to authority check information and block check information, returning the test result information to a test page of a service participant terminal for display, and therefore testing service requests of a test chain and effectively recording process test information of the block chain service platform for processing the service requests.
Drawings
FIG. 1 is an application environment diagram of a blockchain-based testing method in one embodiment;
FIG. 2 is a block diagram of a block chain business system in one embodiment;
FIG. 3 is a flow diagram of a blockchain-based testing method in one embodiment;
FIG. 4 is a flow chart illustrating steps for generating rights verification information in one embodiment;
FIG. 5 is a flowchart illustrating a current block step corresponding to a request packet generation in one embodiment;
FIG. 6 is a flow chart of a blockchain-based testing method in an embodiment;
FIG. 7 is a timing diagram of a blockchain-based testing method in one embodiment;
FIG. 8 is a block diagram of a block chain based testing device in one embodiment;
FIG. 9 is a block diagram of a block chain based testing device in another embodiment;
FIG. 10 is a block diagram of a computer device in one embodiment.
Detailed Description
The present application will be described in further detail with reference to the drawings and examples, in order to make the objects, technical solutions and advantages of the present application more apparent. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the application.
FIG. 1 is an application environment diagram of a blockchain-based testing method in one embodiment. Referring to fig. 1, the blockchain-based testing method is applied to a blockchain service system. The blockchain service system includes a service participant terminal 110 and a blockchain service platform 120. The service participant terminal 110 and the blockchain service platform 120 are connected through a network. The service participant terminal 110 may be a desktop terminal or a mobile terminal, and the mobile terminal may be at least one of a mobile phone, a tablet computer, a notebook computer, and the like. The blockchain service platform 120 may be implemented by a stand-alone server or a server cluster formed by a plurality of servers, where the blockchain service platform 120 includes a plurality of server nodes.
Blockchains are novel application modes of computer technologies such as distributed data storage, point-to-point transmission, consensus mechanisms, encryption algorithms, and the like. The blockchain (Blockchain), essentially a de-centralized database, is a string of data blocks that are generated in association using cryptographic methods, each of which contains information from a batch of network transactions for verifying the validity (anti-counterfeit) of its information and generating the next block. The blockchain may include a blockchain underlying platform, a platform product services layer, and an application services layer.
The blockchain underlying platform may include processing modules for user management, basic services, smart contracts, and operational monitoring. The user management module is responsible for identity information management of all blockchain participants, including maintenance of public and private key generation (account management), key management, maintenance of corresponding relation between the real identity of the user and the blockchain address (authority management) and the like, and under the condition of authorization, supervision and audit of transaction conditions of certain real identities, and provision of rule configuration (wind control audit) of risk control; the basic service module is deployed on all block chain node devices, is used for verifying the validity of a service request, recording the service request on a storage after the effective request is identified, for a new service request, the basic service firstly analyzes interface adaptation and authenticates the interface adaptation, encrypts service information (identification management) through an identification algorithm, and transmits the encrypted service information to a shared account book (network communication) in a complete and consistent manner, and records and stores the service information; the intelligent contract module is responsible for registering and issuing contracts, triggering contracts and executing contracts, a developer can define contract logic through a certain programming language, issue the contract logic to a blockchain (contract registering), invoke keys or other event triggering execution according to the logic of contract clauses to complete the contract logic, and simultaneously provide a function of registering contract upgrading; the operation monitoring module is mainly responsible for deployment in the product release process, modification of configuration, contract setting, cloud adaptation and visual output of real-time states in product operation, for example: alarming, monitoring network conditions, monitoring node equipment health status, etc.
The platform product service layer provides basic capabilities and implementation frameworks of typical applications, and developers can complete the blockchain implementation of business logic based on the basic capabilities and the characteristics of the superposition business. The application service layer provides the application service based on the block chain scheme to the business participants for use.
In one embodiment, referring to FIG. 2, the blockchain service platform 120 includes multiple levels of nodes: edge node 1202, proxy node 1204, accounting node 1206, and consensus node 1208. Wherein each consensus node may also be deployed with a corresponding billing node. Nodes in the overall blockchain service system may be denoted blockchain nodes, each of which may be provided as a server. The edge node 1202 may be a first-level authority deployed computer node, and the first layer may be an application service layer in a blockchain service system, such as a computer node deployed by each service provider. Edge node 1202 may be the node closest to the user terminal side that is connected to service participant terminal 110 and each block link point. Proxy node 1204 may be a second level authority deployed computer node, which may be a platform product service layer in a blockchain service system, such as a provincial authority deployed computer node. The billing node 1206 and consensus node 1208 may be respective authority-deployed computer nodes of a third hierarchy, which may be a blockchain bottom-level platform in a blockchain business system, such as a country-level organization and provincial-level organization-deployed computer nodes. Each of the edge node 1202, proxy node 1204, accounting node 1206, and consensus node 1208 has a corresponding service area. Each edge node 1202 is connected directly to the proxy node 1204 in the service area to which it belongs through a network, or indirectly to the proxy nodes 1204 in the corresponding service area through other edge nodes 1202. The edge node 1202 may be configured to receive a service request initiated by a service participant terminal and distribute a request packet to a corresponding node in the blockchain service system according to a service attribute.
As shown in FIG. 3, in one embodiment, a blockchain-based testing method is provided that is applicable to any node in the blockchain service platform 120. The present embodiment is mainly exemplified by the application of the method to the edge node 1202 in the blockchain service platform 120 in fig. 1. Referring to fig. 3, the blockchain-based testing method specifically includes the following steps:
Step 302, a service request triggered by a service participant terminal based on a test service entry page is received, wherein the service request carries a user identifier and a request packet.
In this embodiment, the blockchain service system may be a public chain system, a private chain system, or a federation chain system.
In the blockchain service platform, a plurality of blockchains can be deployed in advance according to service types, each blockchain has a corresponding service type, and the same service type can also correspond to a plurality of blockchains. Each blockchain may have a corresponding blockchain identification. The service participant terminal can be provided with a corresponding service application for initiating a service request of a corresponding service type. The blockchain system comprises a plurality of blockchain nodes, the blockchain nodes can be deployed servers, and the servers are connected with the blockchains and connected with the terminals of the business participants.
The blockchain service platform can be a blockchain-based service platform, for example, baaS platform (Blockchain AS A SERVICE ), is a novel cloud service combining the blockchain technology, and provides a corresponding solution for the service participants based on blockchain development, testing and quick deployment. The block chain service system platform is provided with a plurality of service types of test chains, wherein the test chains correspond to the main network and have the same function, but the main purpose is to test the block chains. The test chain may be a blockchain that is built for testing purposes without breaking the backbone. For example, the test chain may be a test tool provided to a new business participant for joint debugging use at BaaS platform that may be used to familiarize and learn the blockchain's technology and application capabilities for the business participant to facilitate subsequent creation of the blockchain services required by the business participant.
The business participant terminal can be a terminal corresponding to the enterprise user, and when the enterprise user builds the service based on the blockchain, the data read-write test can be performed in the blockchain business system platform to test the corresponding functions and the like, so that the cost can be effectively saved when the service required by the enterprise user is built.
The blockchain service platform can comprise a test service entry page, wherein the test service entry page can be a page displayed on the basis of the node access platform. The service participants can perform read-write operation of various service data, service requests and the like through the test service entry page. The service participation initiated request can be forwarded to the corresponding node for processing through the test service entry page.
Specifically, the service participant initiates a service request on the test service entry page through the corresponding terminal, and the service request may include a transaction test request, a data reading request, and the like for a certain service. The edge node in the block chain service platform can receive the service request sent by the service participant terminal, acquire the user identifier carried by the service request, and extract the request packet corresponding to the service request.
In one embodiment, before a service participant initiates a service request on a test service entry page through a corresponding terminal, the service participant may register in a corresponding blockchain service platform in advance by using the corresponding terminal, generate key information corresponding to a user identifier of the service participant, where the key information may include a pair of public and private keys, and upload the public and private keys to the blockchain service platform for storage. The blockchain service platform can also generate a user data table of the user according to the user identification registered by the user and the selected service identification, and store the user data table.
And step 304, determining a corresponding target test chain identifier from a plurality of blockchains according to the service identifier in the request packet, and performing authority verification on the request packet and the target blockchain identifier to obtain authority verification information.
The request packet may include data such as service data and a corresponding service identifier. The service data refers to data generated corresponding to a service required by a user, and the service data can have various forms, for example, the service data can be a service request initiated by a service participant terminal to a certain service, a confirmation request to a certain service, a data read-write operation to a certain service, and the like.
After receiving a service request sent by a service participant terminal based on a test service entry page, an edge node in the block chain service platform acquires a corresponding service type and signature information of a user on the request packet from the service request and the request packet. The signature information may be a signature of the service data by the user terminal using a user private key based on the blockchain service system, so that the node server matches a corresponding user public key based on the user private key to verify the signature information of the user.
The edge node further obtains a blockchain identifier corresponding to the service type, wherein the blockchain corresponding to the service type may have a plurality of blockchains. The edge node performs hash computation on the service type, the service identifier and the plurality of blockchains respectively to obtain a corresponding hash result set, and when the target blockchain identifier corresponding to the service data exists in the hash result set, the edge node indicates that the target blockchain has access right, and generates access right verification information. The edge node further performs signature verification on the data packet by using the signature information. Specifically, the edge node may analyze the corresponding signature by using the public key of the user to obtain summary information, calculate summary information of the data packet according to a preset algorithm, match the two summary information, if the matching is successful, determine that the signature verification is passed, and generate corresponding signature verification information.
And after verifying the access rights and the signatures of the corresponding blockchains according to the service types and the signature information, the edge node generates rights verification information of the user identification by using the access rights verification information and the signature verification information. When the access right verification information and the signature verification information both indicate that the verification is passed, the result of the right verification information is that the right verification is passed, and step 306 is performed. If the access right verification information and the signature verification information both indicate that the verification is not passed or any one of the access right verification information and the signature verification information is not passed, the right verification information results in that the right verification is not passed, and the service request is in a malicious attack or a malicious tampering risk of the service data, and the edge node can intercept the service request.
And 306, generating a current block corresponding to the request packet according to the target block chain identifier, and distributing the current block to a plurality of test chain nodes corresponding to the target block chain identifier, so that the common node in the test chain performs common-identification verification on the current block.
The block is a data packet carrying transaction data on a block chain network, is a container data structure marked with a time stamp and a hash value of a previous block, and is verified and confirmed by a consensus mechanism of the network. The block ledger is a carrier for recording the data to be authenticated generated for a period of time, and records the information of a plurality of data blocks. The blocks are serially connected in the block ledger according to the generation time sequence. The block includes a block header and a block body.
Wherein the block header records the time stamp of the previous sequential block and the time stamp of the current data block. The tiles also include a tile height, which is the number of tiles linked to the backbone, i.e., the number of tiles linked to the blockchain. The block height may be an identifier of a block, which may include a plurality of, for example, hash values of a block header, and may include a block height, with each block having a specific, fixed block height.
And after determining the corresponding target test chain identification from the plurality of block chains according to the service identification, the edge node generates a corresponding current block according to the service data. Specifically, the server may obtain the block header information of the last block associated with the current block in the target manner chain, generate the current block according to the block header information of the last block, and write the service data into the current block. When the current block is generated, the characteristic value of the current block can be generated according to the block head information of the previous block, and particularly, a plurality of hash algorithms can be adopted for parallel calculation, so that the characteristic value of the current block is obtained.
The test chain node comprises a plurality of consensus nodes, and the consensus nodes are used for carrying out consensus mechanism verification on the current block. The consensus mechanism is to complete verification and confirmation of the transaction in a short time through voting of special nodes; for a transaction, if several nodes with unrelated interests can agree on the transaction, the whole network can be considered to agree on the transaction. Specifically, establishing a connection channel between multiple nodes in the blockchain may synchronously distribute data to the multiple nodes in the blockchain.
After the edge node generates the current block corresponding to the service data, the current block is distributed to a plurality of test chain nodes corresponding to the target block chain identification. After each consensus node in the target test chain acquires the current block, performing consensus verification on the current block. Specifically, the consensus node can adopt any formula algorithm such as a workload proof consensus mechanism, a rights and interests proof consensus mechanism, a share authorization proof consensus mechanism, a Rainbow coin consensus mechanism, a verification pool consensus mechanism and the like to perform consensus verification on the current block so as to verify the consistency and the effectiveness of the current block.
Step 308, when the consensus verification is passed, the current block is stored in the local cache library, and the current block is written into the test chain.
The cache library may be a local repository in a server of the edge node, and is used for storing blocks corresponding to the service data. The cache library may be a database deployed in a disk of a server, such as a hard disk library. Storing the current block to the disk can effectively ensure the storage effectiveness of the data, thereby ensuring the integrity of the data.
When the common identification node in the test chain passes the common identification verification of the current block, the edge node stores the current block corresponding to the service data into a cache library, and the edge node writes the current block into the test chain. Specifically, the edge node obtains the block height corresponding to the current block, broadcasts the current block according to the block height and writes the current block into a block account book of the target test chain, so that the test link points in the test chain write the current block into the block account book corresponding to the respective node according to the block height, and stores the current block process, namely, writes the current block into a remote distributed storage library corresponding to the target test chain.
In one embodiment, after the common node in the test chain passes the common verification of the current block, the edge node stores the current block corresponding to the service data into the cache library, and after the success of writing the current block into the disk is detected, the block height corresponding to the current block is obtained, and the current block is written into the target test chain according to the block height. After the local storage is successful, the current block is written into the target test chain, so that a plurality of test link points store the current block respectively, and transaction data can be effectively and synchronously stored, thereby effectively guaranteeing the consistency and the integrity of data storage. When the business data volume is larger, the data stored in the local cache can be effectively utilized to confirm whether the transaction result is successful in synchronization, and the business data can be effectively ensured.
And step 310, checking the current block in the local cache library and the test chain to obtain block check information.
In the process of writing the current block into the distributed memory bank of the target test chain, problems such as network fluctuation may occur, and the current block may fail to be written into the target block chain. When a network fluctuates or other problems cause data read-write or storage failure in the test chain nodes, data inconsistency can be caused.
When the edge node stores the current block into the local cache library, the cache height of the current block is obtained according to the target test chain identification, and the current block is stored into the cache library according to the cache height. The cache height of the current block may be a block height determined by a common node in the target test chain that shares the current block. The edge node can also acquire the block height corresponding to the current block, broadcast the current block according to the block height and write the current block into a block account book of the target test chain, so that the test link points in the test chain write the current block into the block account book corresponding to the respective node according to the block height, namely, write the current block into a remote distributed storage library corresponding to the target test chain.
And after the edge node locally stores the current block and writes the current block into the target test chain, checking the consistency of the local cache library and the current block stored in the test chain. Specifically, the edge node obtains a cache height in the local cache library and a block height in the target test chain according to the target test chain identification, and detects a writing state of the block according to the cache height and the block height. When the cache height in the cache bank is consistent with the block height of the target blockchain, the writing state of the block is successful in writing, namely the block is successfully stored synchronously. When the cache height in the cache bank is inconsistent with the block height of the target blockchain, the block is lost or the storage fails, and the writing state of the block is not written. And the edge node generates corresponding block verification information according to the writing state of the current block.
And step 312, generating test result information according to the authority verification information and the block verification information, and returning the test result information to a test page of the service participant terminal for display.
The block chain service platform records the test result information of the processing process of the service request initiated by the participant terminal in the test result information.
The edge node further generates test result information according to the authority check information and the block check information obtained in the service request processing process, and returns the test result information to a test page of the service participant terminal for display, so that the service participant can effectively obtain detailed test information for processing the corresponding service request at the block chain service platform. The service participant can further determine corresponding requirement information according to the test result information, wherein the requirement information can be related information aiming at the block chain service required by the construction service participant.
In this embodiment, after receiving a service request sent by a service participant terminal, a corresponding target test chain identifier is determined according to the service identifier, and authority verification is performed on the service request, so that authority verification information of the service request can be effectively generated. After generating a current block corresponding to the request packet, distributing the current block to a plurality of test chain nodes in a target test chain, so that a consensus node in the test chain performs consensus verification on the current block; when the consensus verification is passed, storing the current block into a local cache library and writing the current block into a test chain; and verifying the current block in the local cache library and the test chain to obtain block verification information, and writing the current block into the target test chain after the current block is locally stored, so that the consistency of block storage can be effectively transacted. The method comprises the steps of generating test result information according to authority check information and block check information, returning the test result information to a test page of a service participant terminal for display, and therefore testing service requests of a test chain and effectively recording process test information of the block chain service platform for processing the service requests.
In one embodiment, the target test chain identifier is a test chain corresponding to a service type, the test chain is a test chain application established and issued by the blockchain service platform according to configured test information and a test environment, and the test chain comprises a plurality of blockchain nodes.
The testing chains can be the blockchains which are developed in the blockchain service platform in advance and used for testing related services, a plurality of testing chains of various service types are deployed in the blockchain service platform in advance, each testing chain has a corresponding service type, the same service type can also comprise a plurality of testing chains, and each testing chain comprises a corresponding testing chain identification. The blockchain service platform can be a blockchain-based service platform, for example, baaS platform (Blockchain AS A SERVICE ), is a novel cloud service combining the blockchain technology, and provides a corresponding solution for the service participants based on blockchain development, testing and quick deployment. The block chain service platform comprises a plurality of test chain nodes, the test chain nodes can be deployed servers, and the servers are connected with the plurality of test chains and connected with a plurality of service participant terminals.
Therefore, the testing chain application corresponding to the testing chain can be deployed in the block chain service platform in advance, namely, the testing application based on testing related services. The test chain application can be established and released in the block chain service platform according to the configured test information and the test environment. The test chain application can correspond to a corresponding test service entry page on the blockchain service platform, wherein the test service entry page can be a page displayed on the basis of the node access platform. The service participants can perform read-write operation of various service data, service requests and the like through the test service entry page. The service participation initiated request can be forwarded to the corresponding test chain node for processing through the test service entry page. Before the business user builds the service based on the block chain, the data read-write test can be performed in the block chain business system platform to test the corresponding functions and the like, so that the cost can be effectively saved when the service required by the business user is built.
In one embodiment, the blockchain service platform may include both a blockchain backbone and a test chain for testing. The test chain is a blockchain that has the same function as the corresponding primary network, but is primarily intended for testing. The test chain may be a blockchain that is built for testing purposes without breaking the backbone. The block chain and the test chain can independently operate in the block chain service platform respectively without mutual influence. Thus, the related service request can be effectively tested.
In one embodiment, as shown in fig. 4, determining a corresponding target test chain identifier from a plurality of blockchains according to a service identifier in a request packet, and performing authority verification on the request packet and the target test chain identifier to obtain authority verification information specifically includes the following steps:
Step 402, obtaining the accessible node identifier associated with the user identifier, and verifying whether the accessible node identifier contains the target node identifier obtained by analysis.
Step 404, when the accessible node identifier includes the target test chain identifier, determining that the user identifier has access rights to the target test chain.
Step 406, obtaining the corresponding key information according to the user identification, and performing signature verification on the request packet by using the key information to obtain signature verification information.
In step 408, rights verification information is generated using the access rights and the signature verification information.
Before a participant terminal initiates a service request in a blockchain service platform, the participant terminal may register in the corresponding blockchain service platform in advance, generate key information corresponding to a user identifier of the service participant, where the key information may include a pair of public and private keys, and upload the public and private keys to the blockchain service platform for storage. When registering, the participant terminal can select a corresponding service type and a service identifier to register, the service identifier and the corresponding test chain identifier establish a binding relationship, and the test chain further comprises a corresponding test chain interface which is used for calling the corresponding test chain to perform corresponding service processing. After the service participant registers, the corresponding test chain identifier and the test chain interface are associated and bound according to the selected service identifier, specifically, an access node mapping table corresponding to the user is established, the access node, that is, the service identifier selected by the service participant, corresponds to the blockchain identifier, and the access node can comprise a plurality of blockchain identifiers. The blockchain service platform can also generate a user data table of the service participant according to the user identification registered by the service participant, the selected service identification and the associated access node, and store the user data table.
The service request also comprises a service type and a service identifier, after the edge node in the blockchain service platform obtains the service request sent by the participant terminal, the corresponding target test chain identifier is determined from a plurality of blockchains according to the service identifier in the request packet, and the request packet and the target test chain identifier are subjected to authority verification to obtain authority verification information. Specifically, the edge node obtains a test chain identifier corresponding to a service type, wherein there may be a plurality of blockchains corresponding to the service type. And the edge node respectively carries out hash calculation according to the service type, the service identification and the plurality of test chains to obtain a corresponding hash result set. For example, the edge node may perform hash computation on the service type, the service identifier, and the plurality of test chain identifiers by using a hash algorithm with the highest random weight, so as to obtain a corresponding hash result set. And obtaining the accessible node identifier associated with the user identifier, and indicating that the target test chain has access right when the target test chain identifier corresponding to the service identifier exists in the accessible node identifiers associated with the user identifier in the hash result set. Otherwise, if any accessible node identifier associated with the user identifier in the hash result set does not have the target test chain identifier corresponding to the service identifier, the target test chain identifier is indicated to have no access right, so that the target test chain identifier corresponding to the service request and the corresponding access right can be accurately identified. And the edge node generates corresponding access right verification information according to the access right.
The edge node further obtains signature information corresponding to the user identification of the service participant, and further performs signature verification on the request packet by utilizing the signature information. Specifically, the edge node may analyze the corresponding signature by using the public key of the user to obtain summary information, calculate summary information of the data packet according to a preset algorithm, match the two summary information, and determine that the signature verification passes if the matching is successful. Otherwise, determining that the signature verification is not passed, and generating signature verification information of the request packet by the edge node.
And the edge node generates authority verification information corresponding to the service request by using the access authority information and the signature verification information. In this embodiment, the hash calculation is performed on the service type, the service identifier and the plurality of test chain identifiers, so that the target test chain identifier corresponding to the service request can be accurately identified, and the access right of the target test link and the signature of the request packet are respectively checked, so that the service request can be effectively double-verified, and corresponding right check information is generated.
In one embodiment, as shown in fig. 5, the generation of the current block corresponding to the request packet specifically includes the following steps:
step 502, extracting signature information corresponding to the user identifier from a data table according to the data table corresponding to the service identifier.
And step 504, calculating the service data and the signature information of the user by adopting different hash algorithms respectively to obtain hash values of at least two parts of data.
And step 506, splicing the hash values of at least two parts of data to obtain the characteristic value of the current block.
Step 508, the current block is generated according to the service data, the signature information, the feature value of the previous block in the target block chain, and the feature value of the current block.
Wherein, the request packet includes the service data corresponding to the service request. The data table may be a database table storing relevant data, such as a user table associated with the user identification and the service identification. The service participants can register in the corresponding blockchain service platform in advance by utilizing the corresponding terminals, generate a pair of public and private keys of the user identification, and upload the public and private keys to the blockchain service platform. And the block chain service platform generates a user data table of the user identification according to the user identification registered by the user and the selected service identification, and stores the user data table.
The block data of each block in the block chain comprises input information (i.e. service data), signature information, a block header characteristic value of a parent block, an input information characteristic value, a version number, a time stamp, a difficulty value and the like. The parent block is the last block associated with the current block.
After the service participant terminal initiates a service request to the service system platform, the edge node acquires service data carried by the service request and determines a corresponding target blockchain identifier according to the service identifier. The edge node further generates a current block corresponding to the request packet according to the target test chain identification.
Specifically, the edge node obtains a corresponding data table according to the user identifier, and obtains signature information corresponding to the user identifier from the data table, wherein the signature information comprises key information of the user identifier. The edge node also obtains the block head information of the last block in the target test chain according to the target test chain identification, and extracts the block head characteristic value in the block head information of the last block. When the edge node generates the block corresponding to the service data, the edge node calculates the characteristic value according to the service data, the signature information, the block head characteristic value of the previous block, the timestamp and other information, so as to calculate the block characteristic value of the current block.
When the edge node generates the block characteristic value of the current block, the edge node can further adopt various hash algorithms to perform parallel calculation. For example, the hash algorithm may include SHA256 algorithm, SM3 algorithm, and the like. Specifically, the edge node may divide the information, such as the service data and the signature information, for generating the block feature value into at least two parts of data, and the edge node calculates the at least two parts of data by using different hash algorithms, so as to obtain hash values corresponding to the at least two parts of data, and splice the hash values of the at least two parts of data, so as to obtain the block feature value of the current block. The edge node further generates a current block of the service data according to the block characteristic value, the service data, the signature information, the block header characteristic value of the previous block, the timestamp and other information.
For example, when generating the current block, when receiving a request packet, the edge node checks the request packet, stores service data in the request packet into a memory pool after the check is completed, and updates a hash tree used for recording input information; then, updating the update time stamp to the time of receiving the input information, trying different random numbers, and calculating the characteristic value for a plurality of times, so that the calculated characteristic value can meet the following formula:
SHA256(SHA256(version+prev_hash+merkle_root+ntime+nbits+x))<TARGET
Wherein SHA256 is a eigenvalue algorithm used to calculate eigenvalues; version number is version information of related block protocol in corresponding block chain; the prev_hash is the block header characteristic value of the parent block of the current block; merkle _root is a characteristic value of input information; ntime is the update time of the update timestamp; the nbits is the current difficulty, is a fixed value in a period of time, and is determined again after exceeding a fixed period of time; x is a random number; TARGET is a eigenvalue threshold that can be determined from nbits. Thus, when the random number meeting the formula is calculated, the information can be correspondingly stored to generate the block head and the block main body, and the current block is obtained.
In this embodiment, the block characteristic value is calculated by using different hash algorithms, so as to generate the current block of the service data, thereby effectively improving the security of the block data.
In one embodiment, writing the current block into the target blockchain includes: acquiring the block height of a target test chain; and writing the current block into a block account book of the target test chain according to the block height, so that a plurality of test link points in the target test chain store the current block.
After receiving a service request sent by a service participant terminal, the edge node determines a corresponding target test chain identification according to the service identification, and performs authority verification on the service request, so that authority verification information of the service request can be effectively generated. After generating a current block corresponding to the request packet, distributing the current block to a plurality of test chain nodes in a target test chain, so that a consensus node in the test chain performs consensus verification on the current block; when the consensus verification passes, the current block is stored to the local cache and written into the test chain.
The local repository may be a local repository of a test chain node server in a test chain, for example, a hard disk database in a server. Each test chain node in the test chain has a respective local repository.
When the edge node stores the current block into the local cache library, the edge node obtains the cache height of the current block according to the target blockchain identifier, and stores the current block into the cache library according to the cache height. The cache height of the current block may be a block height determined by a common node in the target blockchain that shares the current block.
After the edge node stores the current block into the local cache library, the edge node writes the current block into the test chain. Specifically, after the current block is successfully stored in the edge node, the current block is broadcasted in the test chain, and each node in the test chain is informed that the current block is authenticated in a consensus way, so that billing can be performed. The edge node can acquire the block height corresponding to the current block, broadcast the current block according to the block height and write the current block into a block account book of a target block chain, so that the test link points in the test chain write the current block into the block account book corresponding to the respective node according to the block height, namely, write the current block into a remote distributed storage library corresponding to the target test chain. The current block after passing the common identification verification is written into the distributed storage library corresponding to the test chain, so that the effectiveness of block storage is effectively ensured.
In one embodiment, verifying the current block in the local cache library and the test chain, obtaining block verification information includes: obtaining a cache height and a block height corresponding to a current block; detecting the writing state of the current block according to the cache height and the block height; and generating corresponding block verification information according to the writing state of the current block.
The cache height is the block height of the target test chain stored in the local cache library of the edge node in real time, and the block height is the block height of the target test chain in the distributed storage library. Typically, after the block accounting and storage is successful, the cache height and block height corresponding to the block in the target test chain are consistent. However, in some abnormal situations, such as network abnormality, node abnormality, etc., block accounting and storage failure may be caused, and at this time, the cache height and the block height corresponding to the block in the target test chain may not be consistent. The edge node can check whether the block is successfully written according to the cache height and the block height.
After receiving the service request, the edge node determines a corresponding target test chain identifier according to the service identifier, performs authority verification on the service request and generates corresponding authority verification information. The edge node generates a current block corresponding to the request packet, distributes the current block to a plurality of test chain nodes in the target test chain, and enables a consensus node in the test chain to perform consensus verification on the current block; when the consensus verification passes, the current block is stored to the local cache and written into the test chain.
When the edge node stores the current block into the local cache library, the cache height of the current block is obtained according to the target test chain identification, and the current block is stored into the cache library according to the cache height. The edge node can also acquire the block height corresponding to the current block, broadcast the current block according to the block height and write the current block into the block account book of the target test chain, so that the test link points in the test chain write the current block into the block account book corresponding to the respective node according to the block height.
After the edge node stores the current block locally and writes it into the target test chain, it needs to check the consistency of the local cache and the current block stored in the test chain.
Specifically, the edge node obtains the cache height corresponding to the current block in the local cache library according to the target test chain identifier, obtains the block height corresponding to the current block in the target test chain, and detects the writing state of the block according to the cache height and the block height. When the cache height in the cache bank is consistent with the block height of the target blockchain, the writing state of the block is successful in writing, namely the block is successfully stored synchronously. When the cache height in the cache bank is inconsistent with the block height of the target blockchain, or when the current block does not exist in the target test chain, the block is lost or the storage fails, and the writing state of the block is writing failure.
Further, the edge node may also verify the current block using both the block height and the block hash value. When the cache height corresponding to the current block is consistent with the block height, the edge node further verifies whether the hash value of the current block in the local cache library is consistent with the hash value of the current block in the test chain account book, and if the corresponding hash values are consistent, the stored current block is indicated to be consistent.
And the edge node generates corresponding block verification information according to the writing state of the current block and the hash value verification information. By verifying the stored block, the storage result of the block can be effectively tested, and thus the block verification information can be effectively obtained.
In one embodiment, the test link point comprises a master node and a plurality of slave nodes, the method further comprising: the master node polls the current load weights of the plurality of slave nodes to obtain the current load weight of each slave node; selecting a corresponding slave node identifier for the service request according to the current load weight of each slave node; sending the service request to the corresponding slave node according to the selected slave node identifier, so that the corresponding slave node processes the service request; and acquiring a load pressure index for processing the service request by the slave node, and adding the load pressure index into the test result information.
Load balancing refers to balancing and distributing loads (work tasks) to a plurality of operation units to run, such as an FTP server, a Web server, an enterprise core application server, other main task servers and the like, so as to cooperatively complete the work tasks. The load balancing is built on the original network structure, and the method is transparent, low in cost and effective, and can expand the bandwidth of the server and the network equipment, strengthen the data processing capacity of the network, increase the throughput and improve the usability and flexibility of the network. The current load weight of a node may represent the current load pressure value of the node, the weight index of the node, and so on.
A plurality of server nodes can be deployed in a test environment built in the block chain service platform, and service requests can be divided by the deployed plurality of server nodes so as to relieve data processing pressure of the server. Each test chain node in the test chain may comprise a master node and a plurality of slave nodes, i.e. the edge nodes also comprise a master node and a slave node.
After the edge node receives the service request sent by the service participant terminal, the edge node can respectively send the service request to a plurality of slave nodes for processing. Specifically, the master node of the edge node polls the current load weights of the plurality of slave nodes to obtain the current load weight of each slave node. And the master node selects corresponding slave node identifiers for the plurality of service requests according to the current load weight of each slave node in the cluster.
And the master node performs smoothing processing on the current load weight corresponding to the selected slave node identifier, and selects the slave node identifier corresponding to the next service request or task to be processed by utilizing the smoothed result until the corresponding slave node identifier is selected for a plurality of service requests or tasks to be processed. And the master node sequentially sends the plurality of service requests or tasks to be processed to the corresponding slave nodes according to the selected slave node identifiers, so that the plurality of slave nodes respectively call the corresponding thread queues to process the plurality of service requests, and a large number of service requests are synchronously processed in parallel.
The resource consumption of the slave nodes which are currently allocated with a plurality of service requests or tasks to be processed can be counteracted through smoothing processing, and the repeated calculation of the load weight is prevented, so that the load balance of a plurality of slave nodes in the cluster is achieved. Therefore, a plurality of slave nodes in the cluster can respectively process a plurality of service requests in parallel, and the processing efficiency of the service requests is effectively improved.
The edge node may monitor the load pressure status of each slave node and monitor metrics, where the monitor metrics may include a number of connections, request response time, incoming broadband, outgoing broadband, etc. a plurality of metrics data may be used. After the edge node distributes the service request sent by the service participant to the corresponding slave node, the slave node can monitor a plurality of load pressure indexes in the process of processing the service request in real time, and the load pressure indexes are added into the test result information. By monitoring the load pressure of the edge node when processing the service request, the processing performance of the node can be effectively tested.
In one embodiment, the method further comprises: monitoring the request frequency of the user identification initiating service request; and generating an access security index according to the request frequency of the user identification, and adding the access security index into the test result information.
Wherein the access security index may be test information for representing access security of the user. The access security index may include a plurality of index information such as a request frequency index for monitoring the user identifier, an upper threshold value of the request frequency, and access security of the request based on the user identifier. The block chain service system can be further provided with a filter and an interceptor, wherein the filter is used for monitoring the request frequency and judging whether the request frequency reaches the upper limit. The interceptor is used for intercepting the requests with the request frequency reaching the upper limit. The same user sends a large number of requests in a short time, for example 50 requests in 10 seconds, 5 times a second on average, which may be abnormal. When a user frequently sends a large number of requests, on one hand, a large amount of server resources are consumed, on the other hand, the server is likely to crash, and the risk of DDOS (Distributed Denial of Service, distributed denial of service attack) exists.
After the edge node receives the service request sent by the service participant terminal, the frequency of the request corresponding to the user identification of the service participant is monitored through a filter deployed in the node. Specifically, the edge node may accumulate the request frequency of the user identifier according to the IP address and URL parameters by acquiring parameters such as the IP address (Internet Protocol, protocol of interconnection between networks) of the service request, URL (uniform resource locator), and the like. And the edge node generates an access security index according to the request frequency of the user identifier and adds the access security index to the test result information. The edge node can also calculate index information of the access security of the request of the user identifier according to the request frequency of the user identifier, further generate an access security index by using the request frequency index of the user identifier, the upper limit threshold of the request frequency, a plurality of index information such as the access security of the request based on the user identifier and the like, and add the access security index to the test result information. By monitoring the user request, the safety of the user request can be effectively tested, and safety performance test information based on the service request in the test chain can be effectively obtained.
In one embodiment, the method further comprises: when the request frequency of the user identification reaches the upper threshold, intercepting the service request of the user identification, and adding the user identification to the restriction list.
The upper threshold may be an index preset for the request frequency of the user, and when the request frequency reaches the upper threshold, the risk of the request frequency of the corresponding user is indicated.
After receiving a service request sent by a service participant terminal, the edge node continuously monitors the request of the user identifier through a filter and accumulates the request frequency corresponding to the user identifier. When the request frequency of the user identifier reaches a preset upper threshold, the edge node calls an interceptor to intercept the service request corresponding to the user identifier. After intercepting the corresponding service request, the edge node can also redirect the currently accessed page of the user identifier to a preset error page and prohibit access.
The edge node may further add the user identification to a restricted list, where the user identification recorded in the restricted list is the user currently restricted from accessing the related business service.
After being forbidden to access the corresponding business service, the edge node can still generate an access security index according to the index of the request frequency of the user identifier, the upper limit threshold of the request frequency, the access security based on the request of the user identifier and other index information, add the access security index to the test result information, and return the test result information to the business participant terminal. Through monitoring the request of the user and intercepting the request with risk, the safety of the request of the user can be effectively tested, and meanwhile, the safety of the block chain service platform can be effectively ensured.
In one embodiment, the method further comprises: receiving an application creation request sent by a service participant terminal based on test result information, wherein the application creation request carries requirement information; and sending an application creation request to a service building platform, enabling the application building platform to deploy block chain nodes according to the demand information, packaging according to the block chain nodes to generate corresponding image files, deploying corresponding block chain applications in a block chain service platform by utilizing the image files, and publishing the block chain applications.
The application may be an application program deployed at a terminal or a Web application program accessible through the Web, and may include a personal user application and an enterprise-level application. The application building platform can be a service platform for building the application, and the application building platform comprises a plurality of nodes, for example, research and development nodes, test nodes, operation and maintenance nodes and the like, and is used for cooperatively building the application corresponding to the corresponding requirement.
After receiving the service request, the edge node determines a corresponding target test chain identifier according to the service identifier, performs authority verification on the service request and generates corresponding authority verification information. The edge node generates a current block corresponding to the request packet, distributes the current block to a plurality of test chain nodes in the target test chain, and enables a consensus node in the test chain to perform consensus verification on the current block; when the consensus verification passes, the current block is stored to the local cache and written into the test chain. And checking the current block in the local cache library and the test chain to obtain block check information, and generating test result information according to the authority check information and the block check information, thereby effectively obtaining process test information for recording the processing of the service request by the block chain service platform.
The test result information may be used for reference information of the business participant for the blockchain-based application to be created. After receiving the test result information returned by the block chain service platform, the service participant terminal can assist in generating the requirement information corresponding to the application to be created according to the test result information.
In another embodiment, the service participant terminal may further generate the required document information of the application to be created in advance, and after the test result information is obtained, may further perform processing such as modification on the required document according to the test result information, so as to perfect the required document information of the application to be created, thereby creating a corresponding blockchain application according to the perfect required document information.
After the service participant terminal generates the requirement information corresponding to the application to be created, an application creation request can be sent to the blockchain service platform according to the requirement information. And after receiving the application creation request sent by the service participant terminal, the edge node of the blockchain service platform forwards the application creation request to the application construction platform. After receiving the application creation request, the nodes in the application building platform analyze the demand information, deploy corresponding block chain nodes according to the analyzed demand information, and package and generate corresponding image files according to the block chain nodes. And the nodes in the application building platform deploy corresponding blockchain applications on the blockchain service platform by using the mirror image files. Further, the application building platform can also test the deployed blockchain application process, and when the test passes, the blockchain application is issued.
In the embodiment, the requirement information for creating the blockchain application is generated in an auxiliary manner according to the test result information, so that problems possibly occurring in the process of creating the blockchain application can be effectively solved, the test efficiency in the process of creating the blockchain application can be effectively improved, the test cost is effectively saved, and the creation efficiency and the test efficiency of the blockchain service can be effectively improved.
In one embodiment, FIG. 6 is a flow chart of a blockchain-based testing method in an embodiment. As shown in fig. 6, the blockchain-based testing method specifically includes the following steps:
step 602, a service request triggered by a service participant terminal based on a test service entry page is received, wherein the service request carries a user identifier and a request packet.
And step 604, determining a corresponding target test chain identifier from a plurality of block chains according to the service identifier in the request packet, and performing authority verification on the request packet and the target test chain identifier to obtain authority verification information.
Step 606, generating a current block corresponding to the request packet according to the target test chain identifier, and distributing the current block to a plurality of test chain nodes corresponding to the target test chain identifier, so that the common node in the test chain performs common-identification verification on the current block.
Step 608, when the consensus verification is passed, the current block is stored in the local cache and written into the test chain.
Step 610, checking the local cache library and the current block in the test chain to obtain block check information; and generating test result information according to the authority check information and the block check information.
Step 612, a load pressure index of the slave node for processing the service request is obtained, and the load pressure index is added to the test result information.
Step 614, monitoring the request frequency of the user identifier initiating the service request; and generating an access security index according to the request frequency of the user identification, and adding the access security index into the test result information.
And 616, returning the test result information to the test page of the service participant terminal for display.
Step 618, receiving an application creation request sent by the service participant terminal based on the test result information, wherein the application creation request carries the requirement information;
And step 620, sending an application creation request to an application building platform, enabling the application building platform to deploy block chain nodes according to the demand information, packaging according to the block chain nodes to generate corresponding image files, deploying corresponding block chain applications in a block chain service platform by utilizing the image files, and publishing the block chain applications.
In a particular embodiment, referring to FIG. 7, FIG. 7 is a timing diagram of a blockchain-based testing method in one embodiment. As shown in fig. 7, after receiving a service request triggered by a service participant terminal based on a test service entry page, an edge node determines a corresponding target test chain identifier from a plurality of blockchains according to the service identifier, and performs authority verification on a request packet and the target test chain identifier to obtain authority verification information. And the edge node generates a current block corresponding to the request packet according to the target test chain identifier, and distributes the current block to a plurality of test chain nodes corresponding to the target test chain identifier, so that the common node in the test chain performs common-identification verification on the current block. And after the common identification verification is passed, storing the current block into a local cache library, and writing the current block into a test chain. Checking the current block in the local cache library and the test chain to obtain block checking information; and generating test result information according to the authority check information and the block check information.
Fig. 3-6 are flow diagrams of a blockchain-based testing method in one embodiment. It should be understood that, although the steps in the flowcharts of fig. 3-6 are shown in order as indicated by the arrows, these steps are not necessarily performed in order as indicated by the arrows. The steps are not strictly limited to the order of execution unless explicitly recited herein, and the steps may be executed in other orders. Moreover, at least some of the steps in fig. 3-6 may include multiple sub-steps or stages that are not necessarily performed at the same time, but may be performed at different times, nor does the order in which the sub-steps or stages are performed necessarily occur sequentially, but may be performed alternately or alternately with at least a portion of the sub-steps or stages of other steps or other steps.
In one embodiment, as shown in FIG. 8, a blockchain-based testing device 800 is provided, the device including a request receiving module 802, a rights checking module 804, a block processing module 806, a data storage module 808, a block checking module 810, and a test result generating module 812, wherein:
A request receiving module 802, configured to receive a service request triggered by a service participant terminal based on a test service entry page, where the service request carries a user identifier and a request packet;
the permission checking module 804 is configured to determine a corresponding target test chain identifier from a plurality of blockchains according to a service identifier in the request packet, and perform permission checking on the request packet and the target test chain identifier to obtain permission checking information;
The block processing module 806 is configured to generate a current block corresponding to the request packet according to the target test chain identifier, and distribute the current block to a plurality of test chain nodes corresponding to the target test chain identifier, so that a consensus node in the test chain performs consensus verification on the current block;
The data storage module 808 is configured to store the current block to the local cache library and write the current block into the test chain after the common identification passes;
the block verification module 810 is configured to verify the local cache library and a current block in the test chain to obtain block verification information;
And the test result generating module 812 is configured to generate test result information according to the authority verification information and the block verification information, and return the test result information to the test page of the service participant terminal for display.
In one embodiment, the target test chain identifier is a test chain corresponding to a service type, the test chain is a test chain application established and issued by the blockchain service platform according to configured test information and a test environment, and the test chain comprises a plurality of blockchain nodes.
In one embodiment, the permission verification module 804 is further configured to obtain an accessible node identifier associated with the user identifier, and verify whether the accessible node identifier includes the target node identifier obtained by parsing; when the accessible node identifier comprises a target test chain identifier, determining that the user identifier has access rights to the target test chain; acquiring corresponding key information according to the user identifier, and carrying out signature verification on the request packet by utilizing the key information to obtain signature verification information; generating rights verification information by using the access rights and the signature verification information.
In one embodiment, the block processing module 806 is further configured to extract signature information corresponding to the user identifier from the data table according to the data table corresponding to the service identifier; calculating the service data and the signature information of the user by adopting different hash algorithms respectively to obtain hash values of at least two parts of data; splicing hash values of at least two parts of data to obtain a characteristic value of a current block; and generating the current block according to the service data, the signature information, the characteristic value of the previous block in the target block chain and the characteristic value of the current block.
In one embodiment, the block processing module 806 is further configured to obtain a block height of the target test chain; and writing the current block into a block account book of the target test chain according to the block height, so that a plurality of test link points in the target test chain store the current block.
In one embodiment, the block verification module 810 is further configured to obtain a cache height and a block height corresponding to the current block; detecting the writing state of the current block according to the cache height and the block height; and generating corresponding block verification information according to the writing state of the current block.
In one embodiment, the test link point includes a master node and a plurality of slave nodes, and the test result generating module 812 is further configured to poll the current load weights of the plurality of slave nodes by the master node to obtain the current load weight of each slave node; selecting a corresponding slave node identifier for the service request according to the current load weight of each slave node; sending the service request to the corresponding slave node according to the selected slave node identifier, so that the corresponding slave node processes the service request; and acquiring a load pressure index for processing the service request by the slave node, and adding the load pressure index into the test result information.
In one embodiment, the test result generating module 812 is further configured to monitor a request frequency of the user identifier initiating the service request; and generating an access security index according to the request frequency of the user identification, and adding the access security index into the test result information.
In one embodiment, the request receiving module 802 is further configured to intercept the service request of the user identifier and add the user identifier to the restriction list when the request frequency of the user identifier reaches the upper threshold.
In one embodiment, as shown in fig. 9, the blockchain-based testing device 800 further includes an application creation module 814, configured to receive an application creation request sent by the service participant terminal based on the test result information, where the application creation request carries requirement information;
And sending an application creation request to an application building platform, enabling the application building platform to deploy block chain nodes according to the demand information, packaging according to the block chain link points to generate corresponding image files, deploying corresponding block chain applications in a block chain service platform by utilizing the image files, and publishing the block chain applications.
FIG. 10 illustrates an internal block diagram of a computer device in one embodiment. The computer device may be specifically a server in the blockchain service platform 120 of fig. 1. As shown in fig. 10, the computer device includes a processor, a memory, a network interface, an input device, and a display screen connected by a system bus. The memory includes a nonvolatile storage medium and an internal memory. The non-volatile storage medium of the computer device stores an operating system and may also store a computer program that, when executed by the processor, causes the processor to implement a blockchain-based testing method. The internal memory may also have stored therein a computer program which, when executed by the processor, causes the processor to perform a blockchain-based testing method. The display screen of the computer equipment can be a liquid crystal display screen or an electronic ink display screen, the input device of the computer equipment can be a touch layer covered on the display screen, can also be keys, a track ball or a touch pad arranged on the shell of the computer equipment, and can also be an external keyboard, a touch pad or a mouse and the like.
It will be appreciated by those skilled in the art that the structure shown in FIG. 10 is merely a block diagram of some of the structures associated with the present inventive arrangements and is not limiting of the computer device to which the present inventive arrangements may be applied, and that a particular computer device may include more or fewer components than shown, or may combine some of the components, or have a different arrangement of components.
In one embodiment, the blockchain-based testing device provided by the present application may be implemented in the form of a computer program that is executable on a computer device as shown in fig. 10. The memory of the computer device may store various program modules that make up the blockchain-based testing device, such as request receiving module 802, entitlement checking module 804, block processing module 806, data storage module 808, block verification module 810, and test result generation module 812 shown in fig. 8. The computer program of each program module causes the processor to perform the steps in the blockchain-based testing method of the various embodiments of the application as described in this specification.
For example, the computer device shown in FIG. 10 may perform step 302 by the request receiving module 802 in the blockchain-based testing device shown in FIG. 8. The computer device may perform step 304 through the rights verification module 804. The computer device may perform step 306 by block processing module 806. The computer device may perform step 308 via the data storage module 808. The computer device may perform step 310 through block verification module 810. The computer device may execute step 312 via test result generation module 812.
In one embodiment, a computer device is provided that includes a memory and a processor, the memory storing a computer program that, when executed by the processor, causes the processor to perform the steps of the blockchain-based testing method described above. The steps of the blockchain-based testing method herein may be steps in the blockchain-based testing method of the various embodiments described above.
In one embodiment, a computer readable storage medium is provided, storing a computer program that, when executed by a processor, causes the processor to perform the steps of the blockchain-based testing method described above. The steps of the blockchain-based testing method herein may be steps in the blockchain-based testing method of the various embodiments described above.
Those skilled in the art will appreciate that all or part of the processes in the methods of the above embodiments may be implemented by a computer program for instructing relevant hardware, where the program may be stored in a non-volatile computer readable storage medium, and where the program, when executed, may include processes in the embodiments of the methods described above. Any reference to memory, storage, database, or other medium used in embodiments provided herein may include non-volatile and/or volatile memory. The nonvolatile memory can include Read Only Memory (ROM), programmable ROM (PROM), electrically Programmable ROM (EPROM), electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double Data Rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (SYNCHLINK) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), among others.
The technical features of the above embodiments may be arbitrarily combined, and all possible combinations of the technical features in the above embodiments are not described for brevity of description, however, as long as there is no contradiction between the combinations of the technical features, they should be considered as the scope of the description.
The foregoing examples illustrate only a few embodiments of the application and are described in detail herein without thereby limiting the scope of the application. It should be noted that it will be apparent to those skilled in the art that several variations and modifications can be made without departing from the spirit of the application, which are all within the scope of the application. Accordingly, the scope of protection of the present application is to be determined by the appended claims.

Claims (20)

1. A blockchain-based testing method, comprising:
receiving a service request triggered by a service participant terminal based on a test service entry page, wherein the service request carries a user identifier and a request packet;
Determining corresponding target test chain identifiers from a plurality of block chains according to service identifiers in the request packet, and performing authority verification on the request packet and the target test chain identifiers to obtain authority verification information;
generating a current block corresponding to the request packet according to the target test chain identifier, and distributing the current block to a plurality of test chain nodes corresponding to the target test chain identifier, so that a consensus node in the plurality of test chain nodes performs consensus verification on the current block;
When the common identification verification is passed, storing the current block into a local cache library, and writing the current block into a target test chain;
obtaining a cache height and a block height corresponding to the current block;
Detecting the writing state of the current block according to the cache height and the block height;
Generating corresponding block verification information according to the writing state of the current block;
And generating test result information according to the authority verification information and the block verification information, and returning the test result information to a test page of the service participant terminal for display.
2. The method of claim 1, wherein the target test case corresponding to the target test chain identifier corresponds to a service type, the target test chain is a test chain application established and issued by a blockchain service platform on the blockchain service platform according to configured test information and a test environment, and the target test chain includes a plurality of blockchain nodes.
3. The method of claim 1, wherein determining a corresponding target test chain identifier from a plurality of blockchains according to the service identifier in the request packet, performing authority verification on the request packet and the target test chain identifier, and obtaining authority verification information includes:
acquiring an accessible node identifier associated with the user identifier, and verifying whether the accessible node identifier contains a target node identifier obtained by analysis;
When the accessible node identifier comprises the target test chain identifier, determining that the user identifier has access rights to the target test chain;
Acquiring corresponding key information according to the user identifier, and performing signature verification on the request packet by utilizing the key information to obtain signature verification information;
and generating rights verification information by using the access rights and the signature verification information.
4. The method of claim 1, wherein the generating the current block corresponding to the request packet comprises:
identifying a corresponding data table according to the service mark, and extracting signature information corresponding to the user mark from the data table;
calculating the service data of the user and the signature information by adopting different hash algorithms respectively to obtain a hash value;
Splicing the obtained hash values to obtain the characteristic value of the current block;
And generating the current block according to the service data, the signature information, the characteristic value of the previous block in the target test chain and the characteristic value of the current block.
5. The method of claim 1, wherein the writing the current block into the target test chain comprises:
Acquiring the block height of the target test chain;
And writing the current block into a block account book of the target test chain according to the block height, so that a plurality of test chain nodes in the target test chain store the current block.
6. The method of claim 1, wherein the test chain node comprises a master node and a plurality of slave nodes, the method further comprising:
the master node polls the current load weights of the plurality of slave nodes to obtain the current load weight of each slave node;
selecting a corresponding slave node identifier for the service request according to the current load weight of each slave node;
sending the service request to the corresponding slave node according to the selected slave node identifier, so that the corresponding slave node processes the service request;
And acquiring a load pressure index of processing the service request by the slave node, and adding the load pressure index into the test result information.
7. The method according to claim 1, wherein the method further comprises:
monitoring the request frequency of the user identification initiating service request;
and generating an access security index according to the request frequency of the user identifier, and adding the access security index into the test result information.
8. The method of claim 7, wherein the method further comprises:
when the request frequency of the user identifier reaches an upper threshold, intercepting the service request of the user identifier, and adding the user identifier to a restricted list.
9. The method according to any one of claims 1 to 8, further comprising:
Receiving an application creation request sent by the service participant terminal based on the test result information, wherein the application creation request carries requirement information;
And sending the application creation request to an application construction platform, enabling the application construction platform to deploy a blockchain node according to the requirement information, packaging according to the blockchain node to generate a corresponding mirror image file, deploying the corresponding blockchain application on the blockchain service platform by utilizing the mirror image file, and publishing the blockchain application.
10. A blockchain-based testing device, the device comprising:
The request receiving module is used for receiving a service request triggered by the service participant terminal based on the test service entry page, wherein the service request carries a user identifier and a request packet;
The permission checking module is used for determining corresponding target test chain identifiers from a plurality of block chains according to service identifiers in the request packet, and performing permission checking on the request packet and the target test chain identifiers to obtain permission checking information;
the block processing module is used for generating a current block corresponding to the request packet according to the target test chain identifier, distributing the current block to a plurality of test chain nodes corresponding to the target test chain identifier, and enabling consensus nodes in the plurality of test chain nodes to perform consensus verification on the current block;
The data storage module is used for storing the current block into a local cache library and writing the current block into a target test chain after the common identification verification is passed;
The block checking module is used for acquiring the cache height and the block height corresponding to the current block; detecting the writing state of the current block according to the cache height and the block height; generating corresponding block verification information according to the writing state of the current block;
and the test result generation module is used for generating test result information according to the authority verification information and the block verification information, and returning the test result information to the test page of the service participant terminal for display.
11. The apparatus of claim 10, wherein the target test case corresponding to the target test chain identifier corresponds to a service type, the target test chain is a test chain application established and published by a blockchain service platform on the blockchain service platform according to configured test information and a test environment, and the target test chain includes a plurality of blockchain nodes.
12. The apparatus of claim 10, wherein the permission verification module is further configured to obtain an accessible node identifier associated with the user identifier, and verify whether the accessible node identifier includes a target node identifier obtained by parsing; when the accessible node identifier comprises the target test chain identifier, determining that the user identifier has access rights to the target test chain; acquiring corresponding key information according to the user identifier, and performing signature verification on the request packet by utilizing the key information to obtain signature verification information; and generating rights verification information by using the access rights and the signature verification information.
13. The apparatus of claim 10, wherein the block processing module is further configured to identify a corresponding data table according to the service identifier, and extract signature information corresponding to the user identifier from the data table; calculating the service data of the user and the signature information by adopting different hash algorithms respectively to obtain a hash value; splicing the obtained hash values to obtain the characteristic value of the current block; and generating the current block according to the service data, the signature information, the characteristic value of the previous block in the target test chain and the characteristic value of the current block.
14. The apparatus of claim 10, wherein the block processing module is further configured to obtain a block height of the target test chain; and writing the current block into a block account book of the target test chain according to the block height, so that a plurality of test chain nodes in the target test chain store the current block.
15. The apparatus of claim 10, wherein the test chain node comprises a master node and a plurality of slave nodes, the master node configured to poll current load weights of the plurality of slave nodes to obtain the current load weight of each slave node; selecting a corresponding slave node identifier for the service request according to the current load weight of each slave node; sending the service request to the corresponding slave node according to the selected slave node identifier, so that the corresponding slave node processes the service request; and acquiring a load pressure index of processing the service request by the slave node, and adding the load pressure index into the test result information.
16. The apparatus of claim 10, wherein the test result generation module is further configured to monitor a request frequency of the user identification initiating service requests; and generating an access security index according to the request frequency of the user identifier, and adding the access security index into the test result information.
17. The apparatus of claim 16, wherein the request receiving module is further configured to intercept the service request of the user identifier and add the user identifier to a restricted list when the request frequency of the user identifier reaches an upper threshold.
18. The apparatus according to any one of claims 10 to 17, further comprising: the application creation module is used for receiving an application creation request sent by the service participant terminal based on the test result information, wherein the application creation request carries requirement information; and sending the application creation request to an application construction platform, enabling the application construction platform to deploy a blockchain node according to the requirement information, packaging according to the blockchain node to generate a corresponding mirror image file, deploying the corresponding blockchain application on the blockchain service platform by utilizing the mirror image file, and publishing the blockchain application.
19. A computer readable storage medium storing a computer program which, when executed by a processor, causes the processor to perform the steps of the method of any one of claims 1 to 9.
20. A computer device comprising a memory and a processor, the memory storing a computer program that, when executed by the processor, causes the processor to perform the steps of the method of any of claims 1 to 9.
CN201910871913.3A 2019-09-16 Block chain-based test method, device, storage medium and computer equipment Active CN110598446B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910871913.3A CN110598446B (en) 2019-09-16 Block chain-based test method, device, storage medium and computer equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910871913.3A CN110598446B (en) 2019-09-16 Block chain-based test method, device, storage medium and computer equipment

Publications (2)

Publication Number Publication Date
CN110598446A CN110598446A (en) 2019-12-20
CN110598446B true CN110598446B (en) 2024-06-28

Family

ID=

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106899680A (en) * 2017-03-09 2017-06-27 上海亿账通区块链科技有限公司 The burst treating method and apparatus of multi-tiling chain
CN107493340A (en) * 2017-08-23 2017-12-19 广州市易彩乐网络科技有限公司 Data distribution method of calibration in block chain network, apparatus and system

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106899680A (en) * 2017-03-09 2017-06-27 上海亿账通区块链科技有限公司 The burst treating method and apparatus of multi-tiling chain
CN107493340A (en) * 2017-08-23 2017-12-19 广州市易彩乐网络科技有限公司 Data distribution method of calibration in block chain network, apparatus and system

Similar Documents

Publication Publication Date Title
CN110633323B (en) Service data storage method, device, storage medium and computer equipment
US11122087B2 (en) Managing cybersecurity vulnerabilities using blockchain networks
AU2020414467B2 (en) Partially-ordered blockchain
CN110633963B (en) Electronic bill processing method, electronic bill processing device, computer readable storage medium and computer readable storage device
Suzuki et al. Blockchain as an audit-able communication channel
CN110032545A (en) File memory method, system and electronic equipment based on block chain
CN111444550A (en) Block chain-based service data verification method and device and readable storage medium
CN112527912B (en) Data processing method and device based on block chain network and computer equipment
CN112667748B (en) Block chain all-in-one machine facing audit service, data processing method and device
CN110990883A (en) Data access method, data access device, computer-readable storage medium and computer equipment
Lin et al. Consortium blockchain-based public integrity verification in cloud storage for IoT
Tate et al. Multi-user dynamic proofs of data possession using trusted hardware
CN111368340A (en) Block chain-based evidence-based security verification method and device and hardware equipment
CN110908786A (en) Intelligent contract calling method, device and medium
Abraham et al. Qualified eID derivation into a distributed ledger based IdM system
CN112448946A (en) Log auditing method and device based on block chain
Ulybyshev et al. (WIP) blockhub: Blockchain-based software development system for untrusted environments
CN110597541A (en) Interface updating processing method, device, equipment and storage medium based on block chain
CN110851877A (en) Data processing method and device, block chain node point equipment and storage medium
US20210240673A1 (en) Load balancing based blockchain transaction submission
CN111260475A (en) Data processing method, block chain node point equipment and storage medium
JP2020204898A (en) Method, system, and program for managing operation of distributed ledger system
CN112564985A (en) Safe operation and maintenance management method based on block chain
CN110598446B (en) Block chain-based test method, device, storage medium and computer equipment
Benrebbouh et al. Enhanced secure and efficient mutual authentication protocol in iot-based energy internet using blockchain

Legal Events

Date Code Title Description
PB01 Publication
SE01 Entry into force of request for substantive examination
GR01 Patent grant