CN111369237A - Data processing method and device and computer storage medium - Google Patents

Data processing method and device and computer storage medium Download PDF

Info

Publication number
CN111369237A
CN111369237A CN202010129447.4A CN202010129447A CN111369237A CN 111369237 A CN111369237 A CN 111369237A CN 202010129447 A CN202010129447 A CN 202010129447A CN 111369237 A CN111369237 A CN 111369237A
Authority
CN
China
Prior art keywords
format
data
transaction data
target
node
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202010129447.4A
Other languages
Chinese (zh)
Other versions
CN111369237B (en
Inventor
周开班
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN202010129447.4A priority Critical patent/CN111369237B/en
Publication of CN111369237A publication Critical patent/CN111369237A/en
Application granted granted Critical
Publication of CN111369237B publication Critical patent/CN111369237B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q20/00Payment architectures, schemes or protocols
    • G06Q20/38Payment protocols; Details thereof
    • G06Q20/382Payment protocols; Details thereof insuring higher security of transaction
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/25Integrating or interfacing systems involving database management systems
    • G06F16/258Data format conversion from or to a database
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Business, Economics & Management (AREA)
  • Accounting & Taxation (AREA)
  • Data Mining & Analysis (AREA)
  • General Engineering & Computer Science (AREA)
  • Finance (AREA)
  • Strategic Management (AREA)
  • General Business, Economics & Management (AREA)
  • Computing Systems (AREA)
  • Computer Security & Cryptography (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The embodiment of the invention provides a data processing method, a data processing device and a computer storage medium, wherein the method is applied to a user terminal, a decentralized application runs on the user terminal, and the method comprises the following steps: acquiring transaction data submitted by the decentralized application, wherein the data format of the transaction data is a first format; converting the data format of the transaction data to obtain transaction data in a target format, wherein the target format comprises a binary format; and sending the transaction data in the target format to a node of a block chain network, so that the node converts the data format of the transaction data in the target format to obtain the transaction data in a second format, wherein the second format is a data format supported by an intelligent contract of the node. By adopting the invention, the data volume transmitted in the cross-language communication process between the decentralized application and the intelligent contract can be reduced, and the accuracy of data conversion can be improved.

Description

Data processing method and device and computer storage medium
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a data processing method and apparatus, and a computer storage medium.
Background
With the development of block chain technology, the development and application of decentralized applications are receiving much attention. Generally speaking, a decentralized application may run on a user's personal device. Generally speaking, the programming language of a decentralized application and the programming language of an intelligent contract for a node of a blockchain network are two different languages. Different code languages require a data conversion, i.e. a communication format is agreed upon for communication between the decentralized application and the intelligent contract. The current communication format is generally the json format. However, json-formatted data is text-formatted data, which results in a relatively large amount of data being transmitted between the decentralized application and the intelligent contract across the course of a verbal communication. In addition, the json-based method is easy to have analysis errors in the conversion process, and the data analyzed from the same text may be different, for example, some special characters may be filtered in the conversion process, thereby reducing the accuracy of data conversion.
Disclosure of Invention
Embodiments of the present invention provide a data processing method, an apparatus, an electronic device, and a computer storage medium, which can reduce the data amount transmitted in the cross-language communication process between a decentralized application and an intelligent contract, and can also improve the accuracy of data conversion.
In a first aspect, an embodiment of the present invention provides a data processing method, which is applied to a user terminal, where a decentralized application is run on the user terminal, and the method includes:
acquiring transaction data submitted by the decentralized application, wherein the data format of the transaction data is a first format;
converting the data format of the transaction data to obtain transaction data in a target format, wherein the target format comprises a binary format;
and sending the transaction data in the target format to a node of a block chain network, so that the node converts the data format of the transaction data in the target format to obtain the transaction data in a second format, wherein the second format is a data format supported by an intelligent contract of the node.
In a second aspect, an embodiment of the present invention further provides a data processing method, which is applied to a node of a blockchain network, where the method includes:
receiving transaction data in a target format sent by a user terminal, wherein the transaction data in the target format is obtained by converting the data format of the transaction data submitted by a decentralized application by the user terminal, and the target format comprises a binary format;
converting the data format of the transaction data in the target format to obtain transaction data in a second format, wherein the second format is a data format supported by the intelligent contract of the node;
and calling the intelligent contract to process the transaction data in the second format.
In a third aspect, an embodiment of the present invention provides a data processing apparatus, which is applied to a user terminal, where a decentralized application runs on the user terminal, and the apparatus includes:
the acquisition module is used for acquiring the transaction data submitted by the decentralized application, and the data format of the transaction data is a first format;
the conversion module is used for converting the data format of the transaction data to obtain the transaction data in a target format, and the target format comprises a binary format;
and the communication module is used for sending the transaction data in the target format to a node of a block link network so as to convert the data format of the transaction data in the target format by the node to obtain the transaction data in a second format, wherein the second format is a data format supported by an intelligent contract of the node.
In a fourth aspect, an embodiment of the present invention further provides a data processing apparatus, which is applied to a node of a blockchain network, where the apparatus includes:
the system comprises a communication module, a data processing module and a data processing module, wherein the communication module is used for receiving transaction data in a target format sent by a user terminal, the transaction data in the target format is obtained by converting the data format of the transaction data submitted by decentralized application by the user terminal, and the target format comprises a binary format;
the conversion module is used for converting the data format of the transaction data in the target format to obtain the transaction data in a second format, wherein the second format is a data format supported by the intelligent contract of the node;
and the processing module is used for calling the intelligent contract to process the transaction data in the second format.
In a fifth aspect, an embodiment of the present invention provides a user terminal, including: a processor, an output device, and a memory; the memory to store program instructions; the processor calls the program instructions to implement the aforementioned data processing method.
In a sixth aspect, an embodiment of the present invention provides a node of a block chain network, including: a processor, an input device, and a memory; the memory to store program instructions; the processor calls the program instructions to implement the aforementioned data processing method.
In a seventh aspect, an embodiment of the present invention provides a computer storage medium, where program instructions are stored in the computer storage medium, and when the program instructions are executed, the computer storage medium is used to implement the foregoing data processing method.
In summary, the user terminal may obtain the transaction data in the first format submitted by the decentralized application, and convert the data format of the transaction data to obtain the transaction data in the target format, where the target format includes a binary format; the user terminal sends the transaction data in the target format to the nodes of the blockchain network, so that the nodes convert the data format of the transaction data in the target format to obtain the transaction data in the second format.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
FIG. 1A is a block diagram of a data processing system according to an embodiment of the present invention;
fig. 1B is a schematic diagram of a block chain according to an embodiment of the present invention;
FIG. 1C is a block generation process according to an embodiment of the present invention;
FIG. 1D is a schematic view of a game item purchase page provided by an embodiment of the present invention;
FIG. 2 is a flow chart of a data processing method according to an embodiment of the present invention;
FIG. 3 is a flow chart of another data processing method provided by the embodiment of the invention;
FIG. 4 is a schematic structural diagram of a data processing apparatus according to an embodiment of the present invention;
FIG. 5 is a block diagram of another data processing apparatus according to an embodiment of the present invention;
fig. 6 is a schematic structural diagram of a user terminal according to an embodiment of the present invention;
fig. 7 is a schematic structural diagram of a node of a block chain according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be described below with reference to the drawings in the embodiments of the present invention.
Referring to the data processing system shown in fig. 1A, the data processing system may include a blockchain network 100, and a user terminal 102. Wherein:
the blockchain network 100 refers to a network for performing data sharing between nodes. The blockchain network may include a plurality of nodes 101, and the plurality of nodes 101 may refer to respective clients in the blockchain network. Each node 101 may receive input information and maintain shared data within the blockchain network based on the received input information while operating normally. In order to ensure information intercommunication in the blockchain network, information connection can exist between each node in the blockchain network, and information transmission can be carried out between the nodes through the information connection. For example, when any node in the blockchain network receives input information, other nodes in the blockchain network acquire the input information according to a consensus algorithm, and store the input information as data in shared data, so that the data stored on all nodes in the blockchain network are consistent.
The user terminal 102 may access the blockchain network and communicate with nodes in the blockchain network, such as to send transaction data in a target format to the nodes in the blockchain network. Among them, the user terminal 102 runs a Decentralized Application (DApp). Decentralized applications may also be referred to as distributed applications. For example, the decentralized application may be a game application or a mining application, and embodiments of the present invention are not limited thereto. The user terminal 102 includes, but is not limited to, a smart phone, a tablet computer, a desktop computer, and the like.
It should be noted that the number of nodes shown in fig. 1A is merely illustrative, and any number of nodes may be deployed according to actual needs.
Each node in the blockchain network has a corresponding node identifier, and each node in the blockchain network can store node identifiers of other nodes in the blockchain network, so that the generated block can be broadcast to other nodes in the blockchain network according to the node identifiers of other nodes. Each node may maintain a node identifier list as shown in the following table, and store the node name and the node identifier in the node identifier list correspondingly. The node identifier may be an IP (Internet Protocol) address and any other information that can be used to identify the node, and table 1 only illustrates the IP address as an example.
Figure BDA0002395392520000041
Each node in the blockchain network stores one identical blockchain. The block chain is composed of a plurality of blocks, referring to fig. 1B, the block chain is composed of a plurality of blocks, the starting block includes a block header and a block main body, the block header stores an input information characteristic value, a version number, a timestamp and a difficulty value, and the block main body stores input information; the next block of the starting block takes the starting block as a parent block, the next block also comprises a block head and a block main body, the block head stores the input information characteristic value of the current block, the block head characteristic value of the parent block, the version number, the timestamp and the difficulty value, and the like, so that the block data stored in each block in the block chain is associated with the block data stored in the parent block, and the safety of the input information in the block is ensured.
When each block in the block chain is generated, referring to fig. 1C, when the node where the block chain is located receives the input information, the input information is verified, after the verification is completed, the input information is stored in the memory pool, and the hash tree for recording the input information is updated; and then, updating the updating time stamp to the time when the input information is received, trying different random numbers, and calculating the characteristic value for multiple times, so that the calculated characteristic value can meet the following formula:
SHA256(SHA256(version+prev_hash+merkle_root+ntime+nbits+x))<TARGET
wherein, SHA256 is a characteristic value algorithm used for calculating a characteristic value; version is version information of the relevant block protocol in the block chain; prev _ hash is a block head characteristic value of a parent block of the current block; merkle _ root is a characteristic value of the input information; ntime is the update time of the update timestamp; nbits is the current difficulty, is a fixed value within a period of time, and is determined again after exceeding a fixed time period; x is a random number; TARGET is a feature threshold, which can be determined from nbits.
Therefore, when the random number meeting the formula is obtained through calculation, the information can be correspondingly stored, and the block head and the block main body are generated to obtain the current block. And then, the node where the block chain is located respectively sends the newly generated blocks to other nodes in the block chain network where the newly generated blocks are located according to the node identifications of the other nodes in the block chain network, the newly generated blocks are verified by the other nodes, and the newly generated blocks are added to the block chain stored in the newly generated blocks after the verification is completed.
The intelligent contract can be operated on the nodes of the block chain network, the intelligent contract is realized by codes executed when a certain condition is met, developers can define contract logic through a programming language, issue the contract logic to the block chain (intelligent contract registration), and call keys or other events to trigger execution according to the logic of contract terms to complete the contract logic and simultaneously provide the functions of upgrading and cancelling the intelligent contract.
Based on the data processing system shown in fig. 1A, an embodiment of the present invention provides a data processing scheme. In this data processing scheme, the user terminal 102 may obtain transaction data submitted by the decentralized application, the transaction data having a data format of a first format. The first format may be a data format supported by a programming language used by the decentralized application. The user terminal 102 converts the data format of the transaction data to obtain the transaction data in a target format, where the target format includes a binary format. For example, the target format may be a protobuf format. The protobuf format may also be abbreviated as pb format. The ProtoBuf herein can also be written as ProtoBuf, and its corresponding english full name can be Protocol Buffer, and its corresponding abbreviation can be PB. That is, the PB format may refer to a PB format. The user terminal 102 sends the transaction data in the target format to the node 101 of the blockchain network. When receiving the data in the target format sent by the user terminal 102, the node 101 may convert the data format of the transaction data in the target format to obtain the transaction data in a second format, where the second format is a data format supported by the intelligent contract of the node 101, that is, the second format is a data format supported by a programming language used by the intelligent contract. Node 101 may invoke the smart contract to process the transaction data in the second format. In the process, the cross-language communication process between the decentralized application and the intelligent contract is realized through the conversion of the target format, the data volume transmitted in the cross-language communication process is reduced, and compared with a json-based method in the prior art, the accuracy of data conversion can be improved due to the fact that the target format comprises a binary format.
The data processing scheme provided by the embodiment of the invention is explained below by taking a scene that a user purchases a game item as an example.
In one application scenario, user a installs DApp1 on a smartphone, DApp1 is a gaming application using JAVA as the programming language, and C + + as the programming language used by the smart contract for node 101. User a may enter the play item purchase page of DApp1, shown in fig. 1D, and may select a play item included in the play item purchase page and click a purchase button corresponding to the play item. After the user clicks the buy button, the smartphone may detect a purchase request submitted by DApp1 for a game item, the purchase request having a data format that is in a first format, that is, a JAVA-supported data format. The smartphone can convert the data format of the purchase request to obtain a purchase request in a PB format, and send the purchase request in the PB format to the node 101. After receiving the purchase request in the PB format, the node 101 may convert the data format of the purchase request in the PB format to obtain the purchase request in the second format, where the second format is a data format supported by the intelligent contract of the node 101, that is, the second format is a data format supported by C + +. Node 101 may invoke a smart contract to execute game item purchase logic according to the purchase request.
It should be noted that the embodiment of the present invention may be applied to other application scenarios besides the above application scenario, and the embodiment of the present invention is not listed here.
It should be further noted that, in addition to being executed by the user terminal, the data processing scheme according to the embodiment of the present invention may also be executed by a service device capable of communicating with the blockchain network, for example, the service device may be a centralized service device. The decentralized application may be run on the service device.
Based on the above description, the embodiment of the present invention provides a data processing method, which can be applied to a user terminal, where a decentralized application runs on the user terminal. Referring to fig. 2, the method may specifically include the following steps:
s201, obtaining transaction data submitted by the decentralized application, wherein the data format of the transaction data is a first format.
The transaction data may refer to any one or more data to be sent to the nodes of the blockchain network. The transaction data may be generated by the decentralized application, or may be input by a user, and the like, and embodiments of the present invention are not limited thereto.
In an embodiment, the data to be sent to the node of the blockchain network may specifically refer to data that needs to be stored or processed by the node of the blockchain network. The data includes, but is not limited to, data such as a request, an instruction, service data, and the like, and the embodiments of the present invention are not limited thereto.
In one embodiment, the user terminal may obtain the transaction data submitted by the decentralized application upon detecting the transaction data submitted by the decentralized application.
S202, converting the data format of the transaction data to obtain the transaction data in a target format, wherein the target format comprises a binary format.
In step S201 to step S202, the user terminal may obtain the transaction data submitted by the decentralized application, and convert the data format of the transaction data to obtain the transaction data in the target format. Because the target format comprises a binary format, compared with a json format mode adopted in the prior art, the data volume transmitted in the cross-language communication process of decentralized application and intelligent contracts can be reduced by adopting the target format mode in the embodiment of the invention.
In an embodiment, the process of converting the data format of the transaction data by the user terminal to obtain the transaction data in the target format may be that the user terminal converts the data format of the transaction data according to a preset first format conversion rule to obtain the transaction data in the target format.
In one embodiment, the first format conversion rule may include a rule set according to a serialization toollibrary. When the first format conversion rule includes a rule set according to the serialization tool library, the process that the user terminal converts the data format of the transaction data according to the preset first format conversion rule to obtain the transaction data in the target format may be as follows: and the user terminal calls a serialization tool library of the decentralized application to carry out serialization processing on the transaction data to obtain the serialization data corresponding to the transaction data, and the serialization data is used as the transaction data in the target format obtained after the data format of the transaction data is converted. Wherein the serialization tool library of the decentralized application may include conversion rules between the data in the first format and the data in the target format. Specifically, the user terminal may invoke a conversion rule between data in the first format and data in the target format included in the serialization tool library of the decentralized application, and perform serialization processing on the transaction data to obtain serialized data corresponding to the transaction data. In one embodiment, when the target format is a PB format, the serialization tool library may be a PB library. That is, when the target format is pb format, the sequencing tool library may be a protbufb library, i.e., a pb library.
S203, sending the transaction data in the target format to a node of a block chain network, so that the node converts the data format of the transaction data in the target format to obtain the transaction data in a second format, wherein the second format is a data format supported by an intelligent contract of the node.
The user terminal may send the transaction data in the target format to a node of the blockchain network. The node may receive the transaction data in the target format and convert the data format of the transaction data in the target format to obtain transaction data in a second format.
In one embodiment, it is contemplated that the user terminal may run multiple decentralized applications that may correspond to different blockchain networks. To accurately transmit data, the user terminal may determine the blockchain network to which the decentralized application corresponds, and then transmit the transaction data in the target format to the nodes of the blockchain network.
In one embodiment, the user terminal may include a profile corresponding to the decentralized application. The user terminal may determine the blockchain network corresponding to the decentralized application according to the information of the blockchain network included in the configuration file of the decentralized application, and then send the transaction data in the target format to the node of the blockchain network.
In one embodiment, in addition to converting the data format of the transaction data submitted by the distributed application through steps S201 to S203, the user terminal may further perform the following operations: the user terminal receives target data in a target format sent by a node, wherein the target data in the target format is obtained by converting the data format of the target data in the second format by the node; the user terminal converts the data format of the target data in the target format to obtain the target data in the first format. The target data refers to any one or more data to be sent to the user terminal. For example, the target data may be a query result obtained by the node in response to a data query request sent by the user terminal.
In one embodiment, the user terminal may send a data query request to the node, and receive a query result in a target format sent by the node in response to the data query request, where the query result in the target format is obtained by converting the data format of the query result in the second format by the node; and the user terminal converts the data format of the query result in the target format to obtain the query result in a first format, wherein the first format is a data format supported by the decentralized application. The process is further described below in connection with operations performed by the nodes.
In one embodiment, the user terminal may send a data query request to the node, and the node may obtain a query result in response to the data query request, where the query result is in the second format. In one embodiment, a node may obtain query results from a blockchain in response to the data query request. The node can convert the data format of the query result to obtain the query result in the target format. That is, the query result in the target format is obtained by converting the data format of the query result in the second format by the node. The node may send the query result in the target format to the user terminal. The user terminal can receive the query result in the target format sent by the node responding to the data query request, and convert the data format of the query result in the target format to obtain the query result in the first format.
In an embodiment, the process of converting the data format of the target data in the target format by the user terminal to obtain the target data in the first format may call the serialization tool library of the decentralized application to perform deserialization processing on the target data in the target format for the user terminal to obtain deserialization data corresponding to the target data in the target format; and the user terminal takes the deserialized data corresponding to the target data in the target format as the target data in the first format obtained after the data format conversion of the target data in the target format.
As can be seen, in the embodiment shown in fig. 2, the user terminal may obtain the transaction data in the first format submitted by the decentralized application, and convert the data format of the transaction data to obtain the transaction data in the target format, where the target format includes a binary format; the user terminal sends the transaction data in the target format to the nodes of the blockchain network, so that the nodes convert the data format of the transaction data in the target format to obtain the transaction data in the second format.
In an embodiment, an embodiment of the present invention further provides another data processing method, which can be applied to a node of a blockchain network. Referring to fig. 3, the method may specifically include the following steps:
s301, receiving transaction data in a target format sent by a user terminal, wherein the transaction data in the target format is obtained by converting the data format of the transaction data submitted by a decentralized application by the user terminal, and the target format comprises a binary format.
The user terminal may send the transaction data in the target format to a node of the blockchain network, and the node may receive the transaction data in the target format sent by the user terminal.
In one embodiment, the user terminal may obtain transaction data submitted by the decentralized application, where the data format of the transaction data is a first format, and then convert the data format of the transaction data to obtain transaction data in a target format, where the target format includes a binary format, so as to send the transaction data in the target format to a node of a blockchain network, and the node may receive the data in the target format sent by the user terminal.
S302, converting the data format of the transaction data in the target format to obtain the transaction data in a second format, wherein the second format is a data format supported by the intelligent contract of the node.
And S303, calling the intelligent contract to process the transaction data in the second format.
In steps S302 to S303, the process of converting the data format of the transaction data in the target format by the node to obtain the transaction data in the second format may be that the user terminal converts the data format of the transaction data in the target format according to a preset second format conversion rule to obtain the transaction data in the second format, and then the intelligent contract is invoked to process the transaction data in the second format.
In one embodiment, the second format conversion rule may include a rule set according to a serialization toollibrary. When the second format conversion rule includes a rule set according to the serialization tool library, the user terminal converts the data format of the transaction data in the target format according to a preset second format conversion rule, and a process of obtaining the transaction data in the second format may be as follows: and the node calls a serialization tool library of the node to perform deserialization processing on the transaction data in the target format to obtain deserialized data, and the deserialized data is used as the transaction data in the second format obtained after the data format of the transaction data in the target format is converted. Wherein the serialization tool library of the node may include conversion rules between the data in the second format and the data in the target format. Specifically, the user terminal may invoke a conversion rule between data in the second format and data in the target format included in the serialization tool library of the node, and perform deserialization processing on the transaction data in the target format to obtain deserialized data. In one embodiment, when the target format is a PB format, the serialization tool library may be a PB library. That is, when the target format is pb format, the sequencing tool library may be a protbufb library, i.e., a pb library.
In one embodiment, in addition to the node being able to convert the data format of the transaction data in the target format through steps S301 to S303, the node may perform the following operations: and the node acquires the target data in the second format, converts the data format of the target data to obtain the target data in the target format, and sends the target data in the target format to the user terminal. The target data may refer to any one or more data to be transmitted to the user terminal. For example, the target data may be a query result obtained by the node in response to a data query request.
In one embodiment, a node may receive a data query request sent by a user terminal; the node responds to the data query request to acquire a query result in a second format from the block chain; converting the data format of the query result by the node to obtain a query result in a target format; and the node sends the query result in the target format to the user terminal so that the user terminal converts the data format of the query result in the target format to obtain the query result in the first format, wherein the first format is the data format supported by the decentralized application. This process will be further explained below in connection with operations performed by the user terminal.
In one embodiment, the user terminal may send a data query request to the node, and the node may obtain a query result in response to the data query request, where the query result is in the second format. For example, a node may obtain query results from a blockchain in response to the data query request. The node can convert the data format of the query result to obtain the query result in the target format. That is, the query result in the target format is obtained by converting the data format of the query result in the second format by the node. The node may send the query result in the target format to the user terminal. The user terminal can receive the query result in the target format sent by the node responding to the data query request, and convert the data format of the query result in the target format to obtain the query result in the first format.
In an embodiment, the process of converting the data format of the target data by the node to obtain the target data in the target format may call a serialization tool library of the node for the node to perform serialization processing on the target data to obtain serialized data corresponding to the target data; and the node takes the serialized data corresponding to the target data as the target data of the target format obtained after the data format of the target data is converted.
It can be seen that, in the embodiment shown in fig. 3, the node may receive the transaction data in the target format sent by the user terminal, and convert the data format of the transaction data in the target format to obtain the transaction data in the second format, so as to invoke the intelligent contract to process the transaction data in the second format, and in the process, the cross-language communication process between the decentralized application and the intelligent contract is implemented, so that the data amount transmitted in the communication process is reduced, and the accuracy of data conversion is improved.
Based on the description of the above method embodiments, in an embodiment, an embodiment of the present invention further provides a schematic structural diagram of a data processing apparatus as shown in fig. 4. The data processing device may be applied to the aforementioned user terminal on which the decentralized application is running. As shown in fig. 4, the data processing apparatus in the embodiment of the present invention may include:
the obtaining module 401 is configured to obtain the transaction data submitted by the decentralized application, where a data format of the transaction data is a first format.
A conversion module 402, configured to convert a data format of the transaction data to obtain transaction data in a target format, where the target format includes a binary format.
The communication module 403 is configured to send the transaction data in the target format to a node of a blockchain network, so that the node converts the data format of the transaction data in the target format to obtain transaction data in a second format, where the second format is a data format supported by an intelligent contract of the node.
In an optional implementation manner, the conversion module 402 converts the data format of the transaction data to obtain transaction data in a target format, specifically, invokes the serialization tool library of the decentralized application to perform serialization processing on the transaction data to obtain serialization data corresponding to the transaction data; and taking the serialized data as the transaction data in the target format obtained after the data format of the transaction data is converted.
In an alternative embodiment, the serialization tool library comprises a protobuf library.
In an optional implementation manner, the communication module 403 is further configured to send a data query request to the node, and receive a query result in a target format sent by the node in response to the data query request, where the query result in the target format is obtained by converting the data format of the query result in the second format by the node.
In an optional implementation manner, the converting module 402 is further configured to convert a data format of the query result in the target format to obtain a query result in a first format, where the first format is a data format supported by the decentralized application.
As can be seen, in the embodiment shown in fig. 4, the data processing apparatus may obtain the transaction data in the first format submitted by the decentralized application, and convert the data format of the transaction data to obtain the transaction data in the target format, where the target format includes a binary format; the data processing device sends the transaction data in the target format to the nodes of the blockchain network, so that the nodes convert the data format of the transaction data in the target format to obtain the transaction data in the second format.
In an embodiment, an embodiment of the present invention further provides a schematic structural diagram of a data processing apparatus as shown in fig. 5. The data processing device may be applied to the aforementioned nodes of a blockchain network. As shown in fig. 5, the data processing apparatus in the embodiment of the present invention may include:
the communication module 501 is configured to receive transaction data in a target format sent by a user terminal, where the transaction data in the target format is obtained by converting a data format of the transaction data submitted by a decentralized application by the user terminal, and the target format includes a binary format.
A conversion module 502, configured to convert a data format of the transaction data in the target format to obtain transaction data in a second format, where the second format is a data format supported by the intelligent contract of the node.
The processing module 503 is configured to invoke the smart contract to process the transaction data in the second format.
In an optional implementation manner, the conversion module 502 converts the data format of the transaction data in the target format to obtain transaction data in a second format, specifically, invokes a serialization tool library of the node to perform deserialization processing on the transaction data in the target format to obtain deserialized data; and the deserialized data is used as the transaction data in the second format obtained after the data format of the transaction data in the target format is converted.
In an optional implementation manner, the processing module 503 is further configured to receive a data query request sent by the user terminal through the communication module 501; responding to the data query request to obtain a query result in a second format from the block chain; converting the data format of the query result to obtain a query result in a target format; the query result in the target format is sent to the user terminal through the communication module 501, so that the user terminal converts the data format of the query result in the target format to obtain the query result in the first format, where the first format is a data format supported by the decentralized application.
It can be seen that, in the embodiment shown in fig. 5, the data processing device may receive the transaction data in the target format sent by the user terminal, and convert the data format of the transaction data in the target format to obtain the transaction data in the second format, so as to invoke the intelligent contract to process the transaction data in the second format, and in the process, a cross-language communication process between the decentralized application and the intelligent contract is implemented, so that the data amount transmitted in the communication process is reduced, and the accuracy of data conversion is improved.
Please refer to fig. 6, which is a schematic structural diagram of a ue according to an embodiment of the present invention. The user terminal in this embodiment as shown in fig. 6 may include: one or more processors 601, one or more input devices 602, one or more output devices 603, and memory 604. The processor 601, input device 602, output device 603, and memory 604 are connected by a bus or other means. Input device 502 may be an optional device, among others. The input device 602, output device 603 may be a standard wired or wireless communication interface. In one embodiment, the input device 602 may also include a touch screen, a voice recorder, or the like. Output devices 603 may also include a display screen, speakers, etc. In one embodiment, the touch screen and display screen may be replaced with a touch display screen. The memory 604 is used for storing a computer program comprising program instructions, and the processor 601 is used for executing the program instructions stored by the memory 604 to implement the various methods referred to above.
Memory 604 may include volatile memory (volatile memory), such as random-access memory (RAM); the memory 604 may also include a non-volatile memory (non-volatile memory), such as a flash memory (flash memory), a solid-state drive (SSD), etc.; the memory 604 may also comprise a combination of the above types of memory.
In one embodiment, processor 601 may be a Central Processing Unit (CPU), which may also be another general-purpose processor, i.e., a microprocessor or any conventional processor. The memory 604 may include read-only memory and random access memory. Therefore, the processor 601 and the memory 604 are not limited herein.
In one embodiment, the processor 601 calls program instructions stored in the memory 604 for obtaining transaction data submitted by the decentralized application, the transaction data having a data format of a first format; converting the data format of the transaction data to obtain transaction data in a target format, wherein the target format comprises a binary format; and sending the transaction data in the target format to a node of a block chain network through an output device 603, so that the node converts the data format of the transaction data in the target format to obtain the transaction data in a second format, wherein the second format is a data format supported by an intelligent contract of the node.
In one embodiment, when the data format of the transaction data is converted to obtain the transaction data in the target format, the processor 601 calls a program instruction stored in the memory 604, specifically, is used to call the serialization tool library of the decentralized application to perform serialization processing on the transaction data to obtain serialized data corresponding to the transaction data; and taking the serialized data as the transaction data in the target format obtained after the data format of the transaction data is converted.
In one embodiment, the serialization tool library comprises a protobuf library.
In one embodiment, processor 601 calls program instructions stored in the memory 604 and is further configured to send a data query request to the node via output device 603; receiving a query result in a target format sent by the node in response to the data query request through an input device 602, where the query result in the target format is obtained by converting the data format of the query result in the second format by the node; and converting the data format of the query result in the target format to obtain the query result in a first format, wherein the first format is a data format supported by the decentralized application.
It should be noted that, for the specific working process of the user terminal and the unit described above, reference may be made to the related description in the foregoing embodiments, and details are not repeated here.
Fig. 7 is a schematic structural diagram of a node of a blockchain network according to an embodiment of the present invention. The nodes of the blockchain network in the present embodiment as shown in fig. 7 may include: one or more processors 701, one or more input devices 702, one or more output devices 703, and memory 704. The processor 701, input device 702, output device 703, and memory 704 are connected by a bus or other means. The input device 702, the output device 703 may be a standard wired or wireless communication interface. The output device 703 is optional. The memory 704 is used to store a computer program comprising program instructions, and the processor 701 is used to execute the program instructions stored by the memory 704 to implement the various methods referred to above.
The memory 704 may include volatile memory (volatile memory), such as random-access memory (RAM); the memory 704 may also include a non-volatile memory (non-volatile memory), such as a flash memory (flash memory), a solid-state drive (SSD), etc.; the memory 704 may also comprise a combination of the above types of memory.
In one embodiment, processor 701 may be a Central Processing Unit (CPU), or other general-purpose processor, i.e., a microprocessor or any conventional processor. The memory 704 may include read-only memory and random access memory. Accordingly, the processor 701 and the memory 704 are not limited herein.
In one embodiment, the processor 701 invokes a program instruction stored in the memory 704, so as to receive, through the input device 702, transaction data in a target format sent by a user terminal, where the transaction data in the target format is obtained by converting, by the user terminal, a data format of transaction data submitted by a decentralized application, and the target format includes a binary format; converting the data format of the transaction data in the target format to obtain transaction data in a second format, wherein the second format is a data format supported by the intelligent contract of the node; and calling the intelligent contract to process the transaction data in the second format.
In one embodiment, when the data format of the transaction data in the target format is converted to obtain the transaction data in the second format, the processor 701 invokes a program instruction stored in the memory 704, specifically, is used to invoke the serialization tool library of the node to perform deserialization processing on the transaction data in the target format to obtain deserialized data; and the deserialized data is used as the transaction data in the second format obtained after the data format of the transaction data in the target format is converted.
In one embodiment, the processor 701 invokes program instructions stored in the memory 704, and is further configured to receive a data query request sent by the user terminal through the input device 702; responding to the data query request to obtain a query result in a second format from the block chain; converting the data format of the query result to obtain a query result in a target format; and sending the query result in the target format to the user terminal through an output device 703, so that the user terminal converts the data format of the query result in the target format to obtain the query result in a first format, where the first format is a data format supported by the decentralized application.
It should be noted that, for the specific working process of the node and the unit of the block chain network described above, reference may be made to the relevant description in each of the foregoing embodiments, and details are not described here again.
It will be understood by those skilled in the art that all or part of the processes of the methods of the above embodiments may be implemented by hardware instructions of a computer program, where the computer program may be stored in a computer storage medium, and the computer storage medium may be a computer-readable storage medium, and when executed, the computer program may include the processes of the above embodiments of the methods. The storage medium may be a magnetic disk, an optical disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), or the like.
While the invention has been described with reference to a number of embodiments, it will be understood by those skilled in the art that various changes in form and details may be made therein without departing from the spirit and scope of the invention as defined by the appended claims.

Claims (10)

1. A data processing method applied to a user terminal, wherein a decentralized application runs on the user terminal, and the method comprises:
acquiring transaction data submitted by the decentralized application, wherein the data format of the transaction data is a first format;
converting the data format of the transaction data to obtain transaction data in a target format, wherein the target format comprises a binary format;
and sending the transaction data in the target format to a node of a block chain network, so that the node converts the data format of the transaction data in the target format to obtain the transaction data in a second format, wherein the second format is a data format supported by an intelligent contract of the node.
2. The method of claim 1, wherein converting the data format of the transaction data to obtain the transaction data in the target format comprises:
calling the serialization tool library of the decentralized application to carry out serialization processing on the transaction data to obtain serialization data corresponding to the transaction data;
and taking the serialized data as the transaction data in the target format obtained after the data format of the transaction data is converted.
3. The method of claim 2, wherein the serialization tool library comprises a protobuf library.
4. The method according to any one of claims 1 to 3, further comprising:
sending a data query request to the node;
receiving a query result in a target format sent by the node in response to the data query request, wherein the query result in the target format is obtained by converting the data format of the query result in the second format by the node;
and converting the data format of the query result in the target format to obtain the query result in a first format, wherein the first format is a data format supported by the decentralized application.
5. A data processing method applied to a node of a blockchain network, the method comprising:
receiving transaction data in a target format sent by a user terminal, wherein the transaction data in the target format is obtained by converting the data format of the transaction data submitted by a decentralized application by the user terminal, and the target format comprises a binary format;
converting the data format of the transaction data in the target format to obtain transaction data in a second format, wherein the second format is a data format supported by the intelligent contract of the node;
and calling the intelligent contract to process the transaction data in the second format.
6. The method of claim 5, wherein converting the data format of the transaction data in the target format to obtain transaction data in a second format comprises:
calling the serialization tool library of the node to perform deserialization processing on the transaction data in the target format to obtain deserialization data;
and the deserialized data is used as the transaction data in the second format obtained after the data format of the transaction data in the target format is converted.
7. The method of claim 5 or 6, further comprising:
receiving a data query request sent by the user terminal;
responding to the data query request to obtain a query result in a second format from the block chain;
converting the data format of the query result to obtain a query result in a target format;
and sending the query result in the target format to the user terminal so that the user terminal converts the data format of the query result in the target format to obtain the query result in a first format, wherein the first format is a data format supported by the decentralized application.
8. A data processing apparatus, for use in a user terminal having a decentralized application running thereon, the apparatus comprising:
the acquisition module is used for acquiring the transaction data submitted by the decentralized application, and the data format of the transaction data is a first format;
the conversion module is used for converting the data format of the transaction data to obtain the transaction data in a target format, and the target format comprises a binary format;
and the communication module is used for sending the transaction data in the target format to a node of a block link network so as to convert the data format of the transaction data in the target format by the node to obtain the transaction data in a second format, wherein the second format is a data format supported by an intelligent contract of the node.
9. A data processing apparatus, for application to a node of a blockchain network, the apparatus comprising:
the system comprises a communication module, a data processing module and a data processing module, wherein the communication module is used for receiving transaction data in a target format sent by a user terminal, the transaction data in the target format is obtained by converting the data format of the transaction data submitted by decentralized application by the user terminal, and the target format comprises a binary format;
the conversion module is used for converting the data format of the transaction data in the target format to obtain the transaction data in a second format, wherein the second format is a data format supported by the intelligent contract of the node;
and the processing module is used for calling the intelligent contract to process the transaction data in the second format.
10. A computer storage medium having stored thereon program instructions for implementing the method of any one of claims 1-7 when executed.
CN202010129447.4A 2020-02-28 2020-02-28 Data processing method and device and computer storage medium Active CN111369237B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010129447.4A CN111369237B (en) 2020-02-28 2020-02-28 Data processing method and device and computer storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010129447.4A CN111369237B (en) 2020-02-28 2020-02-28 Data processing method and device and computer storage medium

Publications (2)

Publication Number Publication Date
CN111369237A true CN111369237A (en) 2020-07-03
CN111369237B CN111369237B (en) 2023-07-14

Family

ID=71212632

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010129447.4A Active CN111369237B (en) 2020-02-28 2020-02-28 Data processing method and device and computer storage medium

Country Status (1)

Country Link
CN (1) CN111369237B (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112148674A (en) * 2020-10-12 2020-12-29 平安科技(深圳)有限公司 Log data processing method and device, computer equipment and storage medium
CN112511621A (en) * 2020-11-26 2021-03-16 青岛海尔科技有限公司 Data transmission method and device, storage medium, and electronic device
CN113094429A (en) * 2021-03-19 2021-07-09 杭州复杂美科技有限公司 Data processing method, data query method, computer device and storage medium

Citations (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106060036A (en) * 2016-05-26 2016-10-26 布比(北京)网络技术有限公司 Decentralized consenting method and apparatus
CN107239479A (en) * 2017-03-28 2017-10-10 阿里巴巴集团控股有限公司 A kind of method and device of data storage and inquiry based on block chain
US20180285996A1 (en) * 2017-04-03 2018-10-04 FutureLab Consulting Inc. Methods and system for managing intellectual property using a blockchain
US20180331821A1 (en) * 2017-05-11 2018-11-15 Microsoft Technology Licensing, Llc Cryptlet identity
CN109359971A (en) * 2018-08-06 2019-02-19 阿里巴巴集团控股有限公司 Block chain method of commerce and device, electronic equipment
CN109691013A (en) * 2018-08-16 2019-04-26 区链通网络有限公司 Block chain communication method between nodes, device and storage medium, block catenary system
CN109698752A (en) * 2018-11-29 2019-04-30 南京南瑞信息通信科技有限公司 A kind of ERP System based on block chain
CN110008263A (en) * 2019-02-20 2019-07-12 顺丰科技有限公司 Dynamic organization's extended method and system under Hyperledger fabric cluster mode
CN110569251A (en) * 2019-09-23 2019-12-13 腾讯科技(深圳)有限公司 Data processing method, related equipment and computer readable storage medium
CN110599182A (en) * 2019-09-27 2019-12-20 腾讯科技(深圳)有限公司 Resource management method and device
CN110599349A (en) * 2019-09-24 2019-12-20 腾讯科技(深圳)有限公司 Data processing method based on block chain network, related equipment and storage medium
CN110602125A (en) * 2019-09-23 2019-12-20 腾讯科技(深圳)有限公司 Data processing method, device, terminal and storage medium
CN110609679A (en) * 2019-09-17 2019-12-24 腾讯科技(深圳)有限公司 Data processing method, data processing device, computer readable storage medium and computer equipment

Patent Citations (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106060036A (en) * 2016-05-26 2016-10-26 布比(北京)网络技术有限公司 Decentralized consenting method and apparatus
CN107239479A (en) * 2017-03-28 2017-10-10 阿里巴巴集团控股有限公司 A kind of method and device of data storage and inquiry based on block chain
US20180285996A1 (en) * 2017-04-03 2018-10-04 FutureLab Consulting Inc. Methods and system for managing intellectual property using a blockchain
US20180331821A1 (en) * 2017-05-11 2018-11-15 Microsoft Technology Licensing, Llc Cryptlet identity
CN109359971A (en) * 2018-08-06 2019-02-19 阿里巴巴集团控股有限公司 Block chain method of commerce and device, electronic equipment
CN109691013A (en) * 2018-08-16 2019-04-26 区链通网络有限公司 Block chain communication method between nodes, device and storage medium, block catenary system
CN109698752A (en) * 2018-11-29 2019-04-30 南京南瑞信息通信科技有限公司 A kind of ERP System based on block chain
CN110008263A (en) * 2019-02-20 2019-07-12 顺丰科技有限公司 Dynamic organization's extended method and system under Hyperledger fabric cluster mode
CN110609679A (en) * 2019-09-17 2019-12-24 腾讯科技(深圳)有限公司 Data processing method, data processing device, computer readable storage medium and computer equipment
CN110569251A (en) * 2019-09-23 2019-12-13 腾讯科技(深圳)有限公司 Data processing method, related equipment and computer readable storage medium
CN110602125A (en) * 2019-09-23 2019-12-20 腾讯科技(深圳)有限公司 Data processing method, device, terminal and storage medium
CN110599349A (en) * 2019-09-24 2019-12-20 腾讯科技(深圳)有限公司 Data processing method based on block chain network, related equipment and storage medium
CN110599182A (en) * 2019-09-27 2019-12-20 腾讯科技(深圳)有限公司 Resource management method and device

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
李立 等: "基于区块链技术在泛在电力物联网智能设备管理的研究应用", 《科技资讯》, vol. 17, no. 34, pages 21 - 23 *

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112148674A (en) * 2020-10-12 2020-12-29 平安科技(深圳)有限公司 Log data processing method and device, computer equipment and storage medium
CN112148674B (en) * 2020-10-12 2023-12-19 平安科技(深圳)有限公司 Log data processing method, device, computer equipment and storage medium
CN112511621A (en) * 2020-11-26 2021-03-16 青岛海尔科技有限公司 Data transmission method and device, storage medium, and electronic device
CN113094429A (en) * 2021-03-19 2021-07-09 杭州复杂美科技有限公司 Data processing method, data query method, computer device and storage medium
CN113094429B (en) * 2021-03-19 2022-05-24 杭州复杂美科技有限公司 Data processing method, data query method, computer device and storage medium

Also Published As

Publication number Publication date
CN111369237B (en) 2023-07-14

Similar Documents

Publication Publication Date Title
CN111369237A (en) Data processing method and device and computer storage medium
US11699073B2 (en) Network off-line model processing method, artificial intelligence processing device and related products
CN111061678B (en) Service data processing method, device, computer equipment and storage medium
CN111026439B (en) Application program compatibility method, device, equipment and computer storage medium
US20210144629A1 (en) Wireless communication core network and method for analyzing user equipment mobility in the same
CN111541662B (en) Communication method based on binary communication protocol, electronic equipment and storage medium
CN115329170A (en) Webpage crawling method, device, equipment and storage medium
US8914815B2 (en) Automated framework for tracking and maintaining kernel symbol list types
CN114741400A (en) Data synchronization and analysis method, device and terminal equipment
CN108153896B (en) Processing method and device for input data and output data
US11347630B1 (en) Method and system for an automated testing framework in design pattern and validating messages
CN113778897A (en) Automatic test method, device, equipment and storage medium of interface
JP2005228183A (en) Program execution method and computer system for executing the program
CN115145806A (en) Data acquisition method and device and computer readable storage medium
US9313653B2 (en) Information processing device, server device, data communication system, data communication method, and computer-readable storage medium storing data communication program
CN111352715A (en) Method, system, terminal and storage medium for destroying flash thread
CN110930253A (en) Intelligent contract internal main key generation method and device, computer equipment and storage medium
US9537931B2 (en) Dynamic object oriented remote instantiation
CN110941658A (en) Data export method, device, server and storage medium
CN114637531A (en) Method and device for dynamically generating application program interface
CN111949862B (en) Method and device for managing business task flow and electronic equipment
CN111651338B (en) System and method for acquiring log formatting time
CN112711602B (en) Method and device for running stored procedure, database system and storage medium
CN114567571A (en) Performance test method and device, electronic equipment and computer readable storage medium
CN109995711B (en) Application development method and device of intelligent robot, terminal equipment and medium

Legal Events

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