We use cookies and other tracking technologies to improve your browsing experience on our site, analyze site traffic, and understand where our audience is coming from. To find out more, please read our privacy policy.

By choosing 'I Accept', you consent to our use of cookies and other tracking technologies.

We use cookies and other tracking technologies to improve your browsing experience on our site, analyze site traffic, and understand where our audience is coming from. To find out more, please read our privacy policy.

By choosing 'I Accept', you consent to our use of cookies and other tracking technologies. Less

We use cookies and other tracking technologies... More

Login or register
to apply for this job!

Login or register to start contributing with an article!

Login or register
to see more jobs from this company!

Login or register
to boost this post!

Show some love to the author of this blog by giving their post some rocket fuel 🚀.

Login or register to search for your ideal job!

Login or register to start working on this issue!

Engineers who find a new job through Blockchain Works average a 15% increase in salary 🚀

Blog hero image

Building a Blockchain? Consider C++

Josh Gretton 12 December, 2017 (3 min read)

Of the blockchain software projects, bitcoin, ethereum and ripple are written in C++ and Go. Other platforms that are also employing the C++ programming language include the Linux Foundation’s Hyperledger Project and SONM, also known as the Supercomputer Organized by Network Mining.


C++ is a general-purpose programming language that has object-oriented and generic programming features. Developed by Bjarne Stroustrup at Bell Labs, in 1983 ‘C with Classes’ was renamed to C++, with the first edition of the C++ Programming Language released in 1985. As an extension of the C language, C++ is considered very powerful, which is often used to create game engines, games, and desktop apps.

C++ is also marketed as one of the most popular programming languages available. According to November 2017 data from TIOBE (The Importance of Being Earnest), one of the most popular rating indexes for programming languages, C++ ranks third, behind Java and C, but ahead of Python. As a statically typed language, C++ is typically more performant compared to dynamically typed languages as the code is type-checked before it’s executed. According to one report, C++ offers the highest performance compared to Java, Go, and Scala.

This could be one of the reasons why it’s not a surprise to learn that C++ is seen as a favoured language, for blockchain repositories on GitHub. Since April 2009, when the core source code supporting bitcoin was first published, which happens to have been written with high-level C++ expertise, the number of projects on GitHub related to the blockchain have grown at a considerable rate.

So much so, that according to a 2017 Deloitte report, it found that the average number of projects was 8,600 a year. Although in 2016, alone, the total amount of new projects reached nearly 27,000. It also established that C++ was used most in the ecosystems’ central repositories, which, according to the report wasn’t surprising given that it has been used for some time within the financial services industry. This is in order to create applications that call for speed, reliability, and memory management. Considering that the finance industry was the first to explore the blockchain and its use cases to improve services, it’s interesting to see that this program has been the method of choice for its applications. Furthermore, when it comes to the heavy lifting behind digital currency projects, including that of bitcoin, C++ is still considered the favoured programming language. In 2016, figures suggest that C++ made up over 5,500 or 10.5 percent, of the blockchain repositories on GitHub.

With over 170 companies now part of the Hyperledger, the platform makes it simple for organisations to build on top of their platforms. One of which is called Iroha, created by the Japanese startup Soramititsu. It is built as a simple and easy to use blockchain framework for businesses that want to use blockchain infrastructure for their projects. Within C++, Iroha focuses on mobile application development, which features a unique Byzantine-fault tolerant consensus algorithm known as Sumeragi.

SONM, which is a universal fog supercomputer powered by the ethereum blockchain, is, according to its white paper, ‘a decentralised worldwide fog supercomputer for general purpose computing from site hosting to scientific calculations.’ Based on the Yandex.Cocaine platform, it is written in C++; however, it has implementations of Go, Java, and Haskell, among others, to enable it to develop computing pools that operate in similar ways to cryptocurrency mining pools.

Advantages of C++ for building blockchain applications

Its benefits include being a highly portable language for multi-device, multi-platform app development, is powerful, efficient and fast, and reusable, enabling the use of written code more than once. It provides performance, memory efficiency, and complete control. It is also an object-oriented program that includes classes, inheritance, polymorphism, data abstraction, and encapsulation. As well as programming at a high level, you can also program at a low level in the same language too.

Of course, as with any programming language there will be flaws and disadvantages associated with them, which is also true of C++.

Disadvantages of C++ for building blockchain applications

The use of the C++ program can become complex in a very large high-level program. This can make it difficult to understand as it contains complex instructions or functions that can be difficult to implement if you don’t fully understand the program. It’s also can’t support garbage application, and is time consuming due to the amount of time that it takes to write a program.

Yet, despite these slight drawbacks, the programming language remains a popular one for blockchain-based applications. According to one user on bitcoin.stackexchange, there are a number of reasons why C++ is a good resource for building a blockchain, arguing that blockchain applications have a large attack surface. As they are required ‘to interoperate with a large number of untrusted endpoints while still providing reliable service to local clients,’ it’s necessary to keep ‘control over tight resources like memory and CPU usage.’

Not only that, but even though it has been in existence since the 1970s, the language is both mature and maintained, with new features continually being added to improve the program.

What language are you using to build your blockchain applications? We would love to hear your thoughts on which programming language is best suited.