CN111597262A - Method and system for managing block data in block chain - Google Patents

Method and system for managing block data in block chain Download PDF

Info

Publication number
CN111597262A
CN111597262A CN202010406741.5A CN202010406741A CN111597262A CN 111597262 A CN111597262 A CN 111597262A CN 202010406741 A CN202010406741 A CN 202010406741A CN 111597262 A CN111597262 A CN 111597262A
Authority
CN
China
Prior art keywords
block
data
child
sub
objects
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
Application number
CN202010406741.5A
Other languages
Chinese (zh)
Other versions
CN111597262B (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.)
Beijing Peersafe Technology Co ltd
Original Assignee
Beijing Peersafe 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 Beijing Peersafe Technology Co ltd filed Critical Beijing Peersafe Technology Co ltd
Priority to CN202010406741.5A priority Critical patent/CN111597262B/en
Publication of CN111597262A publication Critical patent/CN111597262A/en
Application granted granted Critical
Publication of CN111597262B publication Critical patent/CN111597262B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

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/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • 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
    • 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/28Databases characterised by their database models, e.g. relational or object models
    • G06F16/284Relational databases
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Abstract

The invention provides a method for managing block data in a block chain, which comprises the following steps: 1) creating a new block object for each new block, wherein the child object included in the block object is consistent with the child object of the parent block of the block object, and the block object records the position and the abstract value of the child object; 2) calculating the child objects to be modified in the new block, and modifying; 3) for the modified child object, changing the position and the abstract value of the child object included in the parent object; 4) the modification is performed recursively until the block object is reached. The invention also correspondingly provides a management system of the block data in the block chain. The invention can effectively manage the block data, improve the reuse rate of the multi-block common data, accelerate the production speed of the block and ensure that the management efficiency of the block data by the block link points is higher.

Description

Method and system for managing block data in block chain
Technical Field
The present invention belongs to the technical field of data memory object management, and more particularly, to a management method and a management system for block data in a block chain.
Background
The block generation and management scheme of the current block chain is simple. In the blockchain system of the UTXO system represented by the bitcoin, there is no concept of balance, and what the node program needs to pay attention to is how to manage the unconsumed transaction under one account, i.e., the UTXO. However, in the block chain system of the "account-balance" system represented by the ethernet, the balance of a certain account at a certain time needs to be found out, unlike the UTXO system, the balance of the account can be directly found out on data corresponding to a block, instead of traversing and counting all transactions of the user, which is a great characteristic of the "account-balance" system.
In an "account-balance" system, the balance of each account on each tile may be different due to the concept of balance, while the accounts on adjacent tiles do not differ significantly. That is, there are cases where the blocks are not identical, but the difference is not very large.
How to use this feature is important to consider how to make each block share common data and make certain distinction.
The current block chain system will divide each block separately, create the block object first, and then load the corresponding data under the block, which is a forward loading method, and this method has low efficiency
Disclosure of Invention
In view of the problems in the background art, the present invention provides a new block memory organization method, which relates to three aspects of basic block design, a new block generation method and block storage/loading, and can be referred by a block link node program for use. One of the important modules in the node of the block chain is the memory object management of the block, how to design the management scheme of the block directly affects the speed of producing the block in the block chain network, and the reasonable block management scheme also affects the memory use efficiency of the node process. The invention provides a new implementation scheme for the block memory object of the block chain node.
The invention provides a method for managing block data in a block chain, which comprises the following steps:
1) creating a new block object for each new block, wherein the child object included in the block object is consistent with the child object of the parent block of the block object, and the block object records the position and the abstract value of the child object;
2) calculating the child objects to be modified in the new block, and modifying;
3) for the modified child object, changing the position and the abstract value of the child object included in the parent object;
4) the modification is performed recursively until the block object is reached.
The invention also provides a system for managing block data in a block chain, which comprises a processor, wherein the processor can complete the following steps:
1) creating a new block object for each new block, wherein the child object included in the block object is consistent with the child object of the parent block of the block object, and the block object records the position and the abstract value of the child object;
2) calculating the child objects to be modified in the new block, and modifying;
3) for the modified child object, changing the position and the abstract value of the child object included in the parent object;
4) the modification is performed recursively until the block object is reached.
According to the method, the data structure of the basic block is designed, and the parent object is modified through firstly modifying the leaf object and then backtracking and recursively modifying the leaf object, so that the block data is effectively managed, the reuse rate of multi-block common data is improved, the production speed of the block is increased, and the management efficiency of the block link point to the block data is higher.
Drawings
In order that the invention may be more readily understood, it will be described in more detail with reference to specific embodiments thereof that are illustrated in the accompanying drawings. These drawings depict only typical embodiments of the invention and are not therefore to be considered to limit the scope of the invention.
FIG. 1 is a block-based data structure.
FIG. 2 is a flow diagram of modifying a data object within a block.
FIG. 3 is a flow chart of reading object data during block loading.
Detailed Description
Embodiments of the present invention will now be described with reference to the drawings, wherein like parts are designated by like reference numerals. The embodiments described below and the technical features of the embodiments may be combined with each other without conflict.
As shown in fig. 1, the present invention first proposes a block basic data structure. In the basic data structure, a tile is also essentially an object, each tile object containing N sub-objects, each sub-object having a pointer and summary data. These pointers and summary data are maintained by the tile objects. That is, each tile object maintains N pointers and N summary data (preferably, 16 pointers and 16 summary data are used, and 16 is taken as an example to describe the present invention). The object pointed by each pointer corresponds to the original object of each summary data one by one, that is, the summary data of the child object pointed by the first pointer is recorded at the position of the first summary data, and so on.
The object pointed to by each pointer in a tile may be a null object (null value), a leaf object, or a node object. Leaf objects are useful user entity data such as user address, user actions, etc. The node objects, like folders, may contain leaf objects and node objects. Each node object also contains 16 pointers and 16 summary data.
The tile object is a special node object, and M layers (for example, 64 layers) of data are set from the tile object to the lowest layer object. The 16 pointers and 64 layers of data are selected as above, depending on the programming implementation. The digest value of the data is 256 bits, the maximum representable number of 4 bits is 16, the positions of exactly 16 child nodes can be specified, if the positions represented by some 4 bits already have data, the positions of the data need to be confirmed by another 4 bits, and in order to avoid collision, the positions are sunk by one layer, so that 256/4 is sunk to 64 layers in total. The position can also be represented by 8 bits, so that 256 child nodes can exist, and 32 layers can be sunk; if 2 bits are designed to represent the position, then there can be 4 child nodes, and 128 layers will be sunk.
In summary, the basic data structure of the block of the present invention is characterized as follows:
1) each block object comprises 16 sub-objects;
2) each block object records a pointer (which can also be other data as long as the storage position of the sub-object can be found) and abstract data of the sub-object;
3) each sub-object type is divided into a leaf object, a node object and a null object;
4) each node object also contains 16 child objects and pointers and summary data for the corresponding objects.
The generation method of the new block based on the block base data structure is described below with reference to fig. 2.
S1, a tile object is created, wherein the 16 pointers and the 16 summary data follow the values recorded in the parent tile. The new block and the parent block are different objects at this time, but the values are the same except for the block number and the time. I.e. the content pointed to by the two blocks at the moment is identical.
And S2, checking the transaction generated during the round of consensus and modifying the corresponding node object. At this time, instead of modifying on the basis of the original object, an object new entry is created, and the correct value is recorded in the new object. Taking an example as an example: for example, a transaction where a user a (2 nd leaf object at level 6) transfers 100 dollars to a user B (8 th leaf object at level 5) may cause the 2 nd leaf object at level 6 to change from the 8 th leaf object at level 5. Instead of modifying on the basis of the two original objects, an object is now created in which the correct values are recorded, namely: account a has 500 yuan and account B has 300 yuan.
S3, the parent object of the corresponding leaf object is modified, and the corresponding pointer value and the digest value are modified. For example, the corresponding record of the child object in the parent object is the nth pointer and the nth object, at this time, the nth pointer is changed to the pointer of the new object new entry in S2, and the nth digest value is changed to the digest value of the new object new entry in S2.
Since S3 directly affects the parent object of the parent object, S4 performs the same operation in the recursive upward direction. I.e. modifying the parent object, whose child objects have been altered, up to the tile root object. Some pointers and digest values recorded in the final tile root object are changed.
At this time, the content recorded in the new block is different from the parent block, but is limited to some leaf objects and corresponding node objects that are slightly changed.
In summary, the method for generating the new block is characterized in that:
1) creating a new object for each new block, wherein the child object contained in the new block object is consistent with the child object of the parent block;
2) calculating a leaf object to be modified in the new block, and modifying;
3) for leaf objects that have been modified, the content of their parent object is altered: including pointers and digest values corresponding to the child objects;
4) the modifications are recursively made until the block object.
The following describes the storage and loading method of the block based on the block basic data structure with reference to fig. 3.
T1, record the basic information data of the block in the relational data table, including the summary data of the block itself. The object data of the block content is recorded in a key-value database, and each abstract value corresponds to one block object data. The digest value is key, and the serialized data corresponding to the child object is value.
And T2, reading the block summary data from the relational database during loading, reading the block object data from the key-value database according to the summary values, wherein the object data records the summary values of the sub-objects, reading the data of the sub-objects according to the summary values, allocating memory spaces for the sub-objects, and recording the pointers of the sub-objects at the corresponding positions of the 16 pointers. If the node object exists in the sub-object, each sub-object of the node object is continued, and the sub-objects are recursively read until all the sub-objects do not contain the node object, and at the moment, the block data is completely loaded.
In summary, the storage and loading method of the block is characterized in that:
1) and (3) storing: the basic information data of the block is recorded in a relational data table, and the object data of the block content is recorded in a key-value database.
2) Loading: reading the block summary data from the relational database, and then reading all object data from the key-value database according to the summary value recursion.
The invention also proposes a system for managing block data in a block chain, said system having a processor capable of carrying out the method steps as described above.
The above-described embodiments are merely preferred embodiments of the present invention, and general changes and substitutions by those skilled in the art within the technical scope of the present invention are included in the protection scope of the present invention.

Claims (10)

1. A method for managing block data in a block chain, comprising:
1) creating a new block object for each new block, wherein the child object included in the block object is consistent with the child object of the parent block of the block object, and the block object records the position and the abstract value of the child object;
2) calculating the child objects to be modified in the new block, and modifying;
3) for the modified child object, changing the position and the abstract value of the child object included in the parent object;
4) the modification is performed recursively until the block object is reached.
2. The method for managing block data in a block chain according to claim 1,
each sub-object type is divided into a leaf object, a node object and an empty object, and the node object comprises the leaf object and/or the node object.
3. The method for managing block data in a block chain according to claim 1,
the block object records the position of the sub-object as a pointer of the sub-object.
4. A method for managing block data in a block chain according to claim 3, further comprising:
the basic information data of the block is recorded in a relational data table, the basic information data comprises summary data of the block, object data of the block content is recorded in a key-value database, and each summary value corresponds to one block object data.
5. The method for managing block data in a block chain according to claim 4, further comprising:
when loading, reading the block abstract data from the relational database, reading the block object data from the key-value database according to the abstract values, recording the abstract values of all sub-objects in the object data, respectively reading the data of all the sub-objects according to the abstract values, allocating storage spaces for the sub-objects, and recording the pointers of the sub-objects at the corresponding positions of the pointers.
6. A system for managing block data in a block chain, the system having a processor capable of performing the steps of:
1) creating a new block object for each new block, wherein the child object included in the block object is consistent with the child object of the parent block of the block object, and the block object records the position and the abstract value of the child object;
2) calculating the child objects to be modified in the new block, and modifying;
3) for the modified child object, changing the position and the abstract value of the child object included in the parent object;
4) the modification is performed recursively until the block object is reached.
7. A system for managing block data in a block chain according to claim 6,
each sub-object type is divided into a leaf object, a node object and an empty object, and the node object comprises the leaf object and/or the node object.
8. A system for managing block data in a block chain according to claim 6,
the block object records the position of the sub-object as a pointer of the sub-object.
9. A system for managing block data in a block chain according to claim 8, further comprising:
the basic information data of the block is recorded in a relational data table, the basic information data comprises summary data of the block, object data of the block content is recorded in a key-value database, and each summary value corresponds to one block object data.
10. A system for managing block data in a block chain according to claim 9, further comprising:
when loading, reading the block abstract data from the relational database, reading the block object data from the key-value database according to the abstract values, recording the abstract values of all sub-objects in the object data, respectively reading the data of all the sub-objects according to the abstract values, allocating storage spaces for the sub-objects, and recording the pointers of the sub-objects at the corresponding positions of the pointers.
CN202010406741.5A 2020-05-14 2020-05-14 Management method and management system for block data in block chain Active CN111597262B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010406741.5A CN111597262B (en) 2020-05-14 2020-05-14 Management method and management system for block data in block chain

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010406741.5A CN111597262B (en) 2020-05-14 2020-05-14 Management method and management system for block data in block chain

Publications (2)

Publication Number Publication Date
CN111597262A true CN111597262A (en) 2020-08-28
CN111597262B CN111597262B (en) 2023-05-02

Family

ID=72190741

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010406741.5A Active CN111597262B (en) 2020-05-14 2020-05-14 Management method and management system for block data in block chain

Country Status (1)

Country Link
CN (1) CN111597262B (en)

Citations (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107169055A (en) * 2017-04-27 2017-09-15 北京众享比特科技有限公司 The operating method and operating system of a kind of database table
CN107743064A (en) * 2017-09-28 2018-02-27 深圳市易成自动驾驶技术有限公司 The common recognition method and system of block chain
WO2018124716A1 (en) * 2016-12-29 2018-07-05 주식회사 코인플러그 Method for providing integrated point service by using merkle tree structure in utxo-based protocol, and support server using same
CN108520415A (en) * 2018-04-26 2018-09-11 泰康保险集团股份有限公司 Data processing method based on block chain and device
CN108846659A (en) * 2018-06-13 2018-11-20 深圳前海微众银行股份有限公司 Transfer account method, device and storage medium based on block chain
WO2019021107A1 (en) * 2017-07-24 2019-01-31 nChain Holdings Limited Computer-implemented system and method for managing a large distributed memory pool in a blockchain network
CN109408521A (en) * 2018-09-28 2019-03-01 上海擎沣投资控股有限公司 A kind of method and device thereof for more new block chain global data state
CN110347684A (en) * 2019-06-28 2019-10-18 阿里巴巴集团控股有限公司 Based on the classification storage method and device of block chain, electronic equipment
CN110347660A (en) * 2019-06-28 2019-10-18 阿里巴巴集团控股有限公司 Based on the classification storage method and device of block chain, electronic equipment
CN110457319A (en) * 2019-07-31 2019-11-15 阿里巴巴集团控股有限公司 Block chain state date storage method and device, electronic equipment
CN110471795A (en) * 2019-07-31 2019-11-19 阿里巴巴集团控股有限公司 Block chain state data reconstruction method and device, electronic equipment
JP2020046961A (en) * 2018-09-19 2020-03-26 富士通株式会社 Transaction management device, transaction management method and transaction management program

Patent Citations (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2018124716A1 (en) * 2016-12-29 2018-07-05 주식회사 코인플러그 Method for providing integrated point service by using merkle tree structure in utxo-based protocol, and support server using same
CN107169055A (en) * 2017-04-27 2017-09-15 北京众享比特科技有限公司 The operating method and operating system of a kind of database table
WO2019021107A1 (en) * 2017-07-24 2019-01-31 nChain Holdings Limited Computer-implemented system and method for managing a large distributed memory pool in a blockchain network
CN107743064A (en) * 2017-09-28 2018-02-27 深圳市易成自动驾驶技术有限公司 The common recognition method and system of block chain
CN108520415A (en) * 2018-04-26 2018-09-11 泰康保险集团股份有限公司 Data processing method based on block chain and device
CN108846659A (en) * 2018-06-13 2018-11-20 深圳前海微众银行股份有限公司 Transfer account method, device and storage medium based on block chain
JP2020046961A (en) * 2018-09-19 2020-03-26 富士通株式会社 Transaction management device, transaction management method and transaction management program
CN109408521A (en) * 2018-09-28 2019-03-01 上海擎沣投资控股有限公司 A kind of method and device thereof for more new block chain global data state
CN110347684A (en) * 2019-06-28 2019-10-18 阿里巴巴集团控股有限公司 Based on the classification storage method and device of block chain, electronic equipment
CN110347660A (en) * 2019-06-28 2019-10-18 阿里巴巴集团控股有限公司 Based on the classification storage method and device of block chain, electronic equipment
CN110457319A (en) * 2019-07-31 2019-11-15 阿里巴巴集团控股有限公司 Block chain state date storage method and device, electronic equipment
CN110471795A (en) * 2019-07-31 2019-11-19 阿里巴巴集团控股有限公司 Block chain state data reconstruction method and device, electronic equipment

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
SHANGPING WANG等: ""A Blockchain-Based Framework for Data Sharing With Fine-Grained Access Control in Decentralized Storage Systems"", 《IEEE ACCESS 》 *
周坚等: ""基于嵌套Merkle Hash tree区块链的云数据动态审计模型"", 《计算机应用》 *

Also Published As

Publication number Publication date
CN111597262B (en) 2023-05-02

Similar Documents

Publication Publication Date Title
CN110471795B (en) Block chain state data recovery method and device and electronic equipment
TWI731595B (en) Block chain state data storage method and device, and electronic equipment
US7363325B2 (en) Synchronizable transactional database method and system
EP2069979B1 (en) Dynamic fragment mapping
US6532476B1 (en) Software based methodology for the storage and retrieval of diverse information
CN103631538A (en) Cold and hot data identification threshold value calculation method, device and system
CN101441563A (en) Automated solution for generating architectural design models for service-oriented architecture (SOA) information services
CN103473298B (en) Data archiving method and device and storage system
CN101763415B (en) Method and device for generating B tree index of database
US6941309B2 (en) Object integrated management system
CN103890856A (en) Shiftable memory supporting in-memory data structures
CN109558453B (en) Block chain data network storage and relocation method
CN112988912B (en) Block chain data storage method and device and electronic equipment
CN106844288A (en) A kind of random string generation method and device
CN106294423A (en) Data base divides wiring method and the device of table
CN110597805B (en) Memory index structure processing method
CN104133970A (en) Data space management method and device
CN111597262B (en) Management method and management system for block data in block chain
WO2015129109A1 (en) Index management device
CN112988911B (en) Block chain data storage method and device and electronic equipment
CN110096550B (en) Design and implementation method of block chain-based storage structure
US7577673B2 (en) Organising data in a database
CN112287032A (en) Block chain data storage method and device and block chain link points
CN107592368A (en) Distributed Data Synchronization route selection method, storage medium, equipment and system
CN110232139B (en) SOC data management method suitable for embedded software

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