This release includes the following chaindata size and security important improvements:
- Chain-data pruning via the new “gc” (garbage collector) utility. Details are explained below.
- Security bug fix to avoid malicious masternodes panicking the chain
The security bug, reported from our security bug bounty program, consisted in a malicious masternode being able to craft a special empty message during the randomization procedure that would lead to all the masternodes panicking. It was fixed in this pull request.
3. Checkpoint timeout adjusted from 2 minutes to 20 seconds. The checkpoint timeout adjustment was made by this pull request.
In the next sections, we would like to explain how data is stored on the TomoChain network, what impacts the chaindata size growth and how we introduced a “garbage collector” (gc) utility to remove the excessive historical data stored on the “BlockSigner” smart contract.
Modified Merkle Patricia Trie
In TomoChain, there are four merkle tries that maintain all data of blockchain including storage trie, state trie, transactions trie and receipts trie. All of the merkle tries in TomoChain use a modified Merkle Patricia trie. (MPT or trie)
Basically, MPT is a combination of Patricia trie and Merkle tree. Patricia trie is a tree-based data structure that stores (key, value) bindings in which a key represents a path so the nodes in tree that share the same prefix can also share the same path. Advantage of this structure is that it’s fast at finding common prefixes and doesn’t take much memory to store data. Merkle tree is a tree of hashes in which leaf nodes store data and parent nodes contain their children’s hash as well as the hashed value of the sum of their children’s hashes. Merkle tree makes easy to find whether two different nodes have the same data or not by comparing the top hash value of those two nodes.