Block chain test method and device, equipment and medium
By detecting the target stage of the blockchain resource client when executing the transfer business and constructing insufficient asset balance, the problems of low testing efficiency and high cost in the existing technology are solved, and efficient blockchain testing is achieved.
Patent Information
- Application Number
- CN202311216116.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-19
- Publication Date
- 2025-03-21
AI Technical Summary
In the prior art, when performing transfer services, it is difficult for blockchain resource clients to efficiently test whether they can correctly feedback information that the service has not been completed, resulting in low testing efficiency, long process and high cost.
Provide a blockchain testing method. By detecting the target stage of the blockchain resource client when executing the transfer business, if it is in the transaction signature acquisition stage, it will automatically transfer assets to another account, construct the situation of insufficient asset balance, and detect whether the client outputs prompt information to remind the business that it has not been executed.
It realizes efficient testing of blockchain resource clients, shortens the time-consuming test process, reduces the cost of blockchain testing, and can stably construct scenarios with insufficient asset balance.
Smart Images

Figure CN119669047A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of testing technology, and in particular to a blockchain testing method, device, equipment and medium. Background Art
[0002] Currently, with the development of blockchain technology, various related applications are being used more and more widely. Among them, the blockchain resource client is a tool for managing and storing digital assets. It is one of the key applications of blockchain technology, allowing users to safely store and manage their digital assets and trade with other objects.
[0003] In the related art, the blockchain resource client is generally implemented in the form of an application. Users can use the blockchain resource client to implement asset transfer services. In actual applications, it is found that due to the large number of concurrent or client-side transactions of digital assets, during the execution of the transfer business, the asset balance may be sufficient when the transfer business is initiated, but the asset balance is insufficient when the transfer business is on the chain. Therefore, it is necessary to test the blockchain resource client to determine whether it can correctly feedback the information that the relevant business has not been completed. The commonly used testing method at present is often to write a stress test script to execute the transfer business, and use a large amount of random data to simulate the triggering of insufficient asset balance. This method has low testing efficiency, lengthy processes, and requires the preparation of a stress test environment and the writing of a stress test script, which has a high implementation cost.
[0004] In summary, the technical problems existing in the relevant technologies need to be improved. Summary of the invention
[0005] The embodiments of the present application provide a blockchain testing method, apparatus, equipment and medium, which can facilitate efficient testing of blockchain resource clients, help shorten the testing process time and reduce blockchain testing costs.
[0006] An aspect of an embodiment of the present application provides a blockchain testing method, the method comprising:
[0007] Detecting a target stage of the blockchain resource client when executing a first transfer business of a first account;
[0008] If the target stage is the transaction signature acquisition stage, the assets of the first account are transferred to the second account;
[0009] Detecting whether the blockchain resource client outputs a first prompt message at the front end; the first prompt message is used to remind the first account that the first transfer business has not been completed;
[0010] If the blockchain resource client does not output the first prompt information at the front end, it is determined that the blockchain resource client test fails.
[0011] On the other hand, an embodiment of the present application provides a blockchain testing device, the device comprising:
[0012] A first detection unit, configured to detect a target stage at which the blockchain resource client is in when executing a first transfer service of a first account;
[0013] A transfer unit, configured to transfer the assets of the first account to a second account if the target stage is a transaction signature acquisition stage;
[0014] A second detection unit is used to detect whether the blockchain resource client outputs a first prompt message at the front end; the first prompt message is used to remind the first account that the first transfer business has not been completed;
[0015] The processing unit is used to determine that the blockchain resource client test fails if the blockchain resource client does not output the first prompt information at the front end.
[0016] Optionally, the first transfer service is triggered by the following steps:
[0017] The blockchain resource client detects a touch screen operation of the target object, and executes the first transfer service according to the touch screen operation;
[0018] Alternatively, the blockchain resource client obtains the voice data of the target object, performs voice recognition on the voice data, and executes the first transfer service according to the result of the voice recognition.
[0019] Optionally, the trigger unit is specifically configured to:
[0020] Sending a login request for the first account to the blockchain resource client;
[0021] When it is determined that the first account login is completed, a first transfer request is generated; wherein the first transfer request includes a target account, a target asset category and an asset amount corresponding to the first transfer service;
[0022] The first transfer request is sent to the blockchain resource client, so that the blockchain resource client executes a first transfer service of the first account.
[0023] Optionally, the trigger unit is specifically used for:
[0024] When it is determined that the first account login is completed, detecting the asset balance corresponding to each asset category of the first account;
[0025] Determine a target asset category corresponding to the first transfer business from the asset categories, and determine a first asset amount corresponding to the first transfer business according to the asset balance corresponding to the target asset category; wherein the first asset amount is less than or equal to the asset balance corresponding to the target asset category;
[0026] The first transfer request is generated according to a preset target account, the target asset category, and the first asset amount.
[0027] Optionally, the trigger unit is specifically used for:
[0028] When it is determined that the first account login is completed, detecting the asset balance corresponding to each asset category of the first account;
[0029] Determine a target asset category corresponding to the first transfer business from the asset categories, and determine a second asset amount corresponding to the first transfer business according to the asset balance corresponding to the target asset category; wherein the second asset amount is greater than the asset balance corresponding to the target asset category;
[0030] Generate the first transfer request according to a preset target account, the target asset category, and the second asset amount;
[0031] The device further includes a third detection unit, and the third detection unit is specifically used for:
[0032] Detecting whether the blockchain resource client outputs a second prompt message at the front end; the second prompt message is used to remind the first account that the first transfer business has insufficient asset balance;
[0033] If the blockchain resource client does not output the second prompt information at the front end, it is determined that the blockchain resource client test fails.
[0034] Optionally, the transfer unit is specifically used for:
[0035] Acquire a target asset category corresponding to the first transfer business, and detect an asset balance corresponding to the target asset category in the first account;
[0036] A second transfer service is generated and triggered according to the second account, the target asset category and the asset balance corresponding to the target asset category; wherein the second transfer service is used to transfer all assets of the target asset category in the first account to the second account.
[0037] Optionally, the transfer unit is specifically used for:
[0038] generating a second transfer business according to the second account, the target asset category and the asset balance corresponding to the target asset category;
[0039] Calling the transaction service to obtain the transaction signature corresponding to the second transfer service;
[0040] According to the transaction signature, the second transfer business is put on the chain to transfer all the assets of the target asset category in the first account to the second account.
[0041] The device further includes an acquisition unit, which is specifically configured to:
[0042] Obtaining private key information of the first account;
[0043] The second transfer service is encrypted using the private key information to obtain a transaction signature corresponding to the second transfer service.
[0044] Optionally, the transfer unit is specifically used for:
[0045] Acquire the target asset category and asset amount corresponding to the first transfer business, and detect the asset balance corresponding to the target asset category in the first account;
[0046] determining a third asset amount according to the asset amount corresponding to the first transfer business and the asset balance corresponding to the target asset category; the third asset amount is less than the asset balance corresponding to the target asset category, and the sum of the third asset data and the asset amount corresponding to the first transfer business is greater than the asset balance corresponding to the target asset category;
[0047] A third transfer service is generated and triggered according to the second account, the target asset category and the third asset amount; wherein the third transfer service is used to transfer the assets of the target asset category in the first account by the third asset amount to the second account.
[0048] Optionally, the second detection unit is specifically used to:
[0049] Obtaining the operation log information of the blockchain resource client;
[0050] According to the operation log information, determine whether the blockchain resource client outputs the first prompt information at the front end.
[0051] Optionally, the second detection unit is specifically used to:
[0052] Taking a screenshot of the front-end interface of the blockchain resource client to obtain target image data;
[0053] Detect whether the target image data includes the first prompt information.
[0054] On the other hand, an embodiment of the present application provides an electronic device, including a processor and a memory;
[0055] The memory is used to store computer programs;
[0056] The processor executes the computer program to implement the aforementioned blockchain testing method.
[0057] On the other hand, an embodiment of the present application provides a computer-readable storage medium, which stores a computer program, and the computer program is executed by a processor to implement the aforementioned blockchain testing method.
[0058] An embodiment of the present application also discloses a computer program product, including a computer program, which implements the aforementioned blockchain testing method when executed by a processor.
[0059] The embodiments of the present application include at least the following beneficial effects: The present application provides a blockchain testing method, device, equipment and medium, which detects the target stage of the blockchain resource client when executing the first transfer business of the first account. If the target stage is the transaction signature acquisition stage, it means that the blockchain resource client queries the asset balance of the first account and enters the process of the transfer business normally. At this time, the assets of the first account can be automatically transferred to the second account, and the situation of insufficient asset balance of the first account when the transfer business is on the chain can be constructed. Then, it can be detected whether the blockchain resource client outputs the first prompt information for reminding the first account that the first transfer business has not been completed at the front end, that is, it can be detected whether the blockchain resource client can correctly feedback the information that the relevant business has not been completed. According to the detection result, the performance of the blockchain resource client can be judged. If it is found that the blockchain resource client does not output the first prompt information at the front end, it can be determined that the blockchain resource client test fails. This testing method can realize efficient testing of the blockchain resource client through a convenient automated processing flow, and can stably construct a scenario of insufficient asset balance, which is conducive to shortening the time consumption of the test process and reducing the blockchain testing cost. BRIEF DESCRIPTION OF THE DRAWINGS
[0060] The accompanying drawings are used to provide further understanding of the technical solution of the present application and constitute a part of the specification. Together with the embodiments of the present application, they are used to explain the technical solution of the present application and do not constitute a limitation on the technical solution of the present application.
[0061] Figure 1 A schematic diagram of a front-end interface of a blockchain resource client provided in an embodiment of the present application;
[0062] Figure 2A schematic diagram of a transfer operation interface of a blockchain resource client provided in an embodiment of the present application;
[0063] Figure 3 A schematic diagram of an interface in which a blockchain resource client displays a first prompt message on the front end provided in an embodiment of the present application;
[0064] Figure 4 A schematic diagram of an implementation environment of a blockchain testing method provided in an embodiment of the present application;
[0065] Figure 5 A flowchart of a blockchain testing method provided in an embodiment of the present application;
[0066] Figure 6 A schematic diagram of a process flow when a blockchain resource client performs a transfer service provided in an embodiment of the present application;
[0067] Figure 7 A schematic diagram of an interface in which a blockchain resource client displays second prompt information on the front end provided in an embodiment of the present application;
[0068] Figure 8 A schematic diagram of a process for transferring assets from a first account to a second account provided in an embodiment of the present application;
[0069] Fig. 9 A schematic diagram of another process of transferring assets from a first account to a second account provided in an embodiment of the present application;
[0070] Fig.10 A schematic diagram of the structure of a blockchain testing device provided in an embodiment of the present application;
[0071] Fig.11 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0072] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application is further described in detail below in conjunction with the accompanying drawings and examples. It should be understood that the specific embodiments described herein are only used to explain the present application and are not intended to limit the present application. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the embodiments of the present application. They are only examples of devices and methods consistent with some aspects of the embodiments of the present application as detailed in the attached claims.
[0073] It is understood that the terms "first", "second", etc. used in this application can be used to describe various concepts in this article, but unless otherwise specified, these concepts are not limited by these terms. These terms are only used to distinguish one concept from another concept. For example, without departing from the scope of the embodiment of the present application, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Depending on the context, the words "if" and "if" as used herein can be interpreted as "at the time of" or "when" or "in response to determination".
[0074] The terms "at least one", "multiple", "each", "any", etc. used in this application, at least one includes one, two or more, multiple includes two or more, each refers to each of the corresponding multiple, and any refers to any one of the multiple.
[0075] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein are only for the purpose of describing the embodiments of this application and are not intended to limit this application.
[0076] Before describing the embodiments of the present application in detail, some nouns and terms involved in the embodiments of the present application are first described. The nouns and terms involved in the embodiments of the present application are subject to the following explanations.
[0077] 1) Blockchain is a new application model of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanism, encryption algorithm, etc. Blockchain is essentially a decentralized database, a string of data blocks generated by cryptographic methods. Each data block contains a batch of network transaction information, which is used to verify the validity of its information (anti-counterfeiting) and generate the next block. Blockchain can include the underlying blockchain platform, platform product service layer and application service layer. Blockchain can include public chain, alliance chain and private chain. Among them, public chain refers to a blockchain that anyone can enter the blockchain network at any time to read data, send data or compete for accounting; alliance chain refers to a blockchain jointly managed by several organizations or institutions; private chain refers to a blockchain with certain centralized control. The write right of the private chain account book is controlled by a certain organization or institution, and the access and use of data are strictly managed by permissions.
[0078] 2) Blockchain resource client, a tool for managing and storing user digital assets, such as transferring digital assets to other accounts based on the resource client, or receiving digital assets transferred from other accounts based on the resource client. The resource client can be a hardware device or a software program. In this application, the resource client of the target object can establish a communication connection with the decentralized application client to implement related operations such as authorized login of the target object.
[0079] 3) Artificial Intelligence (AI) is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results. In other words, artificial intelligence is a comprehensive technology in computer science that attempts to understand the essence of intelligence and produce a new intelligent machine that can respond in a similar way to human intelligence. Artificial intelligence is to study the design principles and implementation methods of various intelligent machines so that machines have the functions of perception, reasoning and decision-making. Artificial intelligence technology is a comprehensive discipline that covers a wide range of fields, including both hardware-level technology and software-level technology. Basic artificial intelligence technologies generally include technologies such as sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, big data processing technology, operation / interaction systems, and mechatronics. Artificial intelligence software technology mainly includes computer vision technology, speech processing technology, natural language processing technology, and machine learning / deep learning.
[0080] 4) Machine Learning (ML) is a multi-disciplinary subject involving probability theory, statistics, approximation theory, convex analysis, algorithm complexity theory and other disciplines. It specializes in studying how computers simulate or implement human learning behavior to acquire new knowledge or skills and reorganize existing knowledge structures to continuously improve their performance. Machine learning is the core of artificial intelligence and the fundamental way to make computers intelligent. Its applications are spread across all areas of artificial intelligence. Machine learning (deep learning) usually includes artificial neural networks, belief networks, reinforcement learning, transfer learning, inductive learning, and self-learning.
[0081] Currently, with the development of blockchain technology, various related applications are being used more and more widely. Among them, the blockchain resource client is a tool for managing and storing digital assets. It is one of the key applications of blockchain technology, allowing users to safely store and manage their digital assets and trade with other objects.
[0082] In the related art, the blockchain resource client is generally implemented in the form of an application program, and the user can use the blockchain resource client to implement the asset transfer business. Specifically, in some embodiments, for the blockchain resource client, it can include two parts: the front end and the back end. Among them, the front end is the client, which can run on the terminal device, output the relevant interface, receive the user's input, and send the relevant request to the back end for processing. The back end is the server end, which runs on the server. The server can communicate with the terminal device running the client to process the request sent by the client, execute business logic, access the database, and feedback the processing results.
[0083] For example, please refer to Figure 1 , Figure 1 The front-end interface diagram of a blockchain resource client provided in an embodiment of the present application is shown. In the front-end interface of the blockchain resource client, the asset information contained in the client can be displayed. For digital assets, there may be different categories. In the blockchain resource client, the corresponding asset amounts under different asset categories can be displayed respectively. For example, Figure 1 As shown in the figure, the total asset amount in the blockchain resource client is $2.819. These assets include two asset categories, among which the asset amount of asset A is $2.71 and the asset amount of asset B is $0.109. In the front-end interface of the blockchain resource client, some icon buttons for object operations can also be provided, such as Figure 1 A transfer icon 110 may be included in the transaction. When the object clicks the transfer icon 110, a transfer operation may be performed.
[0084] Reference Figure 2 , Figure 2 A schematic diagram of a transfer operation interface of a blockchain resource client provided in an embodiment of the present application is shown. Figure 2 In the transfer operation interface shown, the user of the blockchain resource client can fill in the relevant information to initiate the transfer business. Specifically, in some embodiments, the information that needs to be entered when initiating a transfer business may include but is not limited to the receiving address (the address of the target account corresponding to the transfer business), the asset category corresponding to the transfer business, and the specific transfer amount. Of course, it should be noted here that when initiating a transfer business, the input transfer amount needs to be less than the client balance under the asset category. For example, Figure 2 As shown in the figure, when asset A is selected for transfer, the client balance is $2.71, and the input transfer amount must be within $2.71. After filling in the relevant information, you can click the "Submit Order" button to initiate the transfer business.
[0085] In actual applications, it is found that due to the large number of concurrent or off-client transactions of digital assets, during the execution of a transfer business, the asset balance may be sufficient when the transfer business is initiated, but insufficient when the transfer business is on the chain. Therefore, it is necessary to test the blockchain resource client to determine whether it can correctly feedback the information that the relevant business has not been completed. In the embodiment of this application, this information is recorded as the first prompt information. For example, please refer to Figure 3 , Figure 3 A schematic diagram of an interface in which a blockchain resource client provided in an embodiment of the present application displays first prompt information on the front end is shown. Figure 3 In the example, when using the blockchain resource client to transfer money, the corresponding asset A is selected, the transfer amount is $0.81, and the client balance is $2.71. The asset balance is sufficient when the transfer business is initiated. If there is a concurrent or client-side transaction during the transfer business, resulting in the balance of asset A in the blockchain resource client being less than $0.81, there will be a situation where the asset balance is insufficient when the transfer business is on the chain. At this time, in order to facilitate the user to know that there is a problem with the transfer business, it is necessary to make the blockchain resource client output the first prompt information, such as Figure 3 In the example above, the blockchain resource client can output a pop-up window, which includes the text content "System abnormality, please try again!". However, some blockchain resource clients may have problems with missing functions or unstable performance, making it difficult to normally output the first prompt information in the above situation. Therefore, it is necessary to test the blockchain resource client to facilitate its optimization and improvement. The commonly used testing method at present is often to write a stress test script to execute the transfer business, and use a large amount of random data to simulate the situation of triggering insufficient asset balance. This method has low testing efficiency, lengthy process, and requires the preparation of a stress test environment and the writing of a stress test script, which has a high implementation cost.
[0086] In view of this, the present application provides a blockchain testing method, device, equipment and medium, which detects the target stage of the blockchain resource client when executing the first transfer business of the first account. If the target stage is the transaction signature acquisition stage, it means that the blockchain resource client queries the asset balance of the first account and enters the process of the transfer business normally. At this time, the assets of the first account can be automatically transferred to the second account, and the situation of insufficient asset balance of the first account when the transfer business is on the chain can be constructed. Then, it can be detected whether the blockchain resource client outputs the first prompt information for reminding the first account that the first transfer business has not been completed at the front end, that is, whether the blockchain resource client can correctly feedback the information that the relevant business has not been completed. According to the detection result, the performance of the blockchain resource client can be judged. If it is found that the blockchain resource client does not output the first prompt information at the front end, it can be determined that the blockchain resource client test fails. This testing method can realize efficient testing of the blockchain resource client through a convenient automated processing flow, and can stably construct a scenario of insufficient asset balance, which is conducive to shortening the time consumption of the test process and reducing the blockchain testing cost.
[0087] The blockchain testing method provided in the embodiments of the present application mainly relates to technologies in the field of information technology and blockchain resource clients. It can be understood by those skilled in the art that the blockchain testing method provided in the embodiments of the present application can be executed in various application scenarios:
[0088] Exemplarily, in some embodiments, the blockchain testing method in this application can be applied in the scenario of digital asset transactions. The blockchain resource client is a tool for managing and storing digital assets. Related objects can use the blockchain resource client to send and receive digital assets and view transaction history records. In this application scenario, the blockchain testing method provided in the embodiment of this application can be used to test the functions of the blockchain resource client, verify the stability and reliability of the blockchain resource client, and help improve the security and accuracy of transactions.
[0089] Exemplarily, in some embodiments, the blockchain testing method in this application can be applied in the scenario of decentralized applications (DApps). In the field of blockchain technology, many decentralized applications may use blockchain resource clients as tools for identity authentication and interaction. Users of decentralized applications can use blockchain resource clients to authorize login and corresponding operations, such as transactions, voting, games, etc. In this application scenario, the blockchain testing method provided in the embodiments of this application can be used to test the functions of the blockchain resource client and verify the correctness and security of the interaction between the blockchain resource client and the decentralized application.
[0090] It is understandable that the above application scenarios are only exemplary and do not limit the actual application of the blockchain testing method in the embodiments of the present application. Those skilled in the art can understand that in different application scenarios, the blockchain testing method provided in the embodiments of the present application can be used to perform specified tasks.
[0091] The blockchain testing method provided in the embodiment of the present application has at least the following beneficial effects: Improve security: The blockchain testing method provided in the embodiment of the present application can help discover and repair functional deficiencies and security vulnerabilities in the blockchain resource client, reduce the probability of being attacked and invaded and the risk of data leakage. Improve the user experience: By testing the functions of the blockchain resource client, it can be verified whether it is working properly, which is convenient for upgrading and iterating the blockchain resource client, repairing possible problems in the application interface and interactive logic, improving the user experience, and improving the ease of use of the blockchain resource client. Convenient for integrated development: The blockchain testing method provided in the embodiment of the present application can help achieve the correct integration and interoperability of the blockchain resource client with other components (such as blockchain networks, smart contracts, decentralized applications, etc.), and facilitate the development of a comprehensive blockchain application platform or system. In short, in the embodiment of the present application, testing the blockchain resource client can improve its security, stability and functional integrity. In practical applications, it can help the blockchain resource client provide a better user experience while protecting the digital assets and privacy security of the object. Of course, the blockchain testing method provided in the embodiment of the present application is not limited to the beneficial effects that can be achieved in actual application scenarios. The above is only an exemplary description of some beneficial effects.
[0092] It should be noted that in each specific implementation of the present application, when it comes to the need to perform relevant processing based on the object's information, the object's behavioral data, the object's historical data, the object's location information, and other data related to the object's identity or characteristics, the object's permission or consent will be obtained first, and the collection, use, and processing of these data will comply with the relevant laws, regulations, and standards of the relevant countries and regions. In addition, when the embodiment of the present application needs to obtain sensitive information of the object, the object's separate permission or separate consent will be obtained through a pop-up window or by jumping to a confirmation page. After clearly obtaining the object's separate permission or separate consent, the necessary object-related data for the normal operation of the embodiment of the present application will be obtained.
[0093] The specific implementation of the embodiment of the present application is described in detail below in conjunction with the accompanying drawings. First, a blockchain testing method provided in the embodiment of the present application is described in conjunction with the accompanying drawings.
[0094] Please refer to Figure 4 , Figure 4A schematic diagram of an implementation environment of a blockchain testing method provided in an embodiment of the present application is shown. In this implementation environment, the main hardware and software entities involved include a terminal device 410 and a backend server 420.
[0095] Specifically, in the embodiment of the present application, the terminal device 410 may be configured with a blockchain resource client application and a test framework to be tested, the application of the blockchain resource client in the terminal device 410 is the front end, the background server 420 may be used as the background of the blockchain resource client to process relevant business data, and the terminal device 410 and the background server 420 are connected in communication. The test framework can be used to execute the blockchain test method provided in the embodiment of the present application.
[0096] Exemplarily, the test framework in the terminal device 410 can detect the target stage of the blockchain resource client when executing the first transfer business of the first account. If the target stage is the transaction signature acquisition stage, relevant instructions are issued to transfer the assets of the first account to the second account; then, the test framework can detect whether the blockchain resource client outputs a first prompt message on the terminal device 410, that is, a reminder that the first transfer business has not been completed. If the blockchain resource client does not output the first prompt message on the terminal device 410, it is determined that the blockchain resource client test has failed.
[0097] Among them, the terminal device 410 of the above embodiment may include a smart phone, a tablet computer, a laptop computer, a desktop computer, a smart speaker, a smart watch, and a car terminal, but is not limited thereto.
[0098] The backend server 420 may be an independent physical server, or a server cluster or distributed system composed of multiple physical servers. It may also be a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN (Content Delivery Network), as well as big data and artificial intelligence platforms.
[0099] In addition, the backend server 420 may also be a node server in the blockchain network.
[0100] The terminal device 410 and the backend server 420 may establish a communication connection through a wireless network or a wired network. The wireless network or wired network uses standard communication technology and / or protocols, and the network may be set to the Internet or any other network, such as but not limited to a local area network (LAN), a metropolitan area network (MAN), a wide area network (WAN), a mobile, wired or wireless network, a private network or any combination of a virtual private network. Moreover, the above-mentioned software and hardware entities may use the same communication connection mode or different communication connection modes, and this application does not impose any specific restrictions on this.
[0101] Of course, it is understandable that Figure 4 The implementation environment in this paper is just some optional application scenarios of the blockchain testing method provided in the embodiments of this application. The actual application is not fixed. Figure 4 The method provided in the embodiment of the present application can be applied to various technical fields, such as shopping, games, social networking and other fields, and the present application does not make any specific limitation on this.
[0102] Below, in combination with the above description of the implementation environment, a blockchain testing method provided in an embodiment of the present application is introduced and explained in detail.
[0103] like Figure 5 As shown, in the embodiment of the present application, a blockchain testing method is provided, which can be applied to Figure 4 In the terminal device 410 shown. Figure 5 The blockchain testing method provided in the embodiment of the present application specifically includes but is not limited to steps 510 to 540:
[0104] Step 510: Detect the target stage of the blockchain resource client when executing the first transfer business of the first account;
[0105] In the embodiment of the present application, for the blockchain test, the main goal is to detect whether the blockchain resource client can correctly feedback the information that the relevant business has not been completed when the asset balance is insufficient during the execution of the transfer business. Therefore, in this step, when testing the blockchain resource client, it can be implemented in the transfer business scenario. Specifically, an account registered on the blockchain resource client to be tested can be used to initiate a transfer business. Here, the account is recorded as the first account, and the transfer business initiated by the first account during the blockchain resource client test is recorded as the first transfer business.
[0106] In the embodiment of the present application, the stage in which the blockchain resource client is in when executing the first transfer service can be detected, and the stage is recorded as the target stage. In order to facilitate the subsequent elaboration, in the embodiment of the present application, the general process of initiating a transfer service and executing a transfer service by the blockchain resource client is introduced and explained.
[0107] For example, when initiating a transfer service on a blockchain resource client, you need to log in to the blockchain resource client account first. This process may require providing an account name, password, fingerprint, or other authentication method to log in. After logging in to the corresponding account of the blockchain resource client, refer to Figure 1 and Figure 2 As shown in the figure, on the front-end interface of the blockchain resource client, there can be a transfer operation button and data of related assets. When initiating a transfer business, you can select the asset category to be transferred on the front-end interface, enter the account address and asset amount to be transferred, and then initiate the transfer business.
[0108] Here, it should be noted that when initiating a transfer business, the blockchain resource client can automatically detect whether the asset amount of this transfer business is sufficient, that is, whether the asset balance in the current blockchain resource client meets the asset amount of this transfer. If the verification is passed, the account transfer business will be started; if the verification fails, relevant prompt information can be output to remind you to fill in again. At this time, the blockchain resource client will end the account transfer business and wait for the next transfer business to be initiated.
[0109] Reference Figure 6 , Figure 6A flowchart of a blockchain resource client provided in an embodiment of the present application when executing a transfer business is shown. For the initiated transfer business, the front end of the blockchain resource client can forward the current transfer business to the background processing, and the relevant data forwarded here can include the transfer request and information related to the transfer request initiator. After the background receives the transfer request, it can call the transaction service to query the account address of the transfer. If it is found that the account address does not exist, it can output relevant prompt information to remind you to re-fill in the account address. At this time, the blockchain resource client will end the account transfer business and wait for the next transfer business to be initiated. When the account address is correct, the background of the blockchain resource client will call the relevant service to generate and record the signature information of this transaction. The signature information is digital information used to verify the legitimacy and identity of the transaction, which can prevent the transaction information from being tampered with. After obtaining the signature information, the backend returns the signature information to the frontend. The frontend uses the signature information to call the chain service and request to put the current transfer business on the chain, that is, to broadcast the transaction recorded in the transfer business and the corresponding signature information to the blockchain network. Other nodes in the blockchain network will compete to confirm the transaction. When the transaction recorded in the transfer business is confirmed and written into the blockchain, the transfer business can be completed.
[0110] In the embodiment of the present application, based on the above description and introduction, the transfer business can be divided into at least three stages: transaction verification stage, transaction signature acquisition stage, and transaction on-chain stage. In the transaction verification stage, the blockchain resource client verifies the legitimacy and validity of the transfer business. For example, these verifications may include but are not limited to: format verification, checking whether the data fields and data formats involved in the transaction are correct, such as whether the account address filled in for the transfer conforms to the preset format. Balance verification: verify whether the account initiating the transfer business has sufficient balance to carry out the transaction. In the transaction signature acquisition stage, the transaction is digitally signed using the private key of the account initiating the transfer business to obtain the transaction signature corresponding to the transfer business. The transaction signature obtained in this process can be used to determine that the transfer business is initiated by a legitimate account and has not been tampered with, thereby ensuring the security of the transaction and the reliability of identity authentication. In the transaction on-chain stage, the verified and signed transactions will be broadcast to other nodes in the blockchain network. Specifically, general transactions will be included in the block. This stage involves the following verifications: Block verification, other nodes in the blockchain network will verify whether the newly generated block complies with the blockchain rules and protocols, including timestamps, whether the hash of the previous block is correct, etc. Transaction verification, other nodes will verify the legitimacy and validity of the transaction again to ensure that the transaction can be implemented normally. Consensus verification: The node will check whether the block containing the transaction is accepted and confirmed by the majority of nodes according to the consensus algorithm to ensure that the transaction is widely recognized and confirmed.
[0111] Based on blockchain technology, the blockchain resource client can implement the transfer business through the above process, and the blockchain network can ensure the legality, integrity and security of the transaction. Of course, it should be noted that the above process is only used to illustrate the blockchain resource client's execution of the transfer business. In actual applications, the above process can be flexibly adjusted according to needs, and this application does not limit this.
[0112] Step 520: If the target stage is the transaction signature acquisition stage, transfer the assets of the first account to the second account;
[0113] In this step, when it is detected that the target stage when the blockchain resource client executes the first transfer business of the first account is the transaction signature acquisition stage, it means that the transfer business has passed the previous transaction verification stage, that is, in the transaction verification stage, the blockchain resource client has determined that the first account corresponding to the first transfer business has sufficient balance to carry out the transaction. In the embodiment of the present application, in order to realize the performance detection of the blockchain resource client, it is necessary to construct the situation of insufficient asset balance after the transaction verification stage and before the transaction on-chain stage. Therefore, when it is determined that the target stage is the transaction signature acquisition stage, the assets of the first account can be transferred out, so that it will appear in the subsequent transaction on-chain stage. The situation of insufficient asset balance is convenient for testing whether the blockchain resource client can correctly feedback the information that the relevant business has not been completed in this case.
[0114] Specifically, in the embodiments of the present application, if the assets of the first account are transferred out to construct a transaction on-chain and there is a situation where the asset balance is insufficient, the assets of the first account can be transferred to another account, which can be recorded as the second account. Exemplarily, in some embodiments, the second account can be a preset fixed account, which is specifically used as the target account for asset transfer in the blockchain testing process; in some embodiments, the second account can also be the target account corresponding to the first transfer business. In addition, in some embodiments, the number of second accounts can be one, and in other embodiments, the number of second accounts can also be multiple, that is, the assets of the first account can be transferred to multiple other accounts, and these accounts with transferred assets can all be regarded as second accounts. In the embodiments of the present application, there is no limit on the number of second accounts.
[0115] Of course, it should be noted that in order to improve the security of assets during the test process and facilitate the actual recovery of assets used for testing, in the embodiment of the present application, an account with usage authority can be selected as the second account, and the present application does not impose any restrictions on this.
[0116] In the embodiment of the present application, the assets of the first account are transferred to the second account, and its implementation process is basically the same as the aforementioned transfer business process, which will not be repeated here. The difference is that the first transfer business is executed in the blockchain resource client, and the process of transferring the assets of the first account to the second account is executed outside the blockchain resource client. Here, the purpose of transferring the assets of the first account to the second account is to construct the situation where the asset balance of the first transfer business is insufficient. Therefore, after the asset transfer, the remaining asset balance of the first account needs to be less than the amount of assets transferred in the first transfer business. Specifically, in some embodiments, the assets of the first account are transferred to the second account, which can be transferred to all the assets in the first account to the second account. In this way, it is possible to easily and quickly construct the situation of insufficient asset balance, without the need to perform relevant calculations based on the amount of assets transferred by the first transfer business, which can greatly improve the efficiency of blockchain testing. In other embodiments, the assets of the first account are transferred to the second account, which can also be transferred to a part of the assets in the first account. Transferring the assets of the first account to the second account makes the remaining asset balance less than the amount of assets transferred in the first transfer business, thereby constructing the situation of insufficient asset balance. This implementation does not transfer all the assets in the first account at once, but can support multiple tests in batches, which is suitable for scenarios where repeated testing of blockchain resource clients or batch testing of multiple different blockchain resource clients is required. In actual implementation, those skilled in the art can choose a suitable method to transfer out the assets in the first account according to the needs, and this application does not limit this. The specific implementation process will be described in detail in the subsequent embodiments, and will not be repeated here.
[0117] It should be noted that in order to construct the situation where the asset balance of the first transfer business is insufficient, in the embodiment of the present application, it is necessary to complete the task of transferring the assets of the first account to the second account before the first transfer business, that is, the assets of the first account need to be transferred to the second account first. Specifically, in the embodiment of the present application, when transferring the assets of the first account to the second account, the process can be constrained to be completed before the first transfer business enters the transaction chain stage. Exemplarily, for example, in some embodiments, the transaction signature information generated by the first transfer business during the transaction signature acquisition stage can be intercepted first, and the task of transferring the assets of the first account to the second account is executed. When the task of transferring the assets of the first account to the second account is completed, the transaction signature information corresponding to the intercepted first transfer business is sent to the blockchain resource client, so that the first transfer business can be executed on the chain later, and the situation of insufficient asset balance can be constructed stably and reliably.
[0118] Step 530: Detect whether the blockchain resource client outputs a first prompt message at the front end; the first prompt message is used to remind that the first transfer business of the first account has not been completed;
[0119] In this step, after constructing the situation of insufficient asset balance of the first transfer business, when the blockchain resource client executes the first transfer business and enters the transaction on-chain stage, when other nodes in the blockchain network verify the transaction of the first transfer business, because the assets of the first account have been transferred to the second account before the first transfer business is on-chain, there is insufficient asset balance, so the transaction verification of the first transfer business will fail, that is, the transaction cannot be implemented normally. For the blockchain resource client, it is necessary to test whether it can correctly feedback the information that the relevant business has not been executed in this case, reminding the user of the blockchain resource client that the first transfer business has not been successfully executed.
[0120] Specifically, in the embodiment of the present application, the information that the blockchain resource client should feedback when the asset balance is insufficient when the first transfer business enters the transaction on-chain stage is recorded as the first prompt information. The first prompt information can be used to remind relevant personnel that the first transfer business of the first account has not been completed. The present application does not limit the specific output method and content of the first prompt information. For example, in some embodiments, the first prompt information can only include text information, such as referring to Figure 3 , Figure 3 The "System abnormality, please try again!" in the text can be used as the first prompt information. In some embodiments, the first prompt information can also be output in the form of voice, or the first prompt information in text form can be displayed at the same time, and the audio content in voice form can be output. For example, a terminal device with a blockchain resource client installed can output some set voices, and the voice content can be implemented by referring to the first prompt information in text form, which will not be elaborated here. Of course, the above are only some optional implementation methods of the first prompt information, and this application does not limit this.
[0121] It is understandable that, under normal circumstances, that is, when the blockchain resource client is fully functional, the first prompt information should be output through the front-end of the blockchain resource client to provide guidance to relevant personnel and inform that there is a problem with the first transfer business. Therefore, in the embodiment of the present application, it is possible to detect whether the blockchain resource client outputs the first prompt information at the front end, so as to determine whether it has a functional deficiency or unstable operating performance. Specifically, in the embodiment of the present application, when actually detecting whether the blockchain resource client outputs the first prompt information at the front end, it can be implemented according to the type of the first prompt information. Exemplarily, in some embodiments, when the first prompt information is a type displayed in text form, the operation log information of the blockchain resource client can be obtained, and according to the operation log information, it is determined whether the blockchain resource client outputs the first prompt information at the front end; in some embodiments, when the first prompt information is a type output in voice form, a relevant audio recognition tool can be used to convert the voice content into text information, and analyze the content of the text information to determine whether it belongs to the first prompt information. Of course, the specific detection method can be adjusted according to the equipment requirements and environmental conditions, and this application does not limit this.
[0122] Step 540: If the blockchain resource client does not output the first prompt information at the front end, it is determined that the blockchain resource client test fails.
[0123] In this step, as described above, it is possible to detect whether the blockchain resource client outputs the first prompt information at the front end, so as to determine whether it has a function missing or unstable operating performance. It is understandable that if the blockchain resource client normally outputs the first prompt information at the front end, it can be determined that the transfer business has insufficient asset balance during the transaction on-chain stage, and can correctly feedback the information that the relevant business has not been completed. Therefore, it can be determined that the blockchain resource client is fully functional and has good performance in this scenario, and then it can be determined that the blockchain resource client has passed the test, or continues to execute other test items. Relatively speaking, if the blockchain resource client does not output the first prompt information at the front end, it can be determined that the transfer business has insufficient asset balance during the transaction on-chain stage, and cannot correctly feedback the information that the relevant business has not been completed, and lacks the reminder function for business problems. At this time, it can be determined that the blockchain resource client has a function missing or unstable performance problem in this scenario, and then it can be determined that the blockchain resource client test has not passed, and the relevant developers can update and optimize the blockchain resource client according to the test results to improve its existing problems.
[0124] It is understandable that the blockchain testing method provided in the embodiment of the present application detects the target stage of the blockchain resource client when executing the first transfer business of the first account. If the target stage is the transaction signature acquisition stage, it means that the blockchain resource client queries the asset balance of the first account and is sufficient, and is in the normal transfer business process. At this time, the assets of the first account can be automatically transferred to the second account, and the situation of insufficient asset balance of the first account can be constructed. Next, it can be detected whether the blockchain resource client outputs the first prompt information for reminding the first account that the first transfer business has not been completed at the front end, that is, whether the blockchain resource client can correctly feedback the information that the relevant business has not been completed. According to the detection result, the performance of the blockchain resource client can be judged. If it is found that the blockchain resource client does not output the first prompt information at the front end, it can be determined that the blockchain resource client test fails. This test method can realize efficient testing of the blockchain resource client through a convenient automated processing flow, and can stably construct a scenario of insufficient asset balance, which is conducive to shortening the time-consuming test process and reducing the blockchain test cost.
[0125] Specifically, in a possible implementation manner, the first transfer service is triggered by the following steps:
[0126] The blockchain resource client detects a touch screen operation of the target object, and executes a first transfer service according to the touch screen operation;
[0127] Alternatively, the blockchain resource client obtains voice data of the target object, performs voice recognition on the voice data, and executes the first transfer service according to the result of the voice recognition.
[0128] In the embodiments of the present application, there may be multiple ways to implement triggering the first transfer service on the blockchain resource client. In some embodiments, the first transfer service may be triggered by the target object through interactive operations at the front end of the blockchain resource client. Here, the target object may be a user of the blockchain resource client, and the specific implementation form of the target object interacting with the terminal device to trigger the first transfer service is not limited in this application. Exemplarily, for example, the terminal device may receive an interactive instruction from the target object to the relevant component, and use the interactive instruction as a start instruction to trigger the first transfer service. Here, the relevant component may be a component configured by the underlying system of the terminal device, or a component configured in the blockchain resource client, and its implementation form may be flexibly set as needed. For example, in some embodiments, the component may be a component with a voice interaction function in the terminal device, which may recognize the voice data of the target object through voice recognition technology, and the target object may interact with the terminal device through voice, such as saying to the terminal device "Use the client to transfer, the transfer account is..." and other contents, thereby triggering the first transfer service. For the voice recognition algorithm used in the embodiments of the present application, it can be implemented with reference to the relevant technology, and this application will not elaborate on this.
[0129] In some embodiments, the component may also be a touch component, for example, referring to Figure 1 On the front-end interface of the blockchain resource client, some icons corresponding to the operation options may be displayed, including a transfer icon 110 corresponding to the transfer operation. At this time, the target object clicks the transfer icon 110 on the terminal device screen, which can cause the blockchain resource client to jump to Figure 2 The transfer operation interface shown can input relevant information by interacting in the transfer operation interface, and the blockchain resource client can execute the first transfer business according to the information input by the target object based on the touch screen operation.
[0130] Specifically, in a possible implementation manner, the first transfer service is triggered by the following steps:
[0131] Sending a login request of the first account to the blockchain resource client;
[0132] When it is determined that the first account login is completed, a first transfer request is generated; wherein the first transfer request includes a target account, a target asset category and an asset amount corresponding to the first transfer business;
[0133] A first transfer request is sent to a blockchain resource client, so that the blockchain resource client executes a first transfer service of the first account.
[0134] In the embodiment of the present application, the implementation method of triggering the first transfer business in the blockchain resource client can also be triggered by the test framework based on the automated processing flow. Specifically, in some embodiments, the relevant information of the first account can be pre-stored in the test framework. When the first transfer business is triggered, the test framework can first send a login request for the first account to the blockchain resource client. The login request may include the account name, password, etc. of the first account, but is not limited to this. After the first account login is completed, a transfer request can be generated, which is recorded as the first transfer request. The first transfer request is used to initiate the first transfer business in the blockchain resource client. It can include information such as the target account, target asset category and asset amount corresponding to the first transfer business to be initiated, wherein the target account is the first transfer business to which the assets in the first account are transferred, and the relevant information of the target account can be address information or other information that can uniquely determine the target account; the target asset category refers to the category of assets that the first transfer business needs to transfer to the target account. In the embodiment of the present application, there is no restriction on the specific asset category, which can be flexibly set as needed; the asset amount is the number of assets transferred from the target asset category to the target account by the first transfer business.
[0135] In the embodiment of the present application, after the first transfer request is generated, the first transfer request can be sent to the blockchain resource client so that the blockchain resource client executes the first transfer service of the first account. It can be understood that in the embodiment of the present application, the first transfer request is automatically generated by the test framework to trigger the first transfer service, which can realize the automation of the test process, which is conducive to improving the test efficiency and reducing the time required for the test.
[0136] Specifically, in a possible implementation, when it is determined that the first account login is completed, generating a first transfer request includes:
[0137] When it is determined that the first account login is completed, the asset balance corresponding to each asset category of the first account is detected;
[0138] Determine a target asset category corresponding to the first transfer business from the asset categories, and determine a first asset amount corresponding to the first transfer business according to the asset balance corresponding to the target asset category; wherein the first asset amount is less than or equal to the asset balance corresponding to the target asset category;
[0139] A first transfer request is generated according to a preset target account, target asset category, and first asset amount.
[0140] In the embodiment of the present application, when generating the first transfer request, the process may include: first, after determining that the first account login is complete, the asset balance corresponding to each asset category of the first account may be detected. Figure 1,by Figure 1 The account shown is used as the first account, and it can be detected that it includes two asset categories, namely asset A and asset B, wherein the asset balance corresponding to asset A is $2.71, and the asset balance corresponding to asset B is $0.109. Then, the target asset category corresponding to the first transfer business, that is, the asset category that needs to be transferred, can be determined from the detected asset categories. Here, one can be randomly selected from the asset categories whose asset balances detected by the first account are not 0 as the target asset category. In the embodiment of the present application, there is no restriction on the specific type of the selected target asset category. Assuming that asset A is currently selected as the target asset category, then an amount less than or equal to the asset balance can be determined as the asset amount corresponding to the first transfer business according to the asset balance corresponding to asset A. In the embodiment of the present application, it is recorded as the first asset amount. It can be understood that the first asset amount is less than or equal to the asset balance corresponding to the target asset category, which can meet the situation that the asset balance is sufficient when the transfer business is initiated, so that the first transfer business can normally complete the early transaction verification stage and enter the transaction signature acquisition stage. In the embodiment of the present application, a value can be randomly selected as the first asset amount within a range that is less than or equal to the asset balance corresponding to the target asset category. For example, US$1.15 can be selected as the first asset data, and the present application does not impose any restrictions on this.
[0141] After the target asset category and the first asset amount are determined, a first transfer request may be generated according to the preset target account, target asset category and the first asset amount.
[0142] Specifically, in a possible implementation, when it is determined that the first account login is completed, generating a first transfer request includes:
[0143] When it is determined that the first account login is completed, the asset balance corresponding to each asset category of the first account is detected;
[0144] Determine a target asset category corresponding to the first transfer business from the asset category, and determine a second asset amount corresponding to the first transfer business according to the asset balance corresponding to the target asset category; wherein the second asset amount is greater than the asset balance corresponding to the target asset category;
[0145] Generate a first transfer request according to a preset target account, target asset category, and second asset amount;
[0146] After the step of sending a first transfer request to the blockchain resource client so that the blockchain resource client executes the first transfer service of the first account, the method further includes the following steps:
[0147] Detecting whether the blockchain resource client outputs a second prompt message on the front end; the second prompt message is used to remind the first account that there is insufficient asset balance in the first transfer business;
[0148] If the blockchain resource client does not output the second prompt information on the front end, it is determined that the blockchain resource client test has failed.
[0149] In an embodiment of the present application, a method is also provided for testing whether the blockchain resource client can correctly feedback relevant information when the asset balance is insufficient when initiating a transfer business. Specifically, in the process of generating the first transfer request in an embodiment of the present application, when determining the asset amount corresponding to the first transfer business, a situation where the asset balance is insufficient when initiating the transfer business can be constructed. That is, an amount greater than the asset balance corresponding to the target asset category can be determined as the asset amount corresponding to the first transfer business, and it is recorded as the second asset amount. It can be understood that the second asset amount is greater than the asset balance corresponding to the target asset category, which can meet the situation where the asset balance is insufficient when initiating the transfer business. In an embodiment of the present application, a value can be randomly selected as the second asset amount within the range of the asset balance corresponding to the target asset category. For example, taking the aforementioned asset A as the target asset category as an example, 3.88 US dollars can be selected as the second asset data, and this application does not limit this.
[0150] In the embodiment of the present application, the second asset amount is used to generate the first transfer request. There will be a situation where the asset balance is insufficient when the transfer business is initiated. This can facilitate testing whether the blockchain resource client can feedback the information of insufficient asset balance in this case, so as to facilitate its optimization and improvement. Therefore, after sending the first transfer request to the blockchain resource client, it can be detected whether the blockchain resource client outputs information on the front end to remind the first account that there is insufficient asset balance in the first transfer business. The information here is recorded as the second prompt information. The second prompt information and implementation method and detection method can be similar to the aforementioned first prompt information, and will not be elaborated here. For example, referring to Figure 7 , Figure 7 A schematic diagram of an interface in which a blockchain resource client displays second prompt information on the front end provided in an embodiment of the present application is shown. Figure 7 In the example, since the amount of assets transferred out by the first transfer business is $3.88, and the actual asset balance under the target asset category is only $2.71, there is a situation where the asset balance is insufficient when the transfer business is initiated. At this time, in order to facilitate users to know the insufficient balance, the blockchain resource client can output a second prompt message, such as Figure 7 In the example, the blockchain resource client can output a pop-up window including the text content "Insufficient balance, please try again!", which is the second prompt information.
[0151] It is understandable that in the embodiment of the present application, if the blockchain resource client normally outputs the second prompt information at the front end, it can be determined that it can correctly feedback the relevant prompt information for the situation of insufficient asset balance when initiating a transfer business. Therefore, it can be determined that the blockchain resource client is fully functional and has good performance in this scenario, and other test items can be continued. Relatively speaking, if the blockchain resource client does not output the second prompt information at the front end, it can be determined that it cannot correctly feedback the relevant prompt information for the situation of insufficient asset balance when initiating a transfer business, and there are problems of missing functions or unstable performance in this scenario, and then it can be determined that the blockchain resource client test has failed, and the relevant developers can update and optimize the blockchain resource client according to the test results to improve its existing problems.
[0152] Specifically, in a possible implementation, referring to Figure 8 , transfer the assets of the first account to the second account, including:
[0153] Step 810: Obtain the target asset category corresponding to the first transfer business, and detect the asset balance corresponding to the target asset category in the first account;
[0154] Step 820: Generate and trigger a second transfer service based on the second account, the target asset category, and the asset balance corresponding to the target asset category; wherein the second transfer service is used to transfer all assets of the target asset category in the first account to the second account.
[0155] In the embodiments of the present application, when transferring assets from a first account to a second account, there may be multiple implementation methods. For example, in some embodiments, the target asset category corresponding to the first transfer business may be obtained, and then the asset balance corresponding to the target asset category may be detected. Figure 1 The account shown is used as the first account. If the first transfer business selects asset A as the target asset category, then another transfer business can be constructed based on the asset balance corresponding to asset A, and the transfer business is recorded as the second transfer business. The second transfer business also uses the first account to transfer, and the account to which the asset is transferred is the second account. The target asset category corresponding to the transfer is the same as the target asset category corresponding to the first transfer business, and the amount of assets transferred in the second transfer business can be the asset balance corresponding to the target asset category in the first transfer business. That is, the second transfer business can be determined based on the second account, the target asset category of the first transfer business, and the asset balance corresponding to the target asset category. The second transfer business can transfer all the assets of the target asset category in the first account to the second account. In this way, the situation of insufficient asset balance can be constructed conveniently and quickly, and there is no need to perform relevant calculations based on the amount of assets transferred by the first transfer business, which can greatly improve the efficiency of blockchain testing.
[0156] Specifically, in a possible implementation, generating and triggering the second transfer service includes:
[0157] Generate a second transfer business according to the second account, the target asset category and the asset balance corresponding to the target asset category;
[0158] Call the transaction service to obtain the transaction signature corresponding to the second transfer business;
[0159] According to the transaction signature, the second transfer business is put on the chain to transfer all the assets of the target asset category in the first account to the second account.
[0160] In the embodiment of the present application, when generating and implementing the second transfer business, it is also necessary to go through the blockchain on-chain process. Specifically, first, the second transfer business can be generated according to the second account, the target asset category and the asset balance corresponding to the target asset category. The second transfer business can be handed over to other blockchain resource clients for execution, or executed by the test framework itself, and this application does not limit this. When executing the second transfer business, it will also go through the transaction verification stage, the transaction signature acquisition stage, and the transaction on-chain stage. Among them, in the transaction verification stage, since the amount of assets transferred by the second transfer business is the asset balance corresponding to the target asset category, the conditions for transaction initiation are met. In the transaction signature acquisition stage, the transaction service can be called to obtain the transaction signature corresponding to the second transfer business. Specifically, for example, the private key information of the first account can be obtained through the transaction service, and the second transfer business is encrypted according to the private key information, so as to obtain the transaction signature corresponding to the second transfer business. In the embodiment of the present application, there is no restriction on the specific type of asymmetric encryption algorithm used. After obtaining the transaction signature, the second transfer business can be put on the chain, that is, it can be broadcast to other nodes of the blockchain network, and the chain can be completed after consensus, so that all assets of the target asset category in the first account can be transferred to the second account.
[0161] Specifically, in a possible implementation, referring to Fig. 9 , transfer the assets of the first account to the second account, including:
[0162] Step 910: Obtain the target asset category and asset amount corresponding to the first transfer business, and detect the asset balance corresponding to the target asset category in the first account;
[0163] Step 920: Determine the third asset amount according to the asset amount corresponding to the first transfer business and the asset balance corresponding to the target asset category; the third asset amount is less than the asset balance corresponding to the target asset category, and the sum of the third asset amount and the asset amount corresponding to the first transfer business is greater than the asset balance corresponding to the target asset category;
[0164] Step 930: Generate and trigger a third transfer service based on the second account, the target asset category and the third asset amount; wherein the third transfer service is used to transfer the third asset amount of the assets of the target asset category in the first account to the second account.
[0165] In the embodiment of the present application, when transferring assets from the first account to the second account, part of the assets may also be transferred. Figure 1 The account shown is used as the first account. If the first transfer business selects asset A as the target asset category, then another transfer business can be constructed based on the asset balance corresponding to asset A, and part of asset A can be transferred to construct the situation where the asset balance is insufficient when the first transfer business is on the chain. This transfer business is recorded as the third transfer business. Similarly, the third transfer business also uses the first account to transfer, and the account to which the asset is transferred is the second account. The target asset category corresponding to the transfer is the same as the target asset category corresponding to the first transfer business. The specific asset amount corresponding to the third transfer business is recorded as the third asset amount. Here, the sum of the third asset data and the asset amount corresponding to the first transfer business can be constrained to be greater than the asset balance corresponding to the target asset category. For example, the asset balance corresponding to asset A is US$2.71, and the asset amount corresponding to the first transfer business is US$1.15. The difference between the two is US$1.56. The third asset data can be constrained to be greater than US$1.56, for example, it can be determined to be US$2. In this way, after executing the third transfer business, the asset balance corresponding to asset A will be subtracted from the third asset data, and the remaining new asset balance will be less than the asset amount corresponding to the first transfer business, so that the situation where the asset balance is insufficient when the first transfer business is on the chain can be constructed. In the embodiment of the present application, there is no restriction on the specific size of the third asset amount.
[0166] After determining the amount of the third asset, the third transfer service can be determined according to the second account, the target asset category of the first transfer service and the amount of the third asset, and the third transfer service can transfer the assets of the target asset category in the first account to the second account. It is understandable that this implementation does not transfer all the assets in the first account at one time, and can support multiple tests in batches, which is suitable for scenarios where repeated testing of blockchain resource clients or batch testing of multiple different blockchain resource clients is required.
[0167] Specifically, in a possible implementation, detecting whether the blockchain resource client outputs the first prompt information at the front end includes:
[0168] Take a screenshot of the front-end interface of the blockchain resource client to obtain the target image data;
[0169] Detect whether the target image data contains the first prompt information.
[0170] In the embodiment of the present application, when detecting whether the blockchain resource client outputs the first prompt information at the front end, a screenshot of the front end interface of the blockchain resource client can be taken to obtain the target image data. Then, a machine learning model based on artificial intelligence technology can be used to detect the target image data to determine whether the first prompt information is contained therein. Here, there is no restriction on the specific machine learning model algorithm type adopted, and it can be implemented with reference to related technologies.
[0171] Below, in combination with the specific application implementation process, the blockchain testing method provided in this application is introduced and explained in detail.
[0172] In an embodiment of the present application, a blockchain testing method is provided. The testing method can realize efficient testing of blockchain resource clients through a convenient automated processing flow, and can stably construct a scenario of insufficient asset balance, which is conducive to shortening the time of the testing process and reducing the blockchain testing cost.
[0173] Specifically, for the blockchain resource client to be tested, the test method in the embodiment of the present application uses a test framework to test the blockchain resource client. First, a login request for the first account can be sent to the blockchain resource client. After the first account login is completed, the asset balance corresponding to each asset category of the first account can be detected, and the target asset category can be determined therefrom. According to the asset balance corresponding to the target asset category, a value less than the asset balance is determined as the first asset amount corresponding to the first transfer business, and the first transfer business is initiated on the blockchain resource client. Next, the target stage of the blockchain resource client when executing the first transfer business of the first account is detected. If the target stage is the transaction signature acquisition stage, the second transfer business or the third transfer business is triggered, and the assets of the first account are transferred to the second account from outside the currently tested blockchain resource client. In this way, it is possible to construct a situation where the asset balance is sufficient when the first transfer business is initiated, but the asset balance is insufficient when the first transfer business is on the chain.
[0174] Under normal circumstances, that is, when the blockchain resource client is fully functional, when the asset balance is insufficient when the first transfer business is on the chain, the front end of the blockchain resource client will output the first prompt information to provide guidance to relevant personnel and inform them that there is a problem with the first transfer business. Therefore, in the embodiment of the present application, it can be detected whether the blockchain resource client outputs the first prompt information at the front end, so as to determine whether it has a functional deficiency or unstable operating performance. If the blockchain resource client normally outputs the first prompt information at the front end, it can be determined that the asset balance of the transfer business is insufficient during the transaction on-chain stage, and the relevant business information that has not been executed can be correctly fed back. Therefore, it can be determined that the blockchain resource client is fully functional and has good performance in this scenario, and then it can be determined that the blockchain resource client test has passed, or other test items continue to be executed. Relatively speaking, if the blockchain resource client does not output the first prompt information at the front end, it can be determined that the asset balance of the transfer business is insufficient during the transaction on-chain stage, and the relevant business information that has not been executed can not be correctly fed back, and the reminder function for business problems is lacking. At this point, it can be determined that the blockchain resource client has missing functions or unstable performance in this scenario, and further it can be determined that the blockchain resource client has failed the test. The relevant developers can update and optimize the blockchain resource client based on the test results to improve its existing problems.
[0175] Reference Fig.10 In an embodiment of the present application, a blockchain testing device is also provided, including:
[0176] A first detection unit 1010 is used to detect the target stage of the blockchain resource client when executing the first transfer business of the first account;
[0177] A transfer unit 1020, configured to transfer the assets of the first account to the second account if the target stage is the transaction signature acquisition stage;
[0178] The second detection unit 1030 is used to detect whether the blockchain resource client outputs the first prompt information at the front end; the first prompt information is used to remind the first account that the first transfer business has not been completed;
[0179] The processing unit 1040 is used to determine that the blockchain resource client test fails if the blockchain resource client does not output the first prompt information at the front end.
[0180] Optionally, the first transfer service is triggered by the following steps:
[0181] The blockchain resource client detects a touch screen operation of the target object, and executes a first transfer service according to the touch screen operation;
[0182] Alternatively, the blockchain resource client obtains voice data of the target object, performs voice recognition on the voice data, and executes the first transfer service according to the result of the voice recognition.
[0183] Optionally, the trigger unit is specifically used for:
[0184] Sending a login request of the first account to the blockchain resource client;
[0185] When it is determined that the first account login is completed, a first transfer request is generated; wherein the first transfer request includes a target account, a target asset category and an asset amount corresponding to the first transfer business;
[0186] A first transfer request is sent to a blockchain resource client, so that the blockchain resource client executes a first transfer service of the first account.
[0187] Optionally, the trigger unit is specifically used for:
[0188] When it is determined that the first account login is completed, the asset balance corresponding to each asset category of the first account is detected;
[0189] Determine a target asset category corresponding to the first transfer business from the asset categories, and determine a first asset amount corresponding to the first transfer business according to the asset balance corresponding to the target asset category; wherein the first asset amount is less than or equal to the asset balance corresponding to the target asset category;
[0190] A first transfer request is generated according to a preset target account, target asset category, and first asset amount.
[0191] Optionally, the trigger unit is specifically used for:
[0192] When it is determined that the first account login is completed, the asset balance corresponding to each asset category of the first account is detected;
[0193] Determine a target asset category corresponding to the first transfer business from the asset category, and determine a second asset amount corresponding to the first transfer business according to the asset balance corresponding to the target asset category; wherein the second asset amount is greater than the asset balance corresponding to the target asset category;
[0194] Generate a first transfer request according to a preset target account, target asset category, and second asset amount;
[0195] The device also includes a third detection unit, which is specifically used to:
[0196] Detecting whether the blockchain resource client outputs a second prompt message on the front end; the second prompt message is used to remind the first account that there is insufficient asset balance in the first transfer business;
[0197] If the blockchain resource client does not output the second prompt information on the front end, it is determined that the blockchain resource client test has failed.
[0198] Optionally, the transfer unit is specifically used for:
[0199] Obtaining a target asset category corresponding to the first transfer business, and detecting an asset balance corresponding to the target asset category in the first account;
[0200] A second transfer service is generated and triggered according to the second account, the target asset category and the asset balance corresponding to the target asset category; wherein the second transfer service is used to transfer all assets of the target asset category in the first account to the second account.
[0201] Optionally, the transfer unit is specifically used for:
[0202] Generate a second transfer business according to the second account, the target asset category and the asset balance corresponding to the target asset category;
[0203] Call the transaction service to obtain the transaction signature corresponding to the second transfer business;
[0204] According to the transaction signature, the second transfer business is put on the chain to transfer all the assets of the target asset category in the first account to the second account.
[0205] The device also includes an acquisition unit, which is specifically used to:
[0206] Get the private key information of the first account;
[0207] The second transfer service is encrypted using the private key information to obtain a transaction signature corresponding to the second transfer service.
[0208] Optionally, the transfer unit is specifically used for:
[0209] Obtaining the target asset category and asset amount corresponding to the first transfer business, and detecting the asset balance corresponding to the target asset category in the first account;
[0210] Determine the third asset amount according to the asset amount corresponding to the first transfer business and the asset balance corresponding to the target asset category; the third asset amount is less than the asset balance corresponding to the target asset category, and the sum of the third asset data and the asset amount corresponding to the first transfer business is greater than the asset balance corresponding to the target asset category;
[0211] A third transfer service is generated and triggered according to the second account, the target asset category and the third asset amount; wherein the third transfer service is used to transfer the third asset amount of the assets of the target asset category in the first account to the second account.
[0212] Optionally, the second detection unit is specifically used for:
[0213] Get the operation log information of the blockchain resource client;
[0214] According to the operation log information, determine whether the blockchain resource client outputs the first prompt information on the front end.
[0215] Optionally, the second detection unit is specifically used for:
[0216] Take a screenshot of the front-end interface of the blockchain resource client to obtain the target image data;
[0217] Detect whether the target image data contains the first prompt information.
[0218] It is understandable that if Figure 5 The contents of the blockchain testing method embodiment shown in the figure are applicable to the blockchain testing device embodiment. The functions specifically implemented by the blockchain testing device embodiment are similar to those in the example Figure 5 The blockchain testing method embodiment shown is the same as that shown in FIG. Figure 5 The beneficial effects achieved by the blockchain testing method embodiment shown are also the same.
[0219] The present application also discloses an electronic device, including:
[0220] at least one processor;
[0221] at least one memory for storing at least one program;
[0222] When at least one program is executed by at least one processor, the at least one processor implements Figure 5 An embodiment of the blockchain testing method is shown.
[0223] It is understandable that if Figure 5 The contents of the blockchain testing method embodiment shown in the figure are all applicable to the electronic device embodiment. The functions specifically implemented by the electronic device embodiment are similar to those in the example Figure 5 The blockchain testing method embodiment shown is the same as that shown in FIG. Figure 5 The beneficial effects achieved by the blockchain testing method embodiment shown are also the same.
[0224] The electronic device of the embodiment of the present application may be a terminal device, a computer device or a server device.
[0225] For example, refer to Fig.11 , Fig.11 Schematic diagram of the structure of an electronic device provided in an embodiment of the present application. Taking the electronic device as a terminal device as an example, Fig.11In the embodiment, the electronic device 1100 may include an RF (Radio Frequency) circuit 1110, a memory 1120 including one or more computer-readable storage media, an input unit 1130, a display unit 1140, a sensor 1150, an audio circuit 1160, a short-range wireless transmission module 1170, a processor 1180 including one or more processing cores, and a power supply 1190. Those skilled in the art will appreciate that Fig.11 The device structure shown in the figure does not constitute a limitation on the terminal device, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.
[0226] The RF circuit 1110 can be used for receiving and sending signals during information transmission or calls. In particular, after receiving the downlink information of the base station, it is handed over to one or more processors 1180 for processing; in addition, the data related to the uplink is sent to the base station. Generally, the RF circuit 1110 includes but is not limited to an antenna, at least one amplifier, a tuner, one or more oscillators, a subject identity module (SIM) card, a transceiver, a coupler, an LNA (Low Noise Amplifier), a duplexer, etc. In addition, the RF circuit 1110 can also communicate with the network and other devices through wireless communication. Wireless communication can use any communication standard or protocol, including but not limited to GSM (Global System of Mobile communication), GPRS (General Packet Radio Service), CDMA (Code Division Multiple Access), WCDMA (Wideband Code Division Multiple Access), LTE (Long Term Evolution), email, SMS (Short Messaging Service), etc.
[0227] The memory 1120 can be used to store software programs and modules (or units). The processor 1180 executes various functional applications and data processing by running the software programs and modules (or units) stored in the memory 1120. The memory 1120 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function), etc.; the data storage area may store data created according to the use of the electronic device 1100 (such as audio data, a phone book), etc. In addition, the memory 1120 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage devices. Accordingly, the memory 1120 may also include a memory controller to provide the processor 1180 and the input unit 1130 with access to the memory 1120. Although Fig.11 The RF circuit 1110 is shown, but it is understandable that it is not an essential component of the electronic device 1100 and can be omitted as needed without changing the essence of the invention.
[0228] The input unit 1130 can be used to receive input digital or character information, and generate keyboard, mouse, joystick, optical or trackball signal input related to object setting and function control. Specifically, the input unit 1130 may include a touch-sensitive surface 1131 and other input devices 1132. The touch-sensitive surface 1131, also known as a touch display screen or touch pad, can collect touch operations of an object on or near it (such as operations of an object using a finger, stylus or any other suitable object or accessory on or near the touch-sensitive surface 1131), and drive the corresponding connection device according to a pre-set program. Optionally, the touch-sensitive surface 1131 may include a touch detection device and a touch controller. Among them, the touch detection device detects the touch orientation of the object, detects the signal brought by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device, converts it into touch point coordinates, and then sends it to the processor 1180, and can receive instructions sent by the processor 1180 and execute them. In addition, the touch-sensitive surface 1131 may be implemented in various types such as resistive, capacitive, infrared, and surface acoustic wave. In addition to the touch-sensitive surface 1131, the input unit 1130 may further include other input devices 1132. Specifically, the other input devices 1132 may include, but are not limited to, one or more of a physical keyboard, a function key (such as a volume control key, a switch key, etc.), a trackball, a mouse, a joystick, and the like.
[0229] The display unit 1140 can be used to display information input by an object or information provided to an object and to control various graphic object interfaces of the electronic device 1100. These graphic object interfaces can be composed of graphics, texts, icons, videos and any combination thereof. The display unit 1140 may include a display panel 1141. Optionally, the display panel 1141 may be configured in the form of an LCD (Liquid Crystal Display), an OLED (Organic Light-Emitting Diode), or the like. Further, the touch-sensitive surface 1131 may be covered on the display panel 1141. When the touch-sensitive surface 1131 detects a touch operation on or near it, it is transmitted to the processor 1180 to determine the type of touch event. Subsequently, the processor 1180 provides a corresponding visual output on the display panel 1141 according to the type of touch event. Although in Fig.11 In the embodiment, the touch-sensitive surface 1131 and the display panel 1141 are implemented as two independent components to implement input and output functions, but in some embodiments, the touch-sensitive surface 1131 and the display panel 1141 can be integrated to implement input and output functions.
[0230] The electronic device 1100 may also include at least one sensor 1150, such as a light sensor, a motion sensor, and other sensors. Specifically, the light sensor may include an ambient light sensor and a proximity sensor, wherein the ambient light sensor may adjust the brightness of the display panel 1141 according to the brightness of the ambient light, and the proximity sensor may turn off the display panel 1141 or the backlight when the electronic device 1100 is moved to the ear. As a type of motion sensor, the gravity acceleration sensor can detect the magnitude of acceleration in each direction (generally three axes), and can detect the magnitude and direction of gravity when stationary. It can be used for applications that identify the posture of the mobile phone (such as horizontal and vertical screen switching, related games, magnetometer posture calibration), vibration recognition related functions (such as pedometer, tapping), etc.; as for other sensors such as gyroscopes, barometers, hygrometers, thermometers, infrared sensors, etc. that can also be configured in the electronic device 1100, they will not be repeated here.
[0231] The audio circuit 1160, the speaker 1161, and the microphone 1162 can provide an audio interface between the object and the electronic device 1100. The audio circuit 1160 can transmit the electrical signal converted from the received audio data to the speaker 1161, which is converted into a sound signal for output; on the other hand, the microphone 1162 converts the collected sound signal into an electrical signal, which is received by the audio circuit 1160 and converted into audio data, and then the audio data is processed by the output processor 1180 and sent to another electronic device through the RF circuit 1110, or the audio data is output to the memory 1120 for further processing. The audio circuit 1160 may also include an earplug jack to provide communication between an external headset and the electronic device 1100.
[0232] The short-range wireless transmission module 1170 may be a WIFI (wireless fidelity) module, a Bluetooth module, an infrared module, etc. The electronic device 1100 may transmit information with wireless transmission modules provided on other devices through the short-range wireless transmission module 1170 .
[0233] The processor 1180 is the control center of the electronic device 1100. It uses various interfaces and lines to connect various parts of the entire device. By running or executing software programs or modules stored in the memory 1120, and calling data stored in the memory 1120, it executes various functions of the electronic device 1100 and processes data, thereby controlling the device as a whole. Optionally, the processor 1180 may include one or more processing cores; optionally, the processor 1180 may integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, object interface and application programs, etc., and the modem processor mainly processes wireless communications. It is understandable that the above-mentioned modem processor may not be integrated into the processor 1180.
[0234] The electronic device 1100 also includes a power supply 1190 (such as a battery) for supplying power to various components. Optionally, the power supply 1190 can be logically connected to the processor 1180 through a power management system, so that the power management system can manage charging, discharging, and power consumption. The power supply 1190 can also include one or more DC or AC power supplies, recharging systems, power failure detection circuits, power converters or inverters, power status indicators, and other arbitrary components.
[0235] Although not shown, the electronic device 1100 may also include a camera, a Bluetooth module, etc., which will not be described in detail here.
[0236] The present application also discloses a computer-readable storage medium in which a program executable by a processor is stored. When the program executable by the processor is executed by the processor, it is used to implement the following Figure 5 An embodiment of the blockchain testing method is shown.
[0237] Understandably, Figure 5 The contents of the blockchain testing method embodiment shown in the figure are applicable to the computer-readable storage medium embodiment. The functions specifically implemented by the computer-readable storage medium embodiment are the same as those in the embodiment of the blockchain testing method shown in the figure. Figure 5 The blockchain testing method embodiment shown is the same as that shown in FIG. Figure 5 The beneficial effects achieved by the blockchain testing method embodiment shown are also the same.
[0238] The embodiment of the present application further discloses a computer program product or a computer program, the computer program product or the computer program comprising computer instructions, the computer instructions being stored in the above-mentioned computer-readable storage medium; Fig.11 The processor of the electronic device shown can read the computer instruction from the above-mentioned computer readable storage medium, and the processor executes the computer instruction so that the computer device executes Figure 5 An embodiment of the blockchain testing method is shown.
[0239] Understandably, Figure 5 The contents of the blockchain testing method embodiment shown in the figure are applicable to this computer program product or computer program embodiment, and the functions specifically implemented by this computer program product or computer program embodiment are the same as those in the embodiment of the present invention. Figure 5 The blockchain testing method embodiment shown is the same as that shown in FIG. Figure 5 The beneficial effects achieved by the blockchain testing method embodiment shown are also the same.
[0240] In some selectable embodiments, the function / operation mentioned in the block diagram may not occur in the order mentioned in the operation diagram. For example, depending on the function / operation involved, the two boxes shown in succession can actually be executed substantially simultaneously or the boxes can sometimes be executed in reverse order. In addition, the embodiment presented and described in the flow chart of the application is provided by way of example, for the purpose of providing a more comprehensive understanding of technology. The disclosed method is not limited to the operation and logic flow presented herein. Selectable embodiments are expected, wherein the order of various operations is changed and the sub-operation of a part described as a larger operation is performed independently.
[0241] In addition, although the present application is described in the context of functional modules, it should be understood that, unless otherwise specified, one or more of the functions and / or features can be integrated into a single physical device and / or software module, or one or more functions and / or features can be implemented in a separate physical device or software module. It is also understood that a detailed discussion of the actual implementation of each module is unnecessary for understanding the present application. More specifically, in view of the properties, functions, and internal relationships of the various functional modules in the device disclosed herein, the actual implementation of the module will be understood within the conventional techniques of the engineer. Therefore, those skilled in the art can implement the present application set forth in the claims without excessive experimentation using ordinary techniques. It is also understood that the specific concepts disclosed are merely illustrative and are not intended to limit the scope of the present application, which is determined by the full scope of the attached claims and their equivalents.
[0242] If the function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, and other media that can store program codes.
[0243] The logic and / or steps represented in the flowchart or otherwise described herein, for example, may be considered as an ordered list of executable instructions for implementing logical functions, and may be embodied in any computer-readable storage medium for use by an instruction execution system, apparatus, or device (such as a computer-based system, a system including a processor, or other system that can fetch instructions from an instruction execution system, apparatus, or device and execute instructions), or in conjunction with such instruction execution system, apparatus, or device. For purposes of this specification, a "computer-readable storage medium" may be any device that can contain, store, communicate, propagate, or transmit a program for use by an instruction execution system, apparatus, or device, or in conjunction with such instruction execution system, apparatus, or device.
[0244] It should be understood that the various parts of the present application can be implemented by hardware, software, firmware or a combination thereof. In the above-mentioned embodiments, multiple steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or their combination: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.
[0245] In the above description of this specification, the description with reference to the terms "one embodiment / example", "another embodiment / example" or "certain embodiments / examples" etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present application. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner.
[0246] Although the embodiments of the present application have been shown and described, those skilled in the art will appreciate that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present application, and that the scope of the present application is defined by the claims and their equivalents.
[0247] The above is a specific description of the preferred implementation of the present application, but the present application is not limited to the embodiments. Technical personnel familiar with the field can make various equivalent modifications or substitutions without violating the spirit of the present application. These equivalent modifications or substitutions are all included in the scope defined by the claims of the present application.
Claims
1. A blockchain testing method, characterized in that: The method comprises: Detecting a target stage of a blockchain resource client when executing a first transfer business of a first account; If the target stage is the transaction signature acquisition stage, the assets of the first account are transferred to the second account; Detecting whether the blockchain resource client outputs a first prompt message at the front end; the first prompt message is used to remind the first account that the first transfer business has not been completed; If the blockchain resource client does not output the first prompt information at the front end, it is determined that the blockchain resource client test fails.
2. The blockchain testing method according to claim 1, characterized in that: The first transfer service is triggered by the following steps: The blockchain resource client detects a touch screen operation of the target object, and executes the first transfer service according to the touch screen operation; Alternatively, the blockchain resource client obtains the voice data of the target object, performs voice recognition on the voice data, and executes the first transfer service according to the result of the voice recognition.
3. The blockchain testing method according to claim 1, characterized in that: The first transfer service is triggered by the following steps: Sending a login request for the first account to the blockchain resource client; When it is determined that the first account login is completed, a first transfer request is generated; wherein the first transfer request includes a target account, a target asset category and an asset amount corresponding to the first transfer service; The first transfer request is sent to the blockchain resource client, so that the blockchain resource client executes a first transfer service of the first account.
4. The blockchain testing method according to claim 3 is characterized in that: When it is determined that the first account login is completed, generating a first transfer request includes: When it is determined that the first account login is completed, detecting the asset balance corresponding to each asset category of the first account; Determine a target asset category corresponding to the first transfer business from the asset categories, and determine a first asset amount corresponding to the first transfer business according to the asset balance corresponding to the target asset category; wherein the first asset amount is less than or equal to the asset balance corresponding to the target asset category; The first transfer request is generated according to a preset target account, the target asset category, and the first asset amount.
5. The blockchain testing method according to claim 3 is characterized in that: When it is determined that the first account login is completed, generating a first transfer request includes: When it is determined that the first account login is completed, detecting the asset balance corresponding to each asset category of the first account; Determine a target asset category corresponding to the first transfer business from the asset categories, and determine a second asset amount corresponding to the first transfer business according to the asset balance corresponding to the target asset category; wherein the second asset amount is greater than the asset balance corresponding to the target asset category; Generate the first transfer request according to a preset target account, the target asset category, and the second asset amount; After the step of sending the first transfer request to the blockchain resource client so that the blockchain resource client executes the first transfer service of the first account, the method further includes the following steps: Detecting whether the blockchain resource client outputs a second prompt message at the front end; the second prompt message is used to remind the first account that the first transfer business has insufficient asset balance; If the blockchain resource client does not output the second prompt information at the front end, it is determined that the blockchain resource client test fails.
6. The blockchain testing method according to claim 1, characterized in that: The transferring of the assets of the first account to the second account comprises: Acquire a target asset category corresponding to the first transfer business, and detect an asset balance corresponding to the target asset category in the first account; A second transfer service is generated and triggered according to the second account, the target asset category and the asset balance corresponding to the target asset category; wherein the second transfer service is used to transfer all assets of the target asset category in the first account to the second account.
7. The blockchain testing method according to claim 6, characterized in that: The generating and triggering of the second transfer service includes: generating a second transfer business according to the second account, the target asset category and the asset balance corresponding to the target asset category; Calling the transaction service to obtain the transaction signature corresponding to the second transfer service; According to the transaction signature, the second transfer business is put on the chain to transfer all the assets of the target asset category in the first account to the second account.
8. The blockchain testing method according to claim 7, characterized in that: The transaction signature corresponding to the second transfer service is obtained by the following steps: Obtaining private key information of the first account; The second transfer service is encrypted using the private key information to obtain a transaction signature corresponding to the second transfer service.
9. The blockchain testing method according to claim 8, characterized in that: The transferring of the assets of the first account to the second account comprises: Acquire the target asset category and asset amount corresponding to the first transfer business, and detect the asset balance corresponding to the target asset category in the first account; determining a third asset amount according to the asset amount corresponding to the first transfer business and the asset balance corresponding to the target asset category; the third asset amount is less than the asset balance corresponding to the target asset category, and the sum of the third asset data and the asset amount corresponding to the first transfer business is greater than the asset balance corresponding to the target asset category; A third transfer service is generated and triggered according to the second account, the target asset category and the third asset amount; wherein the third transfer service is used to transfer the assets of the target asset category in the first account by the third asset amount to the second account.
10. The blockchain testing method according to claim 1, characterized in that: The detecting whether the blockchain resource client outputs the first prompt information at the front end includes: Obtaining the operation log information of the blockchain resource client; According to the operation log information, determine whether the blockchain resource client outputs the first prompt information at the front end.
11. The blockchain testing method according to claim 1, characterized in that: The detecting whether the blockchain resource client outputs the first prompt information at the front end includes: Taking a screenshot of the front-end interface of the blockchain resource client to obtain target image data; Detect whether the target image data includes the first prompt information.
12. A blockchain testing device, characterized in that: The device comprises: A first detection unit, configured to detect a target stage at which the blockchain resource client is in when executing a first transfer service of a first account; A transfer unit, configured to transfer the assets of the first account to a second account if the target stage is a transaction signature acquisition stage; A second detection unit is used to detect whether the blockchain resource client outputs a first prompt message at the front end; the first prompt message is used to remind the first account that the first transfer business has not been completed; The processing unit is used to determine that the blockchain resource client test fails if the blockchain resource client does not output the first prompt information at the front end.
13. An electronic device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the method according to any one of claims 1 to 11 is implemented.
14. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 11 is implemented.
15. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the method according to any one of claims 1 to 11 is implemented.