The Perfect Blockchain Language

Finding the Perfect Programming Language for Developing Blockchain Protocols

Blockchain technologies are the roadways and bridges for our current generation, and in building the infrastructure we want to avoid cracks and potholes showing up in the future. Every developer knows the “fail fast and ship early” mantra for consumer apps.

For long-lasting infrastructure, it is crucial to do the hard, time-consuming work up-front to build an impenetrable foundation.

Blockchains build on top of previous transactions. Once a protocol is released into the wild, there are more eyes to discover faults in the code, but also several people willing to exploit them. That is why the time and effort invested earlier on to verify, and ensure that programs have predictable properties pay off in the long run. Good blockchain applications also require an ecosystem to support it. Thus, the programming language on which a blockchain platform is built is one of the major factors in its evaluation.

After systematically learning and evaluating multiple platforms and technologies, I have narrowed the following essential properties of languages to program blockchain infrastructure:

1. Transaction Expressivity

A language should facilitate the breadth of ideas that can be represented and communicated. Earlier and more successful blockchain protocols served the role of digital currencies. With Bitcoin, currency transactions were immutable and verifiable on a public ledger. Smart contract protocols, like Ethereum, opened up the opportunity to encode even more data into the transactions.

Future evolutions of blockchain protocols will enable even richer forms of transaction, and require complex data structures. Beyond just numbers for financial transactions, applications can store rich media files (like MKV for Virtual Reality) for collaborative content creation; detailed industrial designs; or even self-executing AI programs!

2. Safety

The earlier a programming language catches an error, the safer it is to write programs in it. Formal verification methods, pioneered by Tony Hoare, can be used to mathematically prove that a computer program will behave as expected.

So why is formal verification particularly important for blockchain infrastructure protocols?

For standalone programs that run on local machines, computer bugs are annoying (for those who remember Windows Vista). But connected to the internet, they can be exploited to take all the computers in a network down. The Heartbleed vulnerability in OpenSSL, that affected millions of computers worldwide, could have been avoided with formal verification.

Blockchain makes that risk even more substantial. Not only can bugs take down machines, it can wipe out billions of dollars in value, critical health records, and sensitive data. With that much at stake, the time and effort upfront invested in formal verification is absolutely worth it. Fortunately, theorem provers, like Coq and Isabelle, can automate that process, and the code can be written in a formally verifiable programming language.

3. Decentralization

A decentralized network for machines are needed to verify the transactions in a network. If a protocol requires specialized equipment to run effectively, then it pools the power into the hands of a few who have the capital to buy specialized hardware for mining or staking. The compiled bytecode, or virtual machine, therefore needs to be lightweight.

Decentralized open-sourced projects will attract developers with geographical, cultural and language diversity. The easier it is to debug the code, the better it is for collaborative development. Core dumps and memory leaks are much harder to diagnose and debug than stack trace errors from functional languages.

4. Community

The more popular a language is, the more developers there are to contribute to an open-sourced project. However, this is a good to have, rather than a necessity. Without an existing strong community, education becomes more important. Because of the risk and reward calculus, it is better to choose the right language with fewer developers, than to compromise to go after a bigger pool.

Let’s evaluate the major programming languages on those 4 criteria: