A Brief Overview of Quantum Ledger Database
Tags: ledgerdatabase, aws, blockchain, dlt
Published: 2020-12-02 07:10:16

---
title: A Brief Overview of Quantum Ledger Database
published: true
date: 2020-12-01 13:11:46 UTC
tags: ledgerdatabase,aws,blockchain,dlt
canonical_url: https://medium.com/coinmonks/the-heart-of-db-and-the-soul-of-a-dlt-f5fe1229649e
---

![](https://cdn-images-1.medium.com/max/1024/1*3VleEwsSy9Aco2p7bcI57w.png)

### The Heart Of A DB And The Soul Of A DLT…

#### A Brief Overview of Quantum Ledger Database.

### And So Begins The Quest…

At the heart of every great innovation, there is a need. The same holds for ledger technologies. Take, for example, our first attempt at this technology. No, I am not talking about satoshi and bitcoins. My story is way older, like 5000–6000 years old. In a much simpler time, some random Mesopotamian citizens, presumably farmers, were looking for ways to keep track of their produce. They did so by inscribing the images representing their products, along with its quantity, onto clay tablets. The incident marked our very first attempt at creating a ledger technology.

![](https://cdn-images-1.medium.com/max/1024/1*ocrG9Rt9lRz94SewTH015w.png)

There was a need, and thus a solution was born. The clay tablets marked the beginning of a quest, A quest to find the perfect ledger technology. Everything from the double-entry system to Distributed Ledger Technologies(DLT) stemmed from this Quest.

With DLTs, things got very interesting. Remember a couple of years ago when people started building DLTs just for the sake of it, you know, one for every occasion. It was the hot new pie, and everybody wanted a piece of it.

![](https://cdn-images-1.medium.com/max/430/1*1oDPEtIMWbJiOk8768V0Uw.jpeg)

Recent trends, however, show a decline in this erratic behavior. As per the [Gartner Graph](https://www.gartner.com/en/newsroom/press-releases/2019-10-08-gartner-2019-hype-cycle-shows-most-blockchain-technologies-are-still-five-to-10-years-away-from-transformational-impact#:~:text=The%20Gartner%20Inc.,blockchain%20continue%20to%20roll%20out.), People are moving out of the ‘DLT can cure cancer’ phase to a more practical outlook. We are starting to look at use-cases where the technology serves an actual need (You got to have the need !).

Speaking of Quests and needs, In September 2019, Amazon introduced their latest contender for the Quest.

![](https://cdn-images-1.medium.com/max/498/1*nsbETczc7lvDzQX96QANTg.gif)

A tried and tested contender if I might add.

So, the purpose of this blog is to explore the story and the reason behind this new contender.

### The Story

We are well aware of the vastness of AWS(Amazon Web Services). They are one of the leading cloud service providers out there. From storage to computation, they provide enough products to fill up a store.

![](https://cdn-images-1.medium.com/max/640/1*FcoID01rYxvff2F8dbk3nQ.png)<figcaption>Tip Of The Ice Berg. (Source: <a href="https://www.amazoncloudlinux.com/2019/01/all-aws-products-and-use-of-each.html">Amazon Cloud Linux</a>)</figcaption>

Now, With great many services, comes greater responsibilities. I mean, think about it, there are [more than a million customers](https://arstechnica.com/information-technology/2016/04/amazon-cloud-has-1-million-users-and-is-near-10-billion-in-annual-sales/#:~:text=AWS%20is%20used%20by%20more,every%20industry%2C%22%20he%20wrote.&text=%22Today%2C%20AWS%20offers%20more%20than,enterprise%20applications%2C%22%20Bezos%20wrote.), big and small, that rely on these services. Imagine the kind of data that these guys deal with daily. Apart from the user data, AWS also has to keep track of the data regarding various internal operations and systems that are responsible for running these services. Now, This kind of data can be quite tricky. Merely storing these data won’t do you much good. You also have to find ways to keep track of all the changes that the data goes through. That way, you can use these “logs” when you need to conduct an audit or if you want to track an error or if things go haywire in general. Another challenge that comes with this kind of data is maintaining its integrity.

Oh, you might also want to keep it immutable, I mean, you wouldn’t want people to tamper with this kind of critical logs, now would you?

![](https://cdn-images-1.medium.com/max/320/1*pYHvPWWBLwzhoOY0MmtaUw.gif)

At this point, many of you might say things like, “Well, They must have an awesome database that takes care of all this.” Well, They sure did. But, While using traditional databases for this purpose, [They found out that it could not scale or deliver the performance required to support their most widely-used services](https://www.businesswire.com/news/home/20181128005679/en/AWS-Announces-Amazon-Quantum-Ledger-Database-QLDB).

That’s when the people at AWS decided to build a new technology to address these issues. They developed a new kind of database to store and track data. The database helped maintain a complete, immutable, and append-only record of data changes. There was a need, and thus a solution was born. For years, they used this technology to track the changes in their data (Especially Configuration details and things like that). The technology helped resolve the scalability and performance issues that they faced with the traditional databases. Everything was at peace, and AWS continued to prosper. The End.

![](https://cdn-images-1.medium.com/max/492/1*ZeO12Eu3RqI80tjstk2jTQ.gif)

Just kidding.

### Serving The Need!

According to the wise words of Mark Manson, “If you’ve got a problem, chances are millions of other people have had it in the past, have it now, and are going to have it in the future.” It implies that a viable solution to the problem might help all these people. So, like any brilliant company, Amazon Interacted with its customers and found out that many of the customers faced the same kind of issues that they faced.

You see, Tracking data changes is critical to many businesses, But creating audit functionalities using a traditional database involves creating audit tables and stuff like that. These things tend to get complicated. As the complexity increases, so does the chance of error. The entangled set of tables also affects scalability. Did I mention the fact that databases, in general, are not immutable or that it takes time to incorporate such functionalities using traditional databases?

So, after considering all this, In September of 2019, Amazon introduced their new contender, labeled Quantum Ledger Database(QLDB), to the general public.

![](https://cdn-images-1.medium.com/max/1024/1*7BiLowkPS4N_znARJjDmjQ.jpeg)<figcaption>Source: <a href="https://techcrunch.com/2018/11/28/amazon-gets-into-the-blockchain-with-quantum-ledger-database-managed-blockchain/">Techcrunch</a></figcaption>

**QLDB is a purpose-built database that provides a transparent, immutable, and cryptographically verifiable transaction log that helps you track all the changes that happen to the application data.**

Wait a minute! What about blockchains? They pretty much do the exact same thing and ain’t nobody praising them, right? Well, the thing about blockchains is that it is decentralized and suits best when there are multiple parties involved in your use case. **QLDB is for centralized applications. It is owned and operated by centralized authorities**. It provides DLT-like functionalities, without the hassle of setting up a multi-node Network or The need for a consensus mechanism.

### Ledger Database, The First.

![](https://cdn-images-1.medium.com/max/1024/1*lccIwS-IYOuhREsctIt5kQ.png)

If you were paying attention, you must have figured out by now that QLDB is, in fact, a database. Not just any ordinary database, it is a ledger database, The first of its kind. What is a ledger database you might ask, well, according to its creators, it is “ **A NoSQL database that provides an immutable, transparent and cryptographically verifiable transaction log ‎owned by a central authority**.” Simply put, A Document-oriented database with blockchain-esque features owned by a single entity.

Let’s try to understand the inner workings of this blockchain-esque database!

### How It All Unfolds!

Suppose I use QLDB to track data. **In QLDB, we use tables of documents to organize the data**. No, it is not your typical “relational DB” tables. You see, In this document-oriented database, you don’t just store the latest revision (or version) of your document. Here, **you get to keep the entire set of document revisions** ([A _“revision”_ represents a single iteration of a document’s full dataset](https://docs.aws.amazon.com/qldb/latest/developerguide/qldb-glossary.html)). That’s right, in QLDB, A Table is a collection of document revisions. Each of these iterations will have a unique ID and a version number.

![](https://cdn-images-1.medium.com/max/1024/1*OoKSDuN81HaMFDugJOIevQ.gif)

Now, Before I start creating tables, **I need to create an instance of the database. In QLDB lore, this is called a Ledger**. Inside the ledger, I get to build my very own tables, and inside these tables, I can store the documents. Now, these are Amazon ION documents(sort of a buffed-up version of JSON)

![](https://cdn-images-1.medium.com/max/260/1*-SPgRKoj-GrZU3OWLjAgkA.png)

So, to be clear, I have my data stored as an ION document and placed inside a table, and the table is part of a ledger.

![](https://cdn-images-1.medium.com/max/1024/1*saSzs46qs9yBEBcuhC9Eug.gif)

Perfect. Now let’s change the data.

As with many traditional databases, We can change the application data using a database transaction. I can build an application that submits these transactions to the ledger. Most databases keep a log of such transactions. These logs can help recreate Transactions and retrieve data if and when something goes wrong.

![](https://cdn-images-1.medium.com/max/1024/1*Nau5-isZG5s3PNz3ztiJlQ.png)<figcaption>Source: <a href="https://www.sqlshack.com/understanding-log-sequence-numbers-for-sql-server-transaction-log-backups-and-full-backups/">SQL Stack</a></figcaption>

Usually, these logs are not immutable, and the users have a hard time accessing these data. In QLDB, however, these logs take center stage. **One of the core components of QLDB is a little something called a Journal. It is similar to a transaction log, and its purpose is to store a complete and provable history of all the data changes**. It is sort of like a blockchain sitting inside the DB. I Mean, The similarities are staggering when you think about it. As with a blockchain, the journal is an append-only, immutable structure that records the transaction details. It stores the data in units called Blocks, and these blocks create a “cryptographic link” with the adjacent blocks by storing the hash value(SHA 256) of its previous block.

![](https://cdn-images-1.medium.com/max/1024/1*8UNt205FOJpgMt4HneU0_g.gif)

**Each Ledger Will have a single journal.** The blocks inside the journal include the **statements that were used to commit a revision(CRUD statements), objects representing the committed document revisions, and other metadata**. We use partiQL, a SQL compatible query language, to write the statements. For a single transaction, QLDB can write one or more chained blocks to the Journal.

So, every transaction that I make gets sequentially recorded in this tamper-proof Journal.

Now, the reason I called it a core component is because **QLDB follows what is called a “ journal first” approach.**

In this approach, every transaction is initially committed to the Journal. QLDB uses the data from the Journal to determine the state of the data by materializing the transactional data into the tables.

![](https://cdn-images-1.medium.com/max/1024/1*8vw4BSZYGIl7vStlVxntyg.gif)

To put all this into perspective, consider a game of chess. You might have noticed how the players make a move by changing the position of the pieces on the board and how they record those moves in a notepad.

![](https://cdn-images-1.medium.com/max/480/1*TpcGwT2AZifoYB4o6FXK1Q.gif)

Well, in the “journal first” approach, the players would have to write the moves in the note first, verify it, and then, based on their writings, make the appropriate changes in the state of the board.

Now all this sounds fancy, but what if I want to access the current state of my data. Well, the obvious method would be to traverse through all the transactions in the Journal, applying each of them to my initial document and figuring out the whole thing on my own. Well, that’s no fun, especially if there are thousands of transactions involved.

![](https://cdn-images-1.medium.com/max/500/1*yHFrA9og4LiPE_ZsaGg6AQ.gif)

That’s where the view comes in. A “view” makes life so much simpler. “ **a _view,_ in QLDB, is a projection of the data in a table.** ” Think of it as a virtual table that contains tailored information from a table. You see, a view helps hide the complexities and intricacies of the data in the table by providing focused and simple subsets of it.

![](https://cdn-images-1.medium.com/max/1024/1*NxALQsRqlsrm1i9gnIf0WA.png)<figcaption>Example Of A View | Source: <a href="https://redpanthers.co/materialized-views-caching-database-query/">Redpanthers</a></figcaption>

QLDB gives us inbuilt views of the Tables. **QLDB uses transactional information to formulate the view, and they facilitate high-performance querying**. Now, the following are the views that are generated by QLDB, these views help users query information using simple partiQL statements.

**The user view** , which essentially gives you the current state of your data, and

**The committed view** , which contains the latest revision of your data along with the system generated metadata( document ID, revision number, and things like that).

You can also get the complete history of a particular document by using the history function. The function returns the revision details from the committed view.

### In Conclusion….

So QLDB is a ledger database that helps me track the changes to my application data. To make The changes to the data, I use transactions. QLDB initially stores the Transactions in a journal and uses the Journal to determine the state of the data. QLDB also gives me various views, which lets me quickly access the required information. Well, and Good.

![](https://cdn-images-1.medium.com/max/1024/1*KmdZz54Oy-DY1gXyVPhmKQ.png)<figcaption>Image Source: <a href="https://docs.aws.amazon.com/qldb/latest/developerguide/what-is.overview.html">AWS Docs</a></figcaption>

The use cases of QLDB include finance data management, resource, and logistics management, insurance, etc. You see the pattern, don’t you? All these fields dearly value data lineage. So, if you have such a use case in mind, do consider QLDB.

So there you have it folks, a brief overview of Quantum Ledger Database.

For More Detailed Explanations, Do check out the following Links :

[The Documentation](https://docs.aws.amazon.com/qldb/index.html).

[In Data We Trust.](https://www.forbes.com/sites/amazonwebservices/2019/12/23/in-data-we-trust-the-why-and-how-of-amazon-qldb-a-purpose-built-immutable-and-verifiable-database/#3ad2cf9451c7)

P.S. “Quantum” in QLDB is a nod to the atomic changes to the data and has no association with that super-fast computation thing.

* * *