About Daisy: the blockchain where blocks are SQL databases

in #blockchain2 years ago (edited)

For some time now, I've been working on Daisy, a proof-of-authority where blocks are SQLite databases. I think this is a good approach for applications which would benefit from the blockchain structure and at the same time implement a structure which is easily accessible and query-able.

Most of the blockchain products today use a home-grown storage format, either some kind of a binary data dump directly from memory structures (Bitcoin is for a large part like that), or again, a home-grown but documented storage format (like Ethereum and its RLP). In Daisy I've gone for a different approach which I think is valuable for interoperability: its blocks are SQLite databases.

This is possible because the essential requirement for a blockchain structure is that each block contains a digital signature (usually, like in Daisy, this is done by a simple hash) of the previous block, which is just a piece of data in the SQLite database files.

Main features

Daisy is a self-contained blockchain application, a "full node" intended to be run as a system service, but it can easily be adapted for embedding into larger projects.  Its main features are:

  • Daisy can store arbitrary data. Its blocks are SQLite databases, and outside of few "system" tables which are created and maintained by Daisy, the databases can have an arbitrary schema and store arbitrary data. Size is only limited by SQLites per-database limitations.
  • Daisy is adaptable; it is not limited to implementing cryptocurrency-like blockchain, but is a truly data-oriented blockchain which can be used in applications ranging from storing log records, audit records, financial records, to storing sensor data.
  • Each block added to the Daisy blockchain is digitally signed by its author / creator. The process of block creation in Daisy doesn't involve using the energy-intensive Proof-of-Work mining process, but rather relies they will be created by a small set of well-known "miners".
  • The list of block authors ("signatories") is dynamic and can optionally be updated with the consensus of the majority of existing signatories. This enables scalability: as the requirements of the system grow, new block "miners" can be added if necessary.
  • The Daisy blockchain can be distributed and published globally, as a read-only blockchain for the majority of nodes (because only a small set of nodes can author new blocks). All other nodes can access and validate the data stored in the blockchain.
  • Daisy enables blockchain-wide queries, i.e. executing read-only SQL queries on all the databases which form the blockchain. In this way, data can be collated from all blocks in a single operation.

The current status of the Daisy blockchain is "early alpha". It is nearly feature-complete but with a lot of rough corners and not really tested well enough.

It is currently running as a public blockchain - and if you build it from GitHub, you'll connect and download a couple of blocks I've generated for testing. To participate as a data publisher on the Daisy blockchain, I'll have to add your public key as one of the signatories for new blocks.

Intended use scenarios

Daisy is a generic blockchain, not tied with the concept of cryptocurrencies and transactions. Because of that, it is well suitable for use as a generic data storage blockchain. Here are some of the possible use cases where Daisy's properties would be beneficial:

  • Long-term storage of audit records: data can be put into the blockchain to be digitally signed and stored in a way which guarantees long-term data integrity and authenticity.
  • Storage for distributed application data: in a scenario where there are a few authoritative sources of (structured) data, but the data needs to be distributed to a wide audience which needs to access and / or verify it, Daisy can provide a plug-in solution.
  • Distribution of sensor logs: in a system which implements a hub-and-spoke infrastructure where there is a large number of inexpensive sensor which report to an IoT hub, this hub can then publish the sensor data periodically, in the form of blocks signed by the device's key.

Of course, Daisy is not limited to these scenarios, they only serve as illustration of what can be done with Daisy's feature set.Note again that Daisy doesn't implement a cryptocurrency by itself, nor any of the more advanced concepts as smart contracts. Those can be added on top of Daisy if required for certain applications.

Basically, like most blockchains, Daisy is practically infinitely scalable for reading (and, in a sense, distributing) data, while write operations (which in this case lead directly to block creation) are a natural bottleneck.

Important:  Note that Daisy (and this doc) is work-in-progress, and may change at any time and without warning in a way which will break everything.