CN111241069B - Block chain-based data flattening method and system - Google Patents

Block chain-based data flattening method and system Download PDF

Info

Publication number
CN111241069B
CN111241069B CN202010063170.XA CN202010063170A CN111241069B CN 111241069 B CN111241069 B CN 111241069B CN 202010063170 A CN202010063170 A CN 202010063170A CN 111241069 B CN111241069 B CN 111241069B
Authority
CN
China
Prior art keywords
data
flattening
node
blockchain
account
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
CN202010063170.XA
Other languages
Chinese (zh)
Other versions
CN111241069A (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.)
Shanghai Moheng Network Technology Co ltd
Original Assignee
Shanghai Moheng Network Technology 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 Shanghai Moheng Network Technology Co ltd filed Critical Shanghai Moheng Network Technology Co ltd
Priority to CN202010063170.XA priority Critical patent/CN111241069B/en
Publication of CN111241069A publication Critical patent/CN111241069A/en
Application granted granted Critical
Publication of CN111241069B publication Critical patent/CN111241069B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/21Design, administration or maintenance of databases
    • G06F16/211Schema design and management
    • G06F16/212Schema design and management with details for data modelling support
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor

Abstract

The invention discloses a data flattening method and system based on a blockchain, wherein the method comprises the following steps: establishing a data flattening node; the data flattening nodes acquire account data in a distributed mode, obtain account data snapshots, build local data and participate in consensus; and regularly cleaning data which does not participate in consensus, cleaning historical snapshots of account data, and achieving flattening of the local database data of the blockchain node. The data flattening method based on the blockchain removes redundancy and complexity, achieves data flattening, greatly reduces hardware resource requirements, and reduces the application landing threshold of the blockchain; by adopting a distributed synchronous account data mode, the block chain link point resource is fully utilized, the speed of constructing local data is greatly improved, and a foundation is provided for a light device second access block chain to become a block chain node.

Description

Block chain-based data flattening method and system
Technical Field
The present invention relates to the field of data processing, and in particular, to a data flattening method and system based on a blockchain.
Background
The block chain technology is a distributed data processing technology, and encrypted data is sent to each node through a P2P network communication technology so as to achieve the common knowledge of all network nodes, thereby ensuring that the data cannot be tampered and counterfeited. With the development of internet technology, the blockchain technology has the advantages of decentralization, transparent disclosure, non-tampering, trust and the like, and is widely applied to numerous fields such as intelligent contracts, file storage, supply chain finance, identity verification, digital government affairs, electronic commerce, the Internet of things, social communication and the like.
With the development of the blockchain technology, the precipitation of the blockchain data is larger and larger, and a great challenge is faced to the complete synchronization of the blockchain data of newly added nodes, so that the data synchronization process consumes a great amount of time, wastes hardware resources, increases the operation cost, improves the threshold of the blockchain application landing, and is not beneficial to the ecological development of the blockchain.
In the existing blockchain data processing scheme, the local data of each node is completely consistent; the nodes with missing data all need to synchronize data from the connected nodes, process the data and store the data locally so as to achieve the block chain network consensus. After receiving the block data, the node executes a transaction list in the block data, and locally stores the block data, the transaction list, the transaction execution result and account data; the first three types of data are all stored in a local database, while account data are stored both locally and as a cache in Merkle-Patricia Tree structure objects.
Disclosure of Invention
In view of the above-mentioned drawbacks of the prior art, the present invention aims to solve the technical problems of very large data redundancy, very low efficiency of block data synchronization, high requirements on hardware devices, etc. in the existing blockchain transaction service.
In order to achieve the above object, the present invention provides a data flattening method based on blockchain, comprising the following steps:
establishing a data flattening node;
the data flattening node acquires the latest account data in a distributed mode, obtains an account data snapshot, constructs local data and participates in consensus;
and regularly cleaning data which does not participate in consensus, cleaning historical snapshots of account data, and achieving flattening of the local database data of the blockchain node.
Further, establishing a data flattening node specifically includes:
preparing a node, starting with a data flattening mark, and taking the node as a data flattening node;
the data flattening node is connected with a plurality of block chain nodes through P2P;
and the data flattening nodes collect all the same block data of the block chain nodes connected with the data flattening nodes, and compare Root Hash in the block data for verification.
Further, the data flattening node obtains account data in a distributed manner to obtain an account data snapshot, which specifically comprises:
the data flattening node sends commands for acquiring account data to a plurality of block link points in a distributed mode, the block link point groups receive the commands and acquire local data in parallel and send the local data to the data flattening node, and the data flattening node constructs local account data according to the acquired local data and constructs the latest account data snapshot object.
Further, the data participating in consensus in the blockchain is set as all the latest account data snapshots, and each time account data is changed, a new account data snapshot is generated.
In another preferred embodiment of the present invention, there is provided a blockchain-based data flattening system, including:
a newly built module for establishing a data flattening node;
the construction module is used for acquiring account data by the data flattening nodes in a distributed mode, obtaining account data snapshots, constructing local data and participating in consensus;
and the cleaning module is used for regularly cleaning the data which do not participate in consensus so as to flatten the data of the local database of the block chain node.
Further, the newly-built module specifically includes:
a preparation unit for preparing a node, which is started by a data flattening mark and is used as the data flattening node;
the connecting unit is used for connecting the data flattening nodes with a plurality of block chain nodes through P2P;
and the comparison unit is used for collecting the same block data of all the block chain nodes connected with the data flattening nodes by the data flattening nodes, and comparing Root Hash in the block data for verification.
Further, the construction unit specifically includes:
the data flattening node sends commands for acquiring account data to a plurality of block link points in a distributed mode, the block link point groups receive the commands and acquire local data in parallel and send the local data to the data flattening node, and the data flattening node constructs local account data according to the acquired local data and constructs the latest account data snapshot object.
Further, the data participating in consensus in the blockchain is set as all the latest account data snapshots, and each time account data is changed, a new account data snapshot is generated.
In another preferred embodiment of the present invention, a computer device is provided, including a memory, a processor, and a computer program stored on the memory and executable on the processor, the processor implementing a method as any one of the above when executing the program.
In another preferred embodiment of the present invention, a computer readable storage medium storing a computer program is provided, where the computer program causes a computer to implement a blockchain-based data flattening method as in any of the above.
Technical effects
Aiming at the problem that local sedimentation data is gradually increased along with the increase of the height of a blockchain in the prior art, the data flattening method based on the blockchain deletes local blockdata, transaction data, transaction execution result data and historical account data snapshot, and finally local data of a node is the most simplified, redundancy and complexity are removed, so that data flattening is achieved; if no account is newly added in the blockchain network, the node for starting the data flattening in the scheme will not have data increase.
The invention discloses a data flattening method based on a block chain, which aims at the problems of slow and high operation of synchronous data in the existing scheme, adopts a distributed synchronous account data mode to fully utilize block chain point resources, greatly improves the speed of constructing local data, can start data flattening nodes at any block height, and does not need to start synchronous data from block height 0 like the existing scheme. The synchronous data of the prior proposal is a slow and high operation task, the synchronous process is a calculation process and a history process is completely played; the scheme completely discards the low-efficiency synchronization process, takes Root Hash of given block data as a basis, fully utilizes block link point resources in a distributed mode, and efficiently constructs a local account data snapshot to form an effective block chain node.
The data flattening method based on the blockchain disclosed by the invention removes a large amount of redundant data, greatly reduces the hardware resource requirement, reduces the blockchain application landing threshold, and can be used as blockchain nodes for light mobile equipment such as mobile phones, tablets and the like; the account data is constructed in a distributed mode, and a foundation is provided for the light equipment to access the blockchain in seconds to become a blockchain node under the better condition of the network.
The conception, specific structure, and technical effects of the present invention will be further described with reference to the accompanying drawings to fully understand the objects, features, and effects of the present invention.
Drawings
FIG. 1 is a schematic diagram of a data flattening initiation flow of a blockchain-based data flattening method in accordance with a preferred embodiment of the present invention;
FIG. 2 is a flow chart of a process for obtaining blockchain account list for a blockchain-based data flattening method in accordance with a preferred embodiment of the present invention;
FIG. 3 is a block chain account data flow diagram of a block chain based data flattening method according to a preferred embodiment of the present invention.
Detailed Description
In order to make the technical problems, technical schemes and beneficial effects to be solved more clear, the invention is further described in detail below with reference to the accompanying drawings and embodiments. 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 invention.
In the following description, for purposes of explanation and not limitation, specific details are set forth, such as particular internal procedures, techniques, etc. in order to provide a thorough understanding of embodiments of the present invention. It will be apparent, however, to one skilled in the art that the present invention may be practiced in other embodiments that depart from these specific details. In other instances, detailed descriptions of well-known systems, devices, circuits, and methods are omitted so as not to obscure the description of the present invention with unnecessary detail.
Example 1
In the prior art, the data processing scheme in blockchain transaction service has several drawbacks:
1) Existing block data processing schemes are very data redundant
In the existing data processing scheme of the blockchain transaction service, a large amount of data including block data, transaction result data, account data and the like is stored locally by the nodes, so that data redundancy is very large, and data precipitation is heavy and complicated.
2) The data processing scheme of the existing blockchain transaction service has very low block data synchronization efficiency
In the data processing scheme of the existing blockchain transaction service, the block data synchronization efficiency is very low, newly added nodes need to synchronize the blockchain historical data, the time is less, the time is hours, the time is more, and the data is more and the time is longer; nodes that need to synchronize data can only synchronize with one node at a time, resulting in very inefficient data synchronization.
3) The data processing scheme of the existing blockchain transaction service has higher requirements on hardware equipment
In the existing data processing scheme of the blockchain transaction service, a large-capacity storage medium is required to be configured, and a large amount of data generated by the blockchain is stored, so that hardware equipment is heavy, and the blockchain application is not convenient to land.
Aiming at the defects, the invention discloses a data flattening method and a system based on a blockchain, and the invention discloses a method for realizing a blockchain data synchronization protocol based on a blockchain data flattening technology, namely constructing local data in a distributed account data acquisition mode; the invention aims to delete all data which do not participate in consensus so as to realize data flattening, remove redundancy and complexity, and finally, the data size of the node which falls to the ground is extremely small, and the data is added into a blockchain network and participates in consensus. The data flattening method based on the blockchain of the embodiment comprises the following steps:
step 100, establishing a data flattening node;
step 200, the data flattening node acquires account data in a distributed mode, obtains an account data snapshot, constructs local data and participates in consensus;
and 300, periodically cleaning data which does not participate in consensus, and flattening the data of the local database of the blockchain node.
The data locally stored by the blockchain node mainly comprises blockdata, a transaction list, a transaction execution result and account data; the block data refers to blocks packaged by block link points, and the blocks usually comprise block numbers, time, transaction lists and other information block data which are stored locally and do not participate in consensus; the transaction list is a blockchain transaction set, namely, the blockchain transaction set is stored in block data, and is stored locally in a form of Key-Value for convenient retrieval, wherein Key is a Hash of a transaction, and Value is a 16-ary code of the transaction; the result of executing the transaction comprises the transaction execution state, the block number of the execution, the log and other information, and the information is stored locally; the account data includes information such as account number, transaction number, account amount, and smart contract bytecode. The block data, the transaction list, the result of executing the transaction and the like do not participate in the block chain consensus, the data participating in the consensus in the block chain is the latest snapshot of all account data, and a new snapshot of account data is generated each time the account data is changed. The embodiment realizes that a local database is built by adopting the latest account data snapshot, namely, a latest Merkle-Patricia Tree object is built, and the object data is unique data for participating in the block chain network consensus. Merkle-Patricia Tree is an improved data structure which integrates the advantages of two Tree structures of a Merker Tree and a prefix Tree, and is an important data structure used for organizing and managing account data and generating transaction set hashes in an Ethernet.
Further, in step 100, establishing a data flattening node specifically includes:
step 101, preparing a node, starting with a data flattening mark, and taking the node as a data flattening node;
102, connecting a plurality of block chain nodes by a data flattening node through P2P;
and step 103, collecting the same block data of all block chain nodes connected with the data flattening nodes by the data flattening nodes, and comparing Root Hash in the block data for verification.
The data flattening node is a node started by a data flattening mark, local historical data is emptied, a plurality of block chain nodes are connected through P2P, and Root Hash in the block data is acquired for final verification when the first block data of any node is received.
There are two types of blockchain node activation: 1. normally starting the block chain link points; 2. the block link points are activated in a data flattening mode. As shown in fig. 1, the specific procedure for starting the data flattening mode of the present embodiment is as follows:
step 1, preparing new nodes of a block chain, setting data flattening parameters, starting in a data flattening mode, and deleting local block data;
step 2, manually adding one or more online blockchain nodes to the data flattening nodes to establish P2P network connection;
step 3, broadcasting to the data flattening node when the block chain node receives or generates a new block;
and 4, acquiring Root Hash according to the latest block data to obtain account data for verification, wherein the block data is used as the first block data of the data flattening node.
Further, in step 200, the data flattening node obtains account data in a distributed manner to obtain an account data snapshot, which specifically includes:
the data flattening node sends commands for acquiring account data to a plurality of block link points in a distributed mode, the block link point groups receive the commands and acquire local data in parallel and send the local data to the data flattening node, and the data flattening node constructs local account data according to the acquired local data and constructs the latest account data snapshot object.
The method comprises the steps that a Merkle-Patricia Tree object of block chain account data is built in a distributed mode, a data flattening node can be connected with a plurality of block chain nodes P2P, the Root Hash of the same block data sent by the plurality of nodes is consistent, the feasibility of the Root Hash is high, the data flattening node sends an account list obtaining command to a block chain link point to obtain account data to build a local account list, the data flattening node sends account data to the plurality of block chain link points in a distributed mode, the block chain link point group receives the command to obtain the local data in parallel and sends the local data to the data flattening node, the data flattening node builds the local account data, and the latest Merkle-Patricia Tree object is built. Therefore, the data flattening node firstly acquires an account list and then acquires account data; because the account list data is smaller and the account data is larger, the data flattening node acquires the account list and then requests the account data in a distributed mode.
The procedure of obtaining the blockchain account list is as follows, as shown in fig. 2:
step 201, a data flattening node sends an account acquisition command to a blockchain node;
step 202, traversing the local block chain data by the block chain nodes to obtain all account lists, and sending the account lists in batches if the number of the account lists is large;
step 203, caching the data flattening node to the local after receiving the account list, and solving a Hash value of the total list for verification;
step 204, after all the accounts are sent, the blockchain node sends an end mark to the data flattening node;
205. after receiving the end mark, the data flattening node sends an account list Hash value to the block chain link;
step 206, the block chain node verifies whether the Hash value is consistent with the local value, and sends a verification result to the data flattening;
step 207, if the verification is not passed, searching a lost account list according to the index; re-request until all account lists are obtained.
After the data flattening node obtains the account list, the account number is obtained in a distributed manner, as shown in fig. 3, and the step of obtaining the account data flow is as follows:
step 208, the data flattening node sends a command of acquiring account data to the block link point cluster, wherein the command comprises an account list needing to acquire account data;
step 209, traversing the local block chain data by the block chain node cluster according to the account list to obtain data of a corresponding account, splitting and transmitting the data of a single account, and transmitting the data of the account list in batches if the data of the account list is excessive;
step 210, caching the data flattening node to the local after receiving the account data, wherein the cache has a Merkle-Patricia Tree function; steps 208-210 are circularly executed until all account data is acquired
Step 211, after all account data are obtained, starting a data processing process to obtain a final Merkle-Patricia Tree Root Hash, if the Hash is consistent with the Root Hash obtained in fig. 1, checking the integrity and correctness of the data through account list data if the Hash is inconsistent with the Root Hash, randomly selecting other nodes, and continuously sending an 'acquire account data' command to request missing account data or check data;
step 212, since it takes seconds to minutes to perform the above steps, the blockchain generates new blocks during the period, so that the block data during the period needs to be requested;
step 213, synchronously acquiring a small amount of block data;
step 214, the block height of the data flattening node is consistent with the blockchain network, and the data of the block can be normally received, which indicates that the blockchain network has been added, and the blockchain data flattening process is completed.
Further, the data participating in consensus in the blockchain is set as all the latest account data snapshots, and each time account data is changed, a new account data snapshot is generated.
Executing transactions in a blockchain is the only way to change Merkle-Patricia Tree, where transactions include transfer transactions and call smart contract transactions, any change in state changes Merkle-Patricia Tree objects, changing the Root Hash (Root Hash refers to the Hash value of the Merkle-Patricia Tree Root node).
The nodes of the package block or the nodes of the execution block execute related transactions, change the object state of the Merkle-Patricia Tree, store the latest Root Hash in the latest block data, and finally form block data to be broadcasted to other nodes. When the node packs the block, the address of the node is recorded in the block, the local transaction is packed in the block, and finally the block is received by the whole block chain network, and the node is the node of the packed block; if the local transaction is packed when the block is packed, changing the object state of the Merkle-Patricia Tree and calculating the latest Root Hash value to write into the block, and broadcasting the block; other nodes receive the block, also execute the transaction in the block, and also change the Merkle-Patricia Tree object state and calculate the latest Root Hash value; and finally, if the Root Hash values are consistent, the consensus is reached.
The implementation of the blockchain-based data flattening will be described as a specific example:
1) Preparing a node, starting with a data flattening mark, and taking the node as a data flattening node F1;
2) Preparing a plurality of blockchain nodes N2 and N3 …, and establishing P2P network connection with an F1 node;
3) F1 collects the same block data of all block chain nodes, if the block data are consistent with the Root Hash of the block data, F1 is stored, if the block data are inconsistent with the Root Hash of the block data, F1 continues to collect until the Root Hash of the same block data are obtained consistent with each other, and the purpose of ensuring the data security is achieved;
4) F1 is used for obtaining an account command from a blockchain node, and F1 finally obtains a complete account list and caches the whole account list locally;
5) F1 sends an order of acquiring account data to all block chain nodes respectively, a block chain link point group receiving the order distributes data according to a part of account list provided by the F1, and finally the F1 receives and caches all the account data;
6) F1, constructing a Merkle-Patricia Tree object according to account data to obtain Root Hash comparison in the Root Hash and 3), checking missing data and re-requesting if the comparison is inconsistent, achieving the condition that the two hashes are consistent to indicate that a correct account data snapshot is obtained, and finally submitting the account data to a local database;
7) A small number of F1 sync-missing blocks, which are generated by the blockchain network during F1 in 3) to 6), and the final block height of F1 is consistent with the block height of the blockchain node;
8) User creates blockchain transaction and transfers 10 from account A to account B, sends the transaction to blockchain node N2, and nodes in the blockchain network package the transaction and broadcast the blockdata;
9) F1 receives the block data, respectively inquiring account A balance decrease 10 and account B balance increase 10 at an F1 node, wherein F1 is not branched in a block chain network, and F1 has data integrity through transferring different accounts for many times and calling intelligent contracts;
10 F1) periodically cleaning historical block data, transaction execution result data and historical account snapshot data so as to achieve almost no sediment data and finally realize data flattening.
Aiming at the problem that local sedimentation data is gradually increased along with the increase of the height of a blockchain in the prior art, the data flattening method based on the blockchain deletes local blockdata, transaction data, transaction execution result data and historical account data snapshot, and finally local data of a node is the most simplified, redundancy and complexity are removed, so that data flattening is achieved; if no account is newly added in the blockchain network, the node for starting the data flattening in the scheme will not have data increase.
The invention discloses a data flattening method based on a block chain, which aims at the problems of slow and high operation of synchronous data in the existing scheme, adopts a distributed synchronous account data mode to fully utilize block chain point resources, greatly improves the speed of constructing local data, can start data flattening nodes at any block height, and does not need to start synchronous data from block height 0 like the existing scheme. The synchronous data of the prior proposal is a slow and high operation task, the synchronous process is a calculation process and a history process is completely played; the scheme completely discards the low-efficiency synchronization process, takes Root Hash of given block data as a basis, fully utilizes block link point resources in a distributed mode, and efficiently constructs a local account data snapshot to form an effective block chain node.
The data flattening method based on the blockchain disclosed by the invention removes a large amount of redundant data, greatly reduces the hardware resource requirement, reduces the blockchain application landing threshold, and can be used as blockchain nodes for light mobile equipment such as mobile phones, tablets and the like; the account data is constructed in a distributed mode, and a foundation is provided for the light equipment to access the blockchain in seconds to become a blockchain node under the better condition of the network.
Example two
The present embodiment provides a data flattening system based on a blockchain, including:
a newly built module for establishing a data flattening node;
the construction module is used for acquiring account data by the data flattening nodes in a distributed mode, obtaining account data snapshots, constructing local data and participating in consensus;
and the cleaning module is used for regularly cleaning the data which do not participate in consensus so as to flatten the data of the local database of the block chain node.
Further, the newly-built module specifically includes:
a preparation unit for preparing a node, which is started by a data flattening mark and is used as the data flattening node;
the connecting unit is used for connecting the data flattening nodes with a plurality of block chain nodes through P2P;
and the comparison unit is used for collecting the same block data of all the block chain nodes connected with the data flattening nodes by the data flattening nodes, and comparing Root Hash in the block data for verification.
Further, the construction unit specifically includes:
the data flattening node sends commands for acquiring account data to a plurality of block link points in a distributed mode, the block link point groups receive the commands and acquire local data in parallel and send the local data to the data flattening node, and the data flattening node constructs local account data according to the acquired local data and constructs the latest account data snapshot object.
Further, the data participating in consensus in the blockchain is set as all the latest account data snapshots, and each time account data is changed, a new account data snapshot is generated.
The embodiment is to implement a method described in the first embodiment, and the implementation method will not be described herein.
Example III
Example III
The third embodiment of the invention provides a computer device, which comprises a memory, a processor and a computer program stored on the memory and capable of running on the processor, wherein the processor executes the program to realize the method of any one of the above.
The computer device of this embodiment includes: a processor, a memory and a computer program, such as a data processing program, stored in the memory and executable on the processor. The steps of the above-described respective networking method embodiments are implemented when the processor executes the computer program. Alternatively, the processor may implement the functions of the modules/units in the above-described device embodiments when executing the computer program.
The computer program may be divided into one or more modules/units, which are stored in the memory and executed by the processor to accomplish the present invention, for example. The one or more modules/units may be a series of computer program instruction segments capable of performing the specified functions, which instruction segments describe the execution of the computer program in the computer device.
The computer equipment can be a desktop computer, a notebook computer, a palm computer, a cloud server and other computing equipment. The computer device may include, but is not limited to, a processor, a memory.
The processor may be a central processing unit (Central Processing Unit, CPU), but may also be other general purpose processors, digital signal processors (Digital Signal Processor, DSP), application specific integrated circuits (Application Specific Integrated Circuit, ASIC), off-the-shelf programmable gate arrays (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or the like. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The memory may be an internal storage unit of the computer device, such as a hard disk or a memory of the computer device. The memory may also be an external storage device of the computer device, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card) or the like, which are provided on the computer device. Further, the memory may also include both internal storage units and external storage devices of the computer device. The memory is used for storing the computer program and other programs and data required by the computer device. The memory may also be used to temporarily store data that has been output or is to be output.
The embodiment of the invention also provides a computer readable storage medium storing a computer program, which is characterized in that the computer program enables a computer to realize the data flattening method based on the blockchain when the computer program is executed.
The foregoing describes in detail preferred embodiments of the present invention. It should be understood that numerous modifications and variations can be made in accordance with the concepts of the invention by one of ordinary skill in the art without undue burden. Therefore, all technical solutions which can be obtained by logic analysis, reasoning or limited experiments based on the prior art by the person skilled in the art according to the inventive concept shall be within the scope of protection defined by the claims.

Claims (8)

1. A method for flattening data based on a blockchain, comprising the steps of:
establishing a data flattening node; the method specifically comprises the following steps:
preparing a node, starting with a data flattening mark, and taking the node as a data flattening node;
the data flattening node is connected with a plurality of block chain nodes through P2P;
the data flattening nodes collect all block data of the same block chain node connected with the data flattening nodes, and Root Hash in the block data is compared for verification;
the data flattening node acquires the latest account data in a distributed mode, obtains an account data snapshot, constructs local data and participates in consensus;
and regularly cleaning data which does not participate in consensus, cleaning historical snapshots of account data, and achieving flattening of the local database data of the blockchain node.
2. The blockchain-based data flattening method as in claim 1, wherein the data flattening node obtains the latest account data in a distributed manner to obtain an account data snapshot, and specifically comprises:
the data flattening node sends commands for acquiring account data to a plurality of block link points in a distributed mode, the block link point groups receive the commands, acquire local data in parallel and send the local data to the data flattening node, and the data flattening node constructs local account data according to the acquired local data and constructs the latest account data snapshot object.
3. The blockchain-based data flattening method as in claim 1, wherein the data participating in consensus in the blockchain is set to be all the latest account data snapshots, and a new account data snapshot is generated each time account data changes.
4. A blockchain-based data flattening system, comprising:
a newly built module for establishing a data flattening node; the method specifically comprises the following steps:
a preparation unit for preparing a node, which is started by a data flattening mark and is used as the data flattening node;
the connecting unit is used for connecting the data flattening nodes with a plurality of blockchain nodes through P2P;
the comparison unit is used for collecting the same block data of all block chain nodes connected with the data flattening nodes by the data flattening nodes, and comparing Root Hash in the block data for verification;
the construction module is used for acquiring the latest account data by the data flattening nodes in a distributed mode to obtain an account data snapshot, constructing local data and participating in consensus;
and the cleaning module is used for regularly cleaning the data which does not participate in consensus, cleaning the historical snapshot of the account data and flattening the data of the local database of the blockchain node.
5. The blockchain-based data flattening system of claim 4, wherein the building unit specifically includes:
the data flattening node sends commands for acquiring account data to a plurality of block link points in a distributed mode, the block link point groups receive the commands and acquire local data in parallel and send the local data to the data flattening node, and the data flattening node constructs local account data according to the acquired local data and constructs the latest account data snapshot object.
6. The blockchain-based data flattening system of claim 4, wherein the data in the blockchain that is involved in consensus is set to be up-to-date all account data snapshots, and each time account data changes a new account data snapshot is generated.
7. A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the method of any of claims 1-3 when the program is executed by the processor.
8. A computer readable storage medium storing a computer program, wherein the computer program when executed causes a computer to implement a blockchain-based data flattening method as recited in any of claims 1-3.
CN202010063170.XA 2020-01-19 2020-01-19 Block chain-based data flattening method and system Active CN111241069B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010063170.XA CN111241069B (en) 2020-01-19 2020-01-19 Block chain-based data flattening method and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010063170.XA CN111241069B (en) 2020-01-19 2020-01-19 Block chain-based data flattening method and system

Publications (2)

Publication Number Publication Date
CN111241069A CN111241069A (en) 2020-06-05
CN111241069B true CN111241069B (en) 2023-10-20

Family

ID=70874775

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010063170.XA Active CN111241069B (en) 2020-01-19 2020-01-19 Block chain-based data flattening method and system

Country Status (1)

Country Link
CN (1) CN111241069B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112800129B (en) * 2020-12-31 2024-04-23 杭州趣链科技有限公司 Block state updating method, device, system and electronic equipment
US11907186B2 (en) * 2022-04-21 2024-02-20 Bank Of America Corporation System and method for electronic data archival in a distributed data network

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109145163A (en) * 2018-08-22 2019-01-04 深圳前海微众银行股份有限公司 Block chain data capacity reduction method, device and storage medium
CN109194702A (en) * 2018-06-04 2019-01-11 平安科技(深圳)有限公司 Medical data recording method, system, computer equipment and storage medium
CN109324757A (en) * 2018-08-22 2019-02-12 深圳前海微众银行股份有限公司 Block chain data capacity reduction method, device and storage medium
CN109542979A (en) * 2018-11-19 2019-03-29 广州矩阵信息科技有限公司 A kind of block catenary system Fast synchronization and the mode of simple smart data storage
CN109636388A (en) * 2018-12-07 2019-04-16 深圳市智税链科技有限公司 Data processing method, device, medium and electronic equipment in block chain network
CN110400142A (en) * 2018-06-01 2019-11-01 腾讯科技(深圳)有限公司 Data processing method, device and storage medium
CN110493325A (en) * 2019-07-31 2019-11-22 阿里巴巴集团控股有限公司 Block chain state method of data synchronization and device, electronic equipment

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10255342B2 (en) * 2017-04-12 2019-04-09 Vijay K. Madisetti Method and system for tuning blockchain scalability, decentralization, and security for fast and low-cost payment and transaction processing

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110400142A (en) * 2018-06-01 2019-11-01 腾讯科技(深圳)有限公司 Data processing method, device and storage medium
CN109194702A (en) * 2018-06-04 2019-01-11 平安科技(深圳)有限公司 Medical data recording method, system, computer equipment and storage medium
CN109145163A (en) * 2018-08-22 2019-01-04 深圳前海微众银行股份有限公司 Block chain data capacity reduction method, device and storage medium
CN109324757A (en) * 2018-08-22 2019-02-12 深圳前海微众银行股份有限公司 Block chain data capacity reduction method, device and storage medium
CN109542979A (en) * 2018-11-19 2019-03-29 广州矩阵信息科技有限公司 A kind of block catenary system Fast synchronization and the mode of simple smart data storage
CN109636388A (en) * 2018-12-07 2019-04-16 深圳市智税链科技有限公司 Data processing method, device, medium and electronic equipment in block chain network
CN110493325A (en) * 2019-07-31 2019-11-22 阿里巴巴集团控股有限公司 Block chain state method of data synchronization and device, electronic equipment

Also Published As

Publication number Publication date
CN111241069A (en) 2020-06-05

Similar Documents

Publication Publication Date Title
US11556247B2 (en) Secure and transparent pruning for blockchains
US20190354518A1 (en) Chain mesh network for decentralized transaction systems
AU2018355092B2 (en) Witness blocks in blockchain applications
CN111241069B (en) Block chain-based data flattening method and system
CN112612856B (en) Block chain-based data processing method and device
US11100094B2 (en) Taking snapshots of blockchain data
CN109710617B (en) Secure data transaction method based on Mercker certification
CN113420323B (en) Data sharing method and terminal equipment
US11194792B2 (en) Taking snapshots of blockchain data
CN113721856A (en) Digital community management data storage system
CN117370460A (en) Block chain storage optimization method and device based on double-chain storage
CN116977067A (en) Block chain-based data processing method, device, equipment and readable storage medium
CN110874492A (en) Data processing method and device, computing equipment and system
CN110363515B (en) Rights and interests card account information inquiry method, system, server and readable storage medium
CN110474954B (en) Block chain-based file sharing method and device, computer equipment and readable storage medium
CN108805741B (en) Fusion method, device and system of power quality data
CN113760519A (en) Distributed transaction processing method, device and system and electronic equipment
CN112434112A (en) Method and device for synchronously storing block chain data into database
CN111881086A (en) Big data storage method, big data query method, electronic device and storage medium
CN113379542B (en) Block chain transaction query method, device, medium and electronic equipment
US20240129143A1 (en) Dividing data storage and service operations among plural blockchains
CN117332009A (en) Data processing method and related equipment
Tulkinbekov et al. Data Collection Framework Using a Lightweight Blockchain
CN116016374A (en) Block chain-based data processing method, device, equipment and readable storage medium
CN116390058A (en) Internet of vehicles data searching method, device, equipment, medium and product

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