Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Merkle Trees Underpinning Civilization Going Forward

DZone 's Guide to

Merkle Trees Underpinning Civilization Going Forward

Let's look at a use case for Merkle trees in the real world — license plate printing.

· Open Source Zone ·
Free Resource

History-retaining Merkle trees (like Git with force-push turned off) are a significant advance towards a better society, government, and industry. No, not blockchains with distributed consensus, history-retaining Merkle trees with no distributed consensus (Byzantine or not).

Example: UK Number Plates

The Driver Vehicle Licensing Authority (DVLA) is decades old and runs operations for the UK from Swansea in Wales, and allows high-street stores to apply for and then operate license plate printing services (for profit). They are supposed to check that you have the right to that “plate”, but the BBC found that checking is skipped by some firms. People are using those firms to make plates for other people’s cars, in order to evade parking/speeding fines (and worse). Of course, criminals could print their own, but if dodgy firms are mixing illegal plate printing among legal plate printing then whole the system needs an upgrade. Now, it could be (I don’t know) that the license firms mail in paper forms to DVLA who then put them in a pile ahead of scanning them. If true, that is a bit Victorian. Maybe there a website for those firms making changes, and DVLA runs a 10 person dev team just to maintain the site. If it exists, it’s still a bit Victorian as people who own plates that have been cloned “by mistake” are not informed when that cloning happens. I say mistake because the firms caught by the BBC mentioned in their article all have good excuses and pledge to not let it happen again.

If the UK didn’t have that non-public web-application and wanted to launch something electronic that could support tens of plate printings per firm/outlet a day, then you could just stand up a Gitea instance in AWS, make one “private” repo per licensed firm (force-push turned off) and have a simple text-format for plate-printing work performed by those firms. Your requirement would be for firms to add records in real-time — before affixing the plate to the car or handing them to the customer. The firms in question don’t have to learn to use Git, they just have to be able to use the web-UI. DVLA would modify their Gitea to have a custom editor (see below). Each firm would manage their own staff and access to the repo. DVLA would lay on videos for skinny training and compliance.

With the upgrade from Victorian systems, you could have an obligation for the firms making mistakes to indemnify victims of cloning from their costs. At least for the ones where their firm made the mistake and printed a plate. If a firm doesn’t update the record in real time it loses its license to make plates and pays a big fine.

One of the facets of Merkle trees is that they can be audited. Records can be changed in such a tree, but it was apparent that they were after the event. That includes back-inserting something, and Git’s history-retaining nature supercharges this feature. Accounting firms, in the future, will have whole departments dedicated to auditing Merkle trees — verifying that a previously shared SHA1 (or better) correlates to a moment in time in a path/namespace. Not just for government and other regulation-driven uses (like this niche one), but in commerce too. Ultimately there are tens of thousands of uses. Ralph Merkle should get the Nobel peace prize at some point.

On custom editors: see my prior work here, here, here, and here. Those are for web sites, and an Android/iOS app would be possible too, but harder.

On custom editors in Gitea, see the custom/templates/custom directory in the Gitea install. At least, make that directory and put templates there. Templates have names like extra_tabs.tmpl and contents like so:

<div>
  <!-- PaulWashere -->
  <script>
    alert("Hello! I am an alert box!!");
  </script>
</div>


Well, something more than an alert box — see customizing Gitea for more info, and the example of editors above.

Topics:
open source ,merkle trees ,use case ,gitea ,tutorial

Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}