Main navigation

Blockchain Programming: How Many Programming Languages Do You Need for Blockchain?

Fri, 31/05/2019 - 10:25
Blockchain Programming: How Many Programming Languages Do You Need for Blockchain?
Cover image via
Read U.TODAY on
Google News

As humanity moves towards the digitization of everything, basic coding becomes a must even for the average person that is not keen on tech. That requirement is even more apparent when it comes to the blockchain sphere. If we really seek true decentralization, each of us should understand how things work at least on the elemental level. Whether you are an experienced software engineer, or an average Joe, the first thing you should do before learning how blockchain functions is to choose a programming language.

For a new, rumbling technology that is developing at a rushing pace, the task of picking a programming language can be daunting. There are plenty of them available and various startups and open source communities chose different languages to build their products, as their focus and sets of desired features vary. There is no standard and at this point in time; your choice would pretty much come to your personal criteria and the type of applications you crave to build.

In this article, we will review the most popular programming languages that are used in blockchain development to help you out with choosing the most appropriate option. Let’s not put it off any longer and go deep down the rabbit hole!

The most popular programming languages in the blockchain

First and foremost, we need to understand which of the programming languages are used the most when it comes to writing code in the blockchain. You will probably see some familiar names on this list.


To begin reviewing the languages for blockchain programming, we need to take a look at their granddad – C++. This language was released in 1985 by Bjarne Stroustrup to make the original C more flexible. More than three decades later, it was used to build Bitcoin.

Unlike the original C, which is process-oriented, C++ is object-oriented. This approach makes C++ more time-efficient when it comes to writing code. The data along with the functions is stored in so-called objects that can be reused later on in other programs.

Due to its maturity, it’s not a surprise that in terms of the blockchain development, featurewise C++ is quite robust. This language has memory control that ensures speed by efficient CPU management, threading that allows running parallel/non-parallel tasks simultaneously, move semantics for copying data conveniently, compile-time polymorphism for better performance through dividing responsibilities, and code isolation for separating data structures. In addition, its user base consists of more than four million developers.

The one major drawback of C++ for blockchain developers is that it’s not smart contract ready. It doesn’t mean that one cannot code a smart contract on C++, it means that some modifications have to be implemented. This is the reason why blockchain-specific languages started to pop up.

Pros: independent and multiplatform, high-speed, similar to C

Cons: rather difficult to master, complex and sometimes hard to debug, no garbage collection

Best suited for: advanced users, understanding principles of Bitcoin


C# is younger than C++, but it’s quite old too. Created at the end of the ‘90s within Microsoft, it quickly gained traction in the developer community. It’s an OOP (objective-oriented programming) language that provides great features for enterprise-grade applications, cloud, and cross-platform development. Largely backed by Microsoft, this language is a convenient tool both for professionals and casual coders.

Not only is C# flexible and easy to comprehend if you are familiar with C++ or Java, but it’s also packed with features. In addition to some of the C++ functionality, C# offers .NET framework & its class library, the common language runtime, and development frameworks (such as WPF, XAML, and ASP.NET).

C# is favored by big players in the blockchain for a few reasons:

  • Its syntax is easy to comprehend for the large chunk of developers that are already familiar with C++ (4.4 million devs).

  • It’s open-source.

  • It allows writing portable code for mobile devices.

  • It’s affordable due to the BizSpark program.

Among the most prominent startups that base their code on C# are NEO and Stratis. In addition, C# has a dedicated Bitcoin framework (NBitcoin). Microsoft isn’t falling behind and introduces the vNext blockchain for its Azure platform.

Pros: object-oriented, strongly typed, dynamic code support

Cons: weak Linux support

Best suited for: building infrastructure blockchains, Windows users


This is perhaps by far the most recognized programming language in the world. The webpages you scroll through everyday utilize javascript for fancy looks and advanced functionality. In 2007 Jeff Atwood coined a law:

“Any application that can be written in JavaScript, will eventually be written in JavaScript.“

JavaScript is an OOP language that is easy to learn while being quite versatile. Using JS, developers are able to code for clients & servers, IoT devices, and machine learning. One of JavaScript's major advantages in terms of the blockchain is the feature of running events asynchronously, meaning that it allows nodes to communicate freely and efficiently. Another strength of JS is that it doesn’t require compilation. At the same time, simplicity comes at a cost. Despite all of its features, JS is a far cry from C++, but it’s a great language for beginners.  

JavaScript wasn’t very popular among blockchain developers until the ICO outbreak in 2017. Currently, there are several startups with high ranks on CoinMarketCap that are based on this language, such as Lisk, Ark, and Nimiq. One of Ethereum’s most notable competitors, Tron, also supports JavaScript.

Pros: Object-oriented, prototype-based, supports functional programming

Cons: Dynamic, weakly typed

Best suited for: Entering blockchain space, building dApps


Python was created in a minimalistic manner. That is why this language is extremely easy to learn and is a great entry point for beginners. It was created in 1991 and has served a plethora of purposes like application development, network servers’ development, IoT and others. It may be not as recognized as JS yet, but it certainly makes more buzz in the tech world.

Python is an OOP language. It’s a joy to code and it’s universal. To code a simple blockchain, you will need no more than 50 lines. Once the code is written, it can be run across multiple devices with a different OS installed. There is also a huge library of frameworks, such as Tensorflow and Django, albeit their documentation may be incomplete in some cases. To add to this, currently, there are specific libraries, dedicated to blockchain development. Like JavaScript, Python doesn’t require compilation, though it can be compiled like C# and C++. Combine it with a dedicated testing environment that comes with it and you will get a Swiss army knife for your blockchain journey.

Python has been recognized by the industry’s superstars. IBM Hyperledger implemented it in Sawtooth and Ethereum has created its own iteration of this language: Pyethereum.

Pros: Very easy to learn, premade libraries and frameworks, efficient

Cons: Mostly used as a server language, not so smart context

Best suited for: Building dApps for the beginners


Golang (or Go) is an open-source language derived from C. It’s a very young language that was launched in 2007 by devs from Google. Go implementation of the syntax is more Python-like – it’s made simple to provide efficiency and make projects made with it future-proof.

Go’s strong sides for blockchain programming include the availability of modular programming that makes the development process flexible, convenient testing tools, and a huge library of functions. It would be most appealing for cloud-computing developers, as distributed calculations are very simple in terms of this language. Although this language requires compilation, it’s a good factor for security, as all the errors will be shown to the person writing the code before it’s launched. In addition, parallel programming along with Goroutines increase the efficiency of the code and applications’ throughput. This is crucial for scalability, which is a pain point in the blockchain space today. Lastly, Go runs with the OS, not on top of it. This eliminates an extra step when creating EVMs, hence increasing the speed.

Go is a well-known language in the blockchain sphere. Consider IBM Hyperledger that is used Golang for coding smart contracts on its Fabric. Docker is not a blockchain startup, but it works with the distributed systems and is built with Go.

Pros: Memory security, garbage collection, strongly typed

Cons: Not so easy to learn, relatively small community, a small number of packages

Best suited for: Building cloud dApps


Solidity is young, like Golang. It was released in 2014 by Christian Reitwiessner and his team. It’s a language that was created in order to write smart contracts on Ethereum, which is why it’s most popular in the Ethereum ecosystem. It’s worth noting that the ecosystem has grown hundreds of times in the past two years because of the various startups flooding the market. As a result, Solidity has a large user base. Its standard (ERC20) has become the staple for the industry.

Solidity is OOP and a contact-oriented language. It’s also Turing complete, meaning that it can interpret various data-manipulation rules. The syntax of Solidity resembles that of JavaScript, but there are some similarities with C++ & Python as well. Despite its early stage, Solidity is a functional language, it provides inheritance, various libraries, etc. On the downside of the youngness is the issues with documentation that can leave some devs in a predicament.

Currently, the major use cases for Solidity are EVM and smart contracts. It’s not a lot, but those are extremely important and blockchain-specific as much as it could be. If you want to build a dApp, Solidity is your go-to choice.

Pros: Statically typed, easy to learn, trendy

Cons: Not universal, vulnerable

Best suited for: Development of the smart contracts

Basics of coding on the blockchain

Now, that we have reviewed the most popular programming languages in the blockchain, it’s time to get out hands dirty with actual coding. Let’s see how the basic operations are performed in terms via different programming languages.

Before we begin, it’s a good thing to refine our knowledge about what a blockchain is. A blockchain is a distributed ledger with transactions input in a chain of blocks. A block is a placeholder for transaction records. Each new block has a pointer to the previous one in the form of a hash function. After the block is full, a hash is generated using all of its transactions and attached to it. There is also a timestamp server that prevents double-spending and a consensus mechanism that allows nodes to agree on the correct version of the ledger.

Time to put theory into practice. The purpose of this is not to build a complete app, but to show what the process looks like.

  1. C++
    Every blockchain out there has a hard-coded initial block, called a genesis block. Let’s create one.

    C++ genesis block
    Image by Utoday

    Now we can create another block. In order to do so, we’ll type getLatestBlock().

    C++ add blocks
    Image by Utoday
C++ consensus
Image by Utoday

The consensus mechanism is a simple ‘for’ loop function that runs over all the blocks, starting from 1, because there’s no need to revise the 0 genesis block.

  1. C#
    The data structure for a blockchain on C# is rather straightforward. It has Block & Blockchain classes. Here they are.

     C# block
    Image by Utoday
    C# blockchain
    Image by Utoday

    If we visualize the structure, it looks like this:

C# blockchain structure
Image from  

Here’s how we add new blocks:

C# add blocks
Image by Utoday

In order to make our blockchain reach consensus, e.g. validate it, we need only 2 lines of code along with an IsValid method that will check data in each of the blocks and compare hashes.

C# consensus
Image by Utoday
  1. JavaScript
    Now we are reaching territories of more accessible languages, this should be more fun if you don’t have any coding experience. In order to create a blockchain, we need a runtime environment, such as Node.js. Each of the additional blocks will have the following data: index, time of creation, misc (like sender & receiver addresses and the amount transferred), previous block’s hash, own hash. Once it’s done, it’s time to move over to hard-coding of the genesis block:

     JavaScript genesis block
    Image by Utoday

    As we have gotten the genesis block, we shall now add blocks with new data via a nextBlock function. This function will automatically go through all 5 types of data and include them in each new block.

    JavaScript create block
    Image by Utoday
JavaScript add blocks
Image by Utoday
  1. Python
    This time we will start with understanding how a transaction in Python looks like. It’s a simple timestamped post with some data attached.

    Python transaction
    Image by Utoday

    These transactions will get into the blocks. Let’s introduce this class.

Python block
Image by Utoday

We will use SHA-256 which is utilized in Bitcoin to create hashes for validation of our blockchain’s integrity.

Python hash
Image by Utoday

Now we can add the blocks, but first, let’s introduce the Proof-of-Work algorithm that ensures that the data in the blockchain wasn’t corrupted.

Python PoW
Image by Utoday

After that’s done, we are clear to start the blockchain.

  1. Go
    We’ll start with defining our blocks’ properties. BPM is arbitrary data, like network transactions, addresses, etc.

    Golang block
    Image by Utoday

    In order to create blocks, we need to hash data in them and chain by corresponding results. The code for hashing data within a block in Go looks like this:

    Finally, we can start making new blocks, using the generateBlock function. Time to write the consensus, which is represented by isBlockValid function.

    As all things are set, we are ready to launch the block production process. Note that at this point the blockchain will need a server to run on, so there are some extra bits of code that reflect this.

    Golang hash
    Image by Utoday
  2. Solidity
    Building smart contracts differs from what we have just review, but it’s still simple. First, we need to create a contract and name it. This contract is for a person’s will. In case they die, the funds shall be automatically distributed to specific addresses.

    Solidity contract
    Image by Utoday

    Here, we specify the owner’s Ethereum address (owner), the amount left for distribution (unit) and the conditional variable for the owner’s state (bool). The next step is to add modifiers that extend the conditional logic to provide a function with the owner’s state.

    As this is done, we can outline the addresses that will receive the heritage. Then we continue to specify the distribution of funds in case isDeceased = true. Please note that at this stage we can hide the function from the public by putting ‘private next to the ‘payout’ function. Voila, the code can now be deployed.

    Solidity modifiers
    Image by Utoday


To sum up, there is no ultimate blockchain-focused programming language. The blockchain itself is in its infancy and there are unexplored horizons and unstepped grounds. Like in many other spheres, the best possible way of getting around confidently is to become a full-stack developer, which may be a tough task, considering how much knowledge you will need to have. Thankfully, many of the programming languages have similarities in syntax and structure to ease the transition.

If you have to choose one language, you need to consider the context. Should you want to focus on building infrastructure projects, C++ and C# will fit you more. In case you are more fascinated by the development of the apps on top of the existing blockchains, JavaScript, Python and Go are good options to consider. If you just want to launch your own ERC20 token, Solidity will undoubtedly cover your needs.

You should also keep in mind that blockchains are language-agnostic. With new languages like Simplicity coming into play and the existing ones like SQL being integrated, the borders between them will be more and more blurred. Remember, a language is just a tool and you are free to utilize it for whatever purpose. Our best advice would be that if you are already familiar with some languages, keep mastering them – you will definitely be able to create blockchains with them. If you are just starting out, try to look for the easiest entry point – look more towards JavaScript and Solidity.


Latest Press Releases

Our social media
There's a lot to see there, too

Popular articles