Blockchain as database

Has anyone got any experience in using blockchain as database. I have been asked to look at it. My gut reaction was, why and it will be way too slow. But maybe I am wrong.

I am not sure that I see any advantages in using it for a private (non-public) transaction/billing system. Especially when there is no dependency from one transaction to another. The only dependency is between the invoice and payment.

Does it have any place in stock-control ?

This sounds to me like a solution looking for a problem :man_facepalming:. I would stick with a traditional db engines which are designed, tested and battle hardened to work well in the scenarios you are suggesting.

My server db of choice these days is postgresql - runs well on windows or linux (probably other platforms too) - it’s open source and actively developed. It’s also well supported by third party tools and by delphi (firedac driver etc).

We ship postgresql as the default db for our Continua CI product (which also supports mssql) - and have had very few issues over the years with it that were not of our own making.

Oracle has a blockchain option in its database

However, its very easy to roll your own simply version.

  • Put the table in a secure schema and only allow other schemas to INSERT into it. No updated. No deletes

  • The table has a HASH column and to make life easier I also like to have a PRIOR HASH column

  • If you use a PRIOR_HASH column, When inserting a new row, copy the HASH from the prior row into the PRIOR HASH in the current row

  • The HASH column value is calculated by a trigger based on the values in all other columns - something like HASH = Mds5(col1||’@@@’||col2||’@@@’||col3||’@@@’||col4)

  • You can analyze the table rows HASH to determine if any of them does not match the values in the row. If it doesnt match, someone has changed the data

  • to make it easier to detect if someone has hacked a row, add a ROW_NUMBER column and increment it by 1 on every insert.

The cool idea is the hash from the previous row is part of the calculation for the hash in the next row

Thats it - pretty damn easy. This idea is based on row level blockchain. You can also do block level blockchain but that is overkill for most applications.

Have fun