top of page

Rust Programming Language: Made for Cryptocurrency

The most important factors when choosing a programming language to build a cryptocurrency or an cryptocurrency website in are: Security and Performance.

Turns out Mozilla has been working on a language made to maximize both of these features: Rust

I will in fact argue in this post that Rust is the fastest language on the market, as much as 6 times faster than C++ in some scenarios.

This makes Rust the perfect language for cryptocurrencies which have to worry about being a target for theft due to a bug in the code and are known for having performance issues since they require many computers to work together.

And if you want proof Rust is a great language, Rust has been voted the "Most Loved Language" 3 years in a row in The Annual Stackoverflow Developer Survey.


When it comes to cryptocurrency, or any financial application, security is of paramount importance. There are many stories of exchanges or on rarer occasion, the cryptocurrencies themselves being hacked. For instance, the 1/2 Billion dollars that was stolen in the infamous Mt. Gox hack. And while rare, cryptocurrencies should approach security from a place of paranoia, as a security vulnerability could lead to major theft.

And when it comes to security, according to Mozilla, roughly 1/2 of all the security vulnerabilities they've encountered with C++ came from memory safety issues. Memory safety meaning that hackers can manipulate memory locations they are not supposed to access. By reading and writing variables that should be off limits, they gain the ability to hack into code they shouldn't be able to.

Rust gains its security primarily due to its ability to fix these memory safety issues. Rust solves this by tracking the ownership of variables and having developers specify how ownership should to handed off ownership when passing variables between functions.

This essentially forces the developer to practice good coding habits and catches the most common mistakes that cause memory safety issues.


Cryptocurrencies are known for having performance issues. Consider that Bitcoin can currently handle peaks of 7 transactions per second. Meanwhile Visa handles 2000 transactions per second on average. While changing the language will not fix this alone, a speedup of 6x that should reasonably be able to be gained can by changing languages can go a long way.

There are other languages that are more secure than C++ and fix those same memory safety issues. However, C++ has always been known as being the fastest programming language, used by programmers when they need to write high performance code. C++ has roughly twice the performance of some other popular, highly optimized languages such as Java and C#. Many languages such as Python are much worse and are roughly 20x slower than C++.

Because of it's clear way of fixing bugs, Rust is the first language to achieve both the memory safety of other languages and the same performance of C++ for single threaded applications.

However, the same protection Rust uses to achieve memory safety can also be used to help protect against thread safety issues. For our non-programmer friends, threading means that instead of running the code one line at a time, the program instead splits the work amongst multiple cores on your computer. The problem with threading is that it can lead to issues where two different threads try to access the same variable at the same time and freeze or crash the program or can otherwise cause major issues.

The ability to write thread safe code turns out to be a major performance advantage Rust has over C++. Because threading in C++ is very prone to issues, and almost no programmer can write anything but small snippets of thread safe code, this makes threading impossible in some cases. A perfect example of this is Google, which started writing threads to help browsers load and display websites faster, only to fail and cancel the project because it was too complex for even the best programmers to write it without bugs.

Which means that Rust programs can use threads to gain improved performance while C++ programs cannot. Because of this, it can easily be argued that Rust is actually faster than C++.

Most computers these days have the ability to run 8 threads in parallel and newer computers are often coming with the ability to run between 16 and 36 threads and some servers with the ability to run 56 threads in parallel. And in fact some GPUs which have as many as 1024 threads.

The problem when it comes to cryptocurrency is that the network is only as fast as it's slowest miners. This means that most cryptocurrencies can currently only make use of 8 threads for now, but this will of course increase in the future.

While it is rare to achieve perfect parallelization with 8 threads leading to a performance gain of 8, cryptocurrencies can process transactions in parallel efficiently, and should be able to gain a speedup of 6x over writing the same program without threads. And though this only applies to websites and exchanges, those servers with 56 threads could likely gain a 40x performance gain.

Reduced Development Time

There is one more bonus to throw in when it comes to using Rust. Though there is an initial learning curve, the more bugs that can be caught at compile time, the less that are missed during testing and end up being caught later after significant code has been built on top of this bug or after being shipped to customers. Rust does its best to catch as many bugs as it can at compile time.

So while initial development time might take longer, future development will be faster and less time will be spent fixing bugs in old code that isn't as fresh in the minds of developers.

Actually.. Flogram is better than Rust

On a side note, it won't be ready for a long time but Frink is actually planning to build it's own programming language in the long run that is designed from the ground up to be significantly better at accomplishing every one of these points. For the time being though, we are using Rust.

Frink is building a new and exciting cryptocurrency, one of the first that is truly and provably decentralized. We are always looking for programmers, particularly developers with interest in working with Rust, to help us out! Please check us out at and contact us at if interested in helping us fix the financial system.


bottom of page