What are Blockchain Programming Languages: The Old Guard Meets the New Generation
Key Questions Answered
Dozens of programming languages are used in developing blockchain platforms and their apps. Some of these languages are blockchain-specific while others have existed long before Bitcoin (BTC) and are used extensively beyond the blockchain space.
Specifics of Blockchain Programming
A particular blockchain network may use and implement a variety of programming languages. This is in stark contrast to the typical closed-source centralized proprietary networks developed by companies for their own internal use. These corporate networks are usually written and updated in one language, rarely incorporating code written in other languages.
Public blockchains, due to their open-source and decentralized nature, do not necessarily exhibit such uniformity. For example, the Ethereum blockchain has several implementation languages, of which Go, Java, and Python are the most well-known.
As we cover the main languages used in blockchain, you will note that a variety of languages are associated with the same platform, even though their intended applications are different.
Types of Programming Languages Used in Blockchain
Programming languages used in blockchain can fall into the following categories:
- General-purpose programming languages: they are used extensively in the software development industry beyond only blockchains. Some have been instrumental in the development of popular blockchains and crypto apps. General-purpose languages are used to develop blockchain networks and apps residing on these networks. Since blockchains typically host a variety of different apps, different languages are often used on the same blockchain.
- Blockchain-specific languages: in addition to general-purpose languages, a number of blockchain-specific programming languages have developed with industry expansion. These are used for a specific purpose – creating smart contracts.
- Object-oriented languages: some of the languages used in blockchain are object-oriented. In object-oriented languages, programming logic combines data (such as smart contract field names) with methods (i.e., instructions for the software to execute some functions). object-oriented programming makes it easier to reuse/update the existing program code compared to procedural programming. This feature makes object-oriented code more suitable for complex software solutions.
- Procedural languages: in contrast to object-oriented languages, procedural languages (also known as functional) do not combine data/fields and methods/functions within the same entities/objects. In general, procedural languages offer faster program code execution and contain fewer lines of code. Earlier programming languages that originated in the mid- to late 20th century were all based on procedural programming principles.
As modern systems grow in complexity, object-oriented languages have become more popular. In fact, the majority of popular programming languages used in blockchain are object-oriented.
General-Purpose Languages Used in Blockchain
Developed in 1985 by Danish computer scientist Bjarne Stroustrup, C++ became one of the most widely used languages in the late 20th century for creating applications, games, and performance-critical systems. Before the arrival of Java, Python, and other newer programming languages, C++ was the leading general-purpose language for application development.
C++ is considered a partially object-oriented language. While it was derived from the purely procedural C language, it includes object-oriented structures that were not part of C.
Blockchain platforms fully or partly written in C++ include Bitcoin, Ethereum (ETH), EOS, Qtum, and Stratis.
Java is probably the most popular general-purpose language used in blockchain. It was created in 1996 at Sun Microsystems by a team of developers headed by James Gosling, who is often referred to as “Mr. Java.”
Java is considered a purely object-oriented language. The development team aimed to create a language that would fully adhere to the principles of object-oriented programming.
Java was designed to be as platform-independent as possible. Its original slogan — “Write once, run anywhere” — meant that Java programs were designed to be deployed on a variety of platforms with minimal or no code modification.
Java inherited a lot of its syntax and functionality from C++. Compared to C++, Java is more platform-independent but somewhat slower. Therefore, C++ is more widely used for mission-critical scientific systems requiring fast response times, while Java is more popular for business application development.
Popular blockchains fully or partly based on Java include Ethereum, IOTA, NEM, NEO, and Hyperledger Fabric.
Among the general-purpose languages, Python may be Java’s biggest rival in popularity on blockchain platforms. Introduced in 1991 by Dutch programmer Guido van Rossum, Python is an object-oriented language that was designed to be as simple and human-readable as possible.
Python’s popularity has grown significantly in the last decade. Similar to Java, the language is being used now for a wide variety of applications and systems.
In the blockchain world, Python has been used within platforms such as Ark, Hyperledger Fabric, Qtum, Ethereum, Steem, and NEO.
Golang, colloquially shortened to Go at times, is a partially object-oriented programming language first released in 2009 by Google. Golang was derived from the C programming language.
Google stated that their intent with Golang was to introduce a language that improves programmers’ productivity when developing complex multicore distributed software.
Golang has been used in developing both Ethereum and Hyperledger Fabric.
Solidity, an object-oriented language, is the undisputed leader among blockchain-specific languages. It is the most popular language for developing smart contracts on the Ethereum blockchain.
First conceptualized in 2014 by English computer scientist Gavin Wood, Solidity was then created by Ethereum’s development team, led by Dr. Christian Reitwiessner.
While developed specifically for Ethereum, Solidity is also used on other platforms, such as BSC, Tendermint, Counterparty, Polkadot, and Tron.
Simplicity was introduced in late 2017 by software developer Russel O’Connor. While Solidity is an object-oriented language, Simplicity is a procedural language.
Simplicity aims to improve the way smart contracts are written, and is compatible with a variety of platforms. Being a young language, it has not yet seen wide adoption. However, developers who prefer procedural languages to code smart contracts will appreciate this option.
Ride is another procedural programming language for the blockchain environment. Introduced in 2019 it was designed to program smart contracts and decentralized apps (DApps) on the Waves blockchain. It is largely restricted to its native platform.
Ride’s syntax is designed to be simple for beginner programmers, and to provide secure and straightforward programming code execution. To achieve these features, the language had to sacrifice some of the features available in many other programming environments, namely loops and recursions.
Derived from Python, Vyper also aims to be an alternative to Solidity for smart contract development. It was deliberately designed to have fewer features than Solidity to make smart contracts more secure and easier to audit.
Programmers familiar with Python will find it easy to learn Vyper, as the two languages are syntactically similar.
Rholang is a procedural programming language introduced in 2018, and used by the RChain platform for smart contract programming. The language was designed with the aim of providing faster speed and reliability of execution.
In theory, Rholang could be used as a general-purpose language outside of RChain. However, the language is still largely confined to this platform.
Which Blockchain Programming Languages Are Most Popular?
Due to the blockchain ecosystem’s distributed and complex nature, it is impossible to precisely quantify programming language use across all platforms, apps, and smart contracts. However, some experts have come up with methods of approximating such information indirectly.
In 2019, the team at NextFork, a crypto news portal, counted the number of enquiries on StackOverflow related to blockchain and mentioning a specific programming language. This data presents an approximate reflection of each language’s popularity. The chart below shows the number of mentions for each considered language.
The main blockchain programming languages can be divided into general-purpose and blockchain-specific languages.
Blockchain-specific languages are used for smart contract development. By far, the most popular smart contract language is Solidity. Solidity can be used on a number of blockchains, but is mainly seen on Ethereum.
Other blockchain-specific languages either have more limited use, or are actively used only on smaller networks like Rholang on RChain. Since these languages are still relatively young, their adoption may grow in the future.