CN111813866A - Improved block chain account book synchronization method - Google Patents
Improved block chain account book synchronization method Download PDFInfo
- Publication number
- CN111813866A CN111813866A CN202010751855.3A CN202010751855A CN111813866A CN 111813866 A CN111813866 A CN 111813866A CN 202010751855 A CN202010751855 A CN 202010751855A CN 111813866 A CN111813866 A CN 111813866A
- Authority
- CN
- China
- Prior art keywords
- block
- blocks
- state
- node
- backup
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/27—Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
- G06F16/273—Asynchronous replication or reconciliation
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/07—Responding to the occurrence of a fault, e.g. fault tolerance
- G06F11/14—Error detection or correction of the data by redundancy in operation
- G06F11/1402—Saving, restoring, recovering or retrying
- G06F11/1446—Point-in-time backing up or restoration of persistent data
- G06F11/1448—Management of the data involved in backup or backup restore
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/07—Responding to the occurrence of a fault, e.g. fault tolerance
- G06F11/14—Error detection or correction of the data by redundancy in operation
- G06F11/1402—Saving, restoring, recovering or retrying
- G06F11/1446—Point-in-time backing up or restoration of persistent data
- G06F11/1458—Management of the backup or restore process
- G06F11/1464—Management of the backup or restore process for networked environments
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F2201/00—Indexing scheme relating to error detection, to error correction, and to monitoring
- G06F2201/80—Database-specific techniques
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Quality & Reliability (AREA)
- Databases & Information Systems (AREA)
- Computing Systems (AREA)
- Data Mining & Analysis (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The invention relates to an improved block chain account book synchronization method, which effectively solves the problems of data redundancy, disk space waste, slow synchronization block and long cost period when a new node is added in the prior art; the technical scheme for solving the problem is that when a new block is added into a network, the node can recover all world state data only by synchronizing effective blocks without synchronizing all blocks, and the operation method comprises the following steps: the current database is restored through the latest state block, the database is restored to the latest state through the block behind the latest state block, a large amount of memory and synchronization time can be saved through the design, and all blocks only need to be stored in part of the designated data backup nodes, so that the storage space of other nodes is greatly released; the invention can save a large amount of memory and synchronization time, and all blocks only need to be stored in part of the designated data backup nodes, so that the storage space of other nodes is greatly released.
Description
Technical Field
The invention relates to the technical field of block chains, in particular to an improved block chain account book synchronization method.
Background
The block chain adopts the design of distributed storage, and chain storage is adopted for the blocks, the chain storage can cause large data redundancy, and the distributed storage can also cause a large amount of storage space waste. When the number of nodes added to a blockchain network is large and the amount of transactions generated by the network is large, a large amount of space resources are wasted. In addition, when a new node wants to join the blockchain network, all blocks need to be synchronized to be consistent with data on other nodes, and when the number of blocks is large, the time period for the node to join the network is long and the cost is large.
Therefore, the present invention provides an improved method for synchronizing a blockchain ledger to solve the above-mentioned problems.
Disclosure of Invention
In view of the above situation, in order to overcome the defects of the prior art, the invention provides an improved block chain account book synchronization method, which effectively solves the problems of data redundancy, disk space waste, slow synchronization block when a new node is added and long cost period in the prior art.
Setting a common block and a state block in a block chain, wherein the common block is used for normally storing transaction data, the state block is used for storing a backup file of a state database and does not contain the transaction data, the state block is newly appeared, the state block chain is called an active block, a block before the active block is called a history block, the block-making period of the preset state block is N, so that every nN blocks are used as the state blocks, and the N value is recorded in a created block, each state block and each common block;
each common block and each status block comprise a block head and a block body, transaction data or backup files are stored in the block bodies, and the block heads comprise the HASH value of the previous block, the block number of the current block, the block number of the latest status block and the current N value;
and a block service node and a block backup node are arranged in the block chain, the block service node only backs up the active blocks, and the block backup node records all the common blocks and the state blocks in real time without executing other service functions.
Preferably, the transaction data is stored in a common block and the status data is stored in a non-relational database.
Preferably, the transaction data stored in the common block includes contract name, participation, execution result, transaction time, and user signature information related to each transaction;
the non-relational database stores the unique identification of the user and the asset value corresponding to the identification.
Preferably, the storage space of the block backup node is 500 GB-2 TB.
Preferably, each node can be used as a block backup node to backup all block information and also can be used as a block service node to execute a block chain service function.
The invention makes improvement aiming at the problems of data redundancy, disk space waste, slow synchronization block when a new node is added and long cost period in the prior art, and can effectively solve the problems of data redundancy, disk space waste and the like by setting the periodic storage; the invention can save a large amount of memory and synchronization time, and all blocks only need to be stored in part of the appointed data backup nodes, so that the storage space of other nodes is greatly released.
Drawings
FIG. 1 is a diagram illustrating the relationship between status blocks and normal blocks according to the present invention.
FIG. 2 is a diagram illustrating the relationship between history blocks and active blocks according to the present invention.
FIG. 3 is a block head structure of the status block of the present invention.
Detailed Description
The foregoing and other aspects, features and advantages of the invention will be apparent from the following more particular description of embodiments of the invention, as illustrated in the accompanying drawings in which reference is made to figures 1 to 3. The structural contents mentioned in the following embodiments are all referred to the attached drawings of the specification.
In the description of the present invention, it is to be understood that the terms "upper", "middle", "outer", "inner", and the like, indicate orientations or positional relationships, are used for convenience in describing the present invention and simplifying the description, but do not indicate or imply that the referenced components or elements must have a particular orientation, be constructed and operated in a particular orientation, and thus, should not be construed as limiting the present invention.
Exemplary embodiments of the present invention will be described below with reference to the accompanying drawings.
The first embodiment of the present invention is an improved block chain ledger synchronization method, which introduces the following concept word meanings:
a state block: for state database backup, the backup file is treated as a single block, called a state block. The status block only contains the backup file and does not contain other transaction data. Storing the normal state blocks by taking N as a period;
history block: all blocks before (not including) the latest status block are called history blocks;
active block: the latest state block and all blocks after the latest state block are called active blocks;
and block backup node: synchronizing only all blocks nodes that do not perform any on-chain transactions;
the block service node: in order to distinguish from the block backup nodes, the nodes in the original design of the block chain architecture, which are responsible for executing related services such as intelligent contracts, blocking, consensus and the like, are collectively called block service nodes;
setting a common block and a state block in a block chain, wherein the common block is used for normally storing transaction data, the state block is used for containing a backup file but not transaction data, the block-making period of the state block is preset to be N, so that every nN blocks are state blocks, and the N value is recorded in the created block, each state block and each common block;
there are two types of data in a general blockchain, one type is transaction data occurring in a blockchain network, such as transfer records between certain accounts, registration records of new users, creation of intelligent contracts, and the like, and the data is characterized in that: permanent storage is required, once validated, no longer changes; the other type is state data, such as the number of coins held by a person, a value corresponding to a certain key and the like, the data is characterized by frequent change, frequent inquiry and modification, and different storage modes are adopted for respectively recording the two types of data, so that the block chain network is more efficient;
for the first type of data, due to the unchangeable characteristic, in the actual business, only the operation of viewing the first type of data is needed, and the first type of data does not need to be modified. The method is suitable for directly storing the data in the block, for the second class of data, as the data are frequently changed and the current state (value) of the data are frequently used in the service instead of the historical state (value), a non-relational database can be selected for storing, so that the data are convenient to read and modify and high in efficiency, the database records the current states of all keys and is called a state database, and the non-relational database can adopt a levelDB or a coreDB which is frequently used at present;
the block is divided into two types, one type is a common block, namely a block formed by blocking the transaction record in normal business, and the common block is the transaction record generated by the intelligent contract; another is a world state block (hereinafter referred to as "state block"), where the state block stores the current backup file of the state database in a block file in a block form, so that the state database can be restored through the state block, and the state block is blocked in N cycles (N is referred to as a backup cycle by default), for example: if N =100, after the 99 th block is blocked, the node automatically backs up the current state of the database, and adds the backup file as the nth block into the block chain, where the block of the state block only contains the backup file of the database and does not contain any transaction record, and the value of N needs to be recorded in the created block and the state block;
each common block and each status block comprise a block head and a block body, transaction data or backup files are stored in the block body, and the block head comprises a HASH value of a previous block, a block number of a current block and a current N value;
the block service node only backs up an active block, the block backup node records all common blocks and state blocks in real time without executing other service functions, the node is additionally provided with a class of block backup nodes on the original basis, the block backup nodes are used for synchronizing the blocks in real time, all blocks on the chain are recorded, no service function is executed, the block backup node needs a larger storage space, specifically, 500 GB-2 TB, the node can be set according to the service volume, the 500GB with small service volume can be used, if the service volume is large, 1TB or even 2TB can be needed, in addition, the original block service node is modified, the block service node does not need to back up all blocks, only the active block needs to participate in the blocking service, one node can simultaneously play multiple roles, namely the node can simultaneously serve as the block backup node to back up all block information, The system can also be used as a service node to execute the function of block chain service;
when a new block is added into the network, the corresponding node does not need to synchronize all the blocks, and only needs to synchronize the active blocks, so that all the world state data can be recovered, and the specific operation principle is as follows: the current database is restored through the latest state block, and the database is restored to the latest state through the blocks behind the latest state block, so that a large amount of memory and synchronization time are saved.
Second embodiment, on the basis of the first embodiment, this embodiment provides a specific case that, in a certain asset transaction platform, a person owns 100 shares of tokens, the user can take the tokens to perform transaction, the transaction must be implemented by a customized intelligent contract, during the transaction, the assets of the user are changed, the user is stored in the database by a unique identification key, and the corresponding assets are the value (value) corresponding to the key;
the user calls the intelligent contract to generate transaction, in the execution process of the intelligent contract, log recording is carried out on the intelligent contract, the transaction log comprises the name, the input parameter, the execution result, the transaction time and the like of the intelligent contract, the transaction log is stored in a common block, and the identification key of the user and the asset value of the user are stored in a non-relational database, namely the non-relational database is used as a data storage module; the addition, deletion, modification and check of the database are realized through intelligent contracts; and the log generated by calling the intelligent contract is recorded in the common block.
The invention makes improvement aiming at the problems of data redundancy, disk space waste, slow synchronization block when a new node is added and long cost period in the prior art, and can effectively solve the problems of data redundancy, disk space waste and the like by setting the periodic storage; the invention can save a large amount of memory and synchronization time, and all blocks only need to be stored in part of the appointed data backup nodes, so that the storage space of other nodes is greatly released.
Claims (5)
1. An improved block chain account book synchronization method is characterized in that a common block and a state block are arranged in a block chain, the common block is used for normally storing transaction data, the state block is used for storing a backup file of a state database and does not contain the transaction data, the state block is newly appeared and the state block chain is called an active block, a block before the active block is called a history block, the block making period of the preset state block is N, so that every nN blocks are used as the state blocks, and the N value is recorded in a created block, each state block and each common block;
each common block and each status block comprise a block head and a block body, transaction data or backup files are stored in the block bodies, and the block heads comprise the HASH value of the previous block, the block number of the current block, the block number of the latest status block and the current N value;
and a block service node and a block backup node are arranged in the block chain, the block service node only backs up the active blocks, and the block backup node records all the common blocks and the state blocks in real time without executing other service functions.
2. An improved blockchain ledger synchronization method in accordance with claim 1 wherein transaction data is stored in normal blocks and status data is stored in non-relational databases.
3. The improved blockchain ledger synchronization method of claim 2 wherein the transaction data stored in the common block includes contract name, entries, execution result, transaction time, user signature information associated with each transaction;
the non-relational database stores the unique identification of the user and the asset value corresponding to the identification.
4. The method of claim 1, wherein the storage space of the blockchain ledger node is 500 GB-2 TB.
5. An improved synchronization method for blockchain accounts as claimed in claim 1 or 4, wherein each node can be used as a block backup node to backup all block information and also as a block service node to perform blockchain service function.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010751855.3A CN111813866B (en) | 2020-07-30 | 2020-07-30 | Improved block chain account book synchronization method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010751855.3A CN111813866B (en) | 2020-07-30 | 2020-07-30 | Improved block chain account book synchronization method |
Publications (2)
Publication Number | Publication Date |
---|---|
CN111813866A true CN111813866A (en) | 2020-10-23 |
CN111813866B CN111813866B (en) | 2021-03-16 |
Family
ID=72862859
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202010751855.3A Active CN111813866B (en) | 2020-07-30 | 2020-07-30 | Improved block chain account book synchronization method |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN111813866B (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112383610A (en) * | 2020-11-11 | 2021-02-19 | 上海保险交易所股份有限公司 | Synchronous processing method and system for block chain state data |
CN115878729A (en) * | 2023-03-03 | 2023-03-31 | 湖北省楚天云有限公司 | Node block storage allocation optimization method and system based on alliance chain |
Citations (17)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US9703644B1 (en) * | 2014-12-09 | 2017-07-11 | EMC IP Holding Company LLC | Methods for generating a synthetic backup and for consolidating a chain of backups independent of endianness |
WO2018135766A1 (en) * | 2017-01-19 | 2018-07-26 | 주식회사 케이티 | Device and method for managing data by using block chain |
CN108737370A (en) * | 2018-04-05 | 2018-11-02 | 西安电子科技大学 | A kind of cross-domain Verification System of Internet of Things based on block chain and method |
CN108810119A (en) * | 2018-05-31 | 2018-11-13 | 中国联合网络通信集团有限公司 | block chain processing method, device and block chain node |
CN109191124A (en) * | 2018-08-16 | 2019-01-11 | 北京京东尚科信息技术有限公司 | Block chain network, dispositions method and storage medium |
CN109241032A (en) * | 2018-08-16 | 2019-01-18 | 北京京东尚科信息技术有限公司 | Account book database component, operation method and storage medium |
CN109325855A (en) * | 2018-08-16 | 2019-02-12 | 北京京东尚科信息技术有限公司 | Block chain network, dispositions method and storage medium |
CN109325854A (en) * | 2018-08-16 | 2019-02-12 | 北京京东尚科信息技术有限公司 | Block chain network, dispositions method and storage medium |
CN109493222A (en) * | 2018-10-18 | 2019-03-19 | 尚维斯 | A kind of method of any number of block chain account book real-time synchronizations |
KR20190059491A (en) * | 2017-11-23 | 2019-05-31 | 박동화 | System and method for e-commerce with shared and distributed ledger coupled with outer storage devices |
CN109886690A (en) * | 2019-03-06 | 2019-06-14 | 上海共链信息科技有限公司 | A kind of method that block chain synchronizes account book |
CA2995177A1 (en) * | 2018-02-14 | 2019-08-14 | Beijing Tiande Technologies Limited | A method of state synchronization for complex smart contracts based on stage buckets |
CN110390525A (en) * | 2019-07-31 | 2019-10-29 | 中国工商银行股份有限公司 | The direct access method and block chain node of block chain world state |
CN110427346A (en) * | 2019-08-13 | 2019-11-08 | 河南中盾云安信息科技有限公司 | A kind of document storage system and its file memory method based on block chain |
CN110443074A (en) * | 2019-08-01 | 2019-11-12 | 河南中盾云安信息科技有限公司 | A kind of method of block chain node data integrity detection |
US20200004438A1 (en) * | 2018-06-29 | 2020-01-02 | EMC IP Holding Company LLC | Block based striped backups |
US20200117550A1 (en) * | 2018-10-12 | 2020-04-16 | EMC IP Holding Company LLC | Method, device and computer program product for backing up data |
-
2020
- 2020-07-30 CN CN202010751855.3A patent/CN111813866B/en active Active
Patent Citations (17)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US9703644B1 (en) * | 2014-12-09 | 2017-07-11 | EMC IP Holding Company LLC | Methods for generating a synthetic backup and for consolidating a chain of backups independent of endianness |
WO2018135766A1 (en) * | 2017-01-19 | 2018-07-26 | 주식회사 케이티 | Device and method for managing data by using block chain |
KR20190059491A (en) * | 2017-11-23 | 2019-05-31 | 박동화 | System and method for e-commerce with shared and distributed ledger coupled with outer storage devices |
CA2995177A1 (en) * | 2018-02-14 | 2019-08-14 | Beijing Tiande Technologies Limited | A method of state synchronization for complex smart contracts based on stage buckets |
CN108737370A (en) * | 2018-04-05 | 2018-11-02 | 西安电子科技大学 | A kind of cross-domain Verification System of Internet of Things based on block chain and method |
CN108810119A (en) * | 2018-05-31 | 2018-11-13 | 中国联合网络通信集团有限公司 | block chain processing method, device and block chain node |
US20200004438A1 (en) * | 2018-06-29 | 2020-01-02 | EMC IP Holding Company LLC | Block based striped backups |
CN109191124A (en) * | 2018-08-16 | 2019-01-11 | 北京京东尚科信息技术有限公司 | Block chain network, dispositions method and storage medium |
CN109241032A (en) * | 2018-08-16 | 2019-01-18 | 北京京东尚科信息技术有限公司 | Account book database component, operation method and storage medium |
CN109325855A (en) * | 2018-08-16 | 2019-02-12 | 北京京东尚科信息技术有限公司 | Block chain network, dispositions method and storage medium |
CN109325854A (en) * | 2018-08-16 | 2019-02-12 | 北京京东尚科信息技术有限公司 | Block chain network, dispositions method and storage medium |
US20200117550A1 (en) * | 2018-10-12 | 2020-04-16 | EMC IP Holding Company LLC | Method, device and computer program product for backing up data |
CN109493222A (en) * | 2018-10-18 | 2019-03-19 | 尚维斯 | A kind of method of any number of block chain account book real-time synchronizations |
CN109886690A (en) * | 2019-03-06 | 2019-06-14 | 上海共链信息科技有限公司 | A kind of method that block chain synchronizes account book |
CN110390525A (en) * | 2019-07-31 | 2019-10-29 | 中国工商银行股份有限公司 | The direct access method and block chain node of block chain world state |
CN110443074A (en) * | 2019-08-01 | 2019-11-12 | 河南中盾云安信息科技有限公司 | A kind of method of block chain node data integrity detection |
CN110427346A (en) * | 2019-08-13 | 2019-11-08 | 河南中盾云安信息科技有限公司 | A kind of document storage system and its file memory method based on block chain |
Non-Patent Citations (3)
Title |
---|
周云: ""基于区块链的信息网络信任支撑环境构建研究"", 《信息安全与通信保密》 * |
蔡维德 等: ""基于区块链的应用系统开发方法研究"", 《软件学报》 * |
贺海武、延安、陈泽华: ""基于区块链的智能合约技术与应用综述"", 《计算机研究与发展》 * |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112383610A (en) * | 2020-11-11 | 2021-02-19 | 上海保险交易所股份有限公司 | Synchronous processing method and system for block chain state data |
CN115878729A (en) * | 2023-03-03 | 2023-03-31 | 湖北省楚天云有限公司 | Node block storage allocation optimization method and system based on alliance chain |
CN115878729B (en) * | 2023-03-03 | 2023-05-02 | 湖北省楚天云有限公司 | Node block storage allocation optimization method and system based on alliance chain |
Also Published As
Publication number | Publication date |
---|---|
CN111813866B (en) | 2021-03-16 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110471795B (en) | Block chain state data recovery method and device and electronic equipment | |
CN110493325B (en) | Block chain state data synchronization method and device and electronic equipment | |
US11494270B2 (en) | Data backup method, storage medium, and computing device | |
CN110457319B (en) | Block chain state data storage method and device and electronic equipment | |
CN101216821B (en) | Data acquisition system storage management method | |
CN110263014A (en) | Block chain storage system and method towards timing type data | |
CN103780638B (en) | Method of data synchronization and system | |
CN110309218B (en) | Data exchange system and data writing method | |
CN106484906B (en) | Distributed object storage system flash-back method and device | |
CN111813866B (en) | Improved block chain account book synchronization method | |
CN111143476B (en) | Intelligent contract data rapid query method based on database | |
CN111770149B (en) | Novel alliance chain system based on distributed storage | |
CN102388369B (en) | Be derived from the life cycle of the granularity application data of single backup | |
CN101017453A (en) | Method and system for managing deletions in backup sets | |
KR102038529B1 (en) | System for processing real-time data modification of in-memory database | |
CN102142024A (en) | Logical data backup and rollback using incremental capture in a distributed database | |
CN101692226A (en) | Storage method of mass filing stream data | |
WO2021057482A1 (en) | Method and device for generating bloom filter in blockchain | |
CN114780285A (en) | Block chain data recovery method and device and electronic equipment | |
CN110096509A (en) | Realize that historical data draws the system and method for storage of linked list modeling processing under big data environment | |
CN112015697A (en) | Method and system for archiving data on block chain | |
CN102073690B (en) | Method for constructing memory database supporting historical Key information | |
CN111651498A (en) | Efficient retrieval method and device for block chain data | |
CN112800066B (en) | Index management method, related equipment and storage medium | |
CN106656522A (en) | Data calculation method and system of cross-data center |
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 |