TECHNICAL FIELD

This application generally relates to storing data on a blockchain, and more particularly, to a process of generating a snapshot of a world state database and using the snapshot to recover the world state database of a blockchain peer.

BACKGROUND

A centralized database stores and maintains data in a single database (e.g., a database server) at one location. This location is often a central computer, for example, a desktop central processing unit (CPU), a server CPU, or a mainframe computer. Information stored on a centralized database is typically accessible from multiple different points. Multiple users or client workstations can work simultaneously on the centralized database, for example, based on a client/server configuration. A centralized database is easy to manage, maintain, and control, especially for purposes of security because of its single location. Within a centralized database, data redundancy is minimized as a single storing place of all data also implies that a given set of data only has one primary record.

However, a centralized database suffers from significant drawbacks. For example, a centralized database has a single point of failure if there are no fault-tolerance considerations. Therefore, if a hardware failure occurs (for example a hardware, firmware, and/or a software failure), all data within the database is lost and work of all users is interrupted. In addition, centralized databases are highly dependent on network connectivity. As a result, the slower the connection, the amount of time needed for each database access is increased. Another drawback is the occurrence of bottlenecks when a centralized database experiences high traffic due to a single location. Furthermore, a centralized database provides limited access to data because only one copy of the data is maintained by the database.

Organizations are recently turning to blockchain as a means for securely storing data that is not restricted by a central entity and that is accessible from multiple points. In a blockchain network, peers are responsible for collectively managing and storing data on the blockchain. The blockchain may be stored on a ledger which is distributed/replicated among the blockchain peers. Blockchain peers also store a world state database that includes current values of the data objects stored within the blocks on the blockchain. The world state database allows for quick identification/retrieval of current values of the data objects. If a peer's world state database becomes corrupted, it can be problematic to the whole blockchain network. In particular, the peer is unable to endorse new transactions causing new transactions to fail. In order to restore a corrupted world state database, a peer must execute each transaction stored on the blockchain. This process is time consuming and can require significant resources. As such, what is needed is a solution that overcomes these drawbacks and limitations.

SUMMARY

One example embodiment provides a system that includes one or more of a network interface configured to one or more of retrieve a snapshot of key values of a world state database, and retrieve a hash of the snapshot from a blockchain associated with the world state database, and a processor configured to one or more of determine whether the snapshot is valid based on the hash of the snapshot retrieved from the blockchain, and in response to a determination that the snapshot is valid, update key values of a world state database based on the snapshot of key values.

Another example embodiment provides a system that includes one or more of a storage configured to store a blockchain and a world state database that stores values of data objects within the blockchain, and a processor configured to generate a snapshot of the world state database, where the snapshot includes a copy of current key-value pairs of the data objects within the blockchain and a timestamp at when the snapshot was generated, and store the snapshot in a storage.

A further example embodiment provides a method that includes one or more of retrieving a snapshot of key values of a world state database, retrieving a hash of the snapshot from a blockchain associated with the world state database, determining whether the snapshot is valid based on the hash of the snapshot retrieved from the blockchain, and in response to determining the snapshot is valid, updating key values of a world state database based on the snapshot of key values.

