Blockchain technologies are currently being used in many spheres of life apart from the finance sector — in healthcare, record-keeping, logistics, etc. Blockchains are written in many programming languages. This article takes a look at some of them.
The first time I heard about cryptocurrencies was in 2011 when I read an article about Bitcoin. To be frank, I was sceptical about the future of a currency whose value was not tied to any real-world entity, like gold. In March 2013, it was reported that some bugs were found in version 0.8 of the Bitcoin software. I believe that was the first time Bitcoin was widely covered by the press in India. Many experts predicted the end of Bitcoin and cryptocurrencies, with some comparing Bitcoins with the legendary tulip mania—the prices for some bulbs of the tulip (a type of flower) reached extraordinarily high levels in the then Dutch Republic but soon collapsed in February 1637. This was also the first recorded instance of a speculative bubble. But the fate of Bitcoin was different. Time and again we have seen that predicting the future of a technology is a risky business.
Getting back to cryptocurrencies, today, after more than seven years (as of May 2020) the cryptocurrency market is a whopping US$ 1 billion industry. Bitcoin now has many competitors like Ether, Ripple, etc. Besides, the blockchain has found applications in diverse areas like smart contracts, healthcare, personal identification, etc. With major multinational companies investing heavily in blockchain technologies, the industry looks set to gain further momentum.
There are dedicated programming languages for blockchain related technologies. The abundance of programming languages has always amazed me. Developers are willing to create a new programming language rather than modify an existing one, in order to suit a new industry, and that has led to many exciting new options. Blockchain programming languages like Solidity, Simplicity, Vyper, CX, Scilla, Rholang and Obsidian are some of them. Readers will notice that I have omitted the popular Bitcoin Script from this list since it is not Turing complete because it does not support loops. But the unavailability of loops is not an accident. It is done intentionally to avoid the occurrence of infinite loops.
I have tried to work with just one among the programming languages mentioned above, called Solidity, for which I was able to easily install the compiler in my system.
Solidity is an object-oriented programming language which was developed for creating smart contracts, an essential part of blockchain technologies.
Even though it sounds like an over-simplification, a smart contract can be seen as a contract drafted by a programmer using programs and protocols, rather than by a lawyer in the traditional way. Please note, as mentioned earlier, blockchain technology nowadays is not just about cryptocurrencies like Bitcoin. The widespread acceptance of Solidity and the Ethereum platform by the general programming community might take some time. Users of the Ethereum platform may find it useful to learn Solidity, which operates in a way that’s similar to Java — the source code is compiled to byte code and then a virtual machine is used to run it.
First, let us try to install the compiler for Solidity. I was able to install one of its compilers called solc using the package manager Snap.
The following command installed the compiler solc in my system:
sudo snap install solc
Solidity programs use the extension .sol. I searched the Internet in vain to find a HelloWorld.sol program. I even tried the website www.helloworldcollection.de, which offers ‘Hello World’ programs in hundreds of different programming languages. But there was no Solidity program and there is an opportunity there. You can be the first one to add a ‘Hello World’ program in the Solidity programming language.
Again, this tells us something about blockchain programming languages. We must not treat them like other traditional programming languages. Even the smallest Solidity program available was relatively large, so I ended my use of the Solidity compiler solc with the command:
…on the terminal.
Figure 2 shows the output of the command, which tells us that most of the source code of Solidity is licensed under the GNU General Public License. But please note that, based on the philosophy of blockchain, it is implicit that any programming language that can be used in the blockchain environment should have an open source implementation. A technology that depends on openness and decentralised behaviour can support nothing but an open source paradigm — it doesn’t make any sense otherwise. Without further ado, let us move on to some more blockchain programming languages that might become trends in the near future.
Simplicity: This blockchain programming language is supported by Blockstream, a blockchain technology company. Simplicity is dependent on two other traditional software — Haskell (a functional programming language) and coq (an interactive theorem prover). Simplicity is also used to generate smart contracts.
Vyper: This is another programming language that tries to target the Ethereum platform, similar to Solidity. Vyper calls itself a Pythonic programming language – which in simple terms means it exploits the features of Python.
CX: This is a programming language supported by Skycoin, a blockchain technology company. CX claims to be a general-purpose programming language.
Scilla: This language is mostly used to draft smart contracts. It also takes its strength from the proof assistant software coq.
Rholang: This blockchain programming language is still in its development stages (according to the Rholang source on GitHub).
Obsidian: This is another blockchain programming language used for drafting smart contracts.
Of course, I could have added many more to this list. However, as I am not an expert in any of these programming languages, I think it is better to stop at this point. But as a programming language enthusiast, I have to make two observations before I conclude this article. First, I think almost all the so called blockchain programming languages are still evolving and may take a few more years to reach their true potential. Second, if you observe carefully, almost all these languages target a specific blockchain technology platform. This makes the widespread acceptance of any one particular programming language rather difficult. At the same time, with sufficient number of fans and followers, any one of these programming languages could make a huge impact in the industry.