CN118170729A - Processing method, system, equipment and medium for block chain consensus data - Google Patents

Processing method, system, equipment and medium for block chain consensus data Download PDF

Info

Publication number
CN118170729A
CN118170729A CN202410370515.4A CN202410370515A CN118170729A CN 118170729 A CN118170729 A CN 118170729A CN 202410370515 A CN202410370515 A CN 202410370515A CN 118170729 A CN118170729 A CN 118170729A
Authority
CN
China
Prior art keywords
data
consensus
node
block
processing
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.)
Pending
Application number
CN202410370515.4A
Other languages
Chinese (zh)
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.)
China Telecom Corp Ltd
Original Assignee
China Telecom Corp 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 China Telecom Corp Ltd filed Critical China Telecom Corp Ltd
Priority to CN202410370515.4A priority Critical patent/CN118170729A/en
Publication of CN118170729A publication Critical patent/CN118170729A/en
Pending legal-status Critical Current

Links

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The application discloses a processing method, a system, equipment and a medium of block chain consensus data, comprising the following steps: packaging and transmitting service data generated by a database to a block-out node; the block outlet node generates first signature data to be commonly recognized according to the service data; based on the target compressed data packet structure, sending the service data and the first signature data to a consensus node for consensus processing to obtain consensus data; the target compressed data packet structure comprises a target file head, a data area and a file tail; the target file header comprises an original file header and a file tail; packaging the service data after consensus into blocks for uplink processing and storing the consensus data; and when the group number of the consensus data stored in the block of the block chain reaches a preset group number threshold, performing backup deletion processing on the consensus data. The application can improve consensus efficiency and block output speed, reduce storage pressure of nodes, effectively improve operation stability of a block chain system, and can be widely applied to the technical field of block chains.

Description

Processing method, system, equipment and medium for block chain consensus data
Technical Field
The present application relates to the field of blockchain technologies, and in particular, to a processing method, a system, an apparatus, and a medium for blockchain consensus data.
Background
Blockchains are a distributed database that uses encryption techniques to record and verify transactions. The principle of blockchain operation is that transaction records are stored in an ever-increasing list, referred to as a "block". Each block contains one or more transactions, and a pointer to the previous block. Such a design makes the blockchain very secure because anyone cannot alter the transaction records already stored on the blockchain.
However, nodes in the blockchain need to bear functions of calculation, consensus, storage and the like, and in the consensus process, the blockchain link points need to acquire and store consensus data from other nodes. With the increase of nodes and the deepening of the block depth in the block chain, the amount of consensus data to be transmitted between the block chain nodes and the amount of consensus data stored in the block chain nodes are continuously increased, so that the consensus efficiency is reduced, the block outlet speed is reduced, the data storage pressure at the block chain nodes is increased rapidly, and the overall construction cost is influenced.
Disclosure of Invention
The embodiment of the application mainly aims to provide a processing method, a system, equipment and a medium for block chain consensus data, aiming at improving the consensus efficiency and the block output speed of a block chain and relieving the data storage pressure of a block chain node.
To achieve the above object, an aspect of an embodiment of the present application provides a method for processing blockchain consensus data, the method including:
packaging and transmitting service data generated by a database to a block-out node;
The block outlet node generates first signature data to be commonly recognized according to the service data;
Based on a target compressed data packet structure, sending the service data and the first signature data to a consensus node for consensus processing to obtain consensus data; the target compressed data packet structure comprises a target file head, a data area and a file tail; the target file head consists of an original file head and the copied file tail;
Packaging the service data after consensus into blocks for uplink processing, and storing the consensus data;
And when the group number of the consensus data stored in the block of the block chain reaches a preset group number threshold, performing backup deletion processing on the consensus data.
In some embodiments, the step of packaging and sending the service data generated by the database to the output block node, wherein the service data comprises at least one of logistics information, commodity transaction data and uploading data of the internet device.
In some embodiments, generating first signature data to be consensus from the traffic data includes:
carrying out hash processing on the service data to obtain first data;
and signing the first data by adopting the private key of the block-out node to obtain first signature data to be commonly recognized.
In some embodiments, the step of sending the service data and the first signature data to a consensus node to perform consensus processing based on a target compressed data packet structure, where the step of obtaining the consensus data includes:
performing slicing processing on the service data and the first signature data to obtain data fragments;
Compressing the data segment to obtain a first compressed data packet; the first compressed data packet comprises a file header, a data area and a file tail;
Copying the file tail, and attaching the file tail to the back of the file head to obtain a second compressed data packet;
and sending the second compressed data packet to the consensus node.
In some embodiments, the step of sending the service data and the first signature data to a consensus node for consensus processing based on a target compressed data packet structure to obtain consensus data, and performing the consensus processing includes:
Downloading the second compressed data packet in parallel, and decompressing the second compressed data packet to obtain the service data and the first signature data;
signing the service data by adopting the public key of the block-out node;
When the verification passes, the consensus node signs by adopting a private key of the consensus node to obtain second signature data, and further obtain consensus data; wherein the consensus data includes the first signature data and the second signature data.
In some embodiments, when the number of groups of the consensus data stored in the block of the blockchain reaches a preset threshold of the number of groups, the step of performing backup pruning on the consensus data includes:
Taking out the consensus data currently stored in the deletion node as current consensus data;
carrying out hash calculation on the current consensus data to obtain a group of hash values;
Carrying out digital signature on the hash value by adopting the private key of the deleting node to obtain a snapshot;
transmitting the digital signature to other nodes for consensus processing to obtain a consensus result;
for the situation that the consensus result is that the consensus is completed, distributing the snapshot to all block chain nodes for storage;
and determining a backup node, and notifying the blockchain nodes except the backup node to delete the current consensus data.
In some embodiments, the step of determining the backup node comprises:
determining backup nodes according to batches of the consensus data;
Or detecting the current available storage capacity of each block link point, and determining the node with the largest available storage capacity as a backup node.
To achieve the above object, another aspect of an embodiment of the present application provides a system for processing blockchain consensus data, the system including:
the first module is used for packaging and sending the service data generated by the database to the output block node;
the second module is used for generating first signature data to be consensus according to the service data by the block-out node;
The third module is used for sending the service data and the first signature data to a consensus node for consensus processing based on a target compressed data packet structure to obtain consensus data; the target compressed data packet structure comprises a target file head, a data area and a file tail; the target file head consists of an original file head and the copied file tail;
A fourth module, configured to package the service data after consensus into blocks for uplink processing, and store the consensus data;
And a fifth module, configured to perform backup pruning processing on the consensus data when the number of groups of the consensus data stored in the block of the blockchain reaches a preset threshold of the number of groups.
To achieve the above object, another aspect of the embodiments of the present application provides an electronic device, including a memory and a processor, where the memory stores a computer program, and the processor implements the method described above when executing the computer program.
To achieve the above object, another aspect of the embodiments of the present application proposes a computer-readable storage medium storing a computer program which, when executed by a processor, implements the method described above.
The embodiment of the application at least comprises the following beneficial effects: the application provides a processing method, a system, equipment and a medium for block chain consensus data, wherein when the consensus data is transmitted among block chain link points of the scheme, the transmission after the compression processing is carried out on the consensus data by improving the compression data packet format of a file header, the consensus node can efficiently obtain the consensus data, the consensus efficiency and the block outlet speed can be improved, and the data processing performance of the block chain is improved; in addition, in the block chain node, global consensus is carried out on the consensus data, and then the consensus data stored by the block chain link points are deleted, so that the data storage pressure at the block chain node is reduced, and the running stability of the block chain system is improved.
Drawings
The accompanying drawings are included to provide a further understanding of the application and are incorporated in and constitute a part of this specification, illustrate and do not limit the application.
FIG. 1 is a schematic diagram of an application of a blockchain provided by an embodiment of the present application;
FIG. 2 is a flowchart of a method for processing blockchain consensus data according to an embodiment of the present application;
FIG. 3 is a step flow chart of steps S310-S340 provided by an embodiment of the present application;
FIG. 4 is a step flow chart of steps S350-S370 provided by an embodiment of the present application;
FIG. 5 is a step flow chart of steps S510-S560 provided by an embodiment of the present application;
FIG. 6 is a schematic diagram of a ZIP compressed data packet format according to an embodiment of the present application;
FIG. 7 is a schematic diagram of reconstructing a compressed data packet format according to an embodiment of the present application;
FIG. 8 is a schematic diagram of parallel decompression of data segments according to an embodiment of the present application;
FIG. 9 is a block chain data uplink schematic diagram provided by an embodiment of the present application;
FIG. 10 is a schematic diagram of a block chain consensus data processing system according to an embodiment of the present application;
Fig. 11 is a schematic diagram of a hardware structure of an electronic device according to an embodiment of the present application.
Detailed Description
The present application will be described in further detail with reference to the drawings and examples, in order to make the objects, technical solutions and advantages of the present application more apparent. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the application. When the following description refers to the accompanying drawings, the same numbers in different drawings refer to the same or similar elements, unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with embodiments of the application, but are merely examples of apparatuses and methods consistent with aspects of embodiments of the application as detailed in the accompanying claims.
Although functional block diagrams are depicted in system diagrams, logical orders of magnitude are depicted in flowchart form, in some cases, the steps shown or described may be performed in a different order than the block diagrams in the system. The terms first/S100, second/S200, and the like in the description and in the claims and in the above-described figures, are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order.
It is to be understood that the terms "first," "second," and the like, as used herein, may be used to describe various concepts, but are not limited by these terms unless otherwise specified. These terms are only used to distinguish one concept from another. For example, the first information may also be referred to as second information, and similarly, the second information may also be referred to as first information, without departing from the scope of embodiments of the present application. The words "if", as used herein, may be interpreted as "at … …" or "at … …" or "in response to a determination", depending on the context.
The terms "at least one", "a plurality", "each", "any" and the like as used herein, at least one includes one, two or more, a plurality includes two or more, each means each of the corresponding plurality, and any one means any of the plurality.
Reference herein to "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment may be included in at least one embodiment of the application. The appearances of such phrases in various places in the specification are not necessarily all referring to the same embodiment, nor are separate or alternative embodiments mutually exclusive of other embodiments. Those of skill in the art will explicitly and implicitly appreciate that the embodiments described herein may be combined with other embodiments.
Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein is for the purpose of describing embodiments of the application only and is not intended to be limiting of the application.
Before describing embodiments of the present application in detail, some of the terms and expressions that are referred to in the embodiments of the present application will be described first, and the terms and expressions that are referred to in the embodiments of the present application are applicable to the following explanation.
(1) Blockchain: referring to FIG. 1, a blockchain is a distributed database that uses encryption techniques to record and verify transactions. The principle of blockchain operation is to store transaction records in an ever-increasing list, referred to as a "block". Each block contains one or more transactions, and a pointer to the previous block. This design makes the blockchain very secure because anyone cannot alter the transaction records already stored on the blockchain.
(2) Consensus mechanism: in a blockchain network, all nodes agree on a mechanism of blocks, and a common mechanism is a basis for the operation of the blockchain network and is an important means for guaranteeing the integrity and the safety of the blockchain network.
(3) And (3) hash processing: refers to a process of converting input data of an arbitrary length into output data of a fixed length through a hash function. The hash processing is an important data processing technology and is widely applied to the fields of cryptography, data integrity verification, data indexing and the like.
(4) ZIP: a file compression format which can compress a plurality of files or folders into one ZIP file, thereby reducing the storage space and transmission time of the file.
Currently, nodes in a blockchain need to bear functions of calculation, consensus, storage and the like, and in the consensus process, the blockchain link points need to acquire and store consensus data from other nodes. With the increase of nodes and the deepening of the block depth in the block chain, the amount of consensus data to be transmitted between the block chain nodes and the amount of consensus data stored in the block chain nodes are continuously increased, so that the consensus efficiency is reduced, the block-out speed is reduced, and the data storage pressure at the block chain nodes is increased dramatically, so that the overall construction cost is affected.
In view of this, in the embodiment of the present application, when formula data is transmitted between block link points, the method, system, device and medium for processing block chain consensus data are provided, and the consensus data are transmitted after being compressed based on a constructed target compressed data packet structure, so that consensus nodes can efficiently obtain consensus data in a parallel decompression manner, and therefore, consensus efficiency and block output speed can be improved, and data processing performance of a block chain is improved; in addition, in the block chain node, global consensus is carried out on the consensus data, and then the consensus data stored by the block chain link points are deleted, so that the data storage pressure at the block chain node is reduced, and the running stability of the block chain system is improved.
The embodiment of the application provides a processing method of block chain consensus data, and relates to the technical field of block chains. The processing method of the block chain consensus data provided by the embodiment of the application can be applied to a terminal, a server and software running in the terminal or the server. In some embodiments, the terminal may be, but is not limited to, a smart phone, a tablet computer, a notebook computer, a desktop computer, a smart speaker, a smart watch, a vehicle-mounted terminal, and the like; the server side can be configured as an independent physical server, a server cluster or a distributed system formed by a plurality of physical servers, and can be configured as a cloud server for providing cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDNs, basic cloud computing services such as big data and artificial intelligence platforms, and the server can also be a node server in a blockchain network; the software may be an application or the like that implements a processing method of blockchain consensus data, but is not limited to the above.
The application is operational with numerous general purpose or special purpose computer system environments or configurations. For example: personal computers, server computers, hand-held or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set top boxes, programmable consumer electronics, network PCs, minicomputers, mainframe computers, distributed computing environments that include any of the above systems or devices, and the like. The application may be described in the general context of computer-executable instructions, such as program modules, being executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform particular tasks or implement particular abstract data types. The application may also be practiced in distributed computing environments where tasks are performed by remote processing devices that are linked through a communications network. In a distributed computing environment, program modules may be located in both local and remote computer storage media including memory storage devices.
It should be noted that, in each specific embodiment of the present application, when related processing is required according to user information, user behavior data, user history data, user location information, and other data related to user identity or characteristics, permission or consent of the user is obtained first, and the collection, use, processing, and the like of the data comply with related laws and regulations and standards. In addition, when the embodiment of the application needs to acquire the sensitive personal information of the user, the independent permission or independent consent of the user is acquired through popup or jump to a confirmation page and the like, and after the independent permission or independent consent of the user is definitely acquired, the necessary relevant data of the user for enabling the embodiment of the application to normally operate is acquired.
Fig. 2 is an optional flowchart of a method for processing blockchain consensus data according to an embodiment of the present application, where the method in fig. 1 may include, but is not limited to, steps S100 to S500.
Step S100, packaging and transmitting service data generated by a database to a block-out node;
step S200, the block outlet node generates first signature data to be consensus according to the service data;
Step S300, based on a target compressed data packet structure, the service data and the first signature data are sent to a consensus node for consensus processing to obtain consensus data; the target compressed data packet structure comprises a target file head, a data area and a file tail; the target file head consists of an original file head and the copied file tail;
Step S400, packaging the service data after consensus into blocks for uplink processing, and storing the consensus data;
step S500, when the group number of the consensus data stored in the block of the block chain reaches a preset group number threshold, the backup pruning processing is performed on the consensus data.
In the steps S100 to S500 shown in the embodiment of the application, when the common identification data is transmitted between the block chain nodes, the common identification data can be efficiently obtained by the common identification nodes through improving the compressed data packet format of the file header to perform the transmission after the compression processing on the common identification data, the common identification efficiency and the block output speed can be improved, and the data processing performance of the block chain is improved; in addition, in the block chain node, global consensus is carried out on the consensus data, and then the consensus data stored by the block chain link points are deleted, so that the data storage pressure at the block chain node is reduced, and the running stability of the block chain system is improved.
In step S100 of some embodiments, the service data may include any content, for example, but not limited to, logistics information, commodity transaction or data uploaded by the internet of things device or corresponding data hash value. For some private transactions, algorithms such as homomorphic encryption or zero knowledge proof are needed, and business data is obtained after the transaction data is encrypted.
In some embodiments, step S200 may include, but is not limited to including steps S210-S220:
step S210, carrying out hash processing on the service data to obtain first data;
and step S220, signing the first data by adopting the private key of the block-out node to obtain first signature data to be recognized.
The first signature data to be consensus is obtained by step S200, in preparation for the subsequent data consensus.
Referring to fig. 3, in some embodiments, step S300 may include, but is not limited to, steps S310-S340 including transmitting traffic data and first signature data to a consensus node:
Step S310, performing slicing processing on the service data and the first signature data to obtain data fragments;
Step S320, compressing the data segment to obtain a first compressed data packet; the first compressed data packet comprises a file header, a data area and a file tail;
step S330, copying the file tail, and attaching the file tail to the rear of the file head to obtain a second compressed data packet;
step S340, transmitting the second compressed data packet to the consensus node.
Through steps S310-S340, the common-mode data is compressed through the improved compressed data packet structure and then transmitted, so that the common-mode node can efficiently obtain the common-mode data through a parallel decompression mode, and the data processing efficiency is improved.
In some embodiments, referring to fig. 4, step S300 may further include, but is not limited to, steps S350-S370 including performing consensus processing:
Step S350, downloading the second compressed data packet in parallel, and decompressing the second compressed data packet to obtain the service data and the first signature data;
step S360, the public key of the block-out node is adopted to check the service data;
Step S370, when the verification passes, the consensus node signs by adopting a private key of the consensus node to obtain second signature data, and further obtain consensus data; wherein the consensus data includes the first signature data and the second signature data.
Through steps S350-S370, only the consensus node supporting sequential downloading can also quickly acquire the file tail of the compressed data packet, so that the parallel decompression processing of the compressed packet is realized, and the time for verification and decompression is shortened.
In some embodiments, after completing the consensus of the service data, step S400 packages the service data into a block uplink, and stores the consensus data corresponding to the service data, which can facilitate later inspection.
Referring to fig. 5, in some embodiments, step S500 may further include, but is not limited to, steps S510-S560 including a pruning process with backup of consensus data:
step S510, the consensus data currently stored in the deletion node is taken out and used as current consensus data;
step S520, carrying out hash calculation on the current consensus data to obtain a group of hash values;
step S530, carrying out digital signature on the hash value by adopting the private key of the deleting node to obtain a snapshot;
Step S540, the digital signature is sent to other nodes for consensus processing, and a consensus result is obtained;
Step S550, distributing the snapshot to all block chain nodes for storage under the condition that the consensus result is that the consensus is completed;
step S560, determining a backup node, and notifying the blockchain nodes except the backup node to delete the current consensus data.
Through steps S510-S560, the storage pressure of the blockchain can be reduced, and the stability of the blockchain system can be improved.
In some embodiments, the step of determining the backup node in step S500 may include, but is not limited to, including:
step S570, determining backup nodes according to the batches of the consensus data;
Or step S580, detecting the current available storage capacity of each blockchain node, and determining the node with the largest available storage capacity as a backup node.
The standby node determined in step S570 or step S580 can be adapted to different requirements, so as to reduce the construction cost of the blockchain system without affecting the normal consensus storage record of the blockchain.
The following describes and describes the scheme of the embodiment of the present application in detail with reference to a specific blockchain consensus data processing scenario application example:
the embodiment of the application provides a processing method of block chain consensus data, which can be applied to the technical field of block chains and comprises the following main flow steps:
1. And sending the business data generated by the database to the blockchain node for processing.
After the service data is generated in the database, the service data is packaged and sent to the nodes in the block chain. The service data may include any content, such as logistics information, data uploaded by commodity transaction or internet of things equipment, hash values of corresponding data, and the like. For some private transactions, algorithms such as homomorphic encryption or zero knowledge proof are needed, and business data is obtained after the transaction data is encrypted.
2. The block link points generate data for consensus.
At the blockchain node, traffic data is consensus, where the consensus is implemented by means of digital signatures. The block-out node (a node for processing the service data) carries out hash processing on the service data, and then signs by using a private key of the block-out node to obtain first signature data to be agreed. And then the service data and the corresponding first signature data are sent to other nodes, and the other nodes are the consensus nodes in the process. In general, the blockchain consensus mechanism can adopt the half principle, namely, when the data is confirmed to be free of problems by exceeding the common nodes, the service data is considered to be commonly known, and the service data can be processed in a chaining way.
3. The block-out node transmits the data for consensus to the consensus node.
Since the traffic data volume involved in the consensus data may be large and the consensus data transmission needs to be performed in a plurality of nodes. In order to facilitate improving the transmission efficiency of the consensus data among the blockchain nodes, the consensus data can be packed to form compressed data packets for transmission among the nodes. In the embodiment of the application, a fragmentation compression mode can be applied, namely, the compressed data packet is processed into a plurality of fragments, so that parallel decompression processing can be realized in the downloading process, and the data in the compressed packet can be quickly restored.
Referring to FIG. 6, the current compressed data packet format is typically a header-data field-a trailer, such as a zip structure that includes a source file data store (which stores a plurality of compressed data segments, each data segment being a data field preceded by a header), a central directory field, and a central directory end identifier (the two parts are the trailer). The purpose of the header and trailer is to identify the type and structure of the compressed file and to provide information about the compressed file.
The header typically contains information about the compressed file, such as the file type, compression algorithm, compression level, and the like. Such information may help the decompression software identify the type and structure of the compressed file and use the correct algorithms and levels to decompress the file. The trailer typically contains information about the compressed file, such as the offset of the file, the modification time of the file, etc. Such information may help verify the integrity and consistency of the compressed file and ensure that the file is not modified during transmission or storage. The header and trailer conditions of different compression formats differ, but in general, the header and trailer function to identify the type and structure of the compressed file and to provide information about the compressed file in order to properly decompress and verify the file.
In the case where the aforementioned partial node servers may support only sequential downloading, it is possible that these node servers can only download individual data pieces in the compressed packet one by one in the order of file pieces and then decompress them when decompressing the compressed data packet received. There is a problem in that parallel decompression processing cannot be supported because it needs to be downloaded to obtain the file end to achieve correct verification and decompression of each data segment.
The present application proposes an improved compressed data packet format in order to solve the problem that part of the node servers may only support sequential downloading, i.e. only download all data from beginning to end according to the format of the compressed data packet.
Referring to fig. 7, in the embodiment of the present application, the compressed data packet format is reconstructed to obtain the target compressed data packet format, and the working principle thereof is as follows: the data is compressed to obtain a compressed data packet, the compressed data packet comprises a file head, a data area and a file tail, the file tail information of the compressed data packet is copied, the file tail information is attached to the rear of the file head of the obtained compressed data packet, and then the obtained file is used as a new file head, so that the new compressed data packet is obtained. The method has the advantages that the server only supporting sequential downloading can rapidly acquire the file tail of the compressed data packet, so that parallel decompression processing of the compressed data packet can be realized.
Referring to fig. 8, in the present application, in the consensus node, each data segment in the compressed data may be downloaded, for example, during the verification of the 1 st data segment, the 2 nd data segment may be downloaded, and compared with the conventional method of downloading after transmission, and then the verification and decompression, the duration of the verification and decompression may be shortened, so that the data transmission efficiency may be improved, and the consensus efficiency and the block output speed may be further improved.
For example, assuming a group of data to be transmitted, it is first segmented into 5 segments according to the size of the data volume, for example, 100M, and the size of each segment is controlled to be within a reasonable range and balanced as much as possible (for example, between 15 and 25M). And 5 data segments are obtained, and each data segment is compressed by using a compression algorithm (such as a ZIP compression algorithm) to obtain a corresponding compressed data packet. Here, the data is segmented first and then compressed, rather than being subdivided after compression (because the compressed data is a complete packet file, which is not well subdivided). Then, for example, the consensus node a sends the compressed data packets to the consensus node B, and the consensus node B can download the compressed data packets from the consensus node a, after downloading the compressed data packets, the other compressed data packets can be downloaded, and meanwhile, the downloaded compressed data packets can be checked and decompressed, and the checking and decompressing parts belong to the prior art. The key point is that the checking and decompressing work of the downloaded compressed data packet can be carried out together with the downloading work of other compressed data packets, if the downloaded compressed data packet is downloaded together, the downloaded compressed data packet can be checked and decompressed only after being completely downloaded, and the time is relatively longer. For each compressed data packet, the original data can be restored after decompression, and the combination is the complete data before segmentation.
After the improved compressed packet format of the embodiment of the application is adopted, a new file header can be obtained by downloading each compressed data packet, so that the decompression work can be normally executed, and the new file header contains information needed by decompression. In the original format, only when sequential downloading is supported, downloading from the file head to the file tail is needed, and decompression can be started after the whole content is obtained. For example, in the case of a file 1-2-3-4-5-6-7,1 being the file header, 7 being the file footer, and 2 to 6 being the file data, the decompression must be started after the entire content of 1-7 is obtained in order to download the file. In the embodiment of the application, the files are 8-2-3-4-5-6-7, wherein the 8 files comprise 1 file head and 7 file tail, and after the 8 files are downloaded, the 2 content can be checked and decompressed after the downloading is completed, and the 3-4-5-6-7 files are not completely downloaded.
And decompressing the compressed data packet at the consensus node to obtain service data and signature data of the block-out node. The public key of the block node can be used for signing the service data, when verification is passed, the private key of the block node is used for signing to obtain second signature data, the second signature data is returned to the block node, after the consensus of the service data is completed, the service data is packaged into a block uplink, and the consensus data corresponding to the service data is stored, so that later examination is facilitated. In general, a data-up schematic of a blockchain of the present application can be seen with reference to FIG. 9.
4. Deleting the consensus data in the block link points;
In each node, the consensus data corresponding to the service data in each block is stored. As the depth of the blockchain is deepened, the data volume of the consensus data is larger and larger, the data storage capacity of the blockchain nodes is limited, and the excessive consensus data can cause the data storage pressure of the blockchain to be increased, so that the operation stability of the blockchain system is affected. The application provides a targeted scheme for deleting consensus data. For the consensus data corresponding to the blockchain, the consensus data can be numbered according to the corresponding blocks, for example, the blockchain comprises 100 blocks, and the blocks can be recorded as 1-100 blocks from small to large. The common data corresponding to the service data in each block can be divided into 100 groups, namely 100 groups of common data.
When the consensus data is stored, a group number threshold of the consensus data may be set. When the threshold is found to be reached, the consensus data may be processed once. The treatment process is as follows:
1) Retrieving consensus data currently stored in the node (denoted as pruning node);
2) Carrying out hash calculation on the part of consensus data to obtain a group of hash values, and then carrying out digital signature on the hash values by using a private key of a deletion node to form a snapshot;
3) Sending the digital signature to other nodes for consensus, decrypting the digital signature by the other nodes through deleting the public key of the node, then carrying out hash processing on the consensus data, comparing the calculated digest value with the decrypted digest value, and if the digest value is consistent, verifying to pass, and returning the digital signature of the snapshot by the other nodes;
4) After the digital signature in the snapshot is half, the consensus of the consensus data is considered to be completed (the processes are similar to the process of carrying out the consensus on the business data, and the compression transmission mode can also be adopted); otherwise, the consensus of the consensus data is considered to fail, which indicates that the consensus data at the deletion node is tampered or wrong;
5) After the consensus of the consensus data is completed, distributing the snapshot after the global consensus to all nodes for storage, wherein the global snapshot comprises a hash value corresponding to the consensus data and a consensus signature of each node, and also comprises a block number corresponding to the batch of consensus data;
6) Selecting one node from all nodes as a backup node; the backup node can be randomly selected from non-disbursed nodes with good performance;
7) And notifying all nodes except the backup node, and deleting the consensus data passing through the global consensus.
In the application, except the backup node, all block chain nodes only store global snapshot corresponding to the batch of consensus data, and the global snapshot can prove that the batch of consensus data is correct after the block chain link point consensus; the consensus data can prove that the business data in the corresponding block numbers are correctly recognized by the block chain link points, so that the global snapshot corresponding to the consensus data stored by all the block chain nodes can indirectly prove the correctness of the business data in the block chain. And in addition, a large amount of consensus data can be deleted in the block chain node, and only a snapshot after global consensus is needed to be saved, so that the data volume needed to be stored is greatly reduced. In addition, the backup node is selected to store the consensus data of the batch, so that the backup node is convenient to extract and use when needed, and because all nodes have global snapshots, the backup node can be used for checking whether the consensus data in the backup node is tampered or not, and the safety of the data can be improved.
5. And selecting and optimizing the backup node.
Optimizing: in the application, the common identification data of different batches can be constrained to correspond to different backup nodes. In this way, it is possible to prevent a situation in which a certain backup node or a full (or large) amount of consensus data needs to be stored.
An example development of the above process flow is described as follows:
Assuming that 20 blocks occur, the consensus data is pruned once. Detecting the current block number, when the block number reaches a multiple of 20, such as 20, 40 and the like, acquiring the consensus data of the current batch, if the current block number is 60, acquiring the consensus data corresponding to the 41-60 blocks when the current processing batch is 3 rd batch (1-20, 21-40, …).
And carrying out consensus on the part of the consensus data to obtain a global snapshot, and determining corresponding backup nodes, such as 50 total blockchain nodes, wherein node A is a first selected backup node, node B is a second selected backup node, then the node A stores the consensus data corresponding to 1-20 blocks, and the node B stores the consensus data corresponding to 21-40 blocks. From the nodes except for A and B, randomly selecting one backup node corresponding to the 3 rd block, such as node C, and then informing all nodes except for node C to delete the common identification data corresponding to the 41 th block-60 th block. Here, in general, the number of nodes is large, and a large number of blocks can be supported. If all nodes are selected as backup nodes, then the records they were selected are purged and restarted.
Optimizing II: in the application, when the backup node is selected, the current available storage capacity of each node can be detected, and then the largest node is selected as the backup node, so that the storage task of the consensus data can be handed over to the node with the storage space, thereby balancing the data storage pressure of each node. Moreover, because the application is the consensus data processed in batches, when a certain node is used as a backup node, the available storage capacity of the node is reduced, and the node is possibly not selected in the backup node selection of the next batch, so that the condition of insufficient storage space of the node can be prevented.
Through the processing flow, the consensus data to be stored in the block chain link points can be greatly reduced, normal consensus storage records of the block chain are not affected, the data storage pressure can be reduced, and the construction cost of the block chain system is reduced.
In summary, the embodiment of the application has at least the following beneficial effects:
(1) In the application, a new compressed data structure is constructed, and the nodes which can support sequential downloading can realize the decompression of the compressed data in parallel.
(2) In the application, through carrying out parallel downloading-checking-decompressing on each data segment in the compressed data, compared with the traditional mode of downloading after transmission and then checking and decompressing, the method can shorten the checking and decompressing time, thereby improving the data transmission efficiency and further improving the consensus efficiency and the block output speed.
(3) In the application, a large amount of consensus data can be deleted in the blockchain node, and only the snapshot after global consensus is needed to be saved, so that the data quantity needed to be stored is greatly reduced, the data storage pressure can be reduced, and the building cost of the blockchain system is reduced.
(4) In the application, the backup nodes are selected to store the consensus data of each batch, so that the backup nodes are convenient to extract and use when needed, and as all the nodes have global snapshots, the backup nodes can be used for checking whether the consensus data in the backup nodes are tampered or not, and the safety of the data can be improved.
Referring to fig. 10, an embodiment of the present application further provides a processing system for blockchain consensus data, which can implement the above processing method for blockchain consensus data, where the system includes:
the first module is used for packaging and sending the service data generated by the database to the output block node;
the second module is used for generating first signature data to be consensus according to the service data by the block-out node;
The third module is used for sending the service data and the first signature data to a consensus node for consensus processing based on a target compressed data packet structure to obtain consensus data; the target compressed data packet structure comprises a target file head, a data area and a file tail; the target file head consists of an original file head and the copied file tail;
A fourth module, configured to package the service data after consensus into blocks for uplink processing, and store the consensus data;
And a fifth module, configured to perform backup pruning processing on the consensus data when the number of groups of the consensus data stored in the block of the blockchain reaches a preset threshold of the number of groups.
It can be understood that the content in the above method embodiment is applicable to the system embodiment, and the functions specifically implemented by the system embodiment are the same as those of the above method embodiment, and the achieved beneficial effects are the same as those of the above method embodiment.
The embodiment of the application also provides electronic equipment, which comprises a memory and a processor, wherein the memory stores a computer program, and the processor realizes the processing method of the block chain consensus data when executing the computer program. The electronic equipment can be any intelligent terminal including a tablet personal computer, a vehicle-mounted computer and the like.
It can be understood that the content in the above method embodiment is applicable to the embodiment of the present apparatus, and the specific functions implemented by the embodiment of the present apparatus are the same as those of the embodiment of the above method, and the achieved beneficial effects are the same as those of the embodiment of the above method.
Referring to fig. 11, fig. 11 illustrates a hardware structure of an electronic device according to another embodiment, the electronic device includes:
The processor 201 may be implemented by a general purpose CPU (Central Processing Unit ), a microprocessor, an Application SPECIFIC INTEGRATED Circuit (ASIC), or one or more integrated circuits, etc. for executing related programs to implement the technical solution provided by the embodiments of the present application;
The Memory 202 may be implemented in the form of a Read Only Memory (ROM), a static storage device, a dynamic storage device, or a random access Memory (Random Access Memory, RAM). Memory 202 may store an operating system and other application programs, and when implementing the technical solutions provided in the embodiments of the present disclosure by software or firmware, relevant program codes are stored in memory 202, and a processing method for executing a blockchain consensus data of an embodiment of the present disclosure is called by processor 201;
an input/output interface 203 for implementing information input and output;
The communication interface 204 is configured to implement communication interaction between the device and other devices, and may implement communication in a wired manner (e.g. USB, network cable, etc.), or may implement communication in a wireless manner (e.g. mobile network, WIFI, bluetooth, etc.);
A bus 205 for transferring information between various components of the device (e.g., processor 201, memory 202, input/output interface 203, and communication interface 204);
Wherein the processor 201, the memory 202, the input/output interface 203 and the communication interface 204 are communicatively coupled to each other within the device via a bus 205.
The embodiment of the application also provides a computer readable storage medium, which stores a computer program, and the computer program realizes the processing method of the block chain consensus data when being executed by a processor.
It can be understood that the content of the above method embodiment is applicable to the present storage medium embodiment, and the functions of the present storage medium embodiment are the same as those of the above method embodiment, and the achieved beneficial effects are the same as those of the above method embodiment.
The memory, as a non-transitory computer readable storage medium, may be used to store non-transitory software programs as well as non-transitory computer executable programs. In addition, the memory may include high-speed random access memory, and may also include non-transitory memory, such as at least one magnetic disk storage device, flash memory device, or other non-transitory solid state storage device. In some embodiments, the memory optionally includes memory remotely located relative to the processor, the remote memory being connectable to the processor through a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The embodiments described in the embodiments of the present application are for more clearly describing the technical solutions of the embodiments of the present application, and do not constitute a limitation on the technical solutions provided by the embodiments of the present application, and those skilled in the art can know that, with the evolution of technology and the appearance of new application scenarios, the technical solutions provided by the embodiments of the present application are equally applicable to similar technical problems.
It will be appreciated by persons skilled in the art that the embodiments of the application are not limited by the illustrations, and that more or fewer steps than those shown may be included, or certain steps may be combined, or different steps may be included.
The system embodiments described above are merely illustrative, in that the units illustrated as separate components may or may not be physically separate, i.e., may be located in one place, or may be distributed over a plurality of network elements. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
Those of ordinary skill in the art will appreciate that all or some of the steps of the methods, systems, functional modules/units in the devices disclosed above may be implemented as software, firmware, hardware, and suitable combinations thereof.
The terms "first," "second," "third," "fourth," and the like in the description of the application and in the above figures, if any, are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that the embodiments of the application described herein may be implemented in sequences other than those illustrated or otherwise described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
It should be understood that in the present application, "at least one (item)" means one or more, and "a plurality" means two or more. "and/or" for describing the association relationship of the association object, the representation may have three relationships, for example, "a and/or B" may represent: only a, only B and both a and B are present, wherein a, B may be singular or plural. The character "/" generally indicates that the context-dependent object is an "or" relationship. "at least one of" or the like means any combination of these items, including any combination of single item(s) or plural items(s). For example, at least one (one) of a, b or c may represent: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", wherein a, b, c may be single or plural.
In the several embodiments provided by the present application, it should be understood that the disclosed apparatus and method may be implemented in other manners. For example, the system embodiments described above are merely illustrative, e.g., the division of the above elements is merely a logical functional division, and there may be additional divisions in actual implementation, e.g., multiple elements or components may be combined or integrated into another system, or some features may be omitted, or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be an indirect coupling or communication connection via some interfaces, devices or units, which may be in electrical, mechanical or other form.
The units described above as separate components may or may not be physically separate, and components shown as units may or may not be physical units, may be located in one place, or may be distributed over a plurality of network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional unit in the embodiments of the present application may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit. The integrated units may be implemented in hardware or in software functional units.
The integrated units, if implemented in the form of software functional units and sold or used as stand-alone products, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present application may be embodied in essence or a part contributing to the prior art or all or part of the technical solution in the form of a software product stored in a storage medium, including multiple instructions to cause a computer device (which may be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method of the various embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (Random Access Memory RAM), a magnetic disk, or an optical disk, or other various media capable of storing a program.
The preferred embodiments of the present application have been described above with reference to the accompanying drawings, and are not thereby limiting the scope of the claims of the embodiments of the present application. Any modifications, equivalent substitutions and improvements made by those skilled in the art without departing from the scope and spirit of the embodiments of the present application shall fall within the scope of the claims of the embodiments of the present application.

Claims (10)

1. A method for processing blockchain consensus data, comprising:
packaging and transmitting service data generated by a database to a block-out node;
The block outlet node generates first signature data to be commonly recognized according to the service data;
Based on a target compressed data packet structure, sending the service data and the first signature data to a consensus node for consensus processing to obtain consensus data; the target compressed data packet structure comprises a target file head, a data area and a file tail; the target file head consists of an original file head and the copied file tail;
Packaging the service data after consensus into blocks for uplink processing, and storing the consensus data;
And when the group number of the consensus data stored in the block of the block chain reaches a preset group number threshold, performing backup deletion processing on the consensus data.
2. The method of claim 1, wherein the step of packaging and transmitting the service data generated by the database to the output block node, wherein the service data includes at least one of logistics information, commodity transaction data, and uploading data of the internet device.
3. The method of claim 1, wherein generating first signature data to be consensus based on the traffic data comprises:
carrying out hash processing on the service data to obtain first data;
and signing the first data by adopting the private key of the block-out node to obtain first signature data to be commonly recognized.
4. The method of claim 1, wherein the step of transmitting the service data and the first signature data to a consensus node for consensus processing based on a target compressed data packet structure, and the step of transmitting the service data and the first signature data to the consensus node comprises:
performing slicing processing on the service data and the first signature data to obtain data fragments;
Compressing the data segment to obtain a first compressed data packet; the first compressed data packet comprises a file header, a data area and a file tail;
Copying the file tail, and attaching the file tail to the back of the file head to obtain a second compressed data packet;
and sending the second compressed data packet to the consensus node.
5. The method of claim 4, wherein the step of transmitting the service data and the first signature data to a consensus node for consensus processing based on a target compressed data packet structure to obtain consensus data, comprises the steps of:
Downloading the second compressed data packet in parallel, and decompressing the second compressed data packet to obtain the service data and the first signature data;
signing the service data by adopting the public key of the block-out node;
When the verification passes, the consensus node signs by adopting a private key of the consensus node to obtain second signature data, and further obtain consensus data; wherein the consensus data includes the first signature data and the second signature data.
6. The method of claim 1, wherein the step of performing the backup pruning process on the consensus data when the number of groups of the consensus data stored in the block of the blockchain reaches a preset threshold of the number of groups, comprises:
Taking out the consensus data currently stored in the deletion node as current consensus data;
carrying out hash calculation on the current consensus data to obtain a group of hash values;
Carrying out digital signature on the hash value by adopting the private key of the deleting node to obtain a snapshot;
transmitting the digital signature to other nodes for consensus processing to obtain a consensus result;
for the situation that the consensus result is that the consensus is completed, distributing the snapshot to all block chain nodes for storage;
and determining a backup node, and notifying the blockchain nodes except the backup node to delete the current consensus data.
7. The method of claim 6, wherein the step of determining the backup node comprises:
determining backup nodes according to batches of the consensus data;
Or detecting the current available storage capacity of each block link point, and determining the node with the largest available storage capacity as a backup node.
8. A system for processing blockchain consensus data, comprising:
the first module is used for packaging and sending the service data generated by the database to the output block node;
the second module is used for generating first signature data to be consensus according to the service data by the block-out node;
The third module is used for sending the service data and the first signature data to a consensus node for consensus processing based on a target compressed data packet structure to obtain consensus data; the target compressed data packet structure comprises a target file head, a data area and a file tail; the target file head consists of an original file head and the copied file tail;
A fourth module, configured to package the service data after consensus into blocks for uplink processing, and store the consensus data;
And a fifth module, configured to perform backup pruning processing on the consensus data when the number of groups of the consensus data stored in the block of the blockchain reaches a preset threshold of the number of groups.
9. An electronic device comprising a processor and a memory;
The memory is used for storing programs;
the processor executing the program implements the method of any one of claims 1 to 7.
10. A computer storage medium in which a processor executable program is stored, characterized in that the processor executable program is for implementing the method according to any one of claims 1 to 7 when being executed by the processor.
CN202410370515.4A 2024-03-28 2024-03-28 Processing method, system, equipment and medium for block chain consensus data Pending CN118170729A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202410370515.4A CN118170729A (en) 2024-03-28 2024-03-28 Processing method, system, equipment and medium for block chain consensus data

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202410370515.4A CN118170729A (en) 2024-03-28 2024-03-28 Processing method, system, equipment and medium for block chain consensus data

Publications (1)

Publication Number Publication Date
CN118170729A true CN118170729A (en) 2024-06-11

Family

ID=91348495

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202410370515.4A Pending CN118170729A (en) 2024-03-28 2024-03-28 Processing method, system, equipment and medium for block chain consensus data

Country Status (1)

Country Link
CN (1) CN118170729A (en)

Similar Documents

Publication Publication Date Title
CN110855761B (en) Data processing method and device based on block chain system
CN109597717B (en) Data backup and recovery method and device, electronic equipment and storage medium
US20180260583A1 (en) In-situ data verification for the cloud
CN112491989A (en) Data transmission method, device, equipment and storage medium
CN108881454B (en) File transmission method, mobile terminal and storage medium
US8819361B2 (en) Retaining verifiability of extracted data from signed archives
US11249987B2 (en) Data storage in blockchain-type ledger
CN112261038B (en) Big data acquisition method and system, computer equipment and storage medium thereof
CN112839003A (en) Data verification method and system
JP5753946B2 (en) Method and system for downloading font files
CN112163412A (en) Data verification method and device, electronic equipment and storage medium
CN112788270A (en) Video backtracking method and device, computer equipment and storage medium
CN107798236B (en) Method and device for realizing safe installation of application program installation package
WO2021027252A1 (en) Data storage method and apparatus in block chain-type account book, and device
JP2022553130A (en) Methods, systems, electronics and storage media for storing and collecting temperature data
CN113452526A (en) Electronic document storage and verification method and corresponding device
CN111294209B (en) Block chain-based intelligent terminal security verification method and device
CN118170729A (en) Processing method, system, equipment and medium for block chain consensus data
CN111400316A (en) Data acquisition method and device, storage medium and electronic device
CN109002710A (en) A kind of detection method, device and computer readable storage medium
CN111651795A (en) Bid document disclosing method, system and storage medium based on block chain
CN112202453A (en) Information processing method, device, equipment and medium for compressing ciphertext
CN116057925A (en) Data transmission method, data downloading method and terminal
CN113726764B (en) Private data transmission method and device
CN118036048B (en) Data persistence method and device for online debugging platform and computer medium

Legal Events

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