Blockchain Programming Languages: An Introductory Guide

Delton RhodesApril 22, 2020


With blockchain technology taking off around the world, blockchain programming languages are becoming a topic of major interest. According to one estimation, there were around 105,000 blockchain developers in the world in 2018. Of course, this is only a tiny fraction of the global total of 18 million developers. That's why a 2020 LinkedIn report ranked blockchain as the most in-demand “hard skill” that companies need this year.

If you’re a developer looking to learn the right languages to begin your blockchain career, then this post is for you. In this article, we cover the most in-demand blockchain programming languages. We’ll look at how each language is used in the context of blockchain programming, along with examples from major projects in the blockchain space. The three categories featured are protocol-level development, smart contract development, and software development kits (SDKs).

blockchain programming languages banner image

Blockchain Programming Languages For Protocol Development

Core blockchain development, also known as protocol-level development, largely focuses on building blockchain protocols, mechanisms for blockchain consensus, network architecture and security mechanisms for peer to peer networks. Note that protocol development doesn’t include front-end or application development. Here are a few examples of popular blockchain programming languages frequently used in protocol development.

C++

There are two major reasons why C++ is commonly used for building blockchain protocols: its ability to tightly control memory and CPU usage; and its ability to quickly validate and propagate blocks.

Satoshi Nakaomoto wrote the code for Bitcoin Core using C++. Several other blockchain projects use the Bitcoin Core C++ codebase, including Bitcoin source code forks such as Bitcoin Cash and Litecoin. 

Other blockchain networks have also implemented C++ code. The original implementation of the Ethereum network was written in C++, along with implementations written in Go and Python. CryptoNote, an application layer protocol for privacy-oriented cryptocurrencies, was originally written in Java but was rewritten using C++ in 2013. The CryptoNote protocol is used by Bytecoin, Monero, and other source code forks of these two projects. NEM is currently written in Java but will soon be rewritten in C++.

Golang (Go)

Golang (commonly referred to as Go) is a statically typed, compiled programming language designed by Google. According to a book titled, “Invitation To Computer Science”, Go is “an attempt to combine the ease of programming of an interpreted, dynamically typed language with the efficiency and safety of a statically typed, compiled language.” It's also designed to be fast, taking at most a few seconds to build a large executable on a single computer. These characteristics also make it a solid option for core blockchain development on decentralized networks.

Chainlink is building secure blockchain middleware designed to connect smart contracts with external resources, like off-chain data and APIs. The Chainlink Golang node, currently in alpha, is written in Go. It will go on to form the basis for Chainlink's decentralized oracle network.

Loom Network is an Ethereum Layer 2 network which uses the Go-Ethereum, the official Go implementation of Ethereum. Many other aspects of Loom Network utilize Go. For example, the go-loom library contains everything needed to build Go apps and services that interact with Loom DAppChains, dApps that run on their own sidechains. This library can also be used to build smart contracts that live on DAppChains.

Java 

Java is a programming language that handles memory allocation quite well and is considered easier to write than other languages like C or C++. Multiple surveys, such as the TIOBE Programming Community Index and the Cloud Foundry Foundation (CFF) survey, rank Java as the top language for enterprise developers. However, obvious drawbacks of Java are the need to use a Java Virtual Machine (JVM) and a slower performance compared to C++ and Go. 

The bitcoinj library is a Java implementation of the Bitcoin protocol that allows users to maintain a BTC wallet as well as send and receive transactions without needing a local copy of Bitcoin Core. It comes with full documentation and some example apps showing how to use it.

Hyperledger Besu (formerly known as Pantheon) is a Java client developed mainly by PegaSys, the protocol engineering team at ConsenSys. According to the The PegaSys team, Java is “a logical fit to us for a number of reasons, from the size and maturity of its development community to more technical and Ethereum-specific reasons such as maintenance, speed, and extensibility that make it the best language for a large application such as an Ethereum client.” Hyperledger Besu can be run on the Ethereum public network or on private permissioned networks. Web3j provides another Java client option for the Ethereum network.

Blockchain Programming Languages For Smart Contracts

Smart contracts are blockchain-based contracts that execute code automatically when certain conditions are met. When deployed on a blockchain, smart contracts are able to support user activity such as cryptocurrency payments or DeFi applications with little to no need for human intervention. Here are a few examples of popular blockchain programming languages that are often put to use in smart contract development. 

Solidity

Solidity is a statically-typed, object-oriented programming language created specifically for smart contract development for the Ethereum Virtual Machine (EVM), a “quasi-turing complete” 256-bit virtual machine. Solidity was influenced by C++, Python, and JavaScript. 

Remix is a browser-based IDE built specifically for Solidity smart contract development, allowing developers to write, compile, and deploy smart contracts. This IDE includes persistent file storage and doesn’t require additional developer tools or software installations. 

Although it’s possible to write Ethereum-based smart contracts with other languages like Serpent and Vyper (Python-like languages) or LLL (based on Lisp), Solidity is by far the most popular and most robust option available today. On many open source Ethereum-based projects, you’ll notice Solidity’s “.sol” file extension. As the Solidity documentation website states, this language can be used for creating smart contracts for voting, crowdfunding, blind auctions, multi-signature wallets, and much more. Solidity is the go-to choice for many of the world’s most popular dApps.

JavaScript 

With around 11 million developers worldwide, JavaScript has long been a popular choice for web development. Now, it’s also gaining popularity as a language for smart contract development. Some of the advantages of using JavaScript are the fact that it’s object-oriented, prototype-based, and supports functional programming. One possible disadvantage is that it’s a dynamically-typed language.

A public blockchain called Nebulas supports JavaScript and TypeScript for smart contract development. Nebulas implements Nebulas virtual machines (NVM) to run smart contracts. The NVM implementation uses the V8 JavaScript engine, which was developed by the Chromium Project for Google Chrome and Chromium web browsers. Nebulas provides an example of how to use JavaScript and TypeScript to build a basic smart contract called “bank safe”, which allows a user to deposit funds, withdraw funds, and check an account balance. 

Neo is another public blockchain that supports smart contracts written in JavaScript as well as C#, VB.Net, F#, Java, Kotlin, Python, and Go. Similar to Nebulas and Ethereum, Neo’s platform utilizes a virtual machine called NeoVM to execute smart contracts.

For enterprise development, IBM supports smart contracts written in Javascript for its Hyperledger Fabric and Hyperledger Sawtooth frameworks. A smart contract in Hyperledger Fabric is a program, called Chaincode. Developers can use JavaScript to program individual contracts into standalone instances of chaincode or to use one Chaincode to handle all contracts (of certain types) and have it expose APIs to manage the lifecycle of those contracts. Note that Chaincode can also be written in other programming languages such as Go and Java. 

While Fabric is a permissioned-only framework, Sawtooth offers both permissioned and permissionless options. Transaction families, groups of operations or transaction types that you allow on your ledger, can be thought of as distributed applications for Sawtooth. The Sawtooth-Ethereum (Seth) transaction family supports smart contracts written in JavaScript as well as C++, Go, Java, Python, Rust, and Solidity. For developing on-chain smart contracts with the Seth transaction family, IBM recommends using the JavaScript API web.js. 

C++

C++ is a statically-typed, object-oriented, compiled programming language. One of the major benefits of C++ is its ability to produce very fast code, thanks to its design efficiency and optimized code compilers. Two potential downsides are that C++ has a steeper learning curve for junior developers and code redundancy tends to be more common compared to other programming languages.

For the EOS public blockchain, C++ is the native language for smart contract development. Note that developers can also write code in Typescript using AssemblyScript or in any programming language that can be compiled via WebAssembly. For C++ smart contracts, EOS has a comprehensive C++ API. A tutorial of how to use C++ to create a basic mailing list application is available.

Komodo is a multi-chain platform that gives every project an independent blockchain known as a Smart Chain, rather than just the ability to alunch smart contracts on a shared blockchain. Every Smart Chain launched with Komodo's technology can support its own smart contracts and apps with the Antara Framework. Antara Modules, which are advanced UXTO-based smart contracts, are written in C++ (as well as C). Antara Modules can also be written in any compiled programming language that can create a linkable library capable of calling and being called by C/C++ functions. 

Developers have the option to use a built-in library of modules and/or write custom modules. Antara Modules can be coded to run directly in the daemon of one’s Smart Chain, without the need for a virtual machine. Unlike other smart contract platforms, Komodo’s Antara Framework doesn’t require gas fees for a smart contract or dApp to run. Antara Modules just need payment of one transaction fee to run. Transaction fees are always paid in each Smart Chain’s coin. 

Blockchain Programming Languages For SDKs

Software Development Kits (SDKs) for blockchain programming serve the same purpose as SDKs for other types of development, such as web, mobile, or desktop. SDKs for blockchain development are essentially installable packages containing sets of tools, libraries, documentation, code samples, and other relevant information that enable programmers to develop software applications on a specific blockchain platform. Here are a few examples of popular blockchain programming languages commonly supported in SDKs.

JavaScript

As mentioned earlier, JavaScript is a popular high-level programming language. Its widespread use also means blockchain projects select it as the first or one of the first programming languages for SDK creation. 

Stellar, a public blockchain protocol for digital currency to fiat money transfers, has a JavaScript SDK that facilitates integration with the Stellar Horizon API server and submission of Stellar transactions, either on Node.js or in the browser. This SDK has two main uses: querying Horizon and building, signing, and submitting transactions to the Stellar network. The Stellar project team has also created SDKs for Go and Java. The Stellar community has written SDKs for Python, C# .NET Core 2.0, Ruby, iOS & macOS, and Scala.

The Aeternity blockchain has a JavaScript SDK as well as SDKs for Go, Python, Elixir, Java, and .NET. The JavaScript SDK currently appears to be the most comprehensive option available, with an up-to-date changelog and extensive API documentation. 

Raiden Network, an Ethereum Layer 2 scaling solution, has a JavaScript-based SDK called Raiden Light Client SDK. This client is written in JavaScript/Typescript and is capable of running in modern web3-enabled browsers, wallets, and Node.js environments.

Rust

Rust is a statically-typed, lightweight, portable, and ‘blazingly fast’ language. It compiles to web, iOS, and Android platforms that are popular with many third-party developers. Although the language is relatively new (first appeared in 2010), it has been chosen as Stack Overflow's most loved language for four years in a row. According to the Stack Overflow blog, “Rust’s strong type system and emphasis on memory safety—all enforced at compile time—mean that it’s extremely common to get errors when compiling your code.”

The Cardano Rust Project has created a toolbox of Cardano’s cryptographic primitives for third-party developers written in the Rust programming language. This is the first open-source project of IOHK (the company behind Cardano). The Cardano Rust Project provides a library of wallet and node functions as well as a Cardano (ADA) wallet. Cardano also has a JavaScript SDK, which is currently in alpha.

In February 2020, CasperLabs announced the launch of a Rust Contract SDK, which includes a runtime environment, documentation, and test framework for building smart contracts.

ARK network features a Rust SDK as one of several options for developers. Like all other ARK SDKs, the Rust SDK follows SoC (Separation of Concerns) design pattern. This means code is separated into two libraries. In this case, there’s a Rust Client SDK and a Rust Cryptography SDK. ARK SDKs for other programming languages include TypeScript, PHP, Java, Go, Python, C++, Elixir, .NET, Ruby, and Swift. Support for Laravel and Symfony PHP frameworks is also available.

Komodo used Rust to write Market Maker 2.0, the networking and architecture layer for Komodo’s atomic swap protocol. Atomic swaps are peer-to-peer trades of cryptocurrency, made from one user to another with no exchange, intermediary, or middleman needed to facilitate the swap. AtomicDEX, Komodo’s atomic swap powered decentralized exchange (DEX), offers an open API which third-party exchanges and wallet providers can use to integrate Komodo’s state-of-the-art atomic swap protocol. Check out the AtomicDEX dev docs here

Golang (Go)

Go is not only gaining adoption as a language used for client implementations of numerous blockchains but has also established itself as an important SDK option, especially with newer generation blockchains.

Cosmos is a platform for building and connecting parallel independent decentralized blockchains into one large interoperable network. Cosmos SDK, just as the protocol itself, is written using Go. Terra, Loom Network, Binance Chain, and IRISnet are four popular application-specific blockchains built using the Cosmos SDK. 

Algorand is another public blockchain with a Go SDK. This provides HTTP clients for the agreement and key management APIs as well as functionality for interacting with the Algorand protocol, including transaction signing, and message encoding. Algorand also has SDKs available for JavaScript, Python, and Java.

For permissioned blockchain development, Hyperledger Fabric has a Go SDK as well as SDKs for Java, JavaScript (Node.js), and Python. The Go SDK includes basic examples of how to query and execute transactions, query a channel's underlying ledger, and how to make a transaction involving multiple organizations.

Blockchain Programming With Komodo

Antara Framework provides a simple and adaptable framework for custom blockchain development. Developers have the ability to create their own programmable blockchains called Smart Chains. Devs also have the ability to code UXTO-based smart contracts, known as Antara Modules. If you’re interested in learning more about developing with Antara Framework, be sure to check out Komodo Documentation for overviews, development tutorials, APIs, and more.

If you'd like to learn more about blockchain technology and keep up with Komodo's progress, you can join Komodo's Community Portal and sign up for the monthly newsletter.

Begin your blockchain journey with Komodo today.