September 08, 2022 - 24 min read
When it comes to blockchain technology, we often look at the outside results; cryptocurrencies, dApps, NFTs, and other consumer-facing products. However, it’s equally, if not more important to understand exactly how these products, programs, and protocols are created, and that’s where blockchain programming comes in. Like any other type of software, blockchains are built from the ground up using a variety of languages.
Understanding blockchain programming languages isn’t just important for those looking to understand more about blockchain and crypto; it’s also important for those considering becoming a blockchain developer. Over the last few years, blockchain developers have been in increasingly high demand. This has certainly influenced the high salaries these developers can command. As of 2022, the average blockchain developer was estimated to earn between $150,000 and $175,000 per year, with many entry-level roles starting above $100,000.
If you want to become a blockchain dev, however, traditional programming skills may not cut it, and you may have to train (or re-train) yourself on blockchain languages. However, time is scarce, so you’ll need to decide quickly and decisively which languages you want to learn, and which you’ll want to avoid (or at least put off until later).
In addition to blockchain programmers, blockchain executives, product managers, and other industry leaders need to make accurate decisions about which languages to work with– and which can often be an incredibly important decision. With that being said, let’s jump into some of the top blockchain programming languages in the industry, how they work, and when to use them.
Solidity often ranks number one on most lists of the top blockchain programming languages, and for a good reason. It’s often considered the best language for developers to learn, as it’s currently the most popular language for programming smart contracts and dApps on the Ethereum blockchain, which, despite increasing competition, is by far the most influential smart contract-enabled blockchain in the industry. Some estimate that there are around 200,000 developers with some knowledge of Solidity on the market today, though many of these may have little real-world experience. In contrast, there are only around 3,000 to 4,000 active Ethereum developers, most of which use Solidity regularly.
In addition to allowing programming directly on Ethereum Virtual Machine (EVM) compatible public blockchains, including major chains like Binance Smart Chain (now BNB Smart Chain), Avalanche, Cardano, and Tron, Solidity also allows for programming on Ethereum Layer-2s like Polygon, Arbitrum, Loopring, Immutable X, Optimism, Boba, and others. It’s also used for private blockchain infrastructure projects, such as Hyperledger.
Solidity, which is an object-oriented programming language, was inspired by traditional programming languages such as C++, JavaScript, and Powershell, and was invented by a team including Ethereum co-founder Gavin Wood in August 2014. Its similarity to these traditional languages is a significant benefit for new developers, as they may find it easier to learn than more exotic programming languages.
In addition, Solidity is considered to be particularly flexible and is thought to have relatively straightforward instructions. Perhaps the main drawback of Solidity is that it’s generally only applicable to blockchain development, unlike JavaScript or Python, which can be used for all kinds of general-purpose applications.
Some of the technical aspects of Solidity include:
Data types supported by Solidity include:
Python, which was first developed in 1991, is one of the world’s most popular programming languages, so it’s no surprise that developers are increasingly using it for blockchain applications. Python is an object-oriented, general-purpose programming language that can analyze data, create software applications and websites, and create a wide scope of other products and protocols.
One of the major benefits of Python is that it is fully open source, and has a massive level of support and documentation from current and previous developers. Publicly available Python libraries, plugins, and other resources make it easy for even beginning developers to solve complex problems and accelerate the speed of their development efforts. Python is also considered to be simple and elegant, meaning that long and complex code is often not required. However, it should be noted that Python is an interpreted language not built expressly for blockchain or cryptocurrency development, so complex cryptography can sometimes pose a challenge.
Like Solidity, Python can program all EVM-compatible blockchains, including a variety of Layer-1 and Layer-2 chains, and is also used to program smart contracts on the Hyperledger and Neo blockchains.
Some of the technical benefits of Python for blockchain programming include:
C++, created in 1985 by Bjarne Stroustrup, is another one of the world’s most popular general-purpose programming languages. Unlike Solidity and Python, which are only object-oriented, C++ supports a variety of programming methodologies, including object-oriented, procedural, functional, and others. C++ is utilized for a wide spectrum of purposes, including browser development, game development, and even developing operating systems. In addition, C++ is often considered the premiere language for cryptocurrency development and was used to develop Bitcoin, Litecoin, Ripple, Stellar, and EOS.
Specific benefits for blockchain development include the utilization of a Standard Template Library (STL), ease of customization, high speed, high transparency, and high computational performance. However, as with all languages, there are some drawbacks, including a more difficult barrier to entry than many other languages, no garbage collection feature, and code redundancy.
Additional benefits of C++ for blockchain programming include:
Move is a unique, open-source, stack-based blockchain-focused programming language initially developed by Facebook (now Meta) to create safe smart contracts for their Diem blockchain and stablecoin payment system. While the project never took off due to regulatory issues, the language that resulted from its development provides significant opportunities for both new and experienced blockchain developers. The main downside of Move is that it can be difficult to run scripts off-chain; every module needs an environment, account handling, and a compile-publishing system.
According to Move’s documentation on Github:
“Move code can exist in two forms, as modules or as transaction scripts…Move modules contain type definitions and code and expose these through a set of public functions that operate on those types. Modules are published at a specific address, and that address is part of the fully qualified module name. Most Move code you will write will be in the form of modules.”
Furthermore, Move focuses on three elements, flexibility, safety, and verifiability.
Flexibility: Each transaction includes a transaction script. Transaction scripts are used to make calls and invoke procedures in a module.
Safety: Safety is enforced in Move, as three main components must be investigated — resources, memory, and types.
Verifiability: Move enables on-chain verification for each safety property. To reinforce safety, Move utilizes off-chain static verification tools, which can limit the complexity of on-chain verification processes.
C# is a general-purpose, multi-paradigm language Initially created by Microsoft programmer Anders Hejlsberg in 2000. Initially a closed-source language, it was quickly approved for uses involving international standards organizations, such as EMCA and ISO. C# later became fully open-source in 2004 as a result of the Mono project which provided a runtime environment and cross-platform compiler for the language.
As a result of C#’s open-source nature, developers can now easily create highly portable code that can run across many major devices and multiple operating systems such as Mac, Windows, Linux, and Android, among others. One of the main benefits of C# is its similarity to Java and C++, making it easier for blockchain developers to learn quickly and easily. Like Solidity, Python, and C++, C# offers object-oriented programming, which can improve overall performance when developing smart contracts and blockchain applications. The language also offers component-oriented programming, offering additional flexibility.
Some of the most prominent blockchain projects currently using C# include the NEO blockchain, an open-source decentralized blockchain, and decentralized application platform, and Stratis, a proof-of-stake blockchain network specifically designed to allow developers to use C# instead of languages like Solidity, which often take additional time and resources to learn.
Other elements of C# include:
Vyper, which is based on Python, is a contract-oriented blockchain programming language specifically intended for programmers writing smart contracts on Ethereum and Ethereum Virtual Machine (EVM) compatible blockchains. Vyper is similar to Solidity and is reportedly the world’s second-most popular smart contract programming language. Vyper attempts to help developers create more accurate, secure, and easily-readable smart contracts while limiting developers’ ability to write malicious code.
Vyper was specifically designed with unique features to address some of the major problems inherent in writing smart contracts in Solidity. Recent research indicates that smart contracts written in other blockchain programming languages can have significant flaws and unpredictability.
These include suicidal contracts, which can be killed by their owners if they are attacked or drained of ETH, greedy contracts which lock ETH and don’t send them out because of errors, and posthumous contracts, which remain on the Ethereum blockchain when they are killed off, however, they continue receiving transactions, which can also lock the subject ETH in the smart contract. Prodigal contracts, in comparison, give away ETH to arbitrary addresses unrelated to the smart contract itself.
Vyper attempts to eliminate these problems by effectively limiting the freedom of developers to create, intentionally or unintentionally, suicidal, greedy, posthumous, and prodigal smart contracts.
Vyper’s technical features include:
Simplicity is a combinator-based, functional, high-level blockchain programming language developed and released by Blockstream’s Russell O’Connor in November 2017. Simplicity was modeled after the programming language Ivy, and focuses on creating human-readable code. Unlike some blockchain programming languages, Simplicity is designed to be used for smart contract development on Ethereum Virtual Machine (EVM) compatible blockchains and for Bitcoin-based blockchain programming.
Simplicity particularly focuses on reducing the complexity of programming the Bitcoin Script. The language is also intended to increase the work capacity and speed of blockchain development and is compatible with the Elements platform, an open-source, Blockchain platform with sidechain capabilities. Simplicity hopes to reduce the trade-offs developers face by creating a complex but unreliable smart contract, or a simple, yet reliable one, by allowing developers to create both complex and reliable smart contracts.
Simplicity has the benefit of using formal denotational semantics in Coq, a general purpose software proof assistant, as well as using operational semantics defined with the Bit Machine, an abstract machine, which helps measure the resources needed to program anything in Simplicity.
Some of the technical elements and additional benefits of Simplicity include:
Developed by programmer and Rhcain CEO Greg Meredith in 2018, Rholang is an open-source functional blockchain programming language. Rholang is intended to be a scalable language that improves reliability, speed, and formal process orchestration, and is reportedly the industry’s most popular functional programming language for blockchain development. Unlike languages like C++ or Python, Rholang is an object-oriented language, and evaluates a program as a series of functions, solving them sequentially. Rholang utilizes the Rchain world computer, which is algorithmically constrained to obey specific rules designed to increase accuracy and prevent errors and bad behavior.
Rhchain project code is itself written in Scala, a high-level programming language that combines functional and object-oriented programming. Additionally, Rchain uses DAGs (directed acyclic graphs) to massively improve scalability. DAGs are a form of distributed ledger technology (DLT) that is considered both a competitor and an enabler of current blockchain technology. Currently, Hedera Hashgraph is perhaps the best-known project using DAG technology, however, it is not a blockchain, so does not use Rholang.
Some of the technical elements of Rholang include:
LLL is a lower-level blockchain programming language specifically designed for Ethereum. It was one of the original Ethereum smart contract languages. It was designed to allow users to more efficiently use the limited resources of the Ethereum Virtual Machine (EVM) while removing the difficulty of stack and jump management. LLL is an acronym that stands for “Low-Level Lisp-Like Language,” as it provides code similar to Lisp to cover the basic assembly instructions for the Ethereum Virtual Machine. While still somewhat influential, in recent years LLL has become significantly less popular than Solidity, and open-source updates and documentation for LLL have become increasingly sparse.
LLL allows programmers direct access to all of the memory and storage locations hidden at the lowest levels of the EVM, giving them greater flexibility when arranging their contract data and increasing potential efficiency. Experienced LLL developers can reportedly create effective smart contracts that are significantly smaller when compared to contracts in other languages, like Solidity, which is important, considering the limited bandwidth of the EVM. Many LLL smart contracts are reportedly between 50% and 70% smaller when compared with similar contracts programmed in Solidity. LLL is also intended to create code that is considerably more straightforward and more human-readable than Solidity and other Ethereum programming languages.
Go, also called Golang, is a compiled, statically typed language developed in 2007 by Google employees Ken Thompson, Rob Pike, and Robert Griesemer. Go was inspired by C, so it may be easier to learn for developers who already know C# or C++, while it may be more challenging for programmers used to working with Python or JavaScript. However, Go is intended to have many of the benefits of Python and JavaScript, including speed, flexibility, scalability, and user-friendliness. One major benefit of Go is the number of active developers with Go-related experience, which is currently estimated at more than 800,000 people.
Major blockchain projects developed with Go include Hyperledger Fabric, an open-source blockchain used to develop private, permissioned blockchains and blockchain applications, and Go-Ethereum, an open-source tool developed by the Ethereum community to generate Ethereum source code using Go.
Some of the technical elements of Go include:
Ruby is a general-purpose, high-level programming language developed in 1995 by Yukihiro “Matz” Matsumoto. Ruby was inspired by various other languages, including BASIC, Lisp, Ada, Perl, and Smalltalk. The language, intended to promote simplicity, supports multiple programming paradigms, such as object-oriented, functional, and procedural programming. Ruby utilizes just-in-time compilation, is dynamically typed, and uses garbage collection. One major benefit of Ruby is that it can easily integrate open-source third-party APIs and plugins, which often allows it to derive some of the benefits of other programming languages.
Ruby is currently used for development on major blockchains, including Bitcoin and Ethereum, and can also be used to quickly create new, custom blockchains from scratch.
CX, developed by blockchain project Skycoin around 2018, is a compiled and interpreted general-purpose blockchain programming language inspired by Golang. CX was specifically designed to help address certain challenges in the Skycoin project that could not be addressed with traditional blockchain programming languages.
The Skycoin project, launched in 2013, is a blockchain project focused on developing a new, censorship-resistant, global, and decentralized internet marketplace, where users pay independent network service providers in cryptocurrency for internet access and other services.
While CX shows promise, the main drawback to the language is that it has not yet been utilized by projects outside the Skycoin ecosystem, so its compatibility and usability with other blockchains is relatively untested and unknown. Despite this, CX is quite flexible and can be used to create desktop and mobile apps and websites.
While CX can be used for smart contracts, it can also be utilized to create other, more advanced types of blockchain-based decentralized programs. CX also allows for the creation of independent CX chains, blockchains that contain a CX program and have full capacity for updates. These chains divide CX programs into two components, transaction code and program code, with program code being stored and updated on the blockchain for every transaction executed.
Technical elements of the CX language include:
Rust, first developed by then-Mozilla developer Gradon Hoare in 2006, and first released in 2010, is considered one of the newer, albeit one of the most effective blockchain programming languages. Rust is a general-purpose programming language emphasizing memory security, type safety, and concurrency.
The language has already been adopted by various major tech companies, including Toyota, Dropbox, Discord, Amazon Web Services, Mozilla, Microsoft Azure, and 1Password, and has earned the rank of #1 most popular programming language on Stack Overflow six years in a row.
Rust is specifically designed to allow for the creation of high-performance applications while helping protect developers from creating dangerous programming flaws. It’s also one of the easiest languages to generate documentation for, facilitating information sharing and the language’s increasing popularity among developers in various industries. However, some have criticized Rust for its excessive wordiness, as well as issues with editor support.
Overall, Rust is ideal for generating high application security, which is one of the reasons the language is growing in popularity for blockchain development. Other popular applications for the language include programming operating systems, cybersecurity programs, and internet browsers.
In blockchain, Rust is best known as the preferred programming language for a variety of major projects, including the rapidly growing Solana and Polkadot blockchain ecosystems, Hyperledger Sawtooth, a Hyperledger-based framework for developing private enterprise blockchains, and the privacy coins Zcash and MobileCoin.
A few of the technical elements of the Rust language include:
Haskell, created in 1990, was the result of the 1987 FCPA (Functional Programming Languages and Computer Architecture( conference, which organized a committee to create a programming language that would help address the problems of a variety of other languages in use at that time.
Haskell is a general-purpose, statically-typed, purely functional programming language with lazy evaluation. Lazy evaluation is an evaluation strategy that does not evaluate an expression until its exact value is needed, which can often allow more straightforward implementation of algorithms and rapid prototyping. Programmers can compile code using the Glasgow Haskell Compiler, Haskell’s open-source native code compiler.
In May 2021, Haskell was rated as the world’s 28th most popular programming language. Haskell is also popular among academics and mathematicians, as it often fits their highly-specialized programming needs.
In the world of blockchain and cryptocurrency, Haskell is best known as being one of the primary programming languages of the popular Cardano blockchain. Cardano’s nodes, wallets, and smart contracts are all based on Haskell. The benefits of Haskell for blockchain development include the fact that the blockchain is focused on functions and immutable data, which increases code reliability.
Technical features of Haskell include:
Plutus is a Turing-complete programming language written in Haskell, which was specifically designed for writing smart contracts on the Cardano blockchain. According to Cardano’s official documentation, the language “draws from modern language research to provide a safe, full-stack programming environment based on Haskell, the leading purely-functional programming language.”
Smart contracts written in Plutus involve both on-chain and off-chain code. While on-chain code is compiled by the Plutus compiler into Plutus Core, off-chain code is written utilizing the Plutus Application Framework (PAF). That on-chain code is later compiled by the GHC (Glasgow Haskell Compiler). This allows programmers to utilize a uniform code base, while the Plutus toolchain automatically divides into off-chain and on-chain code for later deployment.
Just like Bitcoin’s C++ enables UTXO accounting model, Plutus enables Cardano’s UTXO accounting model, which involves inputs and outputs, with inputs being classified as unspent outputs from prior transactions, preventing double-spending. Outputs are classified via a public key and a value containing the number of tokens.
The main downside of Plutus is that it currently is only utilized to write smart contracts for the Cardano blockchain, so unless a programmer is focused primarily on developing for Cardano, the language (at least right now) has little use for those who want to develop on other blockchains, such as Etheruem or Solana.
JavaScript, the most popular web programming language, is used (as of 2022) by 98% of websites. JavaScript, sometimes known as JS, is a high-level, just-in-time compiled programming language that was initially developed from the language JScript and launched in 1996. In addition to its widespread use in web development, Javascript is also used to develop a wide spectrum of applications, including many games.
For blockchain developers, JavaScript provides a variety of benefits, including easier scalability, no need to integrate respective resources, and the ability to use multiple blockchain JavaScript frameworks, including Node.js. Developing blockchain applications in JavaScript also often allows for easier and faster market entry, particularly because the language is so well known by a broad base of developers, who can often address problems and build faster than developers working in newer and less-tested languages.
A few of the technical aspects of JavaScript include:
It should be noted that JavaScript is not the same as Java, though they do share several similarities.
Java, which was first developed by Patrick Naughton, Mike Sheridan and James Gosling in 1991 and first launched by Sun Microsystems in 1996, is a general-purpose, high-level, class-based, object-oriented programming language. Java, which is the official language of Android mobile app development, is among the world’s top three programming languages, and currently has an estimated 9 million active developers worldwide.
Java has a powerful API that includes packages, classes, and interfaces, which allows developers to work faster with less detailed information. Java can also be ported onto a variety of platforms, as programs developed in Java utilize the Java Virtual Machine (JVM) and are thus not tied to any one system-specific architecture.
Several of the best-known blockchains and blockchain platforms that use Java as a main programming language include Hyperledger Fabric, IOTA, NEO, and NEM.
Some of the technical aspects of Java that make it ideal for blockchain programming include:
Erlang, a general-purpose, functional programming language, was first developed in the late 1980s for telephone and communications company Ericsson as a proprietary language and was released as free, open-source software in 1988. Erlang and its Open Telecom Platform (OTP), which includes ready-to-use components, the Erlang runtime system, and design principles for Erlang programming, are still supported by the OTP product unit at Ericsson.
Erlang and its runtime system is generally designed for programming systems with features including:
Some of the benefits of Erlang for blockchain developers include:
Right now, it appears that the only major blockchain project using Erlang is the Aeternity blockchain, which could be a downside for developers who want to learn more widely used blockchain programming languages.
While Erlang may not yet be highly popular for blockchain developers, its significant presence within traditional software development could make it one of the faster-growing blockchain programming languages in the coming years.
In addition to being used by telecommunications companies like Ericsson, Nortel, and T-Mobile, Erlang is the primary language used to develop WhatsApp, and is also heavily used by a variety of other major companies, including Samsung, Nintendo, and even Goldman Sachs.
SQL is a domain-specific language that is generally used for programming databases and structured data. SQL was originally designed by IBM in the 1970s and was first commercially released by Relational Software (now Oracle Corporation) in 1979. SQL is particularly useful when programming databases to easily and efficiently communicate with each other, especially when dealing with structured data.
While SQL is quite popular in the traditional development world, it’s only beginning to become more popular for blockchain developers. Right now, the best-known blockchain project using SQL is Aergo, “an open-source hybrid blockchain smart contract platform for decentralized applications.”
Some of the functions of the SQL language include:
In addition, it should be noted that SQL provides programmers several major statement types (also called sublanguages), including a data query language (DQL), a data manipulation language (DML), a data control language (DCL),a data definition language (DDL), and a data control language (DCL).
Bitcoin Script, sometimes known as Bitcoin Scripting Language or simply “Script” is a stack-based programming language designed to facilitate the processing of transactions on the Bitcoin blockchain. Like Bitcoin itself, it was first developed during or before 2008 by the individual or group calling themselves Satoshi Nakamoto. Bitcoin Script is mainly focused on instructing the core Bitcoin software on the functionality of UXTO (unspent transaction output) functions, which prevents double spending and determines who receives funds, how many coins can be spent after each transaction, and how the recipient of funds can gain access to their Bitcoin. Bitcoin Script is Turing-incomplete, so it lacks certain logical functions, such as loops.
While Bitcoin Script is important, it’s essential to understand that Bitcoin itself (i.e. Bitcoin Core) is written in other (non-Bitcoin Script) programming languages, starting with C++, and later expanding to Java, Go, and Python. The Bitcoin Script is itself implemented using the specific language of the Bitcoin software in question. For example, for C++-written Bitcoin software, any Bitcoin Script inside is implemented in C++, rather than Bitcoin Script itself.
Perhaps most importantly, Bitcoin Script can be used to create simple smart contracts on the Bitcoin blockchain, including multi-signature scripts and time locked Bitcoin transactions. Bitcoin Script is also used for more advanced smart contract layers on top of Bitcoin, such as the Lightning Network, a Bitcoin Layer-2 blockchain that provides significantly improved speed, throughput, and privacy when compared to the original network.
Overall, the main limitation of Bitcoin Script is that it can typically only be used for developing the Bitcoin blockchain and other Bitcoin-related blockchains, and is not (at least right now) applicable to other public or private blockchains.
Obsidian is a new smart contract programming language that was originally developed for the Hyperledger Fabric platform. The development team is currently working with the Ethereum foundation to add Obsidian support for the Ethereum blockchain. Right now, Obsidian is still under development and is not ready for general use. Obsidian is a state-oriented programming language that incorporates linear types, which improve the safety of programming and prevent the accidental loss of resources, including tokens and cryptocurrency.
Two other influential, but perhaps lesser-known blockchain development languages include WASM and Michelson.
WebAssembly (WASM), which was created by a team of engineers from Google, Microsoft, Mozilla and Apple in 2015, is intended to increase internet speeds by offering simple, pre-compiled code to replace JavaScript. WASM is currently used as an alternative language for some Ethereum development projects, and the language has even been part of a proposed redesign of the Ethereum smart contract execution layer using WebAssembly, which would effectively replace Solidity for Ethereum smart contracts. EOSIO blockchain smart contracts are also currently written in WASM. Most WASM-based smart contracts are first written in C++ (with some being written in Python, Rust, or Solidity) and later compiled into WASM.
Michelson, which is the main programming language for the Tezos blockchain, is a functional language specifically designed for Tezos smart contracts. Fortunately, developers do not need to know Michelson to program smart contracts in the language, as Tezos provides easy-to-use compilers for major languages including Python, Go, JavaScript, and TypeScript. The language is stack-based, strongly typed, and does not incorporate named functions, closures, or polymorphism.
In addition to these two, Crystal, a brand-new programming language released in July 2022, also shows some promise for blockchain and cryptocurrency development.
It should be noted that the languages listed above are far from the only languages used in blockchain programming. Some languages were used previously, but have now fallen out of style and have been replaced by easier-to-use, more efficient, or safer alternatives. Two of the most prominent blockchain programming languages that are, in general, no longer used, including Serpent and Mutan.
Serpent, which was inspired by Python, is an assembly language that compiles to EVM code that is extended with various high-level features, supports object-oriented programming, and has real-time garbage collection. Serpent was recently deprecated as an Ethereum programming language, and programs are no longer being written in it.
Mutan, which was inspired by Go, was one of the earliest Ethereum programming languages, but it was deprecated early on (around March 2015) and replaced by Solidity.
When it comes to blockchain programming languages, projects and individual developers alike have quite a few options to choose from– and it appears that their list of options is only growing. It’s clear that traditional programming languages, like Java, JavaScript, Python, C++, and C# are still fundamental to many aspects of blockchain programming.
However, individual blockchain projects have also developed their own unique languages that they believe better serve their purposes. This can be a benefit when it comes to customization and (potentially) security, but it can also make onboarding a sufficient number of developers tough, as they’ll need to learn an entirely new language in a relatively short period of time. Resources like compilers can alleviate this burden somewhat, but do not entirely address the challenge.
So far, it appears that Ethereum’s Solidity language is perhaps the only blockchain programming language beginning to gain wide appeal in its own right, particularly due to the proliferation of Ethereum Layer-2 and EVM compatible chains which utilize it. Despite Solidity’s dominance as the top blockchain-only programming language, the growth of alternative Layer-1 blockchains could give Solidity new competitors in the near future; only time will tell.
Related Articles
Learn More
RECENT POSTS
Подпишитесь на новостную рассылку Supra, чтобы получать новости, обновления, аналитические материалы об индустрии и многое другое.
©2024 Supra | Entropy Foundation (Швейцария: CHE.383.364.961). Все права защищены.