A data processing method and device

By acquiring and preprocessing blockchain request data, using compatibility and stable comparison blockchain to test the compatibility of the blockchain to be tested, the problem of difficult to determine the compatibility of self-developed blockchains and public blockchains is solved, improving blockchain development efficiency and saving costs.

CN113129002BActive Publication Date: 2025-07-18TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202110527924.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-05-14
Publication Date
2025-07-18
Estimated Expiration
2041-05-14

AI Technical Summary

Technical Problem

The compatibility of self-developed blockchains and public blockchains is difficult to determine, resulting in inefficient development of blockchain platforms, and it takes time and cost for developers to learn new smart contract languages.

Method used

By obtaining the request data of the target blockchain, extracting the service request data and preprocessing it, generating the target request data, and then sending it to the blockchain to be detected and the control blockchain, the compatibility and stable control blockchain are used to determine the compatibility of the blockchain to be detected.

Benefits of technology

Rapidly testing blockchain compatibility improves the efficiency of blockchain development, saves development costs, and reduces the difficulty for smart contract developers to learn new languages.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113129002B_ABST
    Figure CN113129002B_ABST
Patent Text Reader

Abstract

An embodiment of the present application discloses a data processing method and device. The method includes the following steps: obtaining request data of a target blockchain; extracting service request data from the request data, and preprocessing the service request data to generate target request data; sending the target request data to a blockchain to be detected and a control blockchain respectively, so that the blockchain to be detected and the control blockchain respectively call the target request data to generate output results of the blockchain to be detected and the control blockchain; the control blockchain is a blockchain with compatibility and stability; obtaining the output results of the blockchain to be detected and the control blockchain, and determining the compatibility of the blockchain to be detected with respect to the control blockchain according to the output results. By using the present application, the compatibility of the blockchain can be quickly tested, the efficiency of blockchain development can be improved, and the development cost can be saved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of Internet technologies, and in particular, to a data processing method and device. Background Art

[0002] Currently, there are various types of self-developed blockchains on the market, as well as their corresponding self-developed smart contract virtual machines. As a service for running smart contracts, the smart contract virtual machine undertakes important functions of the blockchain. However, different from public blockchains, there are certain differences between the smart contracts of self-developed blockchains and public blockchains. Therefore, it is impossible to determine the compatibility between self-developed blockchains and public blockchains. At the same time, developers also need time costs to learn new smart contract languages. In the use and expansion of self-developed blockchains, it is impossible to efficiently make the self-developed blockchain virtual machine compatible with mainstream smart contract virtual machines on the market, which limits the capabilities of the blockchain platform. Summary of the Invention

[0003] Embodiments of this application provide a data processing method and device, which can quickly test the compatibility of blockchains, improve the efficiency of blockchain development, and save development costs.

[0004] One aspect of the embodiments of this application provides a data processing method, which may include:

[0005] Obtain request data of a target blockchain; the target blockchain is a blockchain with compatibility and stability;

[0006] Extract service request data from the request data, and preprocess the service request data to generate target request data; the service request data is request data related to smart contracts in the blockchain;

[0007] Send the target request data to a blockchain to be detected and a control blockchain respectively, so that the blockchain to be detected and the control blockchain respectively call the target request data to generate output results of the blockchain to be detected and the control blockchain; the control blockchain is a blockchain with compatibility and stability;

[0008] Obtain the output results of the blockchain to be detected and the control blockchain, and determine the compatibility of the blockchain to be detected with respect to the control blockchain according to the output results.

[0009] In a feasible embodiment, the obtaining of the request data of the target blockchain includes:

[0010] When the target blockchain is a public chain, monitor the target blockchain and use network packet capture technology to obtain the request data of the target blockchain;

[0011] When the target blockchain is a non-public blockchain, obtain the historical version blockchain of the non-public blockchain, and obtain the request data of the target blockchain from the database corresponding to the historical version blockchain.

[0012] In a feasible implementation manner, extracting business request data from the request data and preprocessing the business request data to generate target request data includes:

[0013] Determine the keywords of the smart contract of the target blockchain, and extract business request data from the request data according to the keywords;

[0014] Preprocess the business request data according to the preset address information and the reference blockchain;

[0015] Determine the preprocessed business request data as the target request data.

[0016] In a feasible implementation manner, the preprocessing the business request data according to the preset address information and the reference blockchain includes:

[0017] Obtain the preset initiating address and destination address, and add the initiating address and the destination address to the business request data;

[0018] Obtain the preset signature information of the initiator corresponding to the initiating address, and adjust the signature information of the business request data according to the preset signature information;

[0019] Obtain the data structure of the business request data in the reference blockchain, and adjust the business request data according to the data structure.

[0020] In a feasible implementation manner, sending the target request data to the blockchain to be detected and the reference blockchain respectively, so that the blockchain to be detected and the reference blockchain respectively call the target request data includes:

[0021] Detect the block height information and timestamp of the target request data;

[0022] According to the block height information and the timestamp, send the target request data to the blockchain to be detected and the reference blockchain respectively, so that the blockchain to be detected and the reference blockchain respectively call the target request data to generate the output results of the blockchain to be detected and the reference blockchain.

[0023] In a feasible implementation manner, obtaining the output results of the blockchain to be detected and the reference blockchain, and determining the compatibility of the blockchain to be detected with respect to the reference blockchain according to the output results includes:

[0024] Obtain the first output result of the blockchain to be detected and the second output result of the control blockchain;

[0025] If the first output result is the same as the second output result, the blockchain to be detected is compatible with the control blockchain;

[0026] If the first output result is different from the second output result, the blockchain to be detected is not compatible with the control blockchain.

[0027] In a feasible implementation manner, it further includes:

[0028] When the blockchain to be detected is compatible with the control blockchain, detect the log information of the blockchain to be detected;

[0029] When the log information of the blockchain to be detected is normal, the status of the blockchain to be detected is normal.

[0030] An embodiment of the present application provides a data processing device on the one hand, which may include:

[0031] A request acquisition unit, configured to acquire request data of a target blockchain; the target blockchain is a blockchain with compatibility and stability;

[0032] A data processing unit, configured to extract service request data from the request data, and preprocess the service request data to generate target request data; the service request data is request data related to smart contracts in the blockchain;

[0033] A data sending unit, configured to send the target request data to the blockchain to be detected and the control blockchain respectively, so that the blockchain to be detected and the control blockchain respectively call the target request data to generate output results of the blockchain to be detected and the control blockchain; the control blockchain is a blockchain with compatibility and stability;

[0034] A compatibility determination unit, configured to acquire the output results of the blockchain to be detected and the control blockchain, and determine the compatibility of the blockchain to be detected with respect to the control blockchain according to the output results.

[0035] In a feasible implementation manner, the request acquisition unit is specifically configured to:

[0036] When the target blockchain is a public chain, monitor the target blockchain and use network packet capture technology to acquire the request data of the target blockchain;

[0037] When the target blockchain is a non-public blockchain, obtain the historical version blockchain of the non-public blockchain, and obtain the request data of the target blockchain from the database corresponding to the historical version blockchain.

[0038] In a feasible implementation manner, the data processing unit includes:

[0039] A data extraction subunit, configured to determine keywords of the smart contract of the target blockchain, and extract service request data from the request data according to the keywords;

[0040] A data processing subunit, configured to preprocess the service request data according to preset address information and a reference blockchain;

[0041] A data determination subunit, configured to determine the preprocessed service request data as target request data.

[0042] In a feasible implementation manner, the data processing subunit is specifically configured to:

[0043] Obtain a preset originating address and destination address, and add the originating address and the destination address to the service request data;

[0044] Obtain preset signature information of the originator corresponding to the originating address, and adjust the signature information of the service request data according to the preset signature information;

[0045] Obtain the data structure of the service request data in the reference blockchain, and adjust the service request data according to the data structure.

[0046] In a feasible implementation manner, the data sending unit is specifically configured to:

[0047] Detect the block height information and timestamp of the target request data;

[0048] According to the block height information and the timestamp, send the target request data to the blockchain to be detected and the reference blockchain respectively, so that the blockchain to be detected and the reference blockchain respectively call the target request data to generate output results of the blockchain to be detected and the reference blockchain.

[0049] In a feasible implementation manner, the compatibility determination unit is specifically configured to:

[0050] Obtain a first output result of the blockchain to be detected and a second output result of the reference blockchain;

[0051] If the first output result is the same as the second output result, the blockchain to be detected is compatible with the reference blockchain;

[0052] If the first output result is different from the second output result, the blockchain to be detected is not compatible with the control blockchain.

[0053] In a feasible implementation, it further includes:

[0054] A status detection unit, configured to detect the log information of the blockchain to be detected when the blockchain to be detected is compatible with the control blockchain;

[0055] If the log information of the blockchain to be detected is normal, the status of the blockchain to be detected is normal.

[0056] On the one hand, an embodiment of the present application provides a computer-readable storage medium, in which a computer program is stored, and the computer program is adapted to be loaded and executed by a processor to perform the above method steps.

[0057] On the one hand, an embodiment of the present application provides a computer device, including a processor and a memory; wherein, the memory stores a computer program, and the computer program is adapted to be loaded and executed by the processor to perform the above method steps.

[0058] On the one hand, an embodiment of the present application provides a computer program product or a computer program. The computer program product or the computer program includes computer instructions, and the computer instructions are stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device performs the above method steps.

[0059] In an embodiment of the present application, by obtaining request data of a target blockchain, extracting service request data from the request data, and preprocessing the service request data to generate target request data, where the service request data is request data related to a smart contract in the blockchain, further sending the target request data to a blockchain to be detected and a control blockchain respectively, the blockchain to be detected and the control blockchain respectively call the target request data, the control blockchain is a blockchain with compatibility and stability, and finally obtaining output results of the blockchain to be detected and the control blockchain, and determining the compatibility of the blockchain to be detected with respect to the control blockchain according to the output results. By detecting the compatibility of the blockchain to be detected, the difficulty and cost for smart contract developers to learn a new smart contract language are reduced, the efficiency of blockchain development is improved, and the development cost is saved. Description of the Drawings

[0060] To more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the accompanying drawings required for the description of the embodiments or the prior art. Obviously, the accompanying drawings in the following description are only some embodiments of the present application. For those of ordinary skill in the art, without creative efforts, other accompanying drawings can be obtained based on these drawings.

[0061] Figure 1a is a system architecture diagram for data processing provided by an embodiment of the present application;

[0062] Figure 1b is a scenario schematic diagram of a distributed system provided by an embodiment of the present application;

[0063] Figure 1c is a schematic structural diagram of a block structure provided by an embodiment of the present application;

[0064] Figure 2 is a schematic flowchart of a data processing method provided by an embodiment of the present application;

[0065] Figure 3 is a schematic flowchart of a data processing method provided by an embodiment of the present application;

[0066] Figure 4 is an example schematic diagram of a data processing method provided by an embodiment of the present application;

[0067] Figure 5 is a schematic structural diagram of a data processing device provided by an embodiment of the present application;

[0068] Figure 6 is a schematic structural diagram of a computer device provided by an embodiment of the present application. Specific embodiments

[0069] The following will clearly and completely describe the technical solutions in the embodiments of the present application in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only some embodiments of the present application, rather than all embodiments. Based on the embodiments of the present application, all other embodiments obtained by those of ordinary skill in the art without creative efforts belong to the scope of protection of the present application.

[0070] Please refer to Figure 1a, which is a system architecture diagram for data processing provided by an embodiment of the present invention. Server 10d establishes a connection with the target blockchain through a communication bus. The target blockchain is a blockchain with compatibility and stability, such as a mainstream public blockchain. Server 10d obtains the request data of the target blockchain, extracts the service request data from the request data, and preprocesses the service request data to generate target request data. The service request data is the request data related to the smart contract in the blockchain. Server 10d further sends the target request data to the blockchain to be detected 10b and the control blockchain 10c respectively. The control blockchain 10c is a blockchain with compatibility and stability, and the control blockchain can be the above-mentioned mainstream public blockchain. The blockchain to be detected 10b and the control blockchain 10c respectively call the target request data, obtain the output results of the blockchain to be detected 10b and the control blockchain 10c, and determine the compatibility of the blockchain to be detected 10b with respect to the control blockchain 10c according to the output results.

[0071] The server 10d involved in the embodiment of the present application may include user terminals with data transmission and storage functions, specifically including: terminal devices such as tablet computers, smart phones, personal computers (PCs), laptop computers, and palmtop computers.

[0072] The blockchain involved in the embodiment of the present application is a new application mode of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanism, and encryption algorithm. The blockchain may include a blockchain underlying platform, a platform product service layer, and an application service layer.

[0073] The underlying blockchain platform may include processing modules such as user management, basic services, smart contracts, and operation monitoring. Among them, the user management module is responsible for the identity information management of all blockchain participants, including maintaining the generation of public and private keys (account management), key management, and the maintenance of the correspondence between the real identity of users and blockchain addresses (permission management). And under authorization, it supervises and audits the transaction situations of certain real identities, and provides the rule configuration for risk control (risk control and auditing); the basic service module is deployed on all blockchain node devices to verify the validity of business requests, and after reaching a consensus on valid requests, records them on the storage. For a new business request, the basic service first performs interface adaptation parsing and authentication processing (interface adaptation), then encrypts the business information through a consensus algorithm (consensus management), and after encryption, transmits it to the shared ledger completely and consistently (network communication), and performs record storage; the smart contract module is responsible for the registration and issuance of contracts, as well as contract triggering and contract execution. Developers can define contract logic through a certain programming language, publish it to the blockchain (contract registration), and according to the logic of the contract terms, call keys or other events to trigger execution, complete the contract logic, and at the same time also provide functions for contract upgrade and cancellation; the operation monitoring module is mainly responsible for the deployment, configuration modification, contract setting, cloud adaptation during the product release process, and the visual output of the real-time status during product operation, such as: alarming, monitoring network conditions, monitoring the health status of node devices, etc.

[0074] The platform product service layer provides the basic capabilities and implementation frameworks of typical applications. Developers can build on these basic capabilities and overlay the characteristics of the business to complete the blockchain implementation of the business logic. The application service layer provides application services based on the blockchain solution for business participants to use.

[0075] The following will be combined with Figure 1b and Figure 1c , to illustrate the specific implementation scenarios provided by the embodiments of this application. The blockchain network involved in the embodiments of the present invention may be a distributed system formed by connecting a client and multiple nodes (any form of computing device accessing the network, such as a server, a user terminal) in the form of network communication.

[0076] Taking the distributed system as an example of the blockchain system, refer to Figure 1b , Figure 1bFIG. 0 is an optional schematic structural diagram of the distributed system 100 provided by an embodiment of the present invention applied to a blockchain system, which is formed by multiple nodes (any form of computing device accessing the network, such as a server or a user terminal) and a client. A peer-to-peer (P2P) network is formed among the nodes. The P2P protocol is an application layer protocol running on top of the Transmission Control Protocol (TCP). In the distributed system, any machine such as a server or a terminal can join and become a node. A node includes a hardware layer, an intermediate layer, an operating system layer, and an application layer.

[0077] See Figure 1b the functions of each node in the illustrated blockchain system. The functions involved include:

[0078] 1) Routing, which is a basic function of a node and is used to support communication between nodes.

[0079] In addition to the routing function, a node may also have the following functions:

[0080] 2) Application, which is used to be deployed in the blockchain. According to actual business requirements, it implements specific services, records the data related to the implemented functions to form record data, carries a digital signature in the record data to indicate the source of the task data, and sends the record data to other nodes in the blockchain system. When other nodes verify the source and integrity of the record data successfully, they add the record data to a temporary block.

[0081] For example, the services implemented by the application include:

[0082] 2.1) Wallet, which is used to provide the function of conducting electronic currency transactions, including initiating a transaction (i.e., sending the transaction record of the current transaction to other nodes in the blockchain system. After other nodes verify successfully, as a response to acknowledging the validity of the transaction, they deposit the record data of the transaction into the temporary block of the blockchain. Of course, the wallet also supports querying the remaining electronic currency in the electronic currency address;

[0083] 2.2) Shared ledger, which is used to provide functions such as storage, query, and modification of account data. It sends the record data of the operations on the account data to other nodes in the blockchain system. After other nodes verify its validity, as a response to acknowledging the validity of the account data, they deposit the record data into the temporary block and can also send a confirmation to the node that initiated the operation.

[0084] 2.3) Smart contracts are computerized protocols that can execute the terms of a contract. They are implemented by deploying code on a shared ledger that is executed when certain conditions are met. The code is used to complete automated transactions based on actual business needs, such as querying the logistics status of the goods purchased by the buyer and transferring the buyer's electronic currency to the merchant's address after the buyer signs for the goods. Of course, smart contracts are not limited to executing contracts for transactions, but can also execute contracts for processing received information.

[0085] 3) Blockchain, including a series of blocks that are connected to each other in the order of their generation. Once a new block is added to the blockchain, it will not be removed. The block records the record data submitted by the nodes in the blockchain system.

[0086] See also Figure 1c , Figure 1c This is an optional schematic diagram of the block structure provided by an embodiment of the present invention. Each block includes the hash value of the transaction record stored in this block (the hash value of this block) and the hash value of the previous block. Each block is connected by the hash value to form a blockchain. In addition, the block can also include information such as the timestamp when the block was generated. The blockchain is essentially a decentralized database, a string of data blocks generated by cryptographic methods. Each data block contains relevant information for verifying the validity of its information (anti-counterfeiting) and generating the next block.

[0087] See also Figure 2 , which is a flow chart of a data processing method provided in an embodiment of the present application. Figure 2 As shown, the method in the embodiment of the present application may include the following steps S101 to S104.

[0088] S101, obtaining request data of the target blockchain;

[0089] Specifically, the data processing device obtains the request data of the target blockchain. It can be understood that the target blockchain is a blockchain with compatibility and stability, which can be a mainstream public chain or a stable version of a self-developed blockchain, and the request data is a transaction request in the target blockchain. Specifically, if the target blockchain is a public chain, since all transaction requests on the public chain are broadcast to the entire network, all blockchain transaction requests can be monitored and obtained. If the target blockchain is a self-developed blockchain, the transaction request of the self-developed blockchain can be pulled from the database through the rights of the developer.

[0090] Specific methods for obtaining transaction requests can include filtering network requests through IP ports, listening to network traffic to obtain request data, or modifying the business. When there is a transaction request, the request data is stored in a database, and then the corresponding request data can be directly obtained from the database. Or network packet capture technologies such as Wireshark and tcpdump can be used to capture traffic and obtain request data.

[0091] S102, Extract business request data from the request data and preprocess the business request data to generate target request data;

[0092] Specifically, the request data includes business request data and non-business request data. Business request data is the request data related to smart contracts in the blockchain, which can specifically be request information and return information during transaction on-chain, etc. Non-business request data includes heartbeat packets, handshake information, etc. in the request data. The data processing device extracts business request data from the request data and further preprocesses the business request data to generate target request data. The preprocessing of business request data is to improve and modify business data to make it meet subsequent call requirements. Specific preprocessing includes complementing and contrasting the call field differences between the blockchain and the blockchain to be processed, adding the initiating address and receiving address, and adjusting the signature information in the request data to ensure the controllability and legality of blockchain transactions.

[0093] S103, Send the target request data to the blockchain to be detected and the control blockchain respectively, so that the blockchain to be detected and the control blockchain respectively call the target request data to generate output results of the blockchain to be detected and the control blockchain;

[0094] Specifically, the data processing device sends the target request data to the blockchain to be detected and the control blockchain respectively. It can be understood that the blockchain to be detected is the blockchain used for compatibility detection, and the control blockchain is a blockchain with compatibility and stability. The control blockchain can be a mainstream public chain or a stable version of a self-developed blockchain. For example, for a newly developed blockchain to be detected, if it is necessary to detect its compatibility with the mainstream public chain, the mainstream public chain can be used as the control blockchain; or if a new version of a self-developed blockchain is to be released and it is necessary to detect the compatibility between the new version and the previous version, the previous stable version of the self-developed blockchain can be used as the control blockchain for the new version.

[0095] The target request data can be multiple request data. When the blockchain to be detected and the control blockchain call the multiple request data, they are called in the same order. Specifically, the height of the request data in the blockchain can be used as the sequence. The request data with a lower height is the request initiated first and is called first. For request data with the same height, the timestamp when the transaction is initiated can be used as the sequence, and the one with an earlier timestamp is the request initiated first. After the target request data is called, the output results of the blockchain to be detected and the control blockchain are generated.

[0096] S104. Obtain the output results of the blockchain to be detected and the control blockchain, and determine the compatibility of the blockchain to be detected with respect to the control blockchain according to the output results.

[0097] Specifically, after the blockchain to be detected and the control blockchain respectively call the target request data, the data processing device obtains the output results of the blockchain to be detected and the control blockchain. It can be understood that the output results include the output results of the blockchain to be detected and the control blockchain for each request data respectively, and determine the compatibility of the blockchain to be detected with respect to the control blockchain according to the output results. If the output result of the blockchain to be detected is the same as the output result of the control blockchain, then the blockchain to be detected is compatible with respect to the control blockchain. If the target request data includes multiple request data and the data results of all request data are the same, then the blockchain to be detected is compatible with respect to the control blockchain; if there is an inconsistent situation between the output result of the blockchain to be detected and the output result of the control blockchain, then the blockchain to be detected is not compatible with respect to the control blockchain.

[0098] In the embodiment of the present application, by obtaining the request data of the target blockchain, extracting the business request data from the request data, and preprocessing the business request data to generate the target request data, where the business request data is the request data related to the smart contract in the blockchain, and further sending the target request data to the blockchain to be detected and the control blockchain respectively. The blockchain to be detected and the control blockchain respectively call the target request data, and the control blockchain is a blockchain with compatibility and stability. Finally, obtain the output results of the blockchain to be detected and the control blockchain, and determine the compatibility of the blockchain to be detected with respect to the control blockchain according to the output results. By detecting the compatibility of the blockchain to be detected, it reduces the difficulties and costs for smart contract developers to learn new smart contract languages, improves the efficiency of blockchain development, and saves the development costs.

[0099] Please refer to Figure 3 , which is a schematic flowchart of a data processing method provided by an embodiment of the present application. AsFigure 3 As shown in Figure 3 , the method according to the embodiment of the present application may include the following steps S201-S206.

[0100] S201, when the target blockchain is a public blockchain, monitor the target blockchain and use network packet capture technology to obtain the request data of the target blockchain; when the target blockchain is a non-public blockchain, obtain the historical version blockchain of the non-public blockchain and obtain the request data of the target blockchain from the database corresponding to the historical version blockchain.

[0101] Specifically, the target blockchain is a mainstream public blockchain or a stable version of a self-developed blockchain. When the target blockchain is a public blockchain, the data processing device monitors the target blockchain. Since all transaction requests on the public blockchain are broadcast across the network, network packet capture technologies such as wireshark or tcpdump can be used to obtain the request data of the target blockchain.

[0102] When the target blockchain is a non-public blockchain, for example, when performing compatibility testing on a new version released by a self-developed blockchain, the target blockchain can be the historical version before the self-developed blockchain. The data processing device obtains the historical version blockchain and obtains the request data of the target blockchain from the database corresponding to the historical version blockchain.

[0103] S202, determine the keywords of the smart contract of the target blockchain, and extract the business request data from the request data according to the keywords;

[0104] Specifically, the data processing device determines the keywords of the smart contract of the target blockchain and extracts the business request data from the request data. It can be understood that the business request data is the request data related to the smart contract in the blockchain. The business request data generally contains special characters. For example, the business request data of a self-developed blockchain contains content such as "call_contract", and such requests should be obtained as data sources in the request; if the destination address of a public blockchain is a contract address, the code in the destination address is not "0x". For example, it can be "code=web3.eth.getCode(\"address\")". Therefore, the keywords of the smart contract of the target blockchain, such as "call_contract", can be determined first, and the business request data can be extracted from the request data according to the keywords.

[0105] S203, preprocess the business request data according to the preset address information and the reference blockchain; determine the preprocessed business request data as the target request data.

[0106] Specifically, the data processing device obtains the preset origin address and destination address, adds the origin address and the destination address to the service request data. The origin address and the destination address are fixed and can be preset in advance, or can be generated by itself. Adding the origin address and the destination address can ensure the controllability of blockchain transactions. Further, the data processing device obtains the preset signature information of the originator corresponding to the origin address, and adjusts the original signature information of the service request data according to the preset signature information. The adjustment of the signature information can ensure the legality of the service request. Further, the data processing device obtains the data structure of the service request data in the reference blockchain, and adjusts the service request data according to the data structure, that is, according to the difference in the call fields between the blockchain to be processed and the reference blockchain, supplements the missing field content in the service request data, and removes the redundant field content in the service request data.

[0107] S204, detect the block height information and timestamp of the target request data; according to the block height information and the timestamp, send the target request data to the blockchain to be detected and the reference blockchain respectively, so that the blockchain to be detected and the reference blockchain respectively call the target request data to generate the output results of the blockchain to be detected and the reference blockchain.

[0108] Specifically, the target request data is at least one request data. The data processing device detects the block height information and timestamp of each request data in the target request data, and sends the target request data to the blockchain to be detected and the reference blockchain respectively in the order of the height information of the request data in the blockchain. The request with a lower height information is the request initiated first. If the request data has the same height information, it is sent to the blockchain to be detected and the reference blockchain according to the timestamp of the request data, and the one with an earlier timestamp is used as the request initiated first. The blockchain to be detected and the reference blockchain respectively call the target request data in the order of the height information and the timestamp. After the target request data is called, the output results of the blockchain to be detected and the reference blockchain are generated.

[0109] S205, obtain the first output result of the blockchain to be detected and the second output result of the reference blockchain; if the first output result is the same as the second output result, the blockchain to be detected is compatible with the reference blockchain; if the first output result is different from the second output result, the blockchain to be detected is not compatible with the reference blockchain.

[0110] Specifically, the data processing device obtains the first output result of the blockchain to be detected and the second output result of the control blockchain. If the first output result is the same as the second output result, the blockchain to be detected is compatible with the control blockchain; if the target request data includes multiple request data, and the first output result is the same as the second output result, the blockchain to be detected is compatible with the control blockchain.

[0111] If the first output result is different from the second output result, the blockchain to be detected is not compatible with the control blockchain. That is, if the target request data includes multiple request data, and there is a difference in the output result of one request data, the blockchain to be detected is not compatible with the control blockchain.

[0112] Please refer to Figure 4 , which is an example schematic diagram of a data processing method provided by an embodiment of the present application. As Figure 4 shown, to detect the compatibility of the blockchain to be processed with the control blockchain, the control blockchain is a blockchain with compatibility and stability, and the control blockchain can be a mainstream public chain or a stable version of a self-developed blockchain. First, obtain the request data of the target blockchain, and the target blockchain can be a mainstream public chain or a stable version of a self-developed blockchain. Then, extract the business request data from the request data and preprocess the business request data to generate target request data. Further, send the target request data to the blockchain to be detected and the control blockchain respectively. The blockchain to be detected and the control blockchain respectively call the target request data. Finally, obtain the output results of the blockchain to be detected and the control blockchain, and determine the compatibility of the blockchain to be detected with the control blockchain according to the output results.

[0113] S206. When the blockchain to be detected is compatible with the control blockchain, detect the log information of the blockchain to be detected; when the log information of the blockchain to be detected is normal, the status of the blockchain to be detected is normal.

[0114] Specifically, when the blockchain to be detected is compatible with the control blockchain, further detect the status information of the blockchain to ensure that the blockchain can work properly. Specifically, detect the log information of the blockchain to be detected. When the log information of the blockchain to be detected is normal, that is, no error log occurs, the status of the blockchain to be detected is normal. When the blockchain to be detected is a blockchain cluster, if the operation results of the blockchains in the blockchain cluster are the same, the status of the blockchain to be detected is normal.

[0115] In an embodiment of the present application, by obtaining request data of a target blockchain, extracting service request data from the request data, and preprocessing the service request data to generate target request data, where the service request data is request data related to a smart contract in the blockchain, further sending the target request data to a blockchain to be detected and a control blockchain respectively, the blockchain to be detected and the control blockchain respectively call the target request data, the control blockchain is a blockchain with compatibility and stability, and finally obtaining output results of the blockchain to be detected and the control blockchain, and determining the compatibility of the blockchain to be detected with respect to the control blockchain according to the output results. By detecting the compatibility of the blockchain to be detected, the difficulty and cost for smart contract developers to learn a new smart contract language are reduced, the efficiency of blockchain development is improved, and the development cost is saved.

[0116] Please refer to Figure 5 , which is a schematic structural diagram of a data processing device provided by an embodiment of the present application. The data processing device may be a computer program (including program code) running in a computer device. For example, the data processing device is an application software; the device may be used to execute corresponding steps in the method provided by an embodiment of the present application. As Figure 5 shown, the data processing device 1 of an embodiment of the present application may include: a request acquisition unit 11, a data processing unit 12, a data sending unit 13, and a compatibility determination unit 14.

[0117] The request acquisition unit 11 is used to obtain request data of a target blockchain; the target blockchain is a blockchain with compatibility and stability;

[0118] The data processing unit 12 is used to extract service request data from the request data and preprocess the service request data to generate target request data; the service request data is request data related to a smart contract in the blockchain;

[0119] The data sending unit 13 is used to send the target request data to a blockchain to be detected and a control blockchain respectively, so that the blockchain to be detected and the control blockchain respectively call the target request data to generate output results of the blockchain to be detected and the control blockchain; the control blockchain is a blockchain with compatibility and stability;

[0120] The compatibility determination unit 14 is used to obtain output results of the blockchain to be detected and the control blockchain, and determine the compatibility of the blockchain to be detected with respect to the control blockchain according to the output results.

[0121] In a feasible implementation manner, the request acquisition unit 11 is specifically used for:

[0122] When the target blockchain is a public blockchain, monitor the target blockchain and use network packet capture technology to obtain the request data of the target blockchain;

[0123] When the target blockchain is a non-public blockchain, obtain the historical version blockchain of the non-public blockchain, and obtain the request data of the target blockchain from the database corresponding to the historical version blockchain.

[0124] Please refer to Figure 5 , the data processing unit 12 in the embodiment of the present application may include: a data extraction subunit 121, a data processing subunit 122, and a data determination subunit 123.

[0125] The data extraction subunit 121 is used to determine the keywords of the smart contract of the target blockchain, and extract service request data from the request data according to the keywords;

[0126] The data processing subunit 122 is used to preprocess the service request data according to the preset address information and the reference blockchain;

[0127] The data determination subunit 123 is used to determine the preprocessed service request data as the target request data.

[0128] In a feasible implementation manner, the data processing subunit 122 is specifically used for:

[0129] Obtain the preset initiating address and destination address, and add the initiating address and the destination address to the service request data;

[0130] Obtain the preset signature information of the initiator corresponding to the initiating address, and adjust the signature information of the service request data according to the preset signature information;

[0131] Obtain the data structure of the service request data in the reference blockchain, and adjust the service request data according to the data structure.

[0132] In a feasible implementation manner, the data sending unit 13 is specifically used for:

[0133] Detect the block height information and timestamp of the target request data;

[0134] According to the block height information and the timestamp, send the target request data to the blockchain to be detected and the reference blockchain respectively, so that the blockchain to be detected and the reference blockchain respectively call the target request data to generate the output results of the blockchain to be detected and the reference blockchain.

[0135] In a feasible implementation manner, the compatibility determination unit 14 is specifically used for:

[0136] Obtain the first output result of the blockchain to be detected and the second output result of the control blockchain;

[0137] If the first output result is the same as the second output result, the blockchain to be detected is compatible with the control blockchain;

[0138] If the first output result is different from the second output result, the blockchain to be detected is not compatible with the control blockchain.

[0139] Please refer to Figure 5 , the data processing device 1 in the embodiment of the present application may further include: a status detection unit 15.

[0140] The status detection unit 15 is used to detect the log information of the blockchain to be detected when the blockchain to be detected is compatible with the control blockchain;

[0141] When the log information of the blockchain to be detected is normal, the status of the blockchain to be detected is normal.

[0142] In the embodiment of the present application, by obtaining the request data of the target blockchain, extracting the service request data from the request data, and preprocessing the service request data to generate target request data, the service request data is the request data related to the smart contract in the blockchain. Further, the target request data is respectively sent to the blockchain to be detected and the control blockchain, and the blockchain to be detected and the control blockchain respectively call the target request data. The control blockchain is a blockchain with compatibility and stability. Finally, the output results of the blockchain to be detected and the control blockchain are obtained, and the compatibility of the blockchain to be detected with respect to the control blockchain is determined according to the output results. By detecting the compatibility of the blockchain to be detected, the difficulty and cost for smart contract developers to learn new smart contract languages are reduced, the efficiency of blockchain development is improved, and the development cost is saved.

[0143] Please refer to Figure 6 , a schematic structural diagram of a computer device is provided for the embodiment of the present application. As Figure 6As shown in the figure, the computer device 1000 may include: at least one processor 1001, such as a CPU, at least one network interface 1004, a user interface 1003, a memory 1005, and at least one communication bus 1002. Among them, the communication bus 1002 is used to realize the connection and communication between these components. Among them, the user interface 1003 may include a display screen (Display), and optionally, the user interface 1003 may further include a standard wired interface and a wireless interface. The network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a WI-FI interface). The memory 1005 may be a random access memory (RAM) or a non-volatile memory (NVM), such as at least one disk memory. Optionally, the memory 1005 may also be at least one storage device located far from the aforementioned processor 1001. As Figure 6 shown, the memory 1005, as a computer storage medium, may include an operating system, a network communication module, a user interface module, and a data processing application program.

[0144] In Figure 6 the computer device 1000 shown in the figure, the network interface 1004 can provide network communication functions, and the user interface 1003 is mainly used to provide an input interface for users; while the processor 1001 can be used to call the data processing application program stored in the memory 1005 to implement the above Figures 2 - 4 description of the data processing method in any one of the corresponding embodiments, which will not be elaborated here.

[0145] It should be understood that the computer device 1000 described in the embodiments of the present application can execute the description of the data processing method in any one of the previous Figures 2 - 4 corresponding embodiments, and can also execute the description of the data processing device in the previous Figure 5 corresponding embodiments, which will not be elaborated here. In addition, the description of the beneficial effects of adopting the same method will not be elaborated either.

[0146] In addition, it should be pointed out here that: the embodiments of the present application also provide a computer-readable storage medium, and the computer-readable storage medium stores a computer program executed by the aforementioned data processing device, and the computer program includes program instructions. When the processor executes the program instructions, it can execute the previous Figures 2 - 4The description of the data processing method in any corresponding embodiment will not be repeated here. In addition, the beneficial effects of using the same method will not be repeated. For the technical details not disclosed in the embodiments of the computer-readable storage medium involved in this application, please refer to the description of the method embodiments of this application. As an example, the program instructions can be deployed to be executed on one computing device, or on multiple computing devices located at one location, or on multiple computing devices distributed at multiple locations and interconnected through a communication network. The multiple computing devices distributed at multiple locations and interconnected through a communication network can form a blockchain system.

[0147] Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be completed by instructing relevant hardware through a computer program. The program can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above methods. Among them, the storage medium can be a magnetic disk, an optical disk, NVM, or RAM, etc.

[0148] The above-disclosed are only the preferred embodiments of this application. Of course, the scope of rights of this application cannot be limited thereby. Therefore, equivalent changes made according to the claims of this application still fall within the scope covered by this application.

Claims

1. A data processing method, characterized in that, Including: Obtaining request data of a target blockchain; The target blockchain is a blockchain with compatibility and stability; Extracting business request data from the request data, and preprocessing the business request data to generate target request data; the business request data is request data related to smart contracts in the blockchain; Sending the target request data to a blockchain to be detected and a control blockchain respectively, so that the blockchain to be detected and the control blockchain respectively call the target request data to generate output results of the blockchain to be detected and the control blockchain; the control blockchain is a blockchain with compatibility and stability; Obtaining the output results of the blockchain to be detected and the control blockchain, and determining the compatibility of the blockchain to be detected with respect to the control blockchain according to the output results.

2. The method according to claim 1, wherein The obtaining of the request data of the target blockchain includes: When the target blockchain is a public blockchain, monitoring the target blockchain and using network packet capture technology to obtain the request data of the target blockchain; When the target blockchain is a non-public blockchain, obtaining the historical version blockchain of the non-public blockchain, and obtaining the request data of the target blockchain from the database corresponding to the historical version blockchain.

3. The method according to claim 1, wherein The extracting of the business request data from the request data and preprocessing the business request data to generate target request data includes: Determining keywords of smart contracts of the target blockchain, and extracting business request data from the request data according to the keywords; Preprocessing the business request data according to preset address information and a control blockchain; Determining the preprocessed business request data as target request data.

4. The method according to claim 3, characterized in that, The preprocessing of the business request data according to preset address information and a control blockchain includes: Obtaining a preset initiating address and destination address, and adding the initiating address and the destination address to the business request data; Obtaining preset signature information of the initiator corresponding to the initiating address, and adjusting the signature information of the business request data according to the preset signature information; Obtaining the data structure of the business request data in the control blockchain, and adjusting the business request data according to the data structure.

5. The method according to claim 1, wherein The sending of the target request data to a blockchain to be detected and a control blockchain respectively, so that the blockchain to be detected and the control blockchain respectively call the target request data to generate output results of the blockchain to be detected and the control blockchain includes: Detecting the block height information and timestamp of the target request data; According to the block height information and the timestamp, sending the target request data to a blockchain to be detected and a control blockchain respectively, so that the blockchain to be detected and the control blockchain respectively call the target request data to generate output results of the blockchain to be detected and the control blockchain.

6. The method according to claim 1, wherein The obtaining of the output results of the blockchain to be detected and the control blockchain, and determining the compatibility of the blockchain to be detected with respect to the control blockchain according to the output results includes: Obtain the first output result of the blockchain to be detected and the second output result of the control blockchain; If the first output result is the same as the second output result, the blockchain to be detected is compatible with the control blockchain; If the first output result is different from the second output result, the blockchain to be detected is not compatible with the control blockchain.

7. The method according to claim 1, characterized in that, It further includes: When the blockchain to be detected is compatible with the control blockchain, detect the log information of the blockchain to be detected; When the log information of the blockchain to be detected is normal, the status of the blockchain to be detected is normal.

8. A data processing device, characterized in that, It includes: A request acquisition unit, configured to acquire request data of a target blockchain; The target blockchain is a blockchain with compatibility and stability; A data processing unit, configured to extract service request data from the request data, and preprocess the service request data to generate target request data; The service request data is request data related to smart contracts in the blockchain; A data sending unit, configured to send the target request data to the blockchain to be detected and the control blockchain respectively, so that the blockchain to be detected and the control blockchain respectively call the target request data to generate output results of the blockchain to be detected and the control blockchain; the control blockchain is a blockchain with compatibility and stability; A compatibility determination unit, configured to acquire the output results of the blockchain to be detected and the control blockchain, and determine the compatibility of the blockchain to be detected with respect to the control blockchain according to the output results.

9. A computer-readable storage medium, characterized in that, A computer program is stored in the computer-readable storage medium, and the computer program is suitable for being loaded and executed by a processor to perform the method according to any one of claims 1-7.

10. A computer device, characterized in that, It is characterized in that it includes: a processor and a memory; wherein, the memory stores a computer program, and the computer program is suitable for being loaded and executed by the processor to perform the method according to any one of claims 1-7.

Citation Information

Patent Citations

  • Block chain-based compatibility test method and apparatus, and electronic device

    CN109800158A

  • Method and device for testing blockchain software

    CN110347609A