GARAIO | Blog

Democraticing Blockchain with Azure SQL

Geschrieben von Jörg Bieri | 20. Juli 2021

Using blockchain technologies has never been easier! In the following, I'm going to show you how blockchain technology can be used by everyone.

Blockchain is not exclusively about Bitcoin.

At its core, blockchain as a technology guarantees that data cannot be changed or deleted.

To achieve this, the data is stored in so-called blocks and represented by a hash key. This key is unique and therefore represents only this sole block:

In regards to the current Covid-situation, I will use vaccinations in general in the above illustration. 

As you can see a block always references its predecessor by storing the corresponding hash within in the data set. If a block is changed or even deleted, this automatically leads to an inconsistency because of the inconsistent key that follows.

This exact mechanism has been built into Azure SQL. With the Azure SQL Database Ledger, you can choose if a table should be stored as a blockchain. When creating a database, it is even possible to configure that all tables within the database are automatically stored as a blockchain.

The configuration is very simple, add «LEDGER=ON” to the command when creating a table.

Azure SQL then creates the following configuration in the background:

As shown in the illustration,  two more  tables are created in addition to the actual table (ledger table): a history table and a ledger view, in which all blocks are visible.

Furthermore, the current blockchain is mirrored in a "trusted storage" when the data is updated. You as a user can choose where this storage should be (e.g. Azure BLOB Storage).

If a ledger table has been configured, Azure SQL automatically prevents data from being deleted or directly changed. At any given time, you can check whether the data is correct or not.