# US 11,030,175 B2 · Blockchain based hierarchical data storage

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 11,030,175 B2
- Document ID: US11030175B2
- Status: Granted
- Kind: B2
- Application number: 17/091,571
- Filed: 2020-11-06
- Published: 2021-02-25
- Granted: 2021-06-08
- Earliest claimed: 2019-06-28
- Assignees: Advanced New Technologies Co., Ltd.
- Applicants: Advanced New Technologies Co., Ltd.
- Inventors: Zhonghao Lu; Haizhen Zhuo; Benquan Yu
- Web page: https://patentgrep.com/patent/US11030175B2

## CPC

- G06F 16/2246: {Trees, e.g. B+trees}
- G06F 16/214: {Database migration support}
- G06F 16/27: Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
- H04L 9/3239: {involving non-keyed hash functions, e.g. modification detection codes [MDCs], MD5, SHA or RIPEMD}
- H04L 9/50: {using hash chains, e.g. blockchains or hash trees}
- H04L 63/12: {Applying verification of the received information (cryptographic mechanisms or cryptographic arrangements for data integrity or data verification H04L9/32)}
- H04L 67/104: Peer-to-peer [P2P] networks
- H04L 67/1097: for distributed storage of data in networks, e.g. transport arrangements for network file system [NFS], storage area networks [SAN] or network attached storage [NAS]
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)
- H04L: TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION (arrangements common to telegraphic and telephonic communication H04M)

## Abstract

Disclosed herein are methods, systems, and apparatus, including computer programs encoded on computer storage media, for blockchain-based hierarchical data storage. One of the methods includes determining, based on a blockchain stored in a database that includes multiple levels of storage, a level of storage of the multiple levels of storage that meets a data migration condition as a target level of storage, wherein state data of the blockchain are stored as state Merkle trees in data worksheets of the multiple levels of storage, generating, for the target level of storage, an empty data worksheet in response to determining that the target level of storage meets the data migration condition, and storing at least a portion of a state Merkle tree corresponding to a newly created block of the blockchain to the empty data worksheet.

## Claims

### Claim 1

A blockchain-based hierarchical storage method comprising:
generating, for a target level of storage, an empty data worksheet in response to determining that the target level of storage meets a data migration condition;
storing at least a portion of a first state Merkle tree corresponding to a newly created block of a blockchain to the empty data worksheet;
migrating a second state Merkle tree corresponding to a target block stored in a data worksheet to the empty data worksheet, wherein the target block has a largest block number among block numbers of blocks corresponding to state Merkle trees stored in the target level of storage; and
after migrating the second state Merkle tree corresponding to the target block, migrating the state Merkle trees stored in the data worksheet to a lower level of storage than the target level of storage, wherein the lower level of storage has lower storage cost.

### Claim 2 (depends on 1)

The method according to claim 1, further comprising:
after migrating the second state Merkle tree corresponding to the target block to the empty data worksheet, renaming the data worksheet as a historical data worksheet.

### Claim 3 (depends on 2)

The method according to claim 2, further comprising:
after renaming the data worksheet as the historical data worksheet and migrating the state Merkle trees stored in the historical data worksheet to the lower level of storage, deleting the historical data worksheet.

### Claim 4 (depends on 1)

The method according to claim 1, wherein a remainder of the first state Merkle tree corresponding to the newly created block other than at least the portion of the first state Merkle tree is stored in the empty data worksheet if not all the first state Merkle tree is stored in the empty data worksheet.

### Claim 5 (depends on 4)

The method according to claim 4, further comprising:
receiving a search request for a data node of the first state Merkle tree after the empty data worksheet is generated;
determining whether all the first state Merkle tree is stored in the empty data worksheet;
searching the empty data worksheet in response to determining that all the first state Merkle tree is stored in the empty data worksheet; and
searching the empty data worksheet and the data worksheet in response to determining that not all the first state Merkle tree is stored in the empty data worksheet.

### Claim 6 (depends on 1)

The method according to claim 1, wherein the first state Merkle tree corresponding to the newly created block comprises a latest block appended to the blockchain and historical blocks migrated from higher level of storage that has higher storage cost.

### Claim 7 (depends on 1)

The method according to claim 1, wherein the blockchain is stored in a database, the database is a key-value database, data nodes included in the state Merkle state tree are stored as key-value pairs (KVPs), keys of the KVPs are hash values of corresponding values of the KVPs, and the values of the KVPs are data content of the corresponding data nodes.

### Claim 8 (depends on 1)

The method according to claim 1, wherein the first state Merkle tree or the second state Merkle tree has a tree structure constructed based on a Merkle tree and a prefix tree.

### Claim 9 (depends on 8)

The method according to claim 8, wherein the first state Merkle tree or the second state Merkle tree is a Merkle Patricia tree (MPT).

### Claim 10 (depends on 1)

The method according to claim 1, wherein the blockchain is stored in a database and the database is a LevelDB database.

### Claim 11 (depends on 1)

The method according to claim 1, wherein the blockchain is stored in a database and the database is a RocksDB database.

### Claim 12 (depends on 1)

The method according to claim 1, wherein the lower level of storage is associated with lower storage cost and lower read-write performance.

### Claim 13

A computer-implemented system, comprising:
one or more computers, and
one or more computer memory devices interoperably coupled with the one or more computers and having tangible, non-transitory, machine-readable media storing one or more instructions that, when executed by the one or more computers, perform operations comprising:
generating, for a target level of storage, an empty data worksheet in response to determining that the target level of storage meets a data migration condition;
storing at least a portion of a first state Merkle tree corresponding to a newly created block of a blockchain to the empty data worksheet;
migrating a second state Merkle tree corresponding to a target block stored in a data worksheet to the empty data worksheet, wherein the target block has a largest block number among block numbers of blocks corresponding to state Merkle trees stored in the target level of storage; and
after migrating the second state Merkle tree corresponding to the target block, migrating the state Merkle trees stored in the data worksheet to a lower level of storage than the target level of storage, wherein the lower level of storage has lower storage cost.

### Claim 14 (depends on 13)

The computer-implemented system according to claim 13, further comprising:
after migrating the second state Merkle tree corresponding to the target block to the empty data worksheet, renaming the data worksheet as a historical data worksheet.

### Claim 15 (depends on 14)

The computer-implemented system according to claim 14, further comprising:
after renaming the data worksheet as the historical data worksheet and migrating the state Merkle trees stored in the historical data worksheet to the lower level of storage, deleting the historical data worksheet.

### Claim 16 (depends on 13)

The computer-implemented system according to claim 13, wherein a remainder of the first state Merkle tree corresponding to the newly created block other than at least the portion of the first state Merkle tree is stored in the empty data worksheet if not all the first state Merkle tree is stored in the empty data worksheet.

### Claim 17 (depends on 16)

The computer-implemented system according to claim 16, further comprising:
receiving a search request for a data node of the first state Merkle tree after the empty data worksheet is generated;
determining whether all the first state Merkle tree is stored in the empty data worksheet;
searching the empty data worksheet in response to determining that all the first state Merkle tree is stored in the empty data worksheet; and
searching the empty data worksheet and the data worksheet in response to determining that not all the first state Merkle tree is stored in the empty data worksheet.

### Claim 18 (depends on 13)

The computer-implemented system according to claim 13, wherein the first state Merkle tree corresponding to the newly created block comprises a latest block appended to the blockchain and historical blocks migrated from higher level of storage that has higher storage cost.

### Claim 19 (depends on 13)

The computer-implemented system according to claim 13, wherein the blockchain is stored in a database, the database is a key-value database, data nodes included in the state Merkle state tree are stored as key-value pairs (KVPs), keys of the KVPs are hash values of corresponding values of the KVPs, and the values of the KVPs are data content of the corresponding data nodes.

### Claim 20

A non-transitory, computer-readable medium storing one or more instructions executable by a computer system to perform operations comprising:
generating, for a target level of storage, an empty data worksheet in response to determining that the target level of storage meets a data migration condition;
storing at least a portion of a first state Merkle tree corresponding to a newly created block of a blockchain to the empty data worksheet;
migrating a second state Merkle tree corresponding to a target block stored in a data worksheet to the empty data worksheet, wherein the target block has a largest block number among block numbers of blocks corresponding to state Merkle trees stored in the target level of storage; and
after migrating the second state Merkle tree corresponding to the target block, migrating the state Merkle trees stored in the data worksheet to a lower level of storage than the target level of storage, wherein the lower level of storage has lower storage cost.
