Note: Since this blog post was originally published, "Modules" have been renamed to "Contracts" and "Antara Framework" has been renamed to "Komodo Custom Contracts." However, both might still be referenced by their original names in other blog posts or in the developer documentation.
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 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.
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 Nakamoto 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 (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 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.
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.
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 launch smart contracts on a shared blockchain. Every Smart Chain launched with Komodo's technology can support its own UXTO-based smart contracts (known as Komodo Custom Contracts), are written in C++ (as well as C), and 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 contracts and/or write custom UTXO smart contracts. Komodo Custom Contracts can be coded to run directly in the daemon of one’s Smart Chain, without the need for a virtual machine. Unlike other blockchain networks, Komodo Custom Contracts doesn't require gas fees for a smart contract or dApp to run. Transaction fees are minimal (a fraction of a penny) and 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.
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.”
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.
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.
Blockchain Programming With Komodo
Komodo 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 Komodo Custom Contracts. If you’re interested in learning more about developing with Komodo Custom Contracts, be sure to check out Komodo Documentation for overviews, development tutorials, APIs, and more.
Begin your blockchain journey with Komodo today.