CN116723239B - Block chain data transmission method and device, electronic equipment and readable medium - Google Patents

Block chain data transmission method and device, electronic equipment and readable medium Download PDF

Info

Publication number
CN116723239B
CN116723239B CN202310996714.1A CN202310996714A CN116723239B CN 116723239 B CN116723239 B CN 116723239B CN 202310996714 A CN202310996714 A CN 202310996714A CN 116723239 B CN116723239 B CN 116723239B
Authority
CN
China
Prior art keywords
message
node
information
character
blockchain
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202310996714.1A
Other languages
Chinese (zh)
Other versions
CN116723239A (en
Inventor
吴坤
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN202310996714.1A priority Critical patent/CN116723239B/en
Publication of CN116723239A publication Critical patent/CN116723239A/en
Application granted granted Critical
Publication of CN116723239B publication Critical patent/CN116723239B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/56Provisioning of proxy services
    • H04L67/565Conversion or adaptation of application format or content
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1095Replication or mirroring of data, e.g. scheduling or transport for data synchronisation between network nodes
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1097Protocols in which an application is distributed across nodes in the network for distributed storage of data in networks, e.g. transport arrangements for network file system [NFS], storage area networks [SAN] or network attached storage [NAS]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/56Provisioning of proxy services
    • H04L67/565Conversion or adaptation of application format or content
    • H04L67/5651Reducing the amount or size of exchanged application data
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The application provides a block chain data transmission method, a block chain data transmission device, electronic equipment and a readable medium. The method comprises the following steps: acquiring a data replacement strategy aiming at a blockchain and a message to be processed which is to be sent to a blockchain node, wherein the data replacement strategy comprises a corresponding relation between a keyword and the message to be replaced; replacing keywords in the message to be processed with corresponding information to be replaced according to a data replacement strategy; carrying out serialization coding on the replaced message to be processed to obtain a serialized message; a serialization message is sent to a blockchain node in the blockchain to send a pending message to the blockchain node. The method can reduce the communication data volume between the block chains and the network communication pressure to the block chain network.

Description

Block chain data transmission method and device, electronic equipment and readable medium
Technical Field
The present application relates to the field of computer technologies, and in particular, to a method and apparatus for transmitting blockchain data, an electronic device, and a readable medium.
Background
In the blockchain network, when a new block needs to be uplink, blockchain nodes in the blockchain network can communicate with each other to perform a consensus process, and communication messages need to be sent at each stage of the consensus process.
In the related art, before a blockchain node sends a message, a custom data structure in the message to be sent is serialized into a byte stream, so that a byte stream-based data transmission mode is performed between nodes.
However, in the process of the block chain consensus, the frequency of the consensus among the nodes is higher, the communication traffic is larger, the data volume of the result obtained by serializing the custom data structure is larger, and the block chain network is brought with larger network communication pressure, so that the execution efficiency of the block chain communication is not facilitated.
Disclosure of Invention
Based on the technical problems, the application provides a method, a device, an electronic device and a readable medium for transmitting blockchain data, so as to reduce the communication data volume between blockchains and the network communication pressure on a blockchain network.
Other features and advantages of the application will be apparent from the following detailed description, or may be learned by the practice of the application.
According to an aspect of an embodiment of the present application, there is provided a method for transmitting blockchain data, including:
acquiring a data replacement strategy aiming at a blockchain and a message to be processed which is to be sent to a blockchain node, wherein the data replacement strategy comprises a corresponding relation between a keyword and the message to be replaced;
Replacing keywords in the message to be processed with corresponding information to be replaced according to the data replacement strategy;
carrying out serialization coding on the replaced message to be processed to obtain a serialized message;
and sending the serialized message to a blockchain node in the blockchain to send the message to be processed to the blockchain node.
According to an aspect of an embodiment of the present application, there is provided a transmission apparatus of blockchain data, including:
the information acquisition module is configured to acquire a data replacement strategy for the blockchain and a message to be processed, which is to be sent to the blockchain node, wherein the data replacement strategy comprises a corresponding relation between a keyword and the information to be replaced;
the information replacement module is configured to replace keywords in the message to be processed with corresponding information to be replaced according to the data replacement strategy;
the serialization module is configured to carry out serialization coding on the replaced message to be processed to obtain a serialized message;
and the message sending module is configured to send the serialized message to a blockchain node in the blockchain so as to send the message to be processed to the blockchain node.
In some embodiments of the present application, based on the above technical solutions, the information replacing module is specifically configured to: if the message to be processed is a proposal message, acquiring transaction identifiers of all transaction information in the proposal message according to the information to be replaced corresponding to the keyword in the data replacement strategy; and replacing each transaction information in the proposal message with the transaction identification of the transaction information according to the keywords in the data replacement strategy.
In some embodiments of the present application, based on the above technical solution, the keyword includes voting result information of the proposal message, and the information to be replaced includes a voting result code corresponding to the voting result information; the information replacement module is further configured to: if the message to be processed is a node state message, voting result information of each block chain node in the node state message is obtained; and replacing voting result information in the node state message with a corresponding voting result code according to the keywords in the data replacement strategy.
In some embodiments of the present application, based on the above technical solution, the key further includes a node identifier, and the information to be replaced further includes a node code corresponding to the node identifier; the information replacement module is further configured to: and replacing the node identification of each blockchain node in the node status message with a corresponding node code according to the key words in the data replacement strategy.
In some embodiments of the present application, based on the above technical solution, the keyword includes a node identifier and voting result information for the proposal message, the information to be replaced includes a voting result code corresponding to the voting result information and a node code corresponding to the node identifier, and the information replacing module is further configured to: if the message to be processed is a node state message, voting information of each blockchain node in the node state message is obtained, wherein the voting information comprises voting result information, node identification and voting time information; according to the keywords in the data replacement strategy and the voting information, replacing the obtained voting result information and the node identification with corresponding voting result codes and node codes corresponding to the node identification, and obtaining a voting result coding sequence; and deleting voting information of each blockchain node from the node status message, and adding the voting result coding sequence into the node status message.
In some embodiments of the present application, based on the above technical solution, the keyword includes a field identifier of the transaction information, and the information to be replaced includes a field code corresponding to the field identifier; the information replacement module is further configured to: and if the message to be processed is a transaction message, replacing the field identification of each transaction message in the transaction message with a field code corresponding to the field identification according to the key words in the data replacement strategy.
In some embodiments of the present application, based on the above technical solutions, the serialization module is specifically configured to: serializing the replaced message to be processed to obtain a serialized character stream; and coding the serialized character stream according to the occurrence frequency of each character in the serialized character stream to obtain a coded message and a coding table as the serialized message, wherein the coding table is used for generating the coded message.
In some embodiments of the present application, based on the above technical solution, the serialization module is further configured to: grouping the characters in the serialized character stream according to the occurrence frequency of each character in the serialized character stream to obtain character groups; constructing a coding table according to the characters in each character group to obtain a coding table of each character group; and coding the serialized character stream according to the coding table of each character group to obtain a coded message.
In some embodiments of the present application, based on the above technical solution, the serialization module is further configured to: establishing character grouping indexes for each character grouping according to the number of the character groupings; and coding each character in the serialized character stream according to the group index of the character group where each character in the serialized character stream is located and a coding table corresponding to the character group to obtain a coded message.
In some embodiments of the present application, based on the above technical solution, the serialization module is further configured to: counting the occurrence frequency of each character in the serialized character stream; and clustering the characters according to the character frequency distribution in the serialized character stream to obtain character groups.
According to an aspect of an embodiment of the present application, there is provided an electronic apparatus including: a processor; and a memory for storing executable instructions of the processor; wherein the processor is configured to perform the method of transmitting blockchain data as in the above aspects by executing executable instructions.
According to an aspect of the embodiments of the present application, there is provided a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements a method of transmitting blockchain data as in the above technical solutions.
According to an aspect of embodiments of the present application, there is provided a computer program product or computer program comprising computer instructions stored in a computer readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions to cause the computer device to perform the methods of transmitting blockchain data provided in the various alternative implementations described above.
In the embodiment of the application, when the blockchain node transmits the blockchain data, a data replacement strategy for the blockchain and a message to be processed to be sent to the blockchain node are acquired, wherein the data replacement strategy comprises a corresponding relation between a keyword and the message to be replaced. The block chain node replaces the keyword in the message to be processed with the corresponding message to be replaced according to the data replacement strategy, then carries out serialization coding on the replaced message to be processed to obtain the serialization message, and then sends the serialization message to the block chain node in the block chain so as to send the message to be processed to the block chain node. The information to be processed is replaced according to the data replacement strategy and then is serialized, so that the quantity and the size of information to be serialized are reduced, the communication data volume between the blockchains is reduced, the network communication pressure on the blockchain network is reduced, and the execution efficiency of blockchain communication is facilitated.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the application as claimed.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the application and together with the description, serve to explain the principles of the application. It is evident that the drawings in the following description are only some embodiments of the present application and that other drawings may be obtained from these drawings without inventive effort for a person of ordinary skill in the art.
Fig. 1 is a system architecture of a transmission scheme applied to blockchain data according to an embodiment of the present application.
Fig. 2 is a schematic diagram of a block chain network in an embodiment of the application.
Fig. 3 is a schematic diagram of a block in a block chain network according to an embodiment of the present application.
Fig. 4 is a flowchart of a method of transmitting blockchain data according to an embodiment of the present application.
Fig. 5 is a schematic flow chart of block chain data transmission in an embodiment of the application.
Fig. 6 is a flowchart of a method of transmitting blockchain data according to an embodiment of the present application.
Fig. 7 is a schematic diagram of a proposal message and a proposal message after replacement in an embodiment of the application.
Fig. 8 is a flowchart of a method of transmitting blockchain data according to an embodiment of the present application.
Fig. 9 is an exemplary diagram of keyword replacement for a node status message in an embodiment of the present application.
Fig. 10 is a flowchart of a method of transmitting blockchain data according to an embodiment of the present application.
Fig. 11 is a schematic flow chart of block coding in an embodiment of the application.
Fig. 12 schematically shows a block diagram of a block chain data transmission device in an embodiment of the present application.
Fig. 13 shows a schematic diagram of a computer system suitable for use in implementing an embodiment of the application.
Detailed Description
Example embodiments will now be described more fully with reference to the accompanying drawings. However, the exemplary embodiments may be embodied in many forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the concept of the example embodiments to those skilled in the art.
Furthermore, the described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments. In the following description, numerous specific details are provided to give a thorough understanding of embodiments of the application. One skilled in the relevant art will recognize, however, that the application may be practiced without one or more of the specific details, or with other methods, components, devices, steps, etc. In other instances, well-known methods, devices, implementations, or operations are not shown or described in detail to avoid obscuring aspects of the application.
The block diagrams depicted in the figures are merely functional entities and do not necessarily correspond to physically separate entities. That is, the functional entities may be implemented in software, or in one or more hardware modules or integrated circuits, or in different networks and/or processor devices and/or microcontroller devices.
The flow diagrams depicted in the figures are exemplary only, and do not necessarily include all of the elements and operations/steps, nor must they be performed in the order described. For example, some operations/steps may be decomposed, and some operations/steps may be combined or partially combined, so that the order of actual execution may be changed according to actual situations.
It should be appreciated that the inventive arrangements may be applied in the context of communications between nodes of a blockchain, and in particular in the course of consensus communications of blockchain nodes. In a blockchain network, network communications are typically required between nodes to agree on data. The consensus module submits the process by requiring two or three phases of consensus in order to agree on a block transaction. The master node often needs to send proposal information to other slave nodes, and after receiving the information, the slave nodes need to vote and reply to the information. Finally, after two rounds or three rounds of consensus messages, consensus is achieved. For the transaction pool module, after a certain node receives a transaction sent by a client, the transaction is stored in the node, and meanwhile, the transaction needs to be broadcast to other nodes, so that the transaction can be broadcast to other nodes in time, and the transaction pool can be broadcast out in time after receiving the transaction. The blockchain consensus process typically includes three phases: a proposal phase, a pre-commit phase and a commit phase. In the proposal phase, the master node will package the blocks containing all transactions into the proposal and then broadcast the proposal message to all slave nodes. In the pre-commit phase and commit phase, node status messages are sent between nodes, the message content no longer containing transaction information, but containing voting information collected in the proposal phase. One round of consensus requires three back and forth messages, requiring 6N message traffic to complete the consensus process in the case of N nodes in the blockchain.
In the blockchain network, when a new block needs to be uplink, blockchain nodes in the blockchain network can communicate with each other to perform a consensus process, and communication messages need to be sent at each stage of the consensus process.
In the related art, before a blockchain node sends a message, a custom data structure in the message to be sent is serialized into a byte stream, so that a byte stream-based data transmission mode is performed between nodes.
However, in the process of the block chain consensus, the frequency of the consensus among the nodes is higher, the communication traffic is larger, the data volume of the result obtained by serializing the custom data structure is larger, and the block chain network is brought with larger network communication pressure, so that the execution efficiency of the block chain communication is not facilitated.
Based on the problems, the technical scheme of the embodiment of the application provides a transmission scheme of block chain data. In particular, as shown in fig. 1, a system architecture 100 applied to a blockchain data-based transmission scheme according to an embodiment of the present application may include a terminal device 110, a network 120, and a server 130. Terminal device 110 may include a smart phone, tablet, notebook, smart voice interaction device, smart home appliance, vehicle terminal, aircraft, and the like. The server 130 may be a server providing various services, which may be an independent physical server, a server cluster or a distributed system formed by a plurality of physical servers, or may be a cloud server providing cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN (Content Delivery Network ), and basic cloud computing services such as big data and artificial intelligence platforms. Network 120 may be a communication medium of various connection types capable of providing a communication link between terminal device 110 and server 130, and may be, for example, a wired communication link or a wireless communication link.
The system architecture in embodiments of the present application may have any number of terminal devices, networks, and servers, as desired for implementation. For example, the server 130 may be a server group composed of a plurality of server devices. In addition, the technical solution provided in the embodiment of the present application may be applied to the terminal device 110, or may be applied to the server 130, or may be implemented by the terminal device 110 and the server 130 together, which is not limited in particular. In an embodiment of the present application, a blockchain network may be constructed between the server 130 and the terminal device 110, where both the server 130 and the terminal device 110 join the blockchain network as nodes of the blockchain network.
In one embodiment of the application, server 130 is a master node in a blockchain network. When the server 130 determines that a message needs to be sent, for example, a transaction message is broadcast or a proposal message or a node status message in the consensus process of generating a new block uplink is generated, a data replacement policy for the block chain and a message to be processed to be sent to the block chain node are acquired, the data replacement policy includes keywords in the message to be processed and information to be replaced corresponding to the keywords, and then the keywords in the message to be processed are replaced with the corresponding information to be replaced according to the data replacement policy. The server 130 then performs serialization encoding on the replaced pending message to obtain a serialized message, and then sends the serialized message to the blockchain nodes in the blockchain to send the pending message to the blockchain nodes.
Specifically, the master node is a node responsible for carrying out new block proposal in the blockchain, the master node is not a fixed node, the nodes in the blockchain are usually acted by each other, when one node is called a master node, other nodes are automatically called slave nodes, the master node carries out proposal on the new block, the slave nodes verify and vote on the proposal of the new block, and after consensus among the slave nodes is achieved, the master node notifies all the nodes to uplink the new block. Blockchain (Blockchain) is a point-to-point distributed ledger that is made up of multiple nodes. Each node contains all of the transaction records and all of the nodes need to verify each transaction. Each node in the blockchain network may be a full node or a local blockchain node. The full node may be connected to other nodes, while the local blockchain node refers to an independent node running in the blockchain that is not connected to other nodes. The local blockchain node does not participate in the blockchain network's consensus mechanism like a full node, but it can independently validate transactions and create new blocks. The second node sends the secret information of the first node, and only the first node can decrypt the secret information, so that the content in the secret information is obtained, and secret communication between the two wires is realized.
Blockchains are novel application modes of computer technologies such as distributed data storage, point-to-point transmission, consensus mechanisms, encryption algorithms, and the like. Blockchains are essentially a de-centralized database, which is a series of data blocks (i.e., blocks) that are generated in association using cryptographic methods, each of which contains information from a batch of network transactions for verifying the validity (anti-counterfeiting) of the information and generating the next block. Blockchains are commonly maintained by nodes in a blockchain network. For example, in the blockchain network shown in fig. 2, a plurality of nodes 201 may be included, and the plurality of nodes 201 may be individual clients forming the blockchain network. Each node 201 may receive input information while operating normally and maintain shared data within the blockchain network based on the received input information. In order to ensure information intercommunication in the blockchain network, information connection can exist between every two nodes in the blockchain network, and information transmission can be carried out between the nodes through the information connection. For example, when any node in the blockchain network receives input information, other nodes in the blockchain network acquire the input information according to a consensus algorithm, and store the input information as shared data, so that the data stored on all nodes in the blockchain network are consistent.
For each node in the blockchain network, there is a node identification corresponding thereto, and each node in the blockchain network may store the node identifications of other nodes for subsequent broadcasting of the generated blocks to other nodes in the blockchain network based on the node identifications of the other nodes. Each node can maintain a node identification list, and the node names and the node identifications are correspondingly stored in the node identification list. The node identifier may be an IP (Internet Protocol, protocol interconnecting between networks) address, or any other information that can be used to identify the node.
Each node in the blockchain network stores one and the same blockchain. The blockchain is composed of a plurality of blocks, as shown in fig. 3, and the starting block comprises a block head and a block main body, wherein the block head stores an input information characteristic value, a version number, a timestamp, a difficulty value and the like, and the block main body stores input information; the next block of the starting block takes the starting block as a father block, the next block also comprises a block head and a block main body, the block head stores the input information characteristic value of the current block, the block head characteristic value, the version number, the timestamp, the difficulty value and the like of the father block, and the like, so that the block data stored in each block in the block chain are associated with the block data stored in the father block, and the safety of the input information in the block is ensured.
The transaction information in the proposal message, the voting information in the node status message, and the transaction information in the transaction message may be located in the tile body shown in fig. 3.
The implementation details of the technical scheme of the embodiment of the application are described in detail below:
fig. 4 is a flowchart illustrating a method of transmitting blockchain data, which is applied to a master node in a blockchain and may be specifically performed by a device having a computing processing function, such as a server or a terminal device where the master node is located, according to an embodiment of the present application. Referring to fig. 4, the method for transmitting blockchain data at least includes steps S410 to S440, which are described in detail as follows:
step S410, a data replacement strategy for the blockchain and a message to be processed to be sent to the blockchain node are obtained, wherein the data replacement strategy comprises a corresponding relation between a keyword and the message to be replaced.
The data replacement policy is configuration information configured for each node in the blockchain for information replacement. The data replacement strategy comprises a corresponding relation between the keywords and the information to be replaced, namely the keywords and the information to be replaced corresponding to the keywords. The data replacement policy may be configured in each node of the blockchain, which may be stored directly into the blockchain for the node to acquire from the blockchain when needed, or may be updated down the chain to individual blockchain nodes, such as directly locally to the device of the new node before the new node joins the blockchain node. The keyword is information that will appear in the message to be processed, and is also target information that is replaced in the message to be processed, which may be direct information such as a tag, a field name, or the like, or an expression or instruction information for indicating the replaced information. For example, the key may be an identifier for indicating a piece of information, e.g., the key is a start identifier and an end identifier of the transaction information, thereby indicating that the replaced target is the transaction information. The information to be replaced is information for replacing a key, which may be information preconfigured in the data replacement policy, for example, a key is a certain field name "endorsement Signature", and the corresponding information to be replaced is "e". The information to be replaced may also be information such as an expression or an identifier of the information, and the master node may obtain corresponding information according to the expression or the identifier, for example, the information to be replaced indicates a transaction identifier in the transaction information, and then the master node may obtain the transaction identifier of the transaction as the information to be replaced. It will be appreciated that, in either form of the key and the information to be replaced, the amount of memory space or bytes of the information to be replaced is less than the amount of memory space or bytes occupied by the key.
Step S420, replacing the keyword in the message to be processed with the corresponding information to be replaced according to the data replacement policy.
And the main node replaces the keywords in the message to be processed with corresponding information to be replaced according to the data replacement strategy. And the master node searches all keywords in the data replacement strategy in the message to be processed, and replaces the keywords in the message to be processed with corresponding information to be replaced in the data replacement strategy for the searched keywords. It can be understood that, in the case that the information to be replaced is identification information or a replacement rule, the master node additionally acquires information to be used in actual replacement and then replaces the information. For the case that the keyword is identification information for identifying the replaced information, the master node also determines the actual data content to be replaced in the information to be processed. In the replacement process, the information to be replaced and the replaced keyword are not necessarily in one-to-one relationship, for example, a plurality of keywords may be replaced by one piece of information according to a certain rule. The replaced information may also be empty, i.e. the keywords are deleted from the information to be processed without adding new content.
Step S430, carrying out serialization coding on the replaced message to be processed to obtain a serialized message.
The master node performs serialization encoding on the replaced message to be processed to obtain a serialized message. The serialization encoding is typically performed based on a serialization protocol configured for the blockchain. For example in a readable serialization manner or in a serialization manner of a binary stream, etc. It will be appreciated that, depending on the way of serialization, the serialized message may contain additional information content generated during the serialization process, such as the encoding information or serialization rules used during the encoding process, in addition to the result of the replaced pending message being serialized.
Step S440, the serialization message is sent to the blockchain nodes in the blockchain to send the pending message to the blockchain nodes.
The master node sends a serialization message to the blockchain nodes in the blockchain. After receiving the serialization message, the slave nodes deserialize the serialization message according to a configured serialization protocol or algorithm, so as to restore the replaced message to be processed, and translate the actual content represented by the replaced part in the message to be processed according to a local data replacement strategy, so as to obtain the complete message to be processed. It will be appreciated that the data replacement policy for each blockchain node in the blockchain is the same. The block chain nodes synchronize the data replacement strategies with each other, and the synchronization process can be finished before or off-line. In embodiments where the data replacement policy is stored on the blockchain, the updating process of the data replacement policy may be accomplished through a consensus uplink process of the blockchain. Referring to fig. 5, fig. 5 is a schematic flow chart of block chain data transmission in an embodiment of the application. As shown in fig. 5, the node a performs data replacement on the original data according to the data replacement policy, and performs serialization after the replacement is completed, so as to obtain a serialized message to be sent.
In the embodiment of the application, when the blockchain node transmits the blockchain data, a data replacement strategy for the blockchain and a message to be processed to be sent to the blockchain node are acquired, wherein the data replacement strategy comprises a corresponding relation between a keyword and the message to be replaced. The block chain node replaces the keyword in the message to be processed with the corresponding message to be replaced according to the data replacement strategy, then carries out serialization coding on the replaced message to be processed to obtain the serialization message, and then sends the serialization message to the block chain node in the block chain so as to send the message to be processed to the block chain node. The information to be processed is replaced according to the data replacement strategy and then is serialized, so that the quantity and the size of information to be serialized are reduced, the communication data volume between the blockchains is reduced, the network communication pressure on the blockchain network is reduced, and the execution efficiency of blockchain communication is facilitated.
In the embodiment of the present application, other embodiments for refining the technical solution of the embodiment shown in fig. 4 are also provided, and specifically as shown in fig. 6, in the method for transmitting blockchain data according to an embodiment of the present application, the method may include the following steps:
Step S610, a data replacement strategy for the blockchain and a message to be processed to be sent to the blockchain node are obtained, wherein the data replacement strategy comprises a corresponding relation between a keyword and the message to be replaced.
Optionally, the implementation details of step S610 are identical to those of step S410 shown in fig. 4, and will not be described again.
In the present embodiment, if the message to be processed is a proposal message, step S520 is performed. The proposal message is a message transmitted from the master node to the slave node in the proposal phase of the blockchain consensus process. The main content in the proposal message is the transaction information of each blockchain transaction to be uplinked. However, although transaction information is included in the proposal message, it is not responsible for providing the transaction information to the slave node. Each slave node will synchronize its own transaction pool during the transaction information broadcast process when the blockchain transaction is proposed, thereby obtaining the transaction information for each blockchain transaction, and thus, eventually, each transaction will be synchronized to all of the consensus nodes, which typically occurs prior to the proposal phase. The slave node performs validity verification on the transaction information in the proposal message and provides voting information to the master node.
Step S620, obtaining the transaction identifier of each transaction information in the proposal message according to the information to be replaced corresponding to the keyword in the data replacement policy.
Since the slave node only needs to verify the transaction in the proposal message, and does not need to provide the whole content of the transaction information, the transaction information of the blockchain transaction is replaced by the transaction identifier of the transaction in the data replacement strategy for the proposal information. Based on this, the keywords in the data replacement policy are typically identification information for identifying the storage location of the transaction information in the proposal message, e.g., tags or keywords for the beginning and end of the transaction information, etc. The information to be replaced is used for indicating the transaction identifier, for example, directly defined as the field name of the transaction identifier in the proposal message or the corresponding expression, etc. And the master node acquires the transaction identification of each transaction information from the proposal message according to the information to be replaced corresponding to the key words in the data replacement strategy. The transaction identification is information that is used to uniquely identify a transaction in the blockchain, typically in the form of a number or code. The proposal message generated by the master node in a packaging way contains transaction information, and the transaction information contains transaction identification, so that the transaction identification can be directly obtained from the proposal message.
Step S630, replacing each transaction information in the proposal message with a transaction identifier of the transaction information according to the keywords in the data replacement policy.
After the transaction identifier is obtained, the master node replaces each transaction information in the proposal message with the transaction identifier of the transaction information according to the keywords in the data replacement strategy. The key is used to identify the storage location of the respective transaction information in the proposal message. The master node obtains the storage position of each transaction information according to the key words, and replaces the information of the storage position with the transaction identification of the transaction information. It will be appreciated that after the replacement is completed, the proposal message no longer contains the completed transaction information, but only a list of transaction identifications of blockchain transactions to be uplinked. Referring to fig. 7, fig. 7 is a schematic diagram of a proposal message and a proposal message after replacement in an embodiment of the application. As shown in fig. 7, after the replacement is completed, the transaction list in the original proposal is replaced with the transaction ID list, thereby reducing the amount of data in the proposal message. By replacing the transaction information with the transaction identifier, the message length of the proposal message is reduced, which is beneficial to reducing the communication resources occupied by the communication message.
Step S640, the replaced message to be processed is subjected to serialization coding, and the serialized message is obtained.
Optionally, the implementation details of step S640 are identical to those of step S430 shown in fig. 4, and will not be described again.
Step S650, sending the serialized message to a blockchain node in the blockchain to send the pending message to the blockchain node.
Optionally, the implementation details of step S650 are identical to those of step S440 shown in fig. 4, and will not be described again.
In the embodiment of the application, when the blockchain node transmits the blockchain data, a data replacement strategy for the blockchain and a message to be processed to be sent to the blockchain node are acquired, wherein the data replacement strategy comprises a corresponding relation between a keyword and the message to be replaced. The block chain node replaces the keyword in the message to be processed with the corresponding message to be replaced according to the data replacement strategy, then carries out serialization coding on the replaced message to be processed to obtain the serialization message, and then sends the serialization message to the block chain node in the block chain so as to send the message to be processed to the block chain node. The information to be processed is replaced according to the data replacement strategy and then is serialized, so that the quantity and the size of information to be serialized are reduced, the communication data volume between the blockchains is reduced, the network communication pressure on the blockchain network is reduced, and the execution efficiency of blockchain communication is facilitated.
In the embodiment of the present application, other embodiments for refining the technical solution of the embodiment shown in fig. 4 are also provided, in which the keyword includes voting result information of the proposal message, specifically as shown in fig. 8, in the method for transmitting blockchain data in one embodiment of the present application, the method may include the following steps:
step S810, a data replacement strategy for the blockchain and a message to be processed to be sent to the blockchain node are obtained, wherein the data replacement strategy comprises a corresponding relation between a keyword and the message to be replaced.
Optionally, the implementation details of step S810 are identical to those of step S410 shown in fig. 4, and will not be described again.
In the present embodiment, if the message to be processed is a node status message, step S620 is performed. The node status message is a voting result message for notifying each slave node of proposal information by the master node. The main content in the node status message is the voting result of each node. After receiving the node status message, the slave node needs to confirm the voting result according to the voting result message therein, and therefore, the voting result itself needs to be retained in the message to be processed. Thus, for the node status message, the key and the information to be replaced in the data replacement policy are set as replacement information for the data structure of the voting result message.
Step S820, obtaining voting result information of each block chain node in the node status message.
The voting result information is a voting result generated by each slave node for the proposal information, and includes the voting result information of the voting node. Based on this, the keywords in the data replacement policy are set as identification information for identifying the voting result information, for example, a field identification of a field in which the voting result information is located, or an expression capable of representing the voting result information, or the like. Based on the key, the master node may slave the voting result information of each blockchain node in the node status message.
And step S830, replacing the voting result information in the node state message with a corresponding voting result code according to the keywords in the data replacement strategy.
After the voting result information is obtained, the master node replaces the voting result information in the node state information with the corresponding voting result code according to the keywords in the data replacement strategy. The voting result codes the code information corresponding to the specific content of the voting result information. For example, if the voting result contains two types, i.e., endorsement and anti-endorsement, the voting result code may be set to a number 1 and a number 0, respectively, and if the voting result also contains no votes, the number 3 may be additionally set to the corresponding voting result code. It can be appreciated that the voting result code is used as a single digital content, and the occupied length of the voting result code is shorter than that of the voting result information in the node state message, so that the network communication pressure on the blockchain network is reduced, and the execution efficiency of the blockchain communication is facilitated.
Step S840, the replaced message to be processed is subjected to serialization coding, and the serialized message is obtained.
Optionally, the implementation details of step S840 are identical to those of step S430 shown in fig. 4, and will not be described again.
Step S850, the serialization message is sent to a blockchain node in the blockchain to send the pending message to the blockchain node.
Optionally, the implementation details of step S850 are identical to those of step S440 shown in fig. 4, and will not be described again.
In the embodiment of the application, when the blockchain node transmits the blockchain data, a data replacement strategy for the blockchain and a message to be processed to be sent to the blockchain node are acquired, wherein the data replacement strategy comprises a corresponding relation between a keyword and the message to be replaced. The block chain node replaces the keyword in the message to be processed with the corresponding message to be replaced according to the data replacement strategy, then carries out serialization coding on the replaced message to be processed to obtain the serialization message, and then sends the serialization message to the block chain node in the block chain so as to send the message to be processed to the block chain node. The information to be processed is replaced according to the data replacement strategy and then is serialized, so that the quantity and the size of information to be serialized are reduced, the communication data volume between the blockchains is reduced, the network communication pressure on the blockchain network is reduced, and the execution efficiency of blockchain communication is facilitated.
In some optional embodiments, the key further includes a node identifier, the information to be replaced further includes a node code corresponding to the node identifier, and in the process of replacing the key, the master node further replaces the node identifier of each blockchain node in the node status message with the corresponding node code according to the key in the data replacement policy. The node code and the node identifier can both uniquely identify a node in the blockchain, and the node code is generated according to the link points aiming at each block and has unique corresponding relation with the node identifier. It will be appreciated that the node identifier generally has a certain interpretable meaning, for example, includes information about the owner of the node, and the node code is used as a digital code, and the occupied length of the node code is shorter than that of the node identifier in the node status message, so that the network communication pressure on the blockchain network is reduced, and the execution efficiency of the blockchain communication is facilitated.
In some alternative embodiments, the key includes a node identifier and voting result information for the proposal message, and the information to be replaced includes a voting result code corresponding to the voting result information and a node code corresponding to the node identifier. Based on the technical scheme, the method comprises the following steps: if the message to be processed is a node state message, voting information of each block chain node in the node state message is obtained, wherein the voting information comprises voting result information, node identification and voting time information; according to the key words and the voting information in the data replacement strategy, the obtained voting result information and the node identification are replaced by corresponding voting result codes and node codes corresponding to the node identification, and a voting result code sequence is obtained; the voting information of each blockchain node is deleted from the node status message, and the voting result coding sequence is added to the node status message. Specifically, in this embodiment, the master node replaces the obtained voting result information and the node identifier with the corresponding voting result code and the node code corresponding to the node identifier according to the keyword and the voting information in the data replacement policy, so as to obtain the voting result code sequence. For example, referring to fig. 9, fig. 9 is an exemplary diagram of keyword replacement for a node status message in an embodiment of the present application. The QC is a set of voting information in the node state message, wherein the voting information of each node is contained. For the voting information, the master node encodes according to the voting result code corresponding to the preset voting result information and the node code corresponding to the node identification. As shown in fig. 9, the node identification "node2" of the node2 is replaced with the node code "2", and the voting result "true" thereof is replaced with the voting result code "1", and the other two nodes are similar. Resulting in voting result code sequence 213140. In the voting result coding sequence, the position and the represented meaning of each character are determined, so that the original voting node and the voting result can be directly restored by the position and the content of the number. As can be seen from fig. 9, the voting information also contains time information, and during the replacement, the content in the entire QC is deleted and refilled as the generated voting result code sequence, so that the time information is deleted in the replaced node status message. The voting information of each blockchain node in the node state message is replaced by the voting result coding sequence, so that the length of the node state message can be shortened, occupation of communication resources by broadcasting contents to the slave nodes by the master node is reduced, and the communication efficiency of the blockchain is improved.
In some alternative embodiments, the key comprises a field identification of the transaction information, and the information to be replaced comprises a field code corresponding to the field identification. Based on the above technical solution, the above method further includes: if the message to be processed is a transaction message, replacing the field identification of each transaction information in the transaction message with a field code corresponding to the field identification according to the key words in the data replacement strategy. The transaction message is information broadcast in the blockchain when the blockchain node submits a blockchain transaction. The transaction message may be generated by its master node itself or may be received for broadcast from other nodes. The key includes a field identification of the transaction information. The field identification is identification information, such as a field name, of each field of the stored data in the data structure of the transaction information. The information to be replaced comprises field codes corresponding to the field identifiers, wherein the field codes are simplified information determined according to field names, and unique corresponding relations exist between the field codes and the field identifiers. In a data structure of transaction information, each field code uniquely corresponds to a field identification and vice versa. The main node replaces the field identification of each transaction information in the transaction information with the field code corresponding to the field identification, so that the data length of the transaction information is shortened, and the communication efficiency of transmitting the transaction information is improved.
In the embodiment of the present application, other embodiments for refining the technical solution of the embodiment shown in fig. 4 are also provided, in which the keyword includes voting result information of the proposal message, specifically as shown in fig. 10, in the method for transmitting blockchain data in one embodiment of the present application, the method may include the following steps:
step S1010, a data replacement strategy for the blockchain and a message to be processed to be sent to the blockchain node are obtained, wherein the data replacement strategy comprises a corresponding relation between a keyword and the message to be replaced.
Optionally, the implementation details of step S1010 are identical to those of step S410 shown in fig. 4, and will not be described again.
Step S1020, replacing the keyword in the message to be processed with the corresponding information to be replaced according to the data replacement policy.
Optionally, the implementation details of step S1020 are identical to those of step S420 shown in fig. 4, and will not be described again.
Step S1030, serializing the replaced message to be processed to obtain a serialized character stream;
step S1040, encoding the serialized character stream according to the occurrence frequency of each character in the serialized character stream, to obtain an encoded message and an encoding table as the serialized message, where the encoding table is used to generate the encoded message.
After the key words in the message to be processed are replaced according to the data replacement policy, the main node sequences the replaced message to be processed. The manner of serialization may employ interpretable serialization or binary stream serialization. By serialization, a serialized character stream of the message to be processed can be obtained. The serialized character stream is typically composed of data and letters. The master node encodes the serialized character stream according to the occurrence frequency of each character in the serialized character stream to obtain an encoded message and an encoded table as the serialized message, wherein the encoded table is used for generating the encoded message. Specifically, the master node may compile a coding table according to the occurrence frequency of each character, and the coding table may adopt a tree structure or a sequence structure. In the code table, the codes corresponding to the characters with high frequency of occurrence are shorter than the codes corresponding to the characters with low frequency of occurrence. The serialized character stream is then encoded according to an encoding table, resulting in a corresponding encoded message. Since the encoding table is associated with the frequency of occurrence of each character in the serialized character stream and is specific to the serialized character stream, it is necessary to use the encoding table together with the encoded message as a serialized message. The serialized character stream is encoded based on the frequency of occurrence of the characters, thereby being beneficial to shortening the length of the encoded message and improving the communication efficiency.
Step S1050, the serialized message is sent to a blockchain node in the blockchain to send the pending message to the blockchain node.
Optionally, the implementation details of step S1050 are identical to those of step S440 shown in fig. 4, and will not be described again.
In the embodiment of the application, when the blockchain node transmits the blockchain data, a data replacement strategy for the blockchain and a message to be processed to be sent to the blockchain node are acquired, wherein the data replacement strategy comprises a corresponding relation between a keyword and the message to be replaced. The block chain node replaces the keyword in the message to be processed with the corresponding message to be replaced according to the data replacement strategy, then carries out serialization coding on the replaced message to be processed to obtain the serialization message, and then sends the serialization message to the block chain node in the block chain so as to send the message to be processed to the block chain node. The information to be processed is replaced according to the data replacement strategy and then is serialized, so that the quantity and the size of information to be serialized are reduced, the communication data volume between the blockchains is reduced, the network communication pressure on the blockchain network is reduced, and the execution efficiency of blockchain communication is facilitated.
In the embodiment of the application, when the blockchain node transmits the blockchain data, a data replacement strategy for the blockchain and a message to be processed to be sent to the blockchain node are acquired, wherein the data replacement strategy comprises a corresponding relation between a keyword and the message to be replaced. The block chain node replaces the keyword in the message to be processed with the corresponding message to be replaced according to the data replacement strategy, then carries out serialization coding on the replaced message to be processed to obtain the serialization message, and then sends the serialization message to the block chain node in the block chain so as to send the message to be processed to the block chain node. The information to be processed is replaced according to the data replacement strategy and then is serialized, so that the quantity and the size of information to be serialized are reduced, the communication data volume between the blockchains is reduced, the network communication pressure on the blockchain network is reduced, and the execution efficiency of blockchain communication is facilitated.
In some alternative embodiments, in the process of encoding the serialized character stream based on the occurrence frequency of each character in the serialized character stream to obtain the encoded message and the encoding table as the serialized message, the master node groups the characters in the serialized character stream according to the occurrence frequency of each character in the serialized character stream to obtain character groups, then constructs the encoding table according to the characters in each character group to obtain the encoding table of each character group, and encodes the serialized character stream according to the encoding table of each character group to obtain the encoded message. By constructing the encoding tables in groups, the characters in each encoding table can be encoded in a relatively short length, which is beneficial to shortening the length of the encoded message.
In some alternative embodiments, in the process of encoding the serialized character stream according to the encoding table of each character packet to obtain the encoded message, the master node establishes a character packet index for each character packet according to the number of character packets. Specifically, the number of character groups affects the length of the character group index, and after determining the length of the character group index according to the number of character groups, the character group index of each character group is correspondingly determined. For example, if there are 4 groups, the length of the character group index is 2, the character group indexes of the 4 groups are 00, 01, 10, and 11, respectively, and if there are only two groups, the length of the character group index is 1, the character group indexes of the two groups are 0 and 1, respectively. After establishing the character group index, the master node encodes each character in the serialized character stream according to the group index of the character group in which each character in the serialized character stream is located and an encoding table corresponding to the character group, and obtains an encoded message. For example, two characters in the serialized character stream are ab, where a is in the first encoding table with a character packet index of 00, a is encoded as 0003, b is encoded in the encoding table with a character packet index of 01, b is encoded as 0003, then eventually a is encoded as 000003, b is encoded as 010003, thereby serialized character stream is 000003010003. The encoding is performed by creating a character packet index, which is advantageous in reducing the amount of information that needs to be contained in the encoded message, as compared to storing the encoding table sequence with additional information.
In some optional embodiments, in the process of grouping the characters in the serialized character stream according to the occurrence frequency of each character in the serialized character stream to obtain the character grouping, the master node counts the occurrence frequency of each character in the serialized character stream, and then clusters the characters according to the character frequency distribution in the serialized character stream to obtain the character grouping. Specifically, the master node may divide the characters with the frequency of occurrence close to each other into the same group, so that the difference of the frequency of occurrence of the characters between different character groups is large, and the difference of the frequency of occurrence of the characters in the same character group is small. Specifically, referring to fig. 11, fig. 11 is a schematic flow chart of block coding in an embodiment of the present application. As shown in fig. 11, the high frequency groups and the low frequency groups are separated according to the occurrence frequency of each character in the original data, each group generates a respective encoding table, and then the original data is encoded, thereby obtaining a serialized message composed of the encoded message and the encoding table. The character groups are grouped through clustering, so that the character groups are divided according to the occurrence frequency, the overlong encoding of the high-frequency characters is prevented from causing overlong encoding information, and the communication resources occupied by the encoding information are reduced.
It should be noted that although the steps of the methods of the present application are depicted in the accompanying drawings in a particular order, this does not require or imply that the steps must be performed in that particular order, or that all illustrated steps be performed, to achieve desirable results. Additionally or alternatively, certain steps may be omitted, multiple steps combined into one step to perform, and/or one step decomposed into multiple steps to perform, etc.
The apparatus implementations of the present application are described below as being used to perform the blockchain data transmission method of the above embodiments of the present application. Fig. 12 schematically shows a block diagram of a block chain data transmission device in an embodiment of the present application. As shown in fig. 12, the apparatus 1200 for transmitting blockchain data may mainly include:
the information obtaining module 1210 is configured to obtain a data replacement policy for the blockchain and a message to be processed to be sent to a blockchain node, where the data replacement policy includes a correspondence between a keyword and the message to be replaced;
an information replacing module 1220, configured to replace the keyword in the message to be processed with corresponding information to be replaced according to the data replacing policy;
A serialization module 1230 configured to perform serialization encoding on the replaced message to be processed, so as to obtain a serialized message;
a message sending module 1240 configured to send the serialized message to a blockchain node in the blockchain to send the pending message to the blockchain node.
In some embodiments of the present application, based on the above technical solutions, the information replacing module 1220 is specifically configured to: if the message to be processed is a proposal message, acquiring transaction identifiers of all transaction information in the proposal message according to the information to be replaced corresponding to the keyword in the data replacement strategy; and replacing each transaction information in the proposal message with the transaction identification of the transaction information according to the keywords in the data replacement strategy.
In some embodiments of the present application, based on the above technical solution, the keyword includes voting result information of the proposal message, and the information to be replaced includes a voting result code corresponding to the voting result information; the information replacement module 1220 is further configured to: if the message to be processed is a node state message, voting result information of each block chain node in the node state message is obtained; and replacing voting result information in the node state message with a corresponding voting result code according to the keywords in the data replacement strategy.
In some embodiments of the present application, based on the above technical solution, the key further includes a node identifier, and the information to be replaced further includes a node code corresponding to the node identifier; the information replacement module 1220 is further configured to: and replacing the node identification of each blockchain node in the node status message with a corresponding node code according to the key words in the data replacement strategy.
In some embodiments of the present application, based on the above technical solution, the keyword includes a node identifier and voting result information for the proposal message, and the information to be replaced includes a voting result code corresponding to the voting result information and a node code corresponding to the node identifier, and the information replacing module 1220 is further configured to: if the message to be processed is a node state message, voting information of each blockchain node in the node state message is obtained, wherein the voting information comprises voting result information, node identification and voting time information; according to the keywords in the data replacement strategy and the voting information, replacing the obtained voting result information and the node identification with corresponding voting result codes and node codes corresponding to the node identification, and obtaining a voting result coding sequence; and deleting voting information of each blockchain node from the node status message, and adding the voting result coding sequence into the node status message.
In some embodiments of the present application, based on the above technical solution, the keyword includes a field identifier of the transaction information, and the information to be replaced includes a field code corresponding to the field identifier; the information replacement module 1220 is further configured to: and if the message to be processed is a transaction message, replacing the field identification of each transaction message in the transaction message with a field code corresponding to the field identification according to the key words in the data replacement strategy.
In some embodiments of the present application, based on the above technical solutions, the serialization module 1230 is specifically configured to: serializing the replaced message to be processed to obtain a serialized character stream; and coding the serialized character stream according to the occurrence frequency of each character in the serialized character stream to obtain a coded message and a coding table as the serialized message, wherein the coding table is used for generating the coded message.
In some embodiments of the present application, based on the above technical solutions, the serialization module 1230 is further configured to: grouping the characters in the serialized character stream according to the occurrence frequency of each character in the serialized character stream to obtain character groups; constructing a coding table according to the characters in each character group to obtain a coding table of each character group; and coding the serialized character stream according to the coding table of each character group to obtain a coded message.
In some embodiments of the present application, based on the above technical solutions, the serialization module 1230 is further configured to: establishing character grouping indexes for each character grouping according to the number of the character groupings; and coding each character in the serialized character stream according to the group index of the character group where each character in the serialized character stream is located and a coding table corresponding to the character group to obtain a coded message.
In some embodiments of the present application, based on the above technical solutions, the serialization module 1230 is further configured to: counting the occurrence frequency of each character in the serialized character stream; and clustering the characters according to the character frequency distribution in the serialized character stream to obtain character groups.
It should be noted that, the apparatus provided in the foregoing embodiments and the method provided in the foregoing embodiments belong to the same concept, and a specific manner in which each module performs an operation has been described in detail in the method embodiment, which is not described herein again.
Fig. 13 shows a schematic diagram of a computer system suitable for use in implementing an embodiment of the application.
It should be noted that, the computer system 1300 of the electronic device shown in fig. 13 is only an example, and should not impose any limitation on the functions and the application scope of the embodiments of the present application.
As shown in fig. 13, the computer system 1300 includes a central processing unit (Central Processing Unit, CPU) 1301, which can perform various appropriate actions and processes according to a program stored in a Read-Only Memory (ROM) 1302 or a program loaded from a storage portion 1308 into a random access Memory (Random Access Memory, RAM) 1303. In the RAM 1303, various programs and data required for the system operation are also stored. The CPU 1301, ROM 1302, and RAM 1303 are connected to each other through a bus 1304. An Input/Output (I/O) interface 1305 is also connected to bus 1304.
The following components are connected to the I/O interface 1305: an input section 1306 including a keyboard, a mouse, and the like; an output portion 1307 including a Cathode Ray Tube (CRT), a liquid crystal display (Liquid Crystal Display, LCD), and the like, a speaker, and the like; a storage portion 1308 including a hard disk or the like; and a communication section 1309 including a network interface card such as a LAN (Local Area Network ) card, a modem, or the like. The communication section 1309 performs a communication process via a network such as the internet. The drive 1310 is also connected to the I/O interface 1305 as needed. Removable media 1311, such as magnetic disks, optical disks, magneto-optical disks, semiconductor memory, and the like, is mounted on drive 1310 as needed so that a computer program read therefrom is mounted into storage portion 1308 as needed.
In particular, the processes described in the various method flowcharts may be implemented as computer software programs according to embodiments of the application. For example, embodiments of the present application include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method shown in the flowcharts. In such embodiments, the computer program may be downloaded and installed from a network via the communication portion 1309 and/or installed from the removable medium 1311. When executed by a Central Processing Unit (CPU) 1301, performs various functions defined in the system of the present application.
It should be noted that, the computer readable medium shown in the embodiments of the present application may be a computer readable signal medium or a computer readable storage medium, or any combination of the two. The computer readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples of the computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-Only Memory (ROM), an erasable programmable read-Only Memory (Erasable Programmable Read Only Memory, EPROM), flash Memory, an optical fiber, a portable compact disc read-Only Memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this document, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In the present application, however, the computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, with the computer-readable program code embodied therein. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wired, etc., or any suitable combination of the foregoing.
The flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present application. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
It should be noted that although in the above detailed description several modules or units of a device for action execution are mentioned, such a division is not mandatory. Indeed, the features and functions of two or more modules or units described above may be embodied in one module or unit in accordance with embodiments of the application. Conversely, the features and functions of one module or unit described above may be further divided into a plurality of modules or units to be embodied.
From the above description of embodiments, those skilled in the art will readily appreciate that the example embodiments described herein may be implemented in software, or may be implemented in software in combination with the necessary hardware. Thus, the technical solution according to the embodiments of the present application may be embodied in the form of a software product, which may be stored in a non-volatile storage medium (may be a CD-ROM, a U-disk, a mobile hard disk, etc.) or on a network, and includes several instructions to cause a computing device (may be a personal computer, a server, a touch terminal, or a network device, etc.) to perform the method according to the embodiments of the present application.
Other embodiments of the application will be apparent to those skilled in the art from consideration of the specification and practice of the application disclosed herein. This application is intended to cover any variations, uses, or adaptations of the application following, in general, the principles of the application and including such departures from the present disclosure as come within known or customary practice within the art to which the application pertains.
It is to be understood that the application is not limited to the precise arrangements and instrumentalities shown in the drawings, which have been described above, and that various modifications and changes may be effected without departing from the scope thereof. The scope of the application is limited only by the appended claims.

Claims (10)

1. A method for transmitting blockchain data, comprising:
acquiring a data replacement strategy aiming at a blockchain and a message to be processed which is to be sent to a blockchain node, wherein the data replacement strategy comprises a corresponding relation between a keyword and the message to be replaced;
replacing keywords in the message to be processed with corresponding information to be replaced according to the data replacement strategy;
serializing the replaced message to be processed to obtain a serialized character stream;
grouping characters in the serialized character stream into a plurality of character groups according to the occurrence frequency of each character in the serialized character stream;
constructing a coding table according to the characters in each character group, and obtaining a plurality of coding tables corresponding to the plurality of character groups, wherein the plurality of coding tables are special coding tables of the serialized character stream;
establishing character grouping indexes for each character grouping according to the number of the character groupings;
coding each character in the serialized character stream through the plurality of coding tables according to the group index of the character group where each character in the serialized character stream is located and the coding table corresponding to the character group, so as to obtain a coded message, wherein the coded message and the plurality of coding tables are used as the serialized message together;
And sending the serialized message to a blockchain node in the blockchain to send the message to be processed to the blockchain node.
2. The transmission method according to claim 1, wherein the replacing the key words in the message to be processed with the corresponding information to be replaced according to the data replacement policy includes:
if the message to be processed is a proposal message, acquiring transaction identifiers of all transaction information in the proposal message according to the information to be replaced corresponding to the keyword in the data replacement strategy;
and replacing each transaction information in the proposal message with the transaction identification of the transaction information according to the keywords in the data replacement strategy.
3. The transmission method according to claim 1, wherein the keyword includes voting result information for the proposal message, and the information to be replaced includes a voting result code corresponding to the voting result information; the method further comprises the steps of:
if the message to be processed is a node state message, voting result information of each block chain node in the node state message is obtained;
and replacing voting result information in the node state message with a corresponding voting result code according to the keywords in the data replacement strategy.
4. A transmission method according to claim 3, wherein the key further comprises a node identifier, and the information to be replaced further comprises a node code corresponding to the node identifier; the method comprises the following steps:
and replacing the node identification of each blockchain node in the node status message with a corresponding node code according to the key words in the data replacement strategy.
5. The transmission method according to claim 1, wherein the keyword includes a node identification and voting result information for the proposal message, the information to be replaced includes a voting result code corresponding to the voting result information and a node code corresponding to the node identification, the method comprising:
if the message to be processed is a node state message, voting information of each blockchain node in the node state message is obtained, wherein the voting information comprises voting result information, node identification and voting time information;
according to the keywords in the data replacement strategy and the voting information, replacing the obtained voting result information and the node identification with corresponding voting result codes and node codes corresponding to the node identification, and obtaining a voting result coding sequence;
And deleting voting information of each blockchain node from the node status message, and adding the voting result coding sequence into the node status message.
6. The transmission method according to claim 1, wherein the key includes a field identifier of transaction information, and the information to be replaced includes a field code corresponding to the field identifier; the method further comprises the steps of:
and if the message to be processed is a transaction message, replacing the field identification of each transaction message in the transaction message with a field code corresponding to the field identification according to the key words in the data replacement strategy.
7. The transmission method according to claim 1, wherein grouping the characters in the serialized character stream according to the occurrence frequency of each character in the serialized character stream to obtain a character group, comprising:
counting the occurrence frequency of each character in the serialized character stream;
and clustering the characters according to the character frequency distribution in the serialized character stream to obtain character groups.
8. A blockchain data transmission device, comprising:
the information acquisition module is configured to acquire a data replacement strategy for the blockchain and a message to be processed, which is to be sent to the blockchain node, wherein the data replacement strategy comprises a corresponding relation between a keyword and the information to be replaced;
The information replacement module is configured to replace keywords in the message to be processed with corresponding information to be replaced according to the data replacement strategy;
the serialization module is configured to serialize the replaced message to be processed to obtain a serialized character stream, group the characters in the serialized character stream according to the occurrence frequency of each character in the serialized character stream to obtain a plurality of character groups, construct a coding table according to the characters in each character group to obtain a plurality of coding tables corresponding to the plurality of character groups, the plurality of coding tables are special coding tables of the serialized character stream, establish character group indexes for each character group according to the number of the character groups, and encode each character in the serialized character stream according to the group index of the character group and the coding table corresponding to the character group in which each character in the serialized character stream is located by the plurality of coding tables to obtain a coded message, wherein the coded message and the plurality of coding tables are used as the serialized message together;
and the message sending module is configured to send the serialized message to a blockchain node in the blockchain so as to send the message to be processed to the blockchain node.
9. An electronic device, comprising:
a processor;
a memory for storing executable instructions of the processor;
wherein the processor is configured to perform the method of transmitting blockchain data of any of claims 1 to 7 via execution of the executable instructions.
10. A computer readable medium having stored thereon a computer program, wherein the computer program when executed by a processor implements the method of transmitting blockchain data as claimed in any of claims 1 to 7.
CN202310996714.1A 2023-08-09 2023-08-09 Block chain data transmission method and device, electronic equipment and readable medium Active CN116723239B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310996714.1A CN116723239B (en) 2023-08-09 2023-08-09 Block chain data transmission method and device, electronic equipment and readable medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310996714.1A CN116723239B (en) 2023-08-09 2023-08-09 Block chain data transmission method and device, electronic equipment and readable medium

Publications (2)

Publication Number Publication Date
CN116723239A CN116723239A (en) 2023-09-08
CN116723239B true CN116723239B (en) 2023-10-31

Family

ID=87875575

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310996714.1A Active CN116723239B (en) 2023-08-09 2023-08-09 Block chain data transmission method and device, electronic equipment and readable medium

Country Status (1)

Country Link
CN (1) CN116723239B (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111262876A (en) * 2020-01-22 2020-06-09 腾讯科技(深圳)有限公司 Data processing method, device and equipment based on block chain and storage medium
CN112232823A (en) * 2020-12-10 2021-01-15 腾讯科技(深圳)有限公司 Transaction processing method, device, medium and electronic equipment of block chain system
GB202113648D0 (en) * 2020-10-08 2021-11-10 Ibm Blockchain implemented data migration audit trail
CN114567681A (en) * 2022-01-25 2022-05-31 浙江数秦科技有限公司 High-efficiency data transmission method for block chain network

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111262876A (en) * 2020-01-22 2020-06-09 腾讯科技(深圳)有限公司 Data processing method, device and equipment based on block chain and storage medium
GB202113648D0 (en) * 2020-10-08 2021-11-10 Ibm Blockchain implemented data migration audit trail
CN112232823A (en) * 2020-12-10 2021-01-15 腾讯科技(深圳)有限公司 Transaction processing method, device, medium and electronic equipment of block chain system
CN114567681A (en) * 2022-01-25 2022-05-31 浙江数秦科技有限公司 High-efficiency data transmission method for block chain network

Also Published As

Publication number Publication date
CN116723239A (en) 2023-09-08

Similar Documents

Publication Publication Date Title
CN113190622B (en) Data processing method, device, equipment and storage medium
CN113407640B (en) Cross-chain method and system based on multi-chain NFT (network File transfer)
CN109711839A (en) Block chain storage method, device, equipment and storage medium based on data compression
CN111291060B (en) Method, device and computer readable medium for managing blockchain nodes
CN109347868B (en) Information verification method, device and storage medium
CN112926982A (en) Transaction data processing method, device, equipment and storage medium
CN111639080B (en) Data processing method and device, node equipment and storage medium
CN112235420A (en) Data synchronization method, system and related equipment based on block chain
CN114666212B (en) Configuration data issuing method
US20230370285A1 (en) Block-chain-based data processing method, computer device, computer-readable storage medium
JP2024515022A (en) Blockchain-based data processing method, device, equipment, and computer program
CN116723239B (en) Block chain data transmission method and device, electronic equipment and readable medium
Ma et al. On coded caching systems with offline users
CN113852470A (en) Proposal broadcasting method, device, equipment and storage medium
CN113157450A (en) Method and apparatus for performing blocks in a blockchain system
CN114584326B (en) Block chain data processing method and device, electronic equipment and storage medium
Li et al. EBFT: A hierarchical and group-based byzantine fault tolerant consensus algorithm
CN117221337A (en) Block chain consensus method, device, medium and electronic equipment
CN112231415B (en) Data synchronization method and system of block chain network, electronic device and readable medium
CN115237909A (en) Multi-system batch data difference discovery method and system
CN104869056A (en) Institution personnel data synchronization method based on relational data separation
CN110838924B (en) Block transmission method and device
CN116095081A (en) Event processing method and device based on block chain system, equipment and medium
CN113228595B (en) Method and device for transmitting records
CN112417843A (en) IDcode identification analysis system and implementation method thereof

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
REG Reference to a national code

Ref country code: HK

Ref legal event code: DE

Ref document number: 40092309

Country of ref document: HK