Efficient Querying On Blockchain


With the advent of Bitcoin as a cryptocurrency, blockchain, the technology behind Bitcoin has gained a lot of attention. The attraction to the technology is mainly driven by the tamper-proof promise given by a blockchain. Being a distributed ledger that no single entity owns and manages and having a consensus protocol to approve transactions in addition to the immutability of written transactions, opens the door for countless applications. This has also led technology developers to think of variants of consensus protocols that can better fit different usage scenarios where proof of work is not the best choice. This has contributed to the speedup of processing of transactions.

Apart from seeing a blockchain as a distributed ledger, it is a way to store data. Thus, it is likely the case that transaction data stored in the chain need to be queried. One such scenario can be in the context of a blockchain that stores information about electronic healthcare records. It might be the case that we need to retrieve the treatment history of a certain patient over a period. In such case, relevant records for the patient in question might be spread over different blocks. Out-of-the-box, search can be done by a linked list traversal from the most recent block backwards and collecting relevant records. Of course, it can be the case that several irrelevant blocks are visited during search. Also, current APIs that provide query are platform dependent, limited and only serve simple queries like top-k and ranging queries.

The target of this work is to implement an efficient online querying engine that standardizes the querying and integration with most of the blockchains like Ethereum, Bitcoin and Hyperledger and serve both private a public blockchains and be able to implement more complex queries “aggregation and join queries“ with a simple SQL Syntax.

Further readings:

  • EtherQL: https://rd.springer.com/chapter/10.1007/978-3-319-55699-4_34
  • BigchainDB: https://www.bigchaindb.com/
  • Third, Allan, and John Domingue. Linked Data indexing of distributed ledgers. Proceedings of the 26th International Conference on World Wide Web Companion. International World Wide Web Conferences Steering Committee, 2017.