Hashchain for Immutable Data Storage using the IOTA Tangle
The full article was originally published by Alessandro Buser on Medium. Read the full article here.
Hashchains for Immutable Data Storage using the IOTA Tangle
In recent times the transaction fees on the major blockchains have exploded making one of their core usecases, immutable data storage, extremely unattractive. This has caused many people, including myself, to restart the search for alternative solutions.
The IOTA Tangle with it’s fee-less architecture would seem to be the perfect candidate, if it was not for the fact that the nodes in the network only store data for a certain amount of time(around 30 days) and than delete it to make space for new data. This allows to nodes to remain lightweight and be compatible with the targeted IoT hardware.
There are a few initiatives to bring permanent data storage to IOTA, the two most notable are: the official IOTA permanode “Chronicle” which will permanently store all transactions sent to the network; and Olaf van Wijk’s “AION” which is a selective permanode that will be able to only store transactions selected by the user, together with a proof that they are valid.
Chronicle is the more mature of the two projects and will be a very useful solution for industry applications. It also will allow for companies to provide “storage-as-a-service” to more casual user.
AION is still in research, but once production ready it will be the most ideal solution for permanent data storage as it allows user to only store the data they care about. And as such it will most likely make other IOTA perma-storage solutions obsolete (the one presented here included).
The Hashchain mechanism was developed as a “quickfix” for the meantime, it does NOT solve the problem of permanently storing IOTA transactions, but it does enable verifiably-immutable storage of selected data without fees.
The Hashchain mechanism
The Hashchain is a solution to create a chain of proofs about the integrity of data stored in a database. It is heavily inspired by the principles and mechanisms of traditional blockchains as it uses a chain of data-blocks linked by hashes, but in a much more simplistic way.
To store data on the Hashchain it is sent to the server over an API (public or private) where it is timestamped and collected in the “mempool”.
Every interval T (can be seconds, minutes or days depending on usecase) a “block” is created by hashing all of the data in the mempool together with metadata like the current timestamp and the hash of the previous block. This new block is sent to the IOTA Tangle in a 0-value transaction, the returned transaction hash is appended to the block header and everything is stored in the local database. From here it can be queried through an API (public or private).