Data transmission method and device, storage medium and electronic equipment

By performing balanced binary tree encoding serialization operations on the character set in transaction data in the blockchain network, the target encoding table and sequence data are generated, and the problem of low data transmission efficiency caused by repeated characters is solved, and efficient data compression and reconciliation is achieved Compression improves transaction processing efficiency.

CN119474196APending Publication Date: 2025-02-18TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202311019539.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-08-11
Publication Date
2025-02-18

AI Technical Summary

Technical Problem

In blockchain networks, due to too many duplicate characters, data transmission efficiency is low, and the existing technology has not yet proposed an effective solution.

Method used

By encoding and serializing the character set in the transaction data at the first node, a balanced binary tree is constructed to generate the serialized encoding format of each character, a target encoding table and sequence data are generated, and a second node is sent to the second node, The two nodes decode the sequence data into transaction data through the target encoding table.

Benefits of technology

It realizes efficient compression and decompression of transaction data, reduces storage and transmission costs, improves transaction processing efficiency, and speeds up the compression speed.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119474196A_ABST
    Figure CN119474196A_ABST
Patent Text Reader

Abstract

The invention discloses a data transmission method and device, a storage medium and electronic equipment. The method comprises the following steps: in response to a submitted transaction message, acquiring a character set extracted from transaction data to be processed at a first node, and performing code serialization operation on the character set to obtain a target code table and sequence data, the coding serialization operation is used for constructing a balanced binary tree according to the character set so as to generate a serialization coding format corresponding to each character, the digit of the serialization coding format is the same as the layer number of the balanced binary tree, and the serialization coding formats corresponding to different types of characters in the character set respectively correspond to different nodes in the balanced binary tree; the serialized coding formats corresponding to the characters of the same type in the character set correspond to the same node in the balanced binary tree, and sending the target coding table and the sequence data to the second node. According to the method and the device, the technical problem of relatively low data transmission efficiency caused by too many repeated characters in related technologies is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computers, and in particular to a data transmission method and device, a storage medium, and an electronic device. Background Art

[0002] Currently, in the blockchain network, when a node receives new transaction data, it will immediately synchronize the transaction data to other consensus nodes while storing it locally for subsequent consensus processes. Transaction data synchronization is often transmitted to other nodes through the network in the form of serialized byte streams. Transaction data synchronization in traditional blockchain transaction pools is usually based on a serialization method to serialize custom data structures into byte streams. After the byte stream is sent to the other node through network transmission, the original transaction data is obtained by deserializing the byte stream to complete the data transmission.

[0003] For traditional blockchain transaction pool transaction data communication, the amount of data is still relatively large if only the customized transaction data is transmitted after serialization. If a large amount of transaction pool transaction data needs to be transmitted in the blockchain network, due to too many repeated characters, it will still occupy a large amount of network resources in the blockchain network.

[0004] To address the above-mentioned problems, no effective solution has been proposed yet. Summary of the invention

[0005] The embodiments of the present application provide a data transmission method and device, a storage medium, and an electronic device to at least solve the technical problem in the related art that data transmission efficiency is low due to too many repeated characters.

[0006] According to one aspect of an embodiment of the present application, a data transmission method is provided, comprising: in response to a submitted transaction message, obtaining transaction data to be processed at a first node, wherein the transaction data includes a character set extracted from the transaction message; performing an encoding serialization operation on the character set according to the transaction data to obtain a target encoding table and sequence data, wherein the encoding serialization operation is used to construct a balanced binary tree according to the character set to generate a serialization encoding format corresponding to each character, the number of bits of the serialization encoding format is the same as the number of layers of the balanced binary tree, the serialization encoding formats corresponding to different types of characters in the character set correspond to different nodes in the balanced binary tree, the serialization encoding formats corresponding to the same types of characters in the character set correspond to the same node in the balanced binary tree, and the target encoding table is used to record the serialization encoding format of each character in the character set; sending the target encoding table and the sequence data to a second node, wherein the second node is used to decode the sequence data into the transaction data through the target encoding table.

[0007] According to another aspect of an embodiment of the present application, a data transmission method is also provided, including: receiving a target data packet sent by a first node; parsing the target data packet to obtain a target coding table and sequence data, wherein the first node is used to generate the target coding table and the sequence data according to the acquired transaction data, the transaction data including a character set extracted from a transaction message acquired by the first node, the first node obtains the target coding table and the sequence data by performing a coding serialization operation on the character set, the coding serialization operation is used to construct a balanced binary tree according to the character set to generate a serialized coding format corresponding to each character, the number of bits of the serialized coding format is the same as the number of layers of the balanced binary tree, the serialized coding formats corresponding to different types of characters in the character set correspond to different nodes in the balanced binary tree, the serialized coding formats corresponding to the same types of characters in the character set correspond to the same node in the balanced binary tree, and the target coding table is used to record the serialized coding format of each character in the character set; the sequence data is decoded according to the target coding table to obtain the transaction data.

[0008] According to another aspect of the embodiment of the present application, a data transmission device is also provided, including: an acquisition module, used to obtain transaction data to be processed at a first node in response to a submitted transaction message, wherein the transaction data includes a character set extracted from the transaction message; an encoding module, used to perform an encoding serialization operation on the character set according to the transaction data to obtain a target encoding table and sequence data, wherein the encoding serialization operation is used to construct a balanced binary tree according to the character set to generate a serialization encoding format corresponding to each character, the number of bits of the serialization encoding format is the same as the number of layers of the balanced binary tree, the serialization encoding formats corresponding to different types of characters in the character set correspond to different nodes in the balanced binary tree, the serialization encoding formats corresponding to the same types of characters in the character set correspond to the same node in the balanced binary tree, and the target encoding table is used to record the serialization encoding format of each character in the character set; a sending module, used to send the target encoding table and the sequence data to a second node, wherein the second node is used to decode the sequence data into the transaction data through the target encoding table.

[0009] Optionally, the device is used to perform encoding and serializing operations on the character set according to the transaction data to obtain a target encoding table and sequence data in the following manner: determine a frequency set corresponding to the character set according to the transaction data, wherein a frequency in the frequency set is used to represent the number of occurrences of a character in the character set; use the frequency set to determine the position of the nodes corresponding to each of the various characters in the balanced binary tree; and determine the target encoding table and the sequence data according to the position.

[0010] Optionally, the device is used to determine the position of the node corresponding to each of the various characters in the balanced binary tree using the frequency set in the following manner: according to the frequency values ​​in the frequency set, the various characters are arranged in descending order to obtain a frequency table; the frequency table is traversed, and the target character with the largest frequency value is selected from the candidate character set each time, wherein the candidate character set represents a character set composed of characters that have not been selected in the frequency table, and the target character selected for the first time corresponds to the root node of the balanced binary tree. Starting from the second selection, each two adjacent selected characters are regarded as a group of characters, and the nodes corresponding to the group of characters are connected to the same parent node in the balanced binary tree; the target character is associated with each node in the balanced binary tree in order from top to bottom and from left to right, and the target character is removed from the candidate character set after each association, and the position of the node corresponding to each target character is determined, wherein each node as a parent node is allowed to have at most two child nodes.

[0011] Optionally, the device is used to determine the target coding table and the sequence data according to the position in the following manner, including: setting the node attribute of the target character selected for the 2N+1th time to a right node, and setting the node attribute of the target character selected for the 2N+2th time to a left node, wherein the nodes corresponding to the target characters selected for the 2N+1th and 2N+2th times are child nodes connected to the same parent node, and N is a natural number; obtaining the level of each node in the target chain where the node corresponding to each target character is located, wherein the target chain represents a node chain starting from the root node and ending at the node corresponding to the target character, and the level is used to determine the bit number of the sequence data; determining the code value corresponding to each node in the target chain according to the level and the node attributes of each node in the target chain, and generating the target coding table.

[0012] Optionally, the device is used to determine the encoding value corresponding to each node in the target chain according to the level of each node in the target chain and the node attributes, and generate the target encoding table in the following manner: obtain the total number of levels of the balanced binary tree; set the total number of bits of the serialized encoding format according to the total number of levels; mark each node in the target chain one by one according to the level of each node in the target chain and the node attributes, and set the value corresponding to each bit in the serialized encoding format corresponding to the target character according to the mark value, wherein the mark value corresponding to the left node of the node attribute is 0, and the mark value corresponding to the right node of the node attribute is 1, and the level of each node is used to indicate the number of bits of the mark value in the serialized encoding format.

[0013] Optionally, the device is used to determine the target coding table and the sequence data according to the position in the following manner, including: determining the serialization coding format corresponding to each character according to the position, and determining the target coding table, wherein the target coding table includes each serialization coding format; using the target coding table to encode the transaction data to obtain the sequence data.

[0014] Optionally, the device is used to obtain transaction data to be processed at the first node in response to a submitted transaction message in the following manner: in response to multiple submitted transaction messages, obtain multiple initial transaction data corresponding to the multiple transaction messages, wherein the multiple initial transaction data include repeated characters; obtain transaction prefixes of the multiple initial transaction data, and merge the multiple initial transaction data according to the transaction prefix to obtain the transaction data.

[0015] Optionally, the device is used to send the target coding table and the sequence data to the second node in the following manner: obtain the coding table length information, wherein the coding table length information is used to describe the storage length of the target coding table; encapsulate the coding table length information, the target coding table and the sequence data to obtain a target data packet; and send the target data packet to the second node.

[0016] According to another aspect of the embodiment of the present application, there is also provided a data transmission device, including:

[0017] A receiving module, used for receiving a target data packet sent by the first node;

[0018] A parsing module, used for parsing the target data packet to obtain a target encoding table and sequence data, wherein the first node is used to generate the target encoding table and the sequence data according to the acquired transaction data, the transaction data includes a character set extracted from the transaction message acquired by the first node, the first node obtains the target encoding table and the sequence data by performing an encoding serialization operation on the character set, the encoding serialization operation is used to construct a balanced binary tree according to the character set to generate a serialization encoding format corresponding to each character, the number of bits of the serialization encoding format is the same as the number of layers of the balanced binary tree, the serialization encoding formats corresponding to different types of characters in the character set correspond to different nodes in the balanced binary tree, the serialization encoding formats corresponding to the same types of characters in the character set correspond to the same node in the balanced binary tree, and the target encoding table is used to record the serialization encoding format of each character in the character set;

[0019] A decoding module is used to decode the sequence data according to the target coding table to obtain the transaction data.

[0020] Optionally, the device is used to parse the target data packet to obtain a target coding table and sequence data in the following manner: parse the target data packet to obtain coding table length information, wherein the coding table length information is used to describe the storage length of the target coding table; determine the target coding table and the sequence data based on the coding table length information.

[0021] Optionally, the device is used to decode the sequence data according to the target coding table to obtain the transaction data in the following manner: determine the serialization coding format corresponding to each character according to the target coding table; and decode the sequence data using the serialization coding format corresponding to each character to obtain the transaction data.

[0022] According to another aspect of the embodiments of the present application, a computer-readable storage medium is provided, in which a computer program is stored, wherein the computer program is configured to execute the above-mentioned data transmission method when running.

[0023] According to another aspect of the embodiment of the present application, a computer program product or a computer program is provided, the computer program product or the computer program includes computer instructions, 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 data transmission method.

[0024] According to another aspect of the embodiments of the present application, there is further provided an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to execute the data transmission method through the computer program.

[0025] In an embodiment of the present application, in response to a submitted transaction message, transaction data to be processed is obtained at a first node, wherein the transaction data includes a character set extracted from the transaction message, and an encoding and serialization operation is performed on the character set according to the transaction data to obtain a target encoding table and sequence data, wherein the encoding and serialization operation is used to construct a balanced binary tree according to the character set to generate a serialization encoding format corresponding to each character, the number of bits of the serialization encoding format is the same as the number of layers of the balanced binary tree, the serialization encoding formats corresponding to different types of characters in the character set correspond to different nodes in the balanced binary tree, the serialization encoding formats corresponding to the same types of characters in the character set correspond to the same node in the balanced binary tree, and the target encoding table is used to record the serialization encoding format of each character in the character set; the target encoding table and the sequence data are sent to a second node, wherein the second node is used to decode the sequence data into transaction data through the target encoding table. In the above method, balanced binary tree encoding is a method for compressing a character set, and the encoding of each character is constructed by a Huffman tree to achieve compression and decompression of the character set. The first node and the second node in the process both play the role of processing transaction data. The first node is responsible for encoding and serializing the transaction data, and the second node is responsible for decoding the serial data, so that characters with higher frequency of occurrence have shorter codes, thereby achieving a higher compression ratio. By using balanced binary tree encoding in the transaction processing process, efficient compression and decompression of transaction data can be achieved, thereby achieving the technical effect of reducing storage and transmission costs, improving transaction processing efficiency, and accelerating decompression speed, thereby solving the technical problem of low data transmission efficiency due to too many repeated characters in related technologies. BRIEF DESCRIPTION OF THE DRAWINGS

[0026] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:

[0027] Figure 1 is a schematic diagram of an application environment of an optional data transmission method according to an embodiment of the present application;

[0028] Figure 2 is a flowchart of an optional data transmission method according to an embodiment of the present application;

[0029] Figure 3is a schematic diagram of an optional data transmission method according to an embodiment of the present application;

[0030] Figure 4 is a schematic diagram of another optional data transmission method according to an embodiment of the present application;

[0031] Figure 5 is a schematic diagram of another optional data transmission method according to an embodiment of the present application;

[0032] Figure 6 is a schematic diagram of another optional data transmission method according to an embodiment of the present application;

[0033] Figure 7 is a schematic diagram of another optional data transmission method according to an embodiment of the present application;

[0034] Figure 8 is a schematic diagram of another optional data transmission method according to an embodiment of the present application;

[0035] Fig. 9 is a schematic diagram of another optional data transmission method according to an embodiment of the present application;

[0036] Fig.10 is a schematic diagram of another optional data transmission method according to an embodiment of the present application;

[0037] Fig.11 is a schematic diagram of another optional data transmission method according to an embodiment of the present application;

[0038] Fig.12 is a schematic diagram of another optional data transmission method according to an embodiment of the present application;

[0039] Fig.13 is a schematic diagram of another optional data transmission method according to an embodiment of the present application;

[0040] Fig.14 is a schematic structural diagram of an optional data transmission device according to an embodiment of the present application;

[0041] Fig.15 is a schematic structural diagram of an optional data transmission product according to an embodiment of the present application;

[0042] Fig.16 It is a schematic diagram of the structure of an optional electronic device according to an embodiment of the present application. DETAILED DESCRIPTION

[0043] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present application.

[0044] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0045] First, some nouns or terms that appear in the description of the embodiments of the present application are subject to the following interpretation:

[0046] Blockchain refers to a chain of blocks. Each block stores certain information, and they are connected into a chain in the order of their generation. This chain is stored in all servers. As long as there is one server in the entire system that can work, the entire blockchain is safe. These servers are called nodes in the blockchain system, and they provide storage space and computing power support for the entire blockchain system. If you want to modify the information in the blockchain, you must obtain the consent of more than half of the nodes and modify the information in all nodes. These nodes are usually in the hands of different entities, so it is extremely difficult to tamper with the information in the blockchain. Compared with traditional networks, blockchain has two core characteristics: one is that data is difficult to tamper with, and the other is decentralization. Based on these two characteristics, the information recorded in the blockchain is more authentic and reliable, which can help solve the problem of people's distrust.

[0047] The present application is described below in conjunction with embodiments:

[0048] According to one aspect of an embodiment of the present application, a data transmission method is provided. Optionally, in this embodiment, the data transmission method can be applied to Figure 1 In the hardware environment composed of the server 101 and the terminal device 103 shown in FIG. Figure 1As shown, the server 101 is connected to the terminal 103 via a network, and can be used to provide services for the terminal device or the application installed on the terminal device. The application can be a video application, an instant messaging application, a browser application, an educational application, a game application, etc. A database 105 may be set up on the server or independently of the server to provide data storage services for the server 101, for example, a game data storage server. The above-mentioned network may include, but is not limited to, a wired network and a wireless network, wherein the wired network includes, for example, a local area network, a metropolitan area network, and a wide area network; the wireless network includes, for example, Bluetooth, WIFI, and other networks that implement wireless communication; the terminal device 103 may be a terminal configured with an application program, and may include, but is not limited to, at least one of the following: a mobile phone (such as an Android phone, an iOS phone, etc.), a laptop computer, a tablet computer, a PDA, a MID (Mobile Internet Devices), a PAD, a desktop computer, a smart TV, an intelligent voice interaction device, a smart home appliance, a vehicle-mounted terminal, an aircraft, a virtual reality (VR) terminal, an augmented reality (AR) terminal, a mixed reality (MR) terminal, and other computer devices; the above-mentioned server may be a single server, a server cluster consisting of multiple servers, or a cloud server.

[0049] Combination Figure 1 As shown, the above data transmission method can be implemented in the terminal device 103 through the following steps:

[0050] S1, in response to a submitted transaction message, obtaining transaction data to be processed at a first node on the terminal device 103, wherein the transaction data includes a character set extracted from the transaction message;

[0051] S2, performing a coding serialization operation on the character set according to the transaction data on the terminal device 103 to obtain a target coding table and sequence data, wherein the coding serialization operation is used to construct a balanced binary tree according to the character set to generate a serialization coding format corresponding to each character, the number of bits of the serialization coding format is the same as the number of layers of the balanced binary tree, the serialization coding formats corresponding to different types of characters in the character set correspond to different nodes in the balanced binary tree, the serialization coding formats corresponding to the same types of characters in the character set correspond to the same node in the balanced binary tree, and the target coding table is used to record the serialization coding format of each character in the character set;

[0052] S3, sending the target coding table and the sequence data to the second node on the terminal device 103, wherein the second node is used to decode the sequence data into transaction data through the target coding table.

[0053] Optionally, in this embodiment, the above data transmission method may also be implemented by a server, for example, Figure 1 It is implemented in the server 101 shown; or it is implemented by the terminal device and the server together.

[0054] The above is only an example and is not specifically limited in this embodiment.

[0055] Optionally, as an optional implementation, as Figure 2 As shown, the above data transmission method includes:

[0056] S202, in response to the submitted transaction message, obtaining transaction data to be processed at the first node, wherein the transaction data includes a character set extracted from the transaction message;

[0057] Optionally, in this embodiment, the above-mentioned submitted transaction message can be understood as a transaction message obtained by the blockchain node from the client. The type of the transaction message is not limited and may include but is not limited to real-time transaction messages, delayed transaction messages, etc.

[0058] Optionally, in this embodiment, the first node can be understood as a consensus node in the blockchain, which refers to a node in the blockchain network that is responsible for verifying transactions and creating new blocks. The consensus nodes reach consensus through a consensus algorithm to ensure the security and reliability of the blockchain.

[0059] Optionally, in this embodiment, the character set extracted from the transaction message may be a character set extracted manually, or a character set extracted based on artificial intelligence. The character set may be understood as a digitized representation of the transaction message.

[0060] In an exemplary embodiment, the above data transmission method can be applied to, including but not limited to, blockchain.

[0061] Blockchain is a new application model of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanism, encryption algorithm, etc. Blockchain is essentially a decentralized database, a string of data blocks generated by cryptographic methods. Each data block contains a batch of network transaction information, which is used to verify the validity of its information (anti-counterfeiting) and generate the next block. Blockchain can include the underlying blockchain platform, platform product service layer, and application service layer.

[0062] The underlying blockchain platform can include processing modules such as user management, basic services, smart contracts, and operational detection. Among them, the user management module is responsible for the identity information management of all blockchain participants, including maintaining public and private key generation (account management), key management, and maintaining the correspondence between the real identity of the account and the blockchain address (authority management), etc., and, under authorization, supervises and audits the transactions of certain real identities and provides risk control rule configuration (risk control audit); the basic service module is deployed on all blockchain node devices to verify the validity of business requests, and records valid requests to storage after consensus is reached. For a new business request, the basic service first performs interface adaptation analysis and authentication processing (interface adaptation), and then encrypts the business information through the consensus algorithm (consensus management). The smart contract module is responsible for the registration and issuance of contracts, as well as contract triggering and contract execution. Developers can define the contract logic in a programming language and publish it to the blockchain (contract registration). According to the logic of the contract terms, the key or other events are called to trigger the execution and complete the contract logic. It also provides the function of contract upgrade and cancellation. The operation detection module is mainly responsible for the deployment, configuration modification, contract setting, cloud adaptation and real-time status visualization output of the product during the product release process, such as alarm, network status detection, node equipment health status detection, etc.

[0063] The platform product service layer provides the basic capabilities and implementation framework of typical applications. Developers can superimpose business features based on these basic capabilities to complete the blockchain implementation of business logic. The application service layer provides application services based on blockchain solutions for business participants to use.

[0064] The system involved in the embodiments of the present application may be a distributed system formed by connecting a client and multiple nodes (any form of computing devices in an access network, such as a server and a user terminal) through network communication.

[0065] Take the distributed system as the blockchain system as an example, see Figure 3 , Figure 3 This is an optional structural diagram of the distributed system 100 provided in the embodiment of the present application applied to the blockchain system, which is formed by multiple nodes (any form of computing devices in the access network, such as servers, user terminals) and clients, and a point-to-point network is formed between the nodes. The point-to-point network protocol is an application layer protocol running on the Transmission Control Protocol (TCP). In a distributed system, any machine such as a server or a terminal can join and become a node, and the node includes a hardware layer, an intermediate layer, an operating system layer, and an application layer.

[0066] See also Figure 3 The functions of each node in the blockchain system shown include:

[0067] 3) Routing: a basic function of a node, used to support communication between nodes.

[0068] In addition to the routing function, the node can also have the following functions:

[0069] 2) Applications are deployed in the blockchain to implement specific businesses based on actual business needs, record data related to the implementation of functions to form record data, carry digital signatures in the record data to indicate the source of the task data, and send the record data to other nodes in the blockchain system for other nodes to add the record data to a temporary block when they successfully verify the source and integrity of the record data.

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

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

[0072] 2.2) Shared ledger, which is used to provide functions such as storage, query and modification of account data. The record data of the operation on the account data is sent to other nodes in the blockchain system. After other nodes verify the validity, as a response to acknowledging the validity of the account data, the record data is stored in a temporary block, and a confirmation can also be sent to the node that initiated the operation.

[0073] 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.

[0074] 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.

[0075] See also Figure 4 , Figure 4This is an optional schematic diagram of the block structure provided by the embodiment of the present application. 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. 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.

[0076] S204, performing a coding serialization operation on the character set according to the transaction data to obtain a target coding table and sequence data, wherein the coding serialization operation is used to construct a balanced binary tree according to the character set to generate a serialization coding format corresponding to each character, the number of bits of the serialization coding format is the same as the number of layers of the balanced binary tree, the serialization coding formats corresponding to different types of characters in the character set correspond to different nodes in the balanced binary tree, the serialization coding formats corresponding to the same types of characters in the character set correspond to the same node in the balanced binary tree, and the target coding table is used to record the serialization coding format of each character in the character set;

[0077] Optionally, in this embodiment, the above encoding serialization operation can be understood as an operation of encoding characters in a character set according to character type, generating a serialization encoding format for each character, and implementing a serialization operation on the character set based on the serialization encoding format.

[0078] In an exemplary embodiment, the above encoding method may include but is not limited to a serialization encoding method based on a balanced binary tree.

[0079] Among them, "Balanced Binary Tree Coding" (BBTC) is a compression algorithm based on binary tree balance. This algorithm aims to reduce the computational complexity of encoding and decoding by maintaining a balanced binary tree while maintaining a good compression effect.

[0080] For example, the input transaction data can be analyzed first, a character set can be extracted from the transaction data, and the frequency of occurrence of each character can be counted. Then the characters are sorted according to frequency, and the data is recorded in a frequency table. A balanced binary tree is constructed using the sorted characters. The characteristic of a balanced binary tree is that the height difference between the left and right subtrees of any node does not exceed 1, which helps to reduce the height of the tree, thereby reducing the computational complexity of encoding and decoding. A binary code is assigned to each leaf node of the balanced binary tree. Starting from the root node, 0 is assigned to the left subtree and 1 is assigned to the right subtree. In this way, each character will get a unique code.

[0081] It should be noted that balanced binary tree encoding is a compression algorithm that converts a character set into a corresponding encoding. This algorithm uses a balanced binary tree to construct the encoding of each character. In a balanced binary tree, each character corresponds to a leaf node, and each non-leaf node has two child nodes. For each character, starting from the root node, going left means that the corresponding bit in the character encoding is 0, and going right means that the corresponding bit in the character encoding is 1. In this way, a unique encoding can be generated for each character, and the number of bits of these encodings is the same, which is equal to the number of layers of the balanced binary tree. During the encoding process, if there are identical characters in the character set, they will be mapped to the same leaf node, and their encoding serialization format is also the same. By using balanced binary tree encoding, the character set can be compressed into a shorter encoding sequence, thereby achieving the purpose of data compression.

[0082] Optionally, in this embodiment, the number of bits of the above-mentioned serialized encoding format is the same as the number of layers of the balanced binary tree, which can be understood as the number of layers of the above-mentioned balanced binary tree is the number of bits of the above-mentioned serialized encoding format, and the maximum does not exceed the minimum transmission unit of the computer, that is, the number of layers of the above-mentioned balanced binary tree is less than 8 bits, and the related technology generally uses 8 bits to encode one character for character encoding. It can be seen that the encoding method provided in this embodiment, the storage space occupied by the encoding method for each character must be smaller than the encoding method used in the related technology.

[0083] For example, Figure 5 is a schematic diagram of another optional data transmission method according to an embodiment of the present application. Assume that there is a character set {A, B, C, D, E, F}, and the probability of each character appearing is as follows: Figure 5 As shown in , in order to encode and compress this character set, balanced binary tree encoding can be used. First, according to the probability size, the character set is constructed into a Huffman tree (also a balanced binary tree), as shown in Figure 5 As shown:

[0084] In this Huffman tree, each leaf node corresponds to a character, and each non-leaf node has two child nodes. Starting from the root node, going left is 0, and going right is 1, you can get the code corresponding to each character:

[0085] As you can see, the encoding of each character is composed of 0s and 1s on the path from the root node to its corresponding leaf node. The lengths of these encodings are different, but after using Huffman tree encoding, characters with higher frequency in the character set have shorter encodings, while characters with lower frequency have longer encodings. In this way, the character set can be compressed.

[0086] It should be noted that the above-mentioned characters of the same type and different types can be understood as the same characters and different characters, and can also be understood as characters that need to be encoded in different encoding formats and characters in the same encoding format.

[0087] Optionally, in this embodiment, a representation form of the target coding table may include but is not limited to: Figure 5 The Huffman coding table shown.

[0088] S206, sending the target coding table and the sequence data to the second node, wherein the second node is used to decode the sequence data into transaction data through the target coding table.

[0089] Optionally, in this embodiment, the target coding table and sequence data may be directly sent to the second node, or may be encapsulated and encrypted before being sent to the second node.

[0090] It should be noted that the above-mentioned first node and second node can be understood as two consensus nodes in the same blockchain network.

[0091] Optionally, in this embodiment, a character encoding serialization implementation example based on a balanced binary tree is introduced. The implementation example involves the interaction of two nodes, the first node is responsible for obtaining the transaction data to be processed and performing the encoding serialization operation, and the second node decodes the sequence data into transaction data through the target encoding table.

[0092] First, in S202, it is necessary to respond to the submitted transaction message and obtain the transaction data to be processed at the first node. The transaction data includes a character set extracted from the transaction message, which provides a basis for subsequent encoding serialization operations.

[0093] Next, in S204, the character set is subjected to encoding and serialization operations according to the transaction data to obtain a target encoding table and sequence data. The encoding and serialization operations are used to construct a balanced binary tree according to the character set to generate a serialization encoding format corresponding to each character. The number of bits of the serialization encoding format is the same as the number of layers of the balanced binary tree. The serialization encoding formats corresponding to different types of characters in the character set correspond to different nodes in the balanced binary tree, and the serialization encoding formats corresponding to the same types of characters in the character set correspond to the same node in the balanced binary tree. The target encoding table is used to record the serialization encoding format of each character in the character set.

[0094] Finally, in S206, the target coding table and the sequence data are sent to the second node. The second node is used to decode the sequence data into transaction data through the target coding table. In this process, the target coding table plays a key role, and the conversion of sequence data to transaction data is realized by corresponding to the serialized coding format of each character.

[0095] In summary, this implementation example provides an efficient and reliable solution for the processing of transaction data based on the character encoding serialization operation of the balanced binary tree.

[0096] Through this embodiment, in the embodiment of the present application, in response to a submitted transaction message, the transaction data to be processed is obtained at the first node, wherein the transaction data includes a character set extracted from the transaction message, and the character set is encoded and serialized according to the transaction data to obtain a target encoding table and sequence data, wherein the encoding and serialization operation is used to construct a balanced binary tree according to the character set to generate a serialization encoding format corresponding to each character, the number of bits of the serialization encoding format is the same as the number of layers of the balanced binary tree, the serialization encoding formats corresponding to different types of characters in the character set correspond to different nodes in the balanced binary tree, the serialization encoding formats corresponding to the same types of characters in the character set correspond to the same node in the balanced binary tree, and the target encoding table is used to record the serialization encoding format of each character in the character set; the target encoding table and the sequence data are sent to the second node, wherein the second node is used to decode the sequence data into transaction data through the target encoding table. In the above method, balanced binary tree encoding is a method for compressing a character set, and the encoding of each character is constructed by a Huffman tree to achieve compression and decompression of the character set. The first node and the second node in the process both play the role of processing transaction data. The first node is responsible for encoding and serializing the transaction data, and the second node is responsible for decoding the serial data, so that characters with higher frequency of occurrence have shorter codes, thereby achieving a higher compression ratio. By using balanced binary tree encoding in the transaction processing process, efficient compression and decompression of transaction data can be achieved, thereby achieving the technical effect of reducing storage and transmission costs, improving transaction processing efficiency, and accelerating decompression speed, thereby solving the technical problem of low data transmission efficiency due to too many repeated characters in related technologies.

[0097] As an optional solution, encoding and serializing operations are performed on the character set according to the transaction data to obtain a target encoding table and sequence data, including: determining a frequency set corresponding to the character set according to the transaction data, wherein a frequency in the frequency set is used to represent the number of times a character appears in the character set; using the frequency set to determine the position of the nodes corresponding to various characters in a balanced binary tree; and determining the target encoding table and sequence data according to the position.

[0098] Optionally, in this embodiment, one frequency in the frequency set corresponds to one character, and each frequency represents the number of times a character appears repeatedly, also referred to as occurrence frequency.

[0099] In an exemplary embodiment, when processing transaction data, the frequency of each character in the character set is determined. To this end, the corresponding frequency set can be obtained by counting the number of times each character appears in the data. For example, for a set of data "abbcdd", a frequency set {a:1, b:2, c:1, d:2} can be obtained, where the value corresponding to each character represents the number of times the character appears in the data.

[0100] Next, the frequency set is used to determine the position of various characters in the balanced binary tree. A balanced binary tree is a special binary tree in which the height difference between the left subtree and the right subtree does not exceed 1. Each element in the frequency set can be regarded as a node, and inserted into the balanced binary tree in order from small to large according to the value of the node. In this way, the position of the node corresponding to each character in the balanced binary tree can be determined.

[0101] Finally, the target encoding table and sequence data can be determined according to the position of the node in the balanced binary tree. The encoding table is a table that maps characters to codes, usually used to compress or encrypt data. In a balanced binary tree, the node value of the left subtree is less than the value of the parent node, and the node value of the right subtree is greater than the value of the parent node. Therefore, the node of the left subtree can be encoded as 0 and the node of the right subtree can be encoded as 1 to obtain the target encoding table. For example, Figure 6 is a schematic diagram of another optional data transmission method according to an embodiment of the present application. For the above frequency set, the following can be obtained: Figure 6 The coding table shown:

[0102] Sequence data refers to data obtained by encoding the original data according to the target encoding table. For example, for the original data "abbcdd", it can be encoded according to the target encoding table to obtain the sequence data "0001101111".

[0103] In summary, through the above steps, the frequency set corresponding to the character set can be determined according to the transaction data, and the position of the nodes corresponding to each character in the balanced binary tree can be determined by using the frequency set. Finally, the target encoding table and sequence data can be determined according to the position.

[0104] As an optional solution, a frequency set is used to determine the position of the nodes corresponding to various characters in a balanced binary tree, including: arranging various characters in descending order according to the frequency values ​​in the frequency set to obtain a frequency table; traversing the frequency table, each time selecting a target character with the largest frequency value from the candidate character set, wherein the candidate character set represents a character set composed of characters that have not been selected in the frequency table, and the first selected target character corresponds to the root node of the balanced binary tree. Starting from the second selection, each two adjacent selected characters are regarded as a group of characters, and the nodes corresponding to a group of characters are connected to the same parent node in the balanced binary tree; the target character is associated with each node in the balanced binary tree in order from top to bottom and from left to right, and the target character is removed from the candidate character set after each association, and the position of the node corresponding to each target character is determined, wherein each node as a parent node is allowed to have at most two child nodes.

[0105] Optionally, in this embodiment, by traversing the frequency table, the target character with the largest frequency is selected each time and associated with a node in the balanced binary tree, thereby achieving effective management and sorting of the characters.

[0106] It should be noted that the above candidate character set can be understood as a dynamic character set. The initial state includes each character in the frequency table. Each time, the target character with the largest frequency value is selected from the candidate character set for subsequent processing, and the target character is removed from the candidate character set.

[0107] Through this embodiment, a large number of characters can be sorted and managed quickly and efficiently. By arranging the characters in descending order according to frequency, the sorting time and space complexity can be effectively reduced. At the same time, by constructing a balanced binary tree, each node can be quickly found and operated, and the rapid management and sorting of characters can be achieved. The technical problems that can be solved include how to efficiently sort and manage a large number of characters, how to quickly find and operate each node, and how to achieve effective management and sorting of characters. By adopting this algorithm, the above problems can be effectively solved, and the efficiency and accuracy of character management and sorting can be improved.

[0108] As an optional solution, the target coding table and sequence data are determined according to the position, including:

[0109] The node attribute of the target character selected for the 2N+1th time is set as the right node, and the node attribute of the target character selected for the 2N+2th time is set as the left node, wherein the nodes corresponding to the target characters selected for the 2N+1th time and the 2N+2th time are child nodes connected to the same parent node, and N is a natural number;

[0110] Get the level of each node in the target chain where the node corresponding to each target character is located, where the target chain represents a node chain starting from the root node and ending at the node corresponding to the target character, and the level is used to determine the bit number of the sequence data;

[0111] The code value corresponding to each node in the target chain is determined according to the level and node attributes of each node in the target chain, and a target code table is generated.

[0112] Optionally, in this embodiment, the above node attributes can be flexibly adjusted, that is, the node attribute of the target character selected for the 2N+1th time is set to the left node, and the node attribute of the target character selected for the 2N+2th time is set to the right node, without specific limitation.

[0113] Optionally, in this embodiment, the target character corresponding to the root node is the right node by default. The nodes of the left subtree are encoded as 0 and the nodes of the right subtree are encoded as 1, so that each parent node has at most 2 child nodes, namely the left node and the right node, and values ​​are assigned to finally generate the target coding table.

[0114] In an exemplary embodiment, in a binary tree, the nodes corresponding to the target character selected for the third time and the target character selected for the fourth time are connected to the same parent node. Therefore, according to the above content, the node attribute of the target character selected for the third time is set to the right node, and the node attribute of the target character selected for the fourth time is set to the left node.

[0115] By implementing the above operations, the structure of the binary tree can be made more flexible and the search efficiency of the binary tree can be improved.

[0116] It should be noted that in a binary tree, a target character is selected, and the level of each node in the target chain where the node corresponding to the character is located is obtained. By implementing the above operation, the bit number of the node in the sequence data can be easily determined and subsequent processing can be performed.

[0117] In view of the above requirements, it is also necessary to determine the code value corresponding to each node in the target chain according to the level and node attributes of each node in the target chain, and generate a target code table. By implementing the above operations, the sequence data can be easily encoded and subsequently processed.

[0118] For example, Figure 7 A schematic diagram of another optional data transmission method according to an embodiment of the present application is as follows: Figure 7 As shown, including but not limited to the following steps:

[0119] S1, statistics: count the frequency of occurrence of each character in the original number;

[0120] S2, sorting: sort the characters according to their frequency of occurrence and store them in a temporary table.

[0121] S3, build a balanced binary tree based on the character frequency. The character with the highest frequency is the vertex of the tree and is marked as 1. Then generate the left node and the right node in the order of frequency, where the left node is d and marked as 0, and the right node is c and marked as 1. And so on.

[0122] S4, Balance: The balanced binary tree here is to control the height difference of all subtrees to be less than or equal to 1. This is more conducive to data encoding performance.

[0123] The height difference of all the subtrees being less than or equal to 1 means that in a tree structure, the height difference between the left subtree and the right subtree of each node does not exceed 1.

[0124] A tree is a data structure consisting of nodes and edges. Each node can have zero or more child nodes. Each node in the tree can be regarded as the root node of a subtree, so "the height difference of all subtrees is less than or equal to 1" can be understood as, for any node in the tree, the absolute value of the difference between the height of its left subtree and the height of its right subtree does not exceed 1.

[0125] As an optional scheme, the encoding value corresponding to each node in the target chain is determined according to the level and node attributes of each node in the target chain, and a target encoding table is generated, including: obtaining the total number of levels of the balanced binary tree; setting the total number of bits of the serialization encoding format according to the total number of levels; marking each node in the target chain one by one according to the level and node attributes of each node in the target chain, and setting the value corresponding to each bit in the serialization encoding format corresponding to the target character according to the mark value, wherein the mark value corresponding to the left node of the node attribute is 0, and the mark value corresponding to the right node of the node attribute is 1, and the level of each node is used to indicate the number of bits of the mark value in the serialization encoding format.

[0126] Optionally, in this embodiment, the above-mentioned acquisition of the total number of levels of the balanced binary tree can be achieved by recursively traversing the entire tree. Specifically, the traversal can be started from the root node to obtain the total number of levels of the entire tree.

[0127] Optionally, in this embodiment, the total number of bits of the serialization coding format is set according to the total number of levels by determining the total number of levels, so as to set the total number of bits of each serialization coding format to the above-mentioned total number of levels. For example, if the binary tree includes 3 levels, the corresponding total number of bits of the serialization coding format is 3 bits. If the serialization coding format corresponding to a node is less than 3 bits, the generation of the serialization coding format is completed by padding 0 before the first bit.

[0128] Optionally, in this embodiment, the above-mentioned use of the level and node attributes of each node in the target chain to mark each node in the target chain one by one, and setting the value corresponding to each bit in the serialized encoding format corresponding to the target character according to the mark value can be done by recursively traversing each node in the target chain, and recording the level and node attributes of each node. For each node, its level can be converted into a binary representation, and the corresponding number of bits can be marked in the serialized encoding format. At the same time, the corresponding mark value needs to be set to 0 or 1 according to the node attribute. Through this process, a corresponding serialized encoding format can be generated for each node in the target chain, wherein, for the intermediate node, the marking route from the vertex of the tree to the node is also used. If the length is less than the total number of bits, the missing bits are filled with 0 in front of the encoding format.

[0129] In an exemplary embodiment, Figure 8 A schematic diagram of another optional data transmission method according to an embodiment of the present application is as follows: Figure 8 As shown, the data is passed through the generated balanced binary tree to generate a corresponding binary code for each character:

[0130] From the generated coding table, we can see that the node coding of the last layer of the tree is the marked route from the vertex of the tree to the node. Therefore, the coding of node b is 100, the coding of node a is 101, the coding of node f is 110, and the coding of node g is 111. The coding length of the nodes in the last layer of the tree determines the coding length of the entire balanced binary tree. Figure 8 As shown, the length of the code is 3 bits.

[0131] The code of the intermediate node: The intermediate node also starts from the vertex of the tree and goes all the way to the marked path of the node. However, the length is less than 3 bits, and the missing bits are filled with 0 in front of this code. Therefore, the code of the d node is: 010; the code of the C node is: 011.

[0132] Through the above steps, the serialization encoding of the balanced binary tree can be realized. This process can not only improve the efficiency of data transmission, but also ensure the accuracy and integrity of data transmission. At the same time, this method can also solve the problems of data redundancy and low data transmission efficiency in traditional transmission methods, and has broad application prospects.

[0133] As an optional solution, the target coding table and the sequence data are determined according to the position, including: determining the serialization coding format corresponding to each character according to the position, and determining the target coding table, wherein the target coding table includes each serialization coding format; encoding the transaction data using the target coding table to obtain the sequence data.

[0134] Optionally, in this embodiment, different types of data can be serialized and encoded so as to exchange and transmit data between different systems and platforms. By determining the target encoding table, different types of data can be uniformly encoded, thereby achieving standardization and normalization of data formats.

[0135] In practical applications, the implementation and effect of this technology can be illustrated through specific examples. For example, in the field of financial transactions, various transaction data need to be encoded so that they can be transmitted and shared between different systems. In this case, the corresponding serialization encoding format can be determined according to different transaction types and added to the target encoding table. In this way, different types of transaction data can be uniformly encoded and their interoperability between different systems can be ensured.

[0136] In addition, determining the serialization encoding format corresponding to each character according to the position can also solve some technical problems. For example, when transmitting a large amount of data, if the traditional text format is used for transmission, it will lead to problems such as excessive data volume and slow transmission speed. However, using the serialization encoding format, the data can be compressed into a smaller sequence and transmitted over the network. This can greatly improve data transmission efficiency and reduce network bandwidth usage.

[0137] In summary, determining the serialization encoding format corresponding to each character according to the position and determining the target encoding table is a very practical data encoding technology. Through this technology, different types of data can be uniformly encoded and their interoperability between different systems can be ensured. At the same time, this technology can also solve some technical problems that arise when transmitting large amounts of data, and improve data transmission efficiency and network bandwidth utilization.

[0138] As an optional solution, in response to the submitted transaction message, the first node obtains the transaction data to be processed, including:

[0139] In response to the plurality of submitted transaction messages, obtaining a plurality of initial transaction data corresponding to the plurality of transaction messages, wherein the plurality of initial transaction data includes repeated characters;

[0140] Transaction prefixes of multiple initial transaction data are obtained, and the multiple initial transaction data are merged according to the transaction prefixes to obtain transaction data.

[0141] Optionally, in this embodiment, the corresponding initial transaction data may be obtained for the multiple submitted transaction messages. In practical applications, since repeated characters may exist in the multiple initial transaction data, these data need to be merged to obtain complete transaction data.

[0142] To achieve this goal, the following technical solutions can be used:

[0143] S1, using blockchain technology to obtain transaction data;

[0144] Blockchain technology is a distributed database technology that can achieve decentralized data storage and transaction verification. By using blockchain technology, multiple submitted transaction messages can be obtained, and the initial transaction data corresponding to these transaction messages can be obtained.

[0145] S2, obtain the transaction prefix;

[0146] Before merging the initial transaction data, you need to obtain the transaction prefix. The transaction prefix refers to the same prefix part in multiple initial transaction data. You can use string matching algorithms and other technologies to obtain the transaction prefix.

[0147] S3, merge initial transaction data;

[0148] After obtaining the transaction prefix, multiple initial transaction data can be merged.

[0149] In an exemplary embodiment, in a blockchain scenario, a transaction prefix refers to a portion of transaction data that can be used to identify and classify different types of transactions. By utilizing the transaction prefix, transaction data can be merged, thereby reducing the storage space of the blockchain and improving data processing efficiency.

[0150] The specific implementation method is as follows:

[0151] S1, Design of transaction prefix: First, it is necessary to design a suitable transaction prefix in the blockchain system to identify and classify different types of transactions. Different signs, numbers or strings can be used as transaction prefixes.

[0152] S2, merge based on transaction prefix: When a new transaction needs to be added to the blockchain, it is merged into the transaction data of the same type based on the transaction prefix. The transaction prefix can be processed using a hash function or other methods to ensure the uniqueness and integrity of the merged data.

[0153] For example:

[0154] Assume that in a blockchain system, there are two types of transactions: transfer transactions and smart contract transactions. The transaction prefix can be designed as "TX" for transfer transactions and "SC" for smart contract transactions.

[0155] When a transfer transaction occurs, the transaction data can be as follows:

[0156] Transaction prefix: TX;

[0157] Transaction amount: 10 BTC;

[0158] Sender's address: A;

[0159] Recipient address: B;

[0160] When a smart contract transaction occurs, the transaction data can be as follows:

[0161] Transaction prefix: SC;

[0162] Contract address: C;

[0163] Contract parameters: D;

[0164] In the blockchain system, these transaction data are merged and stored according to the transaction prefix. In this way, when a specific type of transaction needs to be queried or processed, it can be filtered and classified according to the transaction prefix, improving data processing efficiency.

[0165] It should be noted that the design of transaction prefixes should take into account new transaction types that may appear in the future, so that the system can flexibly expand and add new transaction prefixes. At the same time, the processing and query of the merged transaction data can also be designed and optimized accordingly to ensure the performance and availability of the system.

[0166] Through the above technical solution, it is possible to effectively process multiple submitted transaction messages and obtain complete transaction data.

[0167] As an optional solution, the target coding table and sequence data are sent to the second node, including: obtaining the coding table length information, wherein the coding table length information is used to describe the storage length of the target coding table; encapsulating the coding table length information, the target coding table and the sequence data to obtain a target data packet; and sending the target data packet to the second node.

[0168] Optionally, in this embodiment, in response to the need to obtain the length information of the coding table, the target coding table can be encoded by using a coding algorithm, and the length information of the coding table can be obtained. The specific implementation method is to encode the target coding table using a Huffman coding algorithm, and then obtain the storage length of the target coding table by reading the length information of the coding table. After obtaining the length information of the coding table, the coding table length information, the target coding table and the sequence data are encapsulated to obtain a target data packet. The specific implementation method is to combine the coding table length information, the target coding table and the sequence data according to a certain format, and add a header and a tail to form a complete data packet.

[0169] Finally, the target data packet is sent to the second node. In the implementation process, a network transmission protocol, such as TCP / IP protocol, can be used to send the data packet to the second node.

[0170] Through the above implementation, the length information of the coding table can be obtained, and the target data packet can be sent to the second node. This implementation has the advantages of high efficiency, reliability, and security, and can effectively solve related technical problems.

[0171] Optionally, as an optional implementation, as Fig. 9 As shown, the above data transmission method includes:

[0172] S902, receiving a target data packet sent by the first node;

[0173] S904, parsing the target data packet to obtain a target encoding table and sequence data, wherein the first node is used to generate the target encoding table and sequence data according to the acquired transaction data, the transaction data includes a character set extracted from the transaction message acquired by the first node, the first node obtains the target encoding table and sequence data by performing an encoding serialization operation on the character set, the encoding serialization operation is used to construct a balanced binary tree according to the character set to generate a serialization encoding format corresponding to each character, the number of bits of the serialization encoding format is the same as the number of layers of the balanced binary tree, the serialization encoding formats corresponding to different types of characters in the character set correspond to different nodes in the balanced binary tree, the serialization encoding formats corresponding to the same types of characters in the character set correspond to the same node in the balanced binary tree, and the target encoding table is used to record the serialization encoding format of each character in the character set;

[0174] S906, decoding the sequence data according to the target coding table to obtain transaction data.

[0175] Optionally, in this embodiment, first, in S902, a target data packet sent by the first node is received. This step is the starting point of the entire encoding and decoding process, and subsequent operations can only be performed after the target data packet is successfully received.

[0176] Next, in S904, the target data packet is parsed to obtain a target encoding table and sequence data. The target encoding table is used to record the serialized encoding format of each character in the character set, and the sequence data is the encoded transaction data. In this step, a balanced binary tree is used to perform encoding and serialization operations on the character set to generate the serialized encoding format corresponding to each character. At the same time, the sequence data is also parsed to facilitate subsequent decoding operations.

[0177] Finally, in S906, the sequence data is decoded according to the target encoding table to obtain the transaction data. This step is the end point of the entire encoding and decoding process. Only when the transaction data is successfully decoded can it be passed to the subsequent processing flow.

[0178] It should be noted that the technology involved in this embodiment is aimed at encoding and decoding of transaction data. In this embodiment, encoding and decoding of transaction data are implemented to facilitate effective transmission and processing during data transmission.

[0179] Through the above steps, the transaction data can be effectively encoded and decoded, and a series of technical problems that arise during data transmission can be solved. For example, data loss, data corruption and other problems may occur during the transmission process, and by encoding and decoding the data, these problems can be effectively avoided. At the same time, when processing a large amount of transaction data, the use of encoding and decoding technology can effectively improve the efficiency of data transmission and processing, thereby improving the performance of the entire system.

[0180] As an optional solution, the target data packet is parsed to obtain the target coding table and sequence data, including: parsing the target data packet to obtain the coding table length information, wherein the coding table length information is used to describe the storage length of the target coding table; determining the target coding table and sequence data according to the coding table length information.

[0181] As an optional solution, the sequence data is decoded according to the target coding table to obtain transaction data, including: determining the serialization coding format corresponding to each character according to the target coding table; and decoding the sequence data using the serialization coding format corresponding to each character to obtain transaction data.

[0182] The following is a further explanation of this application with reference to specific examples:

[0183] This application proposes an optimization scheme for blockchain transaction pool transaction synchronization. This scheme proposes a data compression synchronization method for transaction data transmission in the blockchain network, which effectively reduces the communication volume of transaction synchronization data and improves the communication efficiency of transaction data synchronization. At the same time, this synchronization compression scheme ensures data compression efficiency while also ensuring that the CPU usage is reduced as much as possible. This scheme is effective for transaction pool synchronization in the blockchain, and can also be effective for other modules with similar scenarios.

[0184] Currently in the blockchain network, when a node receives new transaction data, it will immediately synchronize the transaction data to other consensus nodes while storing it locally for subsequent consensus processes. The synchronization of transaction data is often transmitted to other nodes through the network in the form of serialized byte streams. For example: Protobuf (Protocol Buffers, referred to as PB) is used to serialize custom data structures into byte streams and deserialize byte streams into data structures. Therefore, it is very suitable for data storage and data exchange formats for different languages ​​and different applications to communicate with each other. As long as the same protocol format is implemented, that is, the proto file suffix is ​​compiled into different language versions and added to their respective projects, different languages ​​can parse data serialized by other languages ​​through Protobuf. Compared with other data transmission forms such as json / xml, the data after PB serialization has a smaller data stream and is more conducive to data transmission. The synchronization of transaction data in traditional blockchain transaction pools is usually based on a serialization method to serialize custom data structures into byte streams. After the byte stream is sent to the other node through network transmission, the original transaction data is obtained by deserializing the byte stream to complete the data transmission.

[0185] For traditional blockchain transaction pool transaction data communication, the amount of data is still relatively large if the customized transaction data is only serialized and transmitted through PB and other methods. Although the PB serialization method is relatively small in size compared to other serialization methods, if a large amount of transaction pool transaction data needs to be transmitted in the blockchain network, it will still occupy a large amount of network resources in the blockchain network.

[0186] This application proposes a solution for the synchronization of transaction data in blockchain transaction pools. This solution proposes a data compression scheme, which can ensure that the volume of data transmission is smaller and does not occupy a large amount of computing resources.

[0187] Specifically, the steps include:

[0188] S1, Transaction Merger:

[0189] In a blockchain network, when one of the consensus nodes receives a new transaction submitted by a client, the node itself will perform a series of security and legality checks on the transaction. Transactions that pass the check will be synchronized to other consensus nodes to facilitate the subsequent consensus process. For a popular blockchain network with a large transaction volume, each transaction is broadcast once, which consumes a lot of network resources. Therefore, the first thing to do is to merge the transaction resources and then broadcast them through the network.

[0190] Fig.10A schematic diagram of another optional data transmission method according to an embodiment of the present application is as follows: Fig.10 As shown, the transaction broadcast of the transaction pool:

[0191] S1-1, when the client sends a transaction to node A, in order to reduce the amount of message communication, the transaction pool usually does not broadcast the transaction immediately, but caches it first, and only initiates the broadcast when the cached transactions reach a certain number.

[0192] S1-2: If the number of transactions is small and not enough transactions have been collected for a long time, the transaction pool will not wait forever, but will immediately broadcast the cached new transactions after waiting for a fixed time.

[0193] S1-3, the transaction pool will maintain a timer to time the new transactions collected. When the number of transactions meets the conditions or the timer is reached, the conditions for broadcasting the transaction will be triggered.

[0194] S1-4, Merge transaction prefixes: For the merged transaction list, it is not necessary to encapsulate each transaction into the transaction broadcast data structure as when each transaction is broadcast. Instead, all transaction lists need to be put into the same transaction broadcast data structure. Therefore, the overall broadcast data volume is significantly reduced.

[0195] S2, message serialization:

[0196] The communication of messages between nodes cannot directly send local structured data. Usually, the structured data needs to be serialized into a byte stream and then sent over the network. There are many ways of serialization at present: for example, Json serialization, that is, serializing the data structure according to the Json format. After receiving the information, the other end also uses the Json format to deserialize and obtain the original data; the basic principle of XML serialization is consistent with Json serialization. Both serializations are readable serializations, which means that the serialized content can be printed out and the content can be recognized by the naked eye. There is another serialization method, which is also a very common serialization method at present, that is, Protobuf (Protocol Buffers abbreviated as PB) serialization. This serialization method mainly uses the binary stream data format, so the data volume is smaller and more conducive to data transmission.

[0197] Fig.11 A schematic diagram of another optional data transmission method according to an embodiment of the present application is as follows: Fig.11 As shown, the transaction data can be serialized and sent based on the above balanced binary tree encoding method:

[0198] S2-1, before node A sends a message, the original data is a custom transaction data structure, which contains the identification information and transaction list of the transaction pool transaction broadcast.

[0199] S2-2, before sending data, node A needs to serialize the custom transaction data structure into a byte stream through PB, and then send the byte stream universal network module to node B.

[0200] S2-3, after node B receives the byte stream sent by node A, it first needs to deserialize the byte stream into the original custom transaction data structure through the same PB, and then it can process the data.

[0201] S3, balanced binary tree encoding:

[0202] "Balanced Binary Tree Coding" (BBTC) is a compression algorithm based on binary tree balance. This algorithm aims to reduce the computational complexity of encoding and decoding by maintaining a balanced binary tree while maintaining good compression effect. First, analyze the input data and count the frequency of occurrence of each character. Then sort the characters according to frequency and record the data in a frequency table. Use the sorted characters to build a balanced binary tree. The characteristic of a balanced binary tree is that the height difference between the left and right subtrees of any node does not exceed 1, which helps to reduce the height of the tree, thereby reducing the computational complexity of encoding and decoding. Assign a binary code to each leaf node of the balanced binary tree. Starting from the root node, assign 0 to the left subtree and assign 1 to the right subtree.

[0203] In this way, each character will get a unique code. Figure 7 As shown:

[0204] S3-1, Statistics: Count the frequency of occurrence of each character in the original number;

[0205] S3-2, Sorting: Sort the characters by frequency of occurrence and store them in a temporary table.

[0206] S3-3, build a balanced binary tree based on the frequency of the characters. The character with the highest frequency is the vertex of the tree and is marked as 1. Then the left node and the right node are generated in the order of frequency, where the left node is d and marked as 0, and the right node is c and marked as 1. And so on.

[0207] S3-4, Balance: The balanced binary tree here is to control the height difference of all subtrees to be less than or equal to 1. This is more conducive to data encoding performance.

[0208] like Figure 8As shown, the data is passed through the generated balanced binary tree to generate a corresponding binary code for each character. It can be seen from the generated coding table:

[0209] The node code of the last layer of the tree is the marked route from the vertex of the tree to the node. Therefore, the code of node b is: 100, the code of node a is 101, the code of node f is: 110, and the code of node g is 111. The code length of the nodes in the last layer of the tree determines the code length of the entire balanced binary tree. For example Figure 8 In the example, the length of the code is 3 bits.

[0210] The code of the intermediate node: The intermediate node also starts from the vertex of the tree and goes all the way to the marked path of the node. However, if the length is less than 3 digits, the code is padded with 0 in front of the code. Therefore, the code of the d node is: 010; the code of the C node is: 011.

[0211] S4, encode the data:

[0212] The original data in the example is: abcdebcdecdedeefg, a total of 17 characters, each character occupies 8 bits, a total of 136 bits. After balanced binary tree encoding, the length of each character is 3 bits, so a total of 51 bits. Theoretically, the length of the data encoded by the balanced binary tree only occupies 35.5% of the original data length. Of course, the compression rate of this data is not fixed, it is related to the number of data repetitions and the number of node levels of the balanced binary tree. When the data repetition rate is higher, the number of levels of the generated balanced binary tree may be relatively smaller, then the encoding length of the corresponding encoding table will be shorter, and therefore the data compression ratio will be greater.

[0213] Fig.12 A schematic diagram of another optional data transmission method according to an embodiment of the present application is as follows: Fig.12 As shown, including but not limited to:

[0214] S4-1, the original data has 17 characters in total, and the length after conversion to binary is 136 bits. The binary length of the characters after balanced binary tree encoding is 51 bits, and the data volume is reduced to 35.5% of the original.

[0215] S4-2, Final Encoding: The encoded binary is not the final encoding of the data. If this encoding is sent to the peer node, the peer node cannot know how to decode this encoding. Therefore, the data actually sent also needs to include the encoding table generated by the balanced binary tree.

[0216] S4-3, efficiency issue: When the data is relatively small, the total amount of data may not be smaller than the original data because the encoded data needs to be sent together with the coding table. In the case of a balanced binary tree with many levels, it may even be larger than the original data.

[0217] S4-4, usage scenario: In the scenario of broadcasting transactions in the transaction pool, the number of transactions broadcast each time is large, which may be 100 transactions, 1,000 transactions, or even more. A large number of identical characters will appear between the contents. Therefore, after using balanced binary number compression, the effect will be more ideal.

[0218] S5, inverse solution of data:

[0219] The data encoded by the balanced binary tree is sent to the peer node together with the encoding table through the network module. The first thing the peer node needs to do is to decrypt the data. The first thing to do to decrypt the data is to extract the encoding table of the balanced binary tree from the data stream. This step requires specifying in the communication protocol where the encoding table starts and how long it is. For example: the first two bytes of the data represent the length of the encoding table, and the third byte is the content of the encoding table. The completed encoding table can be obtained by byte interception. After obtaining the encoding table, the remaining bytes are all the encoded content data. With the encoding table, the data can be decoded into the original data.

[0220] Fig.13 A schematic diagram of another optional data transmission method according to an embodiment of the present application is as follows: Fig.13 As shown in the figure, the encoding decryption process is similar to the data encoding process. Through the encoding table, the encoded content can be replaced with the original data content one by one. For transaction pool synchronization, a consensus node broadcasts the transaction information encoded by the balanced binary tree. Other consensus nodes need to decrypt the encoded content to obtain the original transaction data.

[0221] Through the embodiment of the present application, a solution for reducing the synchronization of transactions in the blockchain network transaction pool is provided. By merging and sending transactions, the duplicate data brought by transaction broadcasting is reduced, and the communication efficiency is improved.

[0222] In addition, a higher performance and more effective compression encoding method, balanced binary tree encoding, is proposed to encode and compress the byte stream before sending it through the network, thereby reducing the message communication volume again.

[0223] It is understandable that in the specific implementation of this application, related data such as user information is involved. When the above embodiments of this application are applied to specific products or technologies, user permission or consent is required, and the collection, use and processing of relevant data need to comply with relevant laws, regulations and standards of relevant countries and regions.

[0224] It should be noted that, for the aforementioned method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the described order of actions, because according to the present application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present application.

[0225] According to another aspect of the embodiments of the present application, a data transmission device for implementing the above data transmission method is also provided. Fig.14 As shown, the device comprises:

[0226] An acquisition module 1402, configured to acquire, at a first node, transaction data to be processed in response to a submitted transaction message, wherein the transaction data includes a character set extracted from the transaction message;

[0227] The encoding module 1404 is used to perform an encoding serialization operation on the character set according to the transaction data to obtain a target encoding table and sequence data, wherein the encoding serialization operation is used to construct a balanced binary tree according to the character set to generate a serialization encoding format corresponding to each character, the number of bits of the serialization encoding format is the same as the number of layers of the balanced binary tree, the serialization encoding formats corresponding to different types of characters in the character set correspond to different nodes in the balanced binary tree, the serialization encoding formats corresponding to the same types of characters in the character set correspond to the same node in the balanced binary tree, and the target encoding table is used to record the serialization encoding format of each character in the character set;

[0228] The sending module 1406 is used to send the target coding table and the sequence data to the second node, wherein the second node is used to decode the sequence data into the transaction data through the target coding table.

[0229] As an optional scheme, the device is used to perform encoding and serializing operations on the character set according to the transaction data to obtain a target encoding table and sequence data in the following manner: determine a frequency set corresponding to the character set according to the transaction data, wherein a frequency in the frequency set is used to represent the number of occurrences of a character in the character set; use the frequency set to determine the position of the nodes corresponding to each of the various characters in the balanced binary tree; and determine the target encoding table and the sequence data according to the position.

[0230] As an optional solution, the device is used to determine the position of the node corresponding to each of the various characters in the balanced binary tree using the frequency set in the following manner: according to the frequency values ​​in the frequency set, the various characters are arranged in descending order to obtain a frequency table; the frequency table is traversed, and the target character with the largest frequency value is selected from the candidate character set each time, wherein the candidate character set represents a character set composed of characters that have not been selected in the frequency table, and the target character selected for the first time corresponds to the root node of the balanced binary tree. Starting from the second selection, each two adjacent selected characters are regarded as a group of characters, and the nodes corresponding to the group of characters are connected to the same parent node in the balanced binary tree; the target character is associated with each node in the balanced binary tree in order from top to bottom and from left to right, and the target character is removed from the candidate character set after each association, and the position of the node corresponding to each target character is determined, wherein each node as a parent node is allowed to have at most two child nodes.

[0231] As an optional scheme, the device is used to determine the target coding table and the sequence data according to the position in the following manner, including: setting the node attribute of the target character selected for the 2N+1th time to a right node, and setting the node attribute of the target character selected for the 2N+2th time to a left node, wherein the nodes corresponding to the target characters selected for the 2N+1th time and the 2N+2th time are child nodes connected to the same parent node, and N is a natural number; obtaining the level of each node in the target chain where the node corresponding to each target character is located, wherein the target chain represents a node chain starting from the root node and ending at the node corresponding to the target character, and the level is used to determine the bit number of the sequence data; determining the code value corresponding to each node in the target chain according to the level and the node attribute of each node in the target chain, and generating the target coding table.

[0232] As an optional scheme, the device is used to determine the encoding value corresponding to each node in the target chain according to the level of each node in the target chain and the node attributes, and generate the target encoding table in the following manner: obtain the total number of levels of the balanced binary tree; set the total number of bits of the serialized encoding format according to the total number of levels; mark each node in the target chain one by one according to the level of each node in the target chain and the node attributes, and set the value corresponding to each bit in the serialized encoding format corresponding to the target character according to the mark value, wherein the mark value corresponding to the left node of the node attribute is 0, and the mark value corresponding to the right node of the node attribute is 1, and the level of each node is used to indicate the number of bits of the mark value in the serialized encoding format.

[0233] As an optional scheme, the device is used to determine the target coding table and the sequence data according to the position in the following manner, including: determining the serialization coding format corresponding to each character according to the position, and determining the target coding table, wherein the target coding table includes each serialization coding format; using the target coding table to encode the transaction data to obtain the sequence data.

[0234] As an optional solution, the device is used to obtain transaction data to be processed at the first node in response to a submitted transaction message in the following manner: in response to multiple submitted transaction messages, obtain multiple initial transaction data corresponding to the multiple transaction messages, wherein the multiple initial transaction data include repeated characters; obtain transaction prefixes of the multiple initial transaction data, and merge the multiple initial transaction data according to the transaction prefix to obtain the transaction data.

[0235] As an optional scheme, the device is used to send the target coding table and the sequence data to the second node in the following manner: obtain the coding table length information, wherein the coding table length information is used to describe the storage length of the target coding table; encapsulate the coding table length information, the target coding table and the sequence data to obtain a target data packet; and send the target data packet to the second node.

[0236] According to another aspect of the embodiment of the present application, a data transmission device is also provided, including: a receiving module, used to receive a target data packet sent by a first node; a parsing module, used to parse the target data packet to obtain a target coding table and sequence data, wherein the first node is used to generate the target coding table and the sequence data according to the acquired transaction data, the transaction data includes a character set extracted from the transaction message acquired by the first node, the first node obtains the target coding table and the sequence data by performing a coding serialization operation on the character set, the coding serialization operation is used to construct a balanced binary tree according to the character set to generate a serialized coding format corresponding to each character, the number of bits of the serialized coding format is the same as the number of layers of the balanced binary tree, the serialized coding formats corresponding to different types of characters in the character set correspond to different nodes in the balanced binary tree, the serialized coding formats corresponding to the same types of characters in the character set correspond to the same node in the balanced binary tree, and the target coding table is used to record the serialized coding format of each character in the character set; a decoding module, used to decode the sequence data according to the target coding table to obtain the transaction data.

[0237] As an optional scheme, the device is used to parse the target data packet to obtain the target coding table and sequence data in the following manner: parse the target data packet to obtain coding table length information, wherein the coding table length information is used to describe the storage length of the target coding table; determine the target coding table and the sequence data based on the coding table length information.

[0238] As an optional scheme, the device is used to decode the sequence data according to the target coding table to obtain the transaction data in the following manner: determine the serialization coding format corresponding to each character according to the target coding table; and decode the sequence data using the serialization coding format corresponding to each character to obtain the transaction data.

[0239] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.

[0240] According to one aspect of the present application, a computer program product is provided, the computer program product comprising a computer program / instruction, the computer program / instruction comprising a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through the communication part 1509, and / or installed from a removable medium 1511. When the computer program is executed by the central processor 1501, various functions provided in the embodiments of the present application are executed.

[0241] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.

[0242] Fig.15 The structure block diagram of a computer system for implementing an electronic device according to an embodiment of the present application is schematically shown.

[0243] It should be noted that Fig.15 The computer system 1500 of the electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.

[0244] like Fig.15As shown, the computer system 1500 includes a central processing unit 1501 (CPU), which can perform various appropriate actions and processes according to the program stored in the read-only memory 1502 (ROM) or the program loaded from the storage part 1508 to the random access memory 1503 (RAM). Various programs and data required for system operation are also stored in the random access memory 1503. The central processing unit 1501, the read-only memory 1502 and the random access memory 1503 are connected to each other through a bus 1504. The input / output interface 1505 (Input / Output interface, i.e., I / O interface) is also connected to the bus 1504.

[0245] The following components are connected to the input / output interface 1505: an input section 1506 including a keyboard, a mouse, etc.; an output section 1507 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 1508 including a hard disk, etc.; and a communication section 1509 including a network interface card such as a LAN card, a modem, etc. The communication section 1509 performs communication processing via a network such as the Internet. A drive 1510 is also connected to the input / output interface 1505 as needed. A removable medium 1511, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 1510 as needed so that a computer program read therefrom is installed into the storage section 1508 as needed.

[0246] In particular, according to an embodiment of the present application, the process described in each method flow chart can be implemented as a computer software program. For example, an embodiment of the present application includes a computer program product, which includes a computer program carried on a computer readable medium, and the computer program contains a program code for executing the method shown in the flow chart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 1509, and / or installed from the removable medium 1511. When the computer program is executed by the central processor 1501, various functions defined in the system of the present application are executed.

[0247] According to another aspect of the embodiment of the present application, an electronic device for implementing the above data transmission method is also provided. The electronic device may be Figure 1 The terminal device or server shown in the figure. This embodiment is described by taking the electronic device as a terminal device as an example. Fig.16As shown, the electronic device includes a memory 1602 and a processor 1604. The memory 1602 stores a computer program, and the processor 1604 is configured to execute the steps in any of the above method embodiments through the computer program.

[0248] Optionally, in this embodiment, the electronic device may be located in at least one network device among a plurality of network devices of a computer network.

[0249] Optionally, in this embodiment, the processor may be configured to perform the following steps through a computer program:

[0250] S1, in response to a submitted transaction message, obtaining transaction data to be processed at a first node, wherein the transaction data includes a character set extracted from the transaction message;

[0251] S2, performing encoding serialization operation on the character set according to the transaction data to obtain a target encoding table and sequence data, wherein the encoding serialization operation is used to construct a balanced binary tree according to the character set to generate a serialization encoding format corresponding to each character, the number of bits of the serialization encoding format is the same as the number of layers of the balanced binary tree, the serialization encoding formats corresponding to different types of characters in the character set correspond to different nodes in the balanced binary tree, the serialization encoding formats corresponding to the same types of characters in the character set correspond to the same node in the balanced binary tree, and the target encoding table is used to record the serialization encoding format of each character in the character set;

[0252] S3, sending the target coding table and the sequence data to the second node, wherein the second node is used to decode the sequence data into transaction data through the target coding table.

[0253] Alternatively, a person skilled in the art may understand that: Fig.16 The structure shown is for illustration only, and the electronic device may also be a smart phone (such as an Android phone, an iOS phone, etc.), a tablet computer, a PDA, a mobile Internet device (MID), a PAD, and other terminal devices. Fig.16 The electronic device and the electronic equipment described above are not limited in structure. Fig.16 More or fewer components (such as network interfaces, etc.) as shown in, or with Fig.16 Different configurations shown.

[0254] Among them, the memory 1602 can be used to store software programs and modules, such as the program instructions / modules corresponding to the data transmission method and device in the embodiments of the present application. The processor 1604 executes various functional applications and data processing by running the software programs and modules stored in the memory 1602, that is, to implement the above-mentioned data transmission method. The memory 1602 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 1602 may further include a memory remotely located relative to the processor 1604, and these remote memories may be connected to the terminal via a network. Examples of the above-mentioned networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof. Among them, the memory 1602 can be specifically, but not limited to, used to store transaction data. As an example, Fig.16 As shown, the memory 1602 may include but is not limited to the acquisition module 1402, the encoding module 1404 and the sending module 1406 in the data transmission device. In addition, it may also include but is not limited to other module units in the data transmission device, which will not be repeated in this example.

[0255] Optionally, the transmission device 1606 is used to receive or send data via a network. Specific examples of the above-mentioned network may include a wired network and a wireless network. In one example, the transmission device 1606 includes a network adapter (Network Interface Controller, NIC), which can be connected to other network devices and routers via a network cable so as to communicate with the Internet or a local area network. In one example, the transmission device 1606 is a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.

[0256] In addition, the electronic device further includes: a display 1608 for displaying the transaction message; and a connection bus 1610 for connecting various module components in the electronic device.

[0257] In other embodiments, the terminal device or server may be a node in a distributed system, wherein the distributed system may be a blockchain system, and the blockchain system may be a distributed system formed by connecting the multiple nodes through network communication. The nodes may form a peer-to-peer network, and any form of computing device, such as a server, terminal or other electronic device, may become a node in the blockchain system by joining the peer-to-peer network.

[0258] According to one aspect of the present application, a computer-readable storage medium is provided, and 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 executes the data transmission method provided in various optional implementations of the above-mentioned data transmission aspect.

[0259] Optionally, in this embodiment, the computer-readable storage medium may be configured to store a computer program for performing the following steps:

[0260] S1, in response to a submitted transaction message, obtaining transaction data to be processed at a first node, wherein the transaction data includes a character set extracted from the transaction message;

[0261] S2, performing encoding serialization operation on the character set according to the transaction data to obtain a target encoding table and sequence data, wherein the encoding serialization operation is used to construct a balanced binary tree according to the character set to generate a serialization encoding format corresponding to each character, the number of bits of the serialization encoding format is the same as the number of layers of the balanced binary tree, the serialization encoding formats corresponding to different types of characters in the character set correspond to different nodes in the balanced binary tree, the serialization encoding formats corresponding to the same types of characters in the character set correspond to the same node in the balanced binary tree, and the target encoding table is used to record the serialization encoding format of each character in the character set;

[0262] S3, sending the target coding table and the sequence data to the second node, wherein the second node is used to decode the sequence data into transaction data through the target coding table.

[0263] Optionally, in this embodiment, a person of ordinary skill in the art may understand that all or part of the steps in the various methods of the above embodiments may be completed by instructing hardware related to the terminal device through a program, and the program may be stored in a computer-readable storage medium, and the storage medium may include: a flash drive, a read-only memory (ROM), a random access memory (RAM), a disk or an optical disk, etc.

[0264] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.

[0265] If the integrated units in the above embodiments are implemented in the form of software functional units and sold or used as independent products, they can be stored in the above computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for enabling one or more computer devices (which may be personal computers, servers, or network devices, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present application.

[0266] In the above embodiments of the present application, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, please refer to the relevant description of other embodiments.

[0267] In the several embodiments provided in the present application, it should be understood that the disclosed client can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.

[0268] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0269] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0270] The above is only a preferred implementation of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.

Claims

1. A data transmission method, characterized in that: include: In response to the submitted transaction message, obtaining, at the first node, transaction data to be processed, wherein the transaction data includes a character set extracted from the transaction message; Performing an encoding serialization operation on the character set according to the transaction data to obtain a target encoding table and sequence data, wherein the encoding serialization operation is used to construct a balanced binary tree according to the character set to generate a serialization encoding format corresponding to each character, the number of bits of the serialization encoding format is the same as the number of layers of the balanced binary tree, the serialization encoding formats corresponding to different types of characters in the character set correspond to different nodes in the balanced binary tree, the serialization encoding formats corresponding to the same types of characters in the character set correspond to the same node in the balanced binary tree, and the target encoding table is used to record the serialization encoding format of each character in the character set; The target coding table and the sequence data are sent to a second node, wherein the second node is used to decode the sequence data into the transaction data through the target coding table.

2. The method according to claim 1, characterized in that The encoding and serialization operation is performed on the character set according to the transaction data to obtain a target encoding table and sequence data, including: Determine a frequency set corresponding to the character set according to the transaction data, wherein a frequency in the frequency set is used to represent the number of occurrences of a character in the character set; Determine the position of the nodes corresponding to the various characters in the balanced binary tree by using the frequency set; The target encoding table and the sequence data are determined according to the position.

3. The method according to claim 2, characterized in that The step of using the frequency set to determine the positions of the nodes corresponding to the various characters in the balanced binary tree includes: According to the frequency values ​​in the frequency set, the various characters are arranged in descending order to obtain a frequency table; Traversing the frequency table, each time selecting a target character with the largest frequency value from the candidate character set, wherein the candidate character set represents a character set consisting of characters that have not been selected from the frequency table, the target character selected for the first time corresponds to the root node of the balanced binary tree, and starting from the second selection, each two adjacent selected characters are regarded as a group of characters, and the nodes corresponding to the group of characters are connected to the same parent node in the balanced binary tree; The target character is associated with each node in the balanced binary tree in order from top to bottom and from left to right. After each association, the target character is removed from the candidate character set, and the position of the node corresponding to each target character is determined, wherein each node as a parent node is allowed to have at most two child nodes.

4. The method according to claim 3, characterized in that The step of determining the target coding table and the sequence data according to the position includes: Setting the node attribute of the target character selected for the 2N+1th time as a right node, and setting the node attribute of the target character selected for the 2N+2th time as a left node, wherein the nodes corresponding to the target characters selected for the 2N+1th time and the 2N+2th time are child nodes connected to the same parent node, and N is a natural number; Obtaining the level of each node in the target chain where the node corresponding to each target character is located, wherein the target chain represents a node chain starting from the root node and ending at the node corresponding to the target character, and the level is used to determine the number of digits of the sequence data; The coding value corresponding to each node in the target chain is determined according to the level of each node in the target chain and the node attribute, and the target coding table is generated.

5. The method according to claim 4, characterized in that The step of determining the code value corresponding to each node in the target chain according to the level of each node in the target chain and the node attribute, and generating the target code table, includes: Obtain the total number of levels of the balanced binary tree; Setting the total number of bits of the serialization encoding format according to the total number of levels; Mark each node in the target chain one by one according to the level of each node in the target chain and the node attributes, and set the value corresponding to each bit in the serialized encoding format corresponding to the target character according to the tag value, wherein the tag value corresponding to the node attribute of the left node is 0, and the tag value corresponding to the node attribute of the right node is 1, and the level of each node is used to indicate the number of bits of the tag value in the serialized encoding format.

6. The method according to claim 2, characterized in that The step of determining the target coding table and the sequence data according to the position includes: Determine the serialization encoding format corresponding to each character according to the position, and determine the target encoding table, wherein the target encoding table includes each serialization encoding format; The transaction data is encoded using the target encoding table to obtain the sequence data.

7. The method according to claim 1, characterized in that The step of obtaining the transaction data to be processed at the first node in response to the submitted transaction message includes: In response to the plurality of submitted transaction messages, obtaining a plurality of initial transaction data corresponding to the plurality of transaction messages, wherein the plurality of initial transaction data includes repeated characters; Transaction prefixes of the multiple initial transaction data are acquired, and the multiple initial transaction data are merged according to the transaction prefixes to obtain the transaction data.

8. The method according to claim 1, characterized in that The sending the target coding table and the sequence data to the second node includes: Acquire encoding table length information, wherein the encoding table length information is used to describe the storage length of the target encoding table; Encapsulating the encoding table length information, the target encoding table and the sequence data to obtain a target data packet; The target data packet is sent to the second node.

9. A data transmission method, characterized in that: include: receiving a target data packet sent by the first node; Parsing the target data packet to obtain a target encoding table and sequence data, wherein the first node is used to generate the target encoding table and the sequence data according to the acquired transaction data, the transaction data includes a character set extracted from a transaction message acquired by the first node, the first node obtains the target encoding table and the sequence data by performing an encoding serialization operation on the character set, the encoding serialization operation is used to construct a balanced binary tree according to the character set to generate a serialization encoding format corresponding to each character, the number of bits of the serialization encoding format is the same as the number of layers of the balanced binary tree, the serialization encoding formats corresponding to different types of characters in the character set correspond to different nodes in the balanced binary tree, the serialization encoding formats corresponding to the same types of characters in the character set correspond to the same node in the balanced binary tree, and the target encoding table is used to record the serialization encoding format of each character in the character set; The sequence data is decoded according to the target coding table to obtain the transaction data.

10. The method according to claim 9, characterized in that The target data packet is parsed to obtain a target coding table and sequence data, including: Parsing the target data packet to obtain coding table length information, wherein the coding table length information is used to describe the storage length of the target coding table; The target coding table and the sequence data are determined according to the coding table length information.

11. The method according to claim 9, characterized in that The decoding of the sequence data according to the target coding table to obtain the transaction data includes: Determine the serialization encoding format corresponding to each character according to the target encoding table; The sequence data is decoded using the serialization encoding format corresponding to each character to obtain the transaction data.

12. A data transmission device, characterized in that: include: an acquisition module, configured to acquire, at the first node, transaction data to be processed in response to a submitted transaction message, wherein the transaction data includes a character set extracted from the transaction message; An encoding module, used for performing an encoding serialization operation on the character set according to the transaction data to obtain a target encoding table and sequence data, wherein the encoding serialization operation is used for constructing a balanced binary tree according to the character set to generate a serialization encoding format corresponding to each character, the number of bits of the serialization encoding format is the same as the number of layers of the balanced binary tree, the serialization encoding formats corresponding to different types of characters in the character set correspond to different nodes in the balanced binary tree, the serialization encoding formats corresponding to the same types of characters in the character set correspond to the same node in the balanced binary tree, and the target encoding table is used for recording the serialization encoding format of each character in the character set; A sending module is used to send the target coding table and the sequence data to a second node, wherein the second node is used to decode the sequence data into the transaction data through the target coding table.

13. A data transmission device, characterized in that: include: A receiving module, used for receiving a target data packet sent by the first node; A parsing module, used for parsing the target data packet to obtain a target encoding table and sequence data, wherein the first node is used to generate the target encoding table and the sequence data according to the acquired transaction data, the transaction data includes a character set extracted from the transaction message acquired by the first node, the first node obtains the target encoding table and the sequence data by performing an encoding serialization operation on the character set, the encoding serialization operation is used to construct a balanced binary tree according to the character set to generate a serialization encoding format corresponding to each character, the number of bits of the serialization encoding format is the same as the number of layers of the balanced binary tree, the serialization encoding formats corresponding to different types of characters in the character set correspond to different nodes in the balanced binary tree, the serialization encoding formats corresponding to the same types of characters in the character set correspond to the same node in the balanced binary tree, and the target encoding table is used to record the serialization encoding format of each character in the character set; A decoding module is used to decode the sequence data according to the target coding table to obtain the transaction data.

14. A computer-readable storage medium, characterized in that: The computer-readable storage medium includes a stored program, wherein the program can be executed by a terminal device or a computer to execute the method described in any one of claims 1 to 8 or 9 to 11.

15. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instructions are executed by a processor, the steps of the method described in any one of claims 1 to 8 or 9 to 11 are implemented.

16. An electronic device comprising a memory and a processor, characterized in that: A computer program is stored in the memory, and the processor is configured to execute the method described in any one of claims 1 to 8 or 9 to 11 through the computer program.

Citation Information

Cited By

  • Interface authentication method, device and equipment

    CN120811761A