Templating and I18n in Javascript

Pangolin – A Practical Translation Architecture

We aren’t translating anything like enough websites into anywhere near enough languages and I wanted to investigate how we might solve that.

This is a rather dull subject. The core issue is all about performing phrase dictionary lookups on a given domain/locale which you will need to be able to localise to a namespace, based usually on the file name, and support parameterised phrases, eg “You have $unread new e-mails”. My proposals are not concerned with natural language processing.

Neither do they involve AI for detection of content in a UI at client/browser level. The cop out to just hand the job over to Google to translate your interface is perhaps the biggest shutdown argument, certainly for anyone paying the bills. In practice. these tools only go so far. Anyone requiring a quality product in a foreign language has to mark the code up, there is no escape.

Overview

It’s not working. And nobody cares that its not working.

You could be forgiven for dismissing the subject as something that we surely already have totally nailed, how hard can it be. Or that if it was an issue then the marketing dept would pay for it to be fixed. But something obviously isn’t working, I present the World Wide Web as evidence. Across sites that have any language selection facility, the range of languages available is invariably severely limited.

There are two costs associated with extending an existing system that has been prepared for internationalisation. The cost of the translations, which should be considered as content at an operational architectural level. And then the cost of release, including maintenance, of that data. We need to reduce both those costs to as close to nothing as possible.

“A quick Google finds more than a few open-source translation databases and engines”. No it doesn’t. We need a public DB and an API as easy as using npm or git. Neither exist. Only proprietorial solutions exist to supply the translations. There is no facility and little motivation to crowd source the data for public use.

The resolution of the translations, the business of substitution in the original template, needs to be performed, when needed, on demand and as part of the production-level execution architecture, and cached for further use. This is essentially a templating issue. With a powerful enough templating architecture you wont need to leverage the software release system to publish translations.

LiquidJS supports asynchronous callbacks (synchronous or blocking call backs would cripple the server). And hence you can extend it to call your database API to fetch data from a call inside your template using parameters passed to the engine, or subsequently read by it, at render time. It is TypeScript compatible, heavily peer reviewed and has undergone multiple major version releases. It is easily extensible. The markup is configurable. Plug-ins and bloc operators are easily implemented and there is a clear API to the internal tokeniser. It also supports the concept of filters on interpolation mark-up. And, critically, it supports asynchronous callbacks. If you take nothing from this or are bored already, take LiquidJS.

Implementation

There are two principal components of Pangolin

1. Foxbat

A LiquidJS extension to support multi phase template execution. Essentially to be able to execute and resolve translation markup on a per locale basis once only per “resource” (generally a file in truth).

2. Marmot

A translation dictionary database implementation. This supports input and output of industry standard gettext portable object files (.po files).

Foxbat

The Foxbat code itself is tiny, and indeed can be further simplified. It is nevertheless conceptually important.

Code here

https://github.com/mark-lester/foxbat/blob/master/index.js

It creates a parent Liquid instance which overrides the renderFile method to perform the following operation based on the file name and the locale. It also instantiates different markup for this phase, so you can code operations to be executed once only per locale, and still perform CGI time and/or client side templating.

There are three instances of the liquid markup available, one for each phase, “once”, “every” and “client”. LiquidJS itself has two kinds of markup blocks, “outputs” and :”tags”, so that’s six, plus a special one for the translations, seven. It is unlikely that you will use both “every” and “client” side application code in the same template, i.e. on user request, generate a client side template to be executed in the users browser.. But its equally likely that you will have an application/web site which includes both models, some client side javascript and also some server side html generation.

1. Determine the intermediary target file.

Convert the file path

<path>/<filename>

to

<path>/.foxbat/<locale>/<filename>

2. Generate the intermediate file

If that file does not exist then Foxbat generates it using the following syntax

The parent instance uses different markup syntax. The standard Liquid markup is

{{variable}} for interpolation of variables, the principal purpose of a templating engine

{%tagname ….. %} extension interface for function call backs, these can be user specified

Foxbat uses

{? variable ?}

and

{!tagname …!}

as markup for this “once only per locale” execution. The call to marmot, described below, is “translate’, so all the to be translated strings in your source files need to marked up thus

{!translate “a phrase I want translating” !}

 Most other templating engines, including the standard JS template engine, require data to be loaded prior to calling the template engine. These engines are intended to perform on a static data structure. This is painfully restrictive. When writing CGI HTML generation it is often far more natural to make a database call at point within the execution of the template. LiquidJS supports asynchronous call backs and hence I/O calls, to be initiated from within the templates.

3. Perform second phase execution

Once this “once only per locale” execution is performed, if necessary, the output file, which typically will have already existed and not need to be compiled, is then executed again. In order that {{ and {% can be preserved for client side templating, a further markup is defined for this “CGI time” execution, specifically

{$ variable $}

and

{@ tagname ….. @}

This resource we have produced could be an executable file in another language such as PHP. You don’t or may not need this second phase execution, I am just demonstrating how you can support three different phases of Liquid execution, “once”, “every” and “client”, and specifically the need for this “once only per locale” execution.

Marmot

The standard translation library used for a quarter of a century is called gettext. It is designed to be

1. executed in an “offline” nature

2. for the entire dictionary to be loaded at start time

3. does not support inline updates of the dictionary

There are some complications with phrase mapping/translating. There can of course be ambiguities with a phrase in English having different translations based on context. Most practical implementations take the file or resource name being translated as a context value, as does Marmot. Another feature of gettext are parametrised phrases. These are sentences that have a numeric variable in them. Curiously, all of the gettext translation dictionaries I have yet witnessed do not support an empty or “zeroth” case. You are expected to print something like

“You have 0 unread mails”.

In no language I am aware of is this grammatically correct. We would normally need to say something like “You have no unread emails”.

Both of these issues, the ambiguities and the parametrised phrases, are in practice minor or relatively rare, and have workarounds. I have nevertheless provided extensive support for both of them.

Marmot is a database implementation of a gettext like interface. The code currently stands at 374 lines. Not as trivial as the base Foxbat code, but it’s still quite light. The marmot and database schema definition are currently held within the Foxbat project at

https://github.com/mark-lester/foxbat

It should to be hived off as a genuinely independent piece of code durring the next refactoring pass.

One obvious reason for building a database oriented implementation of a gettext like interface is so we can subsequently write tools to edit this data. This ability, for the production-team of a specific project to manage their translation database directly using a web application, is a critical piece of the translation/i18n process that is currently missing. We need an open source publicly maintained application so we can all edit our translations effectively, and ultimately recruit our own user-base to help out supporting languages we didn’t previously know we even had exposure to.

There are Load() and Dump() methods implemented which read and write the industry standard portable object files and use publicly maintained code available for converting a JavaScript gettext runtime structure to and from .po file format. These .po files themselves have been overloaded, with magic comment syntax being used to extend the original functionality. This gives us an industry accepted standard for data exchange. Commercial translation sources use these files and so we have a ready made interface for uploading and downloading data through these platforms.

Marmot supports implicit creation (insertion) of previously unseen phrases. This allows for data to be passed through the translation mechanism at a higher level, e.g. place names, sports team names can be translated at CGI delivery time from data within the content DB. Language editors can then witness new phrases in the dictionary and if required translate say Bayern München to Bayern Munch using this syntax.

 {@translate team_name_variable @}

That will call Marmot at CGI delivery time, i.e upon every request of the page, using the value in the team_name_variable that has presumably been fetched from a content Database. We can even move the translation process to the front end and have lookups performed every time a page or view is rendered within the browser. That would presumably result in a remote REST call being made, which would typically be quite expensive, so it’s not a pattern to be used normally.

This is not the same as the parameterized phrase resolution of runtime variables, for that Marmot just bakes the multiple forms required into the served template itself using syntax like

(You can extend your Marmot translations to cope with such things are Slavonic rank cases, just as you can in gettext. Nobody ever seems translate their websites into these languages, but if you want to be able to translate “you have 3 of something” differently to “you have 5 of something”, we can do, and we can cope with further extensions such as gender support.)

  {%transform

empty=”you have no emails”

singular=”you have one email”

plural=”you have {{count}} emails”

control=”count”

  %}

Marmot Editor

This is perhaps the most important part in all this. We aren’t going to get to a crowd sourcing panacea without such an application.

It is undoubtedly the heaviest part of the development work, and quite impractical to complete without broader support for the project. I include a brief video of the application to date. A simple trick, shown in the demonstration, is the matter of marking up a development version of your application such that a user can interact with the target application itself. It’s really quite trivial, we just get the translation substitution routine to stick <div> tags around it’s output with attributes set for the PhraseId is the database, such that we can implement a right click behaviour to warp of to the editor. There are of course many caveats to this. For instance, the contents of the <title> tag don’t want this messy markup. HTML tag attributes and other aspects can often have content we wish to translate and not litter with these tags which are meaningless to the browser, they will just come through as literal text. It is therefore incumbent on the template writer to denote translation tags as not requiring “navigation” markup included. This is done by adding an ‘n’ toggle attribute to the markup

<title>{!translate “App Title” n!}</title>

A mobile implementation would obviously work slightly differently both with the interaction behaviour and the edit interface, perhaps a pane containing a list of all currently viewable phrases, presented in the dictionary.

I have implemented the editor using the Backbone & Marionette MVC framework. It is important that the application is adopted and developed by a series of engineers and engineering groups, and alas Backbone has been abandoned by the engineering world at large. I think it’s important that we review the development of this.

Conclusions

I believe we have to provide a technology whereby anyone can internationalise their website just as easily as they can use GitHub or publish to NPM. It needs to be free at the point of access, and support any manner of release process.

Whether we can establish an open source editor, and a public/open data source as I propose, is highly debatable. Right now, having sketched this out and can now sit back and reassess, I don’t feel massively confident. Most people just don’t accept that there is an issue, or think there is some magic that solves all this.

It might be a great project for interns, especially in all those countries that never get translated into. I live in Asia and will attempt to engage Computer Science departments here in Thailand and Malaysia.

I am going to review what I am doing with this client. Vue seems the people’s choice on that. It’s not critical what client side templating engine is being used. I just don’t want <%….%> which is quite horrid especially if its within an HTML attribute.

Feedback

I have edited this paper significantly with a preface and overview and obviously this section, after receiving the response below. The implementation section, and the source code itself which the respondent was obviously incapable of assessing, are untouched.

“Whoever wrote this doc is a subpar and obsolete engineer who takes himself too seriously. Internationalization (sometimes shortened to “i18n” , meaning “i – eighteen letters -n”) has been a long existing problem in software industry and we already have a tremendous amount of solutions. What he proposes is not “next generation” but re-inventing the wheels of 1990s for console applications only. Adopting his “foxbat” and “marmot” tool in web or desktop applications will bring pain with no gain.”

There is nothing particularly specific to console products in any integrated editor crowd sourcing proposals I have made. The output markup is for the client to process, mobile apps will just manage that behaviour differently as described.

Annual Blockchain Bullshitathon

I don’t do blockchain any more as you know. But it just wont leave me alone. It keeps popping up in the middle of the football. There were two ad campaigns this year that I had to contend with. One from a bunch called HDAC. The H stands for Hyundai. If your dad owns one of the world’s biggest manufacturing companies then you too can launch an ICO and show off to your parents. The other, a truly glossy affair, was from the most blue chip name in all of IT. If IBM are going to boldly claim, with some fancy pants advert on one of the dearest slots on Sky’s advertising schedule, that they are “revolutionising the supply chain with blockchain”, then surely there has to be something in this.

I don’t agree. Blockchain is and only ever can be money. Everything else that is being touted, any reference to “The Blockchain” is in my view bogus. All other use cases do not require universality, they just need irrefutability between two or more parties. Any use cases involving a high number of parties (>100 say) which aren’t really money itself, are essentially public in that it’s members will be prepared to submit trust to a third party, i.e. all the little people log on to one big fat database hub to share their data. Large corporates have their own DBs, which hold only the data pertaining to them.

HDAC burst onto my screen every half-time during the World Cup. With such a lush marketing budget, surely there’s something there. Well yes there is. They raised a quarter of a billion dollars through their initial coin offering off the back of them claiming they had IoT and blockchain woven together in some magical way, and helped no doubt through association with Hyundai. With bucks like that you can pump out all kinds of silly adverts involving a host of semi real or totally made up technologies from dishwashers that turn on when you lock the front door (how or why is this byzantine fault tolerant ?) to granny and grandad turning up at the dining table via a hologram. If you’d asked me 40 years ago “what is more likely, 1. all the 8 bit computing power currently in existence (all PDP11’s, Commodore PETs, Apple IIes etc.) in your pocket along with an instantaneous hi-res video camera, something called GPS, and the bandwidth of the post office tower, or 2. a hologram” I’d have plumped for the latter. So can the hologram people please get on with things. If you don’t know what the World Cup is and missed all the blockchain hullabaloo, enjoy this masterpiece https://www.youtube.com/watch?v=s8EcrSjb85o

There is some critical analysis of HDAC by the community, but it is muted. There simply isn’t enough stuff to assess. All I can say is I cant find a commentator who has the faintest idea how any of this is supposed to work. The advertising campaign, ram packed full of bullshit, didn’t really help.

Big Blue shunted a very glossy advert at me, right after the United v Chelsea match last season, thus ruining the entire afternoon. Surely this is all real, its got a logo on it that is the definition of unsackable corporate integrity. IBM says it is “revolutionising the supply chain with The Blockchain”. If you missed last season’s uncharacteristic victory by United, here is the advert https://www.youtube.com/watch?v=5qPyaqeJ2CY

For my sins I got an invite the other week to an IBM Webinar on the subject of AI and the Blockchain and how they are revolutionizing supply chain. Here is a link to it. https://attendee.gotowebinar.com/register/7127053454941850369

In it is a quote from some revered sage, “Blockchain will do for transactions what the Internet did for communications”. The internet, TCP/IP, literally is communications these days and has been for quite a while. I don’t know how much legitimate (i.e. legal) B2B is actually going on right now, ten years in from inception and at least three since every corp and his dog have been bragging to each other about their imminent blockchain pilots, but I suggest it’s two thirds of not a lot.

The talk is all very plausible, supply chain/blockchain, get on the train, it just has to work. “AI+Blockchain” is such a vote winner, shame we didn’t get much AI. I hope they can get the dependency of whipped cream and beer on CO2 capacity plugged into their neural systems before we all have to suffer again. My beef is not with Watson, apart from the crap name, though one ulterior motive appears to be that if you give our AI guys all your purchasing behaviour they may be able to do great things with it.

My query is what will blockchain do for the supply chain ?. Well it will aid data alignment it is claimed. We wont need to worry if our DB is right or wrong, because everyone has a copy of it and we all ensure that what was said doesn’t get changed. We can even apply rules and permission levels. It’s (going to be) great. Well it is if you want to be hosting a suite of blockchain nodes one for each of your clients, each melting away under the stress of this ever actually taking off and everyone having to record everything that everyone else does. It’s hardly surprising that Big Blue are keen to push this.

Lets just take a step back if I may. What we are trying to do ?, without prejudicing the discussion with “the boss told me to get on the blockchain bandwagon because he wants to cash in some share options”.

We are trying to align databases.

All the supply chain visibility, accountability, provenance and arbitration issues have nothing uniquely to do with blockchain. They revolve around each party to a contract being incontrovertibly aware of any updates by any other party to the contract. I suggest that in practical terms, all of these contracts involve much less than 100 parties that would require their own nodes, if not less then 10. Indeed most of them will actually only involve two, at least initially. Small fry just use other people’s databases, i.e. log onto some hub to record their activity. It’s only big players that need, and will pay, for the independence of their own data system. There just aren’t 200 parties to even the most elaborate supply chain, as IBM claim in their ad, that will all require and pay for their own systems.

You can achieve this irrefutability by multiplying PGP two way encryption with record level many-to-many DB replication. The art of doing this in my opinion is building an arbitrary replication technology that will integrate into a modern stack to update your existing IT. Essentially you have fields in your existing DB which we want to be actually written to by an external party. We don’t want to have to capture that ourselves and then have to record the provenance of the data, we just want it to magically get filled in and for there to be automatic DB accounting such that we can cryptographically prove that the other side said something at a specific time relative to other events in the contract. We DO NOT need universal ordering of all events that use the system. There is only one known use case for that, namely a universally interchangeable vector, or crypto currency. Ideally, we want a system where interaction between two parties is totally invisible to anyone outside the contract. If you aren’t a party to a contract then you shouldn’t even know or be able to become aware of it’s existence, let alone how often it gets updated and irrespective of how much you’ve encrypted it. i.e. just knowing that A is talking to B more than they did yesterday can be of relevance to C, especially if he’s using the artificial intelligence IBM sold him.

Crucially, such a system needs to enable arbitrary document structure to be evolved at an application programmer, or even expert user level. We need to be able to design contracts at a business level. It’s just a shared document that we can apply access rules to. If we can get consistency between parties, the document structure can be reused and standards will evolve. There doesn’t need to be any blockchain hocus pocus involved to do this. We don’t want the data structure to be specified “so we can get it on the blockchain easier”, it should be easy enough to put anything there, much like a web page. It is going to be hard enough to wire what is inevitably yet another data system, be it a blockchain node or something similar to what I propose, to your existing IT. It has to be very flexible and equally scalable.

We will have to see where Maersk, a much touted pilot user, get to with IBM’s blockchain. I don’t suppose a super tanker the size of them is going to get it’s share price deflected much by bragging about how hip they are with blockchain. My view is that the issues that I have mentioned above about peer to peer alignment and then what you do with it, will override the blockchain hype. The value of cross corporate, even intra corporate alignment will become so obvious and needy, that the messy and needless blockchain bit will become short circuited as performance and privacy needs cause direct peer to peer solutions to be implemented. The redundant blockchain bit will ultimately be abandoned.

Or may be not. Perhaps this saga just goes on and on year after year, a self fulfilling twittephecy (I invented that, in honour of the PWC partner who uses word count frequency on blockchain posts to assess the market). I am a lightweight who just doesn’t get it, doesn’t believe. But please, play the webinar to it’s meltdown conclusion, right at the end of the Q&A. While admiring the speaker’s courage in taking unvetted questions on something he is a self professed “not a technician, I’m a ‘practitioner’ “, I would have thought, in view of his extensive practical experience in the supply chain, that “WTF do we do when someone enters sommat wrong ?” would be a common enough scenario for him not to disintegrate when asked.

We don’t need your immutability, it’s bogus, stuff needs to be changed, we just need to know who did what and when and be certain they had the right to do it. We can trivially apply rules and access rights and such like which all parties validate. It’s not rocket science, it’s standard software engineering technology for the most part. We don’t even want universality. Mind your own business, I don’t want to worry about traffic analysis. What we want is irrefutability between a relatively small set of parties. We simply don’t need, and therefore don’t want unless we are bullshitathoning, blockchain for that.

It’s all about alignment, and from that you can naturally develop standardisation. It may be that inter corporate co-operation through blockchain projects will help kick start this and we can start the revolution. But if we are going to get anywhere then focus will need to move to a protocol for arbitrary document sharing across finite sets of parties.

“It’s going to be bigger than the WWW” is a common enough overstatement. If you weren’t literally shaking with excitement the first time you saw Mosaic then I can forgive you getting a little carried away now, just to make up. As soon as a browser appeared with inline images, it was impossible for anyone with any imagination at all not to see what was about to happen. Well let me tell you. Most of us, and that’s just about everyone who isn’t using it so about 99.999% of us in the engineering department, have no use for blockchain as a general purpose DB technology. Other than intrinsically currency based use cases, we cannot see one. That’s why there isn’t a corporate stampede going on with genuine stuff happening, none of us have a clue how we do anything with it that we couldn’t do a damn site easier without it. It’s all just pilots, PoC and “coming soon”. If you are a real company and want to get involved, there’s good news. IBM will let you do it all for free. Just give them a call, tell them you have no money, and they will tear your arm off. Of course you will have to pay your own people to do something meaningful, but don’t worry about the kit and some free seminars, it’s all laid on for anyone who can be bothered to try. That’s how real this stuff actually is.

The US Government Is Sponsoring Blockchain Propaganda

00-Charlatan_Logo3Fake news usually gets outed once it hits the mainstream.  It does damage along the way. If you throw enough of it about and then ask everyone what they think, it can have an effect. But at least within science and engineering we can get to the bottom of stuff pretty quickly and declare something to be bogus. Sure, there are actually people who don’t think the planet is getting hotter because of human activity. And there are many more, myself included, who consider the real problem facing us is pollution and mismanagement as a whole. But the accepted position by most is that The Earth is getting hotter because we’ve simulated excessive volcanic activity for over half a century.

Well not in the world of commercial computing it seems. Blockchain propaganda broadcasts proclaiming that this fascinating technology will be “bigger than the internet” [1] are accepted business mantras without question. We all know that “Blockchain will change the world” [2] right ?. Just look at that Bitcoin graph slow coach and get with the program. Go find yourself a Blockchain use case and stick that word on your company’s mission statement and never look back.

Yesterday I was presented with a paper from NIST, the U.S. Department of Commerce’s technology and standards body [3]. The abstract concludes with “this document explores some specific blockchain applications”. It’s the US government, talking about computing. There’s got to be some valid, in your face use cases, right ?

So let’s go to the trouble of reading it. The first section of the paper is a “high level blockchain overview”. It is a well written compilation of what’s going on, but without going into any gory detail. There are also several checklists you can use to validate your newly acquired crypto genius. It’s implication, indeed purpose, is to enable you to go off into the world and deploy blockchain solutions in your own and other people’s businesses. This is misleading. Blockchain is a complex mesh of cryptographic technology built with a specific goal in mind. Fiddling with the architecture is possible though fraught with difficulties and certainly not for anyone who isn’t a capable cryptographer, let alone someone who isn’t even an engineer and doesn’t even know how the crypto actually works. Changing the core goal, which is to run a cryptocurrency, isn’t actually possible because it needs one of those to function, and the pattern it solves is fundamentally a currency. You can’t take the money out.

The back end of the paper lists by name the top projects. All of which have money at their core. Some of them don’t even have a real blockchain as such in them, namely Ripple. Though they may be the ones to have the most success in the end, which is ironic. If you are going to build something to improve the banking system, then it’s probably a good idea to get the banks involved.

At section 7, sub-section 2, sub-sub-section 1 we get to the coveted use cases. This first batch is of “permisioned” blockchains. These are ones where we have mucked about with the consensus mechanism to get rid of the unpalatable proof of work algorithm. For the pure, these are no longer blockchains, you broke it already. If you are going to secede trust to a handful of institutions, then just let them host the stuff too and corroborate with each other as to the result. Well that’s what Ripple are doing in essence, you just don’t need to fork the cryptocurrency code to do it.

First up then is Banking. Blockchain is money, so if there isn’t a home in the banking industry then we really are in trouble. If you are a banker and want to know what’s going on, go talk to Ripple and the best of luck to you. Oh deary me, R3 didn’t even make the shortlist in the list of stuff-to-use later on in the paper. What on earth are they going to do with the stupendous amounts of cash they raised and have been paying each other. I wonder if they will sue. Note that these companies openly declare that they’ve moved on, because blockchain proper isn’t what the banks need. They are catering to a closed group of financial institutions who already have a basis of trust. At the very best you would only be able to apply this stuff where you have similar levels of trust. There are much simpler ways of doing this.

Next up, Supply Chain. It’s got “chain” in it, this has to fly surely. It’s described as “appealing” and “could be used”. As usual, nobody is actually using it.

We already have end user goods tracking services you may have noticed. This isn’t about that. It’s about irrefutable proof that one party in the supply chain has accepted delivery or executed shipping. You simply do not need blockchain to achieve this. An irrefutable shared record, or contract, between all parties on the supply chain, would suffice. Furthermore, any deployment of a global solution using blockchain would need to ensure a high degree of privacy, otherwise your competitors are going to know just how much business you are doing, with who and when. They may not know if it was electrical goods or lingerie if your company sells both, or access any other detail, or even exactly how many times you connect, but this connectivity information alone is golden and it can be retrieved.

The next sub-sub-sub-section, rather bizarrely, is titled “Insurance and Healthcare”. Well why only have one humongous industry in your use case when you can have two. The insurance industry is plagued with issues of data alignment, recapture and verification. Surely a job for blockchain. These people have been all over the stuff for years. I wrote my solution to tackle this very industry two years ago. It’s not blockchain. Everyone making decisions within the highly politicised world of insurance IT is, or at least was then, besotted with blockchain. It’s the future, get with the program. The love is starting to fade, but ever so slowly. The London market alone screwed up to the tune of 100 million in the last decade as everyone tried fobbing the issue off onto someone else, usually hired from one of those crack management consultancies that you can ask to lead your cutting edge software engineering projects. I fear that once this current cycle of facile pilot projects that they’ve all been fibbing to each other about gets pulled, we will have to wait another decade before they have the stomach to try and work this out again.

As for healthcare, well. Do you really want the fact that you’ve had an association with a rehab clinic engraved for eternity on an immutable and very public data store ?. May be you only went for a check-up, and you are good to go now anyway. The fire hazard constituted by portacabins stuffed full of paper that populate the car parks of every hospital in the country is indeed a pressing issue. In the UK the state of IT in hospitals is a national disgrace with stupid amounts regularly dished out for projects that either break or never even appear. It may well be “appealing” to spray the whole lot with blockchain, but the problems are much deeper even if you waive the privacy issues.

At section 7, sub-section 2, sub-sub-section 2 we get some more use cases for “permisionless” blockchains. These are at least proper blockchains. Interestingly there is a disclaimer “inclusion neither validates or exclusion invalidates”. Well there’s only two, so exclusion would have to be an issue.

First up is “trusted time stamping”. This is a good one and at first sight you may think it has promise. It’s very close to what blockchain does, indeed it’s at its core. What blockchain does is order transactions universally. If we put our proof on the blockchain we wont have to argue about this, will we ?. Well yes, but. For this granularity to be that relevant, the only conceivable use case is back to money problems again. If it’s some cause and effect issue, all we need is irrefutable proof from A that allows B to proceed. An irrefutable shared record between two, or any double digit number of parties, doesn’t need blockchain. (but I know something that can help. Click White Paper in the top left corner).

And we’ve still got to fuel this blockchain somehow, we need an incentive. Bling may work, but I doubt it. Show me something that floats, I have seen none. Money definitely does work. People will join your Byzantine fault tolerant consensus strategy if you pay them. But now I have to pay every time I want to write a time stamp. Pay to play databases are a tough sell at the best of times. If there isn’t a hard business case, if we just don’t care that much if B’s clock is wrong and it’s not going to change who, what and when anyone gets paid, then I suggest you don’t have one.

There is also a bogus publication claim. That by posting proof on a blockchain it’s now public and irrefutable and so I have now done something that can’t otherwise be done by PGP+Twitter. You just post a signed copy of whatever you want to say to one or more super resilient systems that may or may not charge for the privilege of saying or seeing. If you use more than one twitteresque system, they can share signed acknowledgement of receipt amongst each other (see this White Paper he keeps going on about). We don’t have to float a BFT.

Next up: “The Smart Grid”. Very plausible sounding. A Blockchain of Things you might say (if that gets used I am going to cry with anger). The reference paper is from Finland in 2016. It comes with another of these handy blockchain checklists. The other one thrown in there is certification. Again, I would need more detail, but it just sounds like IT systems and paper-work in a muddle. Getting the world to use a universal data system does sound appealing, surely we can standardise now. But if the the problem can be resolved by just two parties sharing irrefutable proof between each other that one has said something and the other acknowledges that they heard them (see white paper) then it’s overkill and most probably not commercially viable.

Conclusions

The opening line in the same section of this paper reads:

“Blockchains are a significant new avenue for technological advancements”

Note the plural. Like we’ve got loads of these. We’ve got umpteen cryptocurrencies, all of which are in danger of being made illegal. We haven’t got a single non-currency based instance of them anywhere that is running for real. BFT certainly is a burgeoning faculty within computer science, and so it should be. But it’s worth remembering, this stuff didn’t directly come from a university. They’ve had ten years since anyone at that end of the department went “holy cow, someone has a real cryptocurrency”. Come on guys, work it out!, or at the very least give me a hand making this a fair playing field.

This work was quite blatantly commissioned by NIST under the premise that is stated on their conclusion. It does cover some critique and pitfalls, but these are virtually in the appendixes. The conclusion that anyone who hasn’t been at the coal face is that this is a racing certainty. The result on investment, or even a fair hearing, from anyone at the other end of the argument is severe. The paper work in all the above use cases continues to pile up while billions are being spent on this self serving army of prophets.

I know to The Converted this just reads like I am picking holes for the sake of it. Well someone has to don’t they ?, or do we now live in an intellectual autocracy ?. We’ve voted for Blockchain and that’s what you are going to get, even if it doesn’t add up, doesn’t solve the issues and wont deliver. This “money is just the start” pipe dream has been about for years now. Somebody somewhere must have something that they’ve floated. And I don’t mean a pilot where those of the One True Faith are all nodding furiously. Show me one of your real easy spray it with blockchain examples that isn’t a currency and is in revenue earning service, just read our government sponsored paper and you are ready to go. They don’t exist.

This stuff is complicated. If it wasn’t we’d have seen something by now. The deluge of propaganda, all of which is void of any genuine content, just menacing language like “threatening the validity of businesses that refuse to adapt”. is giving shelter to hyperbalists selling miracle cures. Greed can consume any of us, and that bitcoin graph could lure all but the most wary. My beef is not that it wont work for all this other stuff. I made my mind up on that issue once I’d ploughed through what this is and what it was built to do. It’s the sterilisation of development in this area that is costing us the most..

There is a positive side to all this. The issues and use cases that have been exposed are for the large part genuine. If we can have a more open discussion on how we solve the matter, and not have everyone dreaming of an IPO/ICO and getting dirty rich in seconds, then just may be we can start producing viable solutions.

If you found these views at least something different and a worthwhile counterpoint, you may also like Blockchain Is and Only Ever can be Money

[1] https://www.tech.london/news/will-the-blockchain-be-bigger-than-the-internet

[2] https://www.forbes.com/sites/danielmarlin/2017/12/22/what-is-blockchain-and-how-will-it-change-the-world/#62adbe17560a

[3] https://csrc.nist.gov/CSRC/media/Publications/nistir/8202/draft/documents/nistir8202-draft.pdf

Blockchain Is, And Can Only Ever Be, Money

It’s The Problem, Not The Solution

 

Berkshire-Hathaway this week described cryptocurrencies as “asinine and poisonous”. My argument here is not about what that bitcoin seismograph is going to do tomorrow, next week or next year. It is about misappropriation of the technology that underpins it. If you’d prefer, this guy makes my point from an analyst’s perspective

Ten years in and nobody has found a use for blockchain

I am a software engineer. I make stuff work. I get called a “coder”, which can be either the highest of compliments or the deepest of insults dependent on the caller. Corporate Earth literally spends or loses in revenue TRILLIONS of bucks a year either struggling to synchronise data both within and across corporations, or suffering from their failure to do so. I have an order note, you have an invoice. This pattern is everywhere.

Such a global issue might sound like the job for the magic of Blockchain. If it can make money out of nothing, can order transactions universally, then surely it can help us synchronise our data. Well alas not.

Universal ordering is a very cool trick indeed. The mesh of cryptographic techniques required to make this happen makes someone like me gawk, wince, and then actually giggle as they pick their way through it. There are of course ecological issues about how this is all done, but lets park the nimbyism outside for now. There are alternatives to Proof of Work in the oven. May be they will taste good when someone actually launches a real currency with them. The snag with respect to my title line is that to date we only have one known use case for this work of true genius that gives us this universal ordering. And that is to maintain a universally interchangeable vector, i.e. to detect and prevent double spending on an account, then we can have a cryptocurrency.

Now this doesn’t mean you can’t fork the bitcoin code, chuck out the inconvenient PoW part that wastes power, call it a “private blockchain” and use it to store data. You have to chuck PoW else apart from a DBMS that’s as fast as a three legged pig on a ketamine overdose, you will have a database that actually costs significant money to use on a per write basis, and thus even more to use inefficiently. That may sound like a reasonable imposition, but from an engineering perspective it’s a ridiculous proposition. I have to come up with a hard business case every time I want to write to the DB.

Lots of people are doing this moneyless blockchain in their pilots, so please read on of you have read stuff like “cryptocurrencies is just the beginning” . There are no sound technical grounds for doing it, other than that your boss may love the idea. The hardcore cryptocurrency brigade, which includes Ethereum, don’t even think you have a blockchain anyway now, you broke it when you dumped PoW and now everyone has to promise not to play dirty. We also have the counter situation to having to restrict usage to high value tasks. Now I get to screw the whole network over with no apparent cost to myself. Any of these systems would have to be heavily policed.

If I don’t have any genuine use for the ordering, the only justification for this is this immutability claim. Immutability means it can’t be rubbed out and can’t be changed. Doing this on the universal ledger is all part of the wonders of blockchain. But if we aren’t playing some global currency game, i.e. it’s just between us what was said, and in what order, then making the network validate this and everyone to keep a copy is massive overkill and frankly redundant.

If we want to be able to prove that someone said something, we get them to digitally sign it with their Verisign keys. If we need ordering of this we get them to either number or timestamp it and then sign it. Only if we need this ordering to be universal do we need to start getting the BFT machine out. Sure, your boss is delighted that he can stick “blockchain” on Companies House, but really that is all that you have achieved.

Cloud computing is available to all. It provides near asteroid-proof resilience (note to British Airways, it can also defend against cleaning ladies). Give me your signed copy and I will put it in my asteroid proof database so it doesn’t get lost. Nobody else need know anything, or have to do anything on my behalf. That is as immutable as anyone could reasonably need in these private circumstances. If Verisign fails then your data verification is going to be the last of your worries.

The problem with Byzantine Fault Tolerant systems is even deeper though. You see you can’t really run them on bling, not unless this bling can be taken down to the local power station and exchanged for the electricity needed to participate in this democracy. Even with proof of stake or proof of trust or any other devilishly cool invention that is currently or may ever be dreamed up, or just proof of nothing as in the case of our “permissioned” stuff, you still need some global network to participate. They need a reason to do this to pay for the fuel bill, and the accountant for the depreciation of the kit.

Getting back to the job in hand, which is just making sure we are certain both or all sides are “on the same page”, once you want to apply constraints and rules to this page/document/contract, which we do, we hit a classical problem of obfuscation. Using blockchain we have to publish these rules to the network, they can’t be hidden. This is completely unacceptable in most business cases.

I know the boss and everyone else on the board isn’t going to like this, they just issued themselves shed loads of new shares in anticipation of the execution of the do-it-with-blockchain command you were issued and they are ready to tell the world and cash in. Profiteering in the bitcoin casino is one thing. There are instances of the above I could list which are tantamount to fraud.

I was assured this week that we aren’t in immediate peril from over exposure to a seismographic BTC graph. This is a relief. How much betting has gone on blockchain startups with no valid raison d’etre I know not. It’s surely  peanuts compared to the last two cock ups in the market. The real issue here is the TRILLIONS I mentioned at the start. We aren’t making the progress we need or could be doing on this matter because investment in this problem is skewed by the bitcoin effect.

I should now confess why I have such a developed opinion on all this. Two years ago I wrote a system to solve this issue of cryptographically irrefutable data synchronisation. It was motivated and designed to help the insurance world synchronise their IT. EC2 had declared out loud that it was looking for “disruptors”. I hope you can agree after reading this that I am at the very least disruptive. Turning up at the annual ACORD bash in my jimjams and attempting to get through all this in three minutes flat was never going to work I guess. Nobody in the stuffy world of insurance was going to touch a nutcase like me. So I wrote it all up, stuck a parody of the famous Sex Pistols album cover on my blog front page, and prepared to go back to a long standing and socially worthwhile project I keep trying to float.

Or maybe it was just because I wasn’t using the magic word. I did get a bite recently and quite out of the blue. Despite some extensive due diligence, when we finally sat down to actually do some work it turned out all they wanted to do was float cryptocurrencies. The words “you can’t and don’t want to do this with” had been auto-redacted, all they had seen was “blockchain”. I have amended the blog to prevent a repeat of this ridiculous saga.

If you are a devotee and claim I am wrong in my assertions, I urge you to contact me with your counter example of a moneyless blockchain use case. I should warn you that I have been sat here for some time, and my erstwhile biz partner and long term friend feeds me possible instances regularly. So far we haven’t found one that’s justification doesn’t eventually just boil down to “I can’t get funding unless it’s called blockchain”.