Verifiable state transitions
A method for storing blockchain data includes receiving a first batch command, the first batch command comprising one or more write operations, and adding one or more entries to a new log file by performing the one or more write operations. The method further includes identifying one or more active entries from one or more previous log files, appending the identified one or more active entries to the new log file, and, based on a determination that the one or more previous log files do not comprise any other active entries, deleting the one or more previous log files.
1 . A method for storing blockchain data, comprising:
receiving a first batch command, the first batch command comprising one or more write operations;
adding one or more entries to a current log file by performing the one or more write operations;
making a first determination that a maximum number of log files have previously been written;
based on the first determination, identifying one or more active entries from one or more previous log files;
appending copies of the identified one or more active entries to the current log file; and
based on the first determination and a second determination that the one or more previous log files do not comprise any other active entries, deleting the one or more previous log files,
wherein identifying the one or more active entries comprises determining that the one or more active entries have not been modified by any subsequent entries, and
wherein a current number of log files cannot exceed the maximum number of log files.
2 . The method of claim 1 , further comprising writing metadata to the current log file, wherein the metadata comprises a hash value of at least one previous log file.
3 . The method of claim 2 , wherein the metadata further comprises a reference to a particular previous log file.
4 . The method of claim 1 , wherein the one or more active entries are the oldest active entries in the one or more previous log files.
5 . The method of claim 1 , wherein the current log file is a first log file, the one or more active entries are a first set of one or more active entries, and the method further comprises:
receiving a second batch command, the second batch command comprising one or more additional write operations;
performing the one or more additional write operations to a second log file;
identifying a second set of one or more active entries from the first log file; and
appending copies of the identified second set of one or more active entries to the second log file.
6 . The method of claim 5 , wherein the method further comprises:
making a third determination that the first log file does not comprise any additional active entries; and
based on the third determination, deleting the first log file.
7 . The method of claim 5 , wherein the second set of one or more active entries are the oldest active entries in the first log file.
8 . The method of claim 1 , wherein each write operation is one of a create operation, a read operation, an update operation, or a delete operation.
9 . A non-transitory computer-readable medium storing a program for storing blockchain data, which when executed by a computer, configures the computer to:
receive a first batch command, the first batch command comprising one or more write operations;
add one or more entries to a current log file by performing the one or more write operations;
make a first determination that a maximum number of log files have previously been written;
based on the first determination, identify one or more active entries from one or more previous log files;
append copies of the identified one or more active entries to the current log file; and
based on the first determination and a second determination that the one or more previous log files do not comprise any other active entries, delete the one or more previous log files,
wherein identifying the one or more active entries comprises determining that the one or more active entries have not been modified by any subsequent entries, and
wherein a current number of log files cannot exceed the maximum number of log files.
10 . The non-transitory computer-readable medium of claim 9 , wherein the program, when executed by the computer, further configures the computer to write metadata to the current log file, wherein the metadata comprises a hash value of at least one previous log file.
11 . The non-transitory computer-readable medium of claim 10 , wherein the metadata further comprises a reference to a particular previous log file.
12 . The non-transitory computer-readable medium of claim 9 , wherein the one or more active entries are the oldest active entries in the one or more previous log files.
13 . The non-transitory computer-readable medium of claim 9 , wherein the current log file is a first log file, the one or more active entries are a first set of one or more active entries, and the program, when executed by the computer, further configures the computer to:
receive a second batch command, the second batch command comprising one or more additional write operations;
perform the one or more additional write operations to a second log file;
identify a second set of one or more active entries from the first log file; and
append copies of the identified second set of one or more active entries to the second log file.
14 . The non-transitory computer-readable medium of claim 13 , wherein the program, when executed by the computer, further configures the computer to:
make a third determination that the first log file does not comprise any additional active entries; and
based on the third determination, delete the first log file.
15 . The non-transitory computer-readable medium of claim 13 , wherein the second set of one or more active entries are the oldest active entries in the first log file.
16 . The non-transitory computer-readable medium of claim 9 , wherein each write operation is one of a create operation, a read operation, an update operation, or a delete operation.
17 . A system for storing blockchain data, comprising:
a processor; and
a non-transitory computer readable medium storing a set of instructions, which when executed by the processor, configure the system to:
receive a first batch command, the first batch command comprising one or more write operations;
add one or more entries to a current log file by performing the one or more write operations;
make a first determination that a maximum number of log files have previously been written;
based on the first determination, identify one or more active entries from one or more previous log files;
append copies of the identified one or more active entries to the current log file; and
based on the first determination and a second determination that the one or more previous log files do not comprise any additional active entries, delete the one or more previous log files,
wherein identifying the one or more active entries comprises determining that the one or more active entries have not been modified by any subsequent entries, and
wherein a current number of log files cannot exceed the maximum number of log files.
18 . The system of claim 17 , wherein the instructions, when executed by the processor, further configure the system to write metadata to the current log file, wherein the metadata comprises one or more of a hash value of at least one previous log file and a reference to a particular previous log file.