Rust: The Perfect Language For Blockchain Development
Table of Contents

Rust: The Perfect Language For Blockchain Development

Rust, Graydon Hoare’s creation, is the famous language for creating fast and secure applications. The language is also universally well-liked, earning the top spot in the Stack Overflow Survey 6 years in a row!

It’s no wonder, then, that many major companies, such as Discord, 1Password, Dropbox, and Toyota decided to embrace Rust, the language developed in 2010.

What makes Rust different?

Rust’s design is unique, and crucially, it aims to answer the oldest existing question: how to eat a cake and still have that cake. In the simplest terms, it solved the challenge of having a tool for designing apps that do not compromise on performance while at the same time, save you from potentially dangerous flaws.

Of course, if you need to escape some of that safety, you may. Even though it is highly discouraged, a simple unsafe statement will do the trick. 

Another key feature that many programmers always appreciate, is how easy it is to generate documentation. If somebody published a piece of code for others to reuse, you may find documentation for it on docs.rs. Frankly, there are few languages that even match that functionality (Go is one of them, of course). 

The Gotchas

Of course, claiming that something is without flaws is delusional. The designer of the language, and the team behind it now, had to make tradeoffs.

One of them is the language’s excessive wordiness. Writing option.as_ref().unwrap().borrow() is a Rustacean’s (that’s how Rust programmers call themselves) constant companion for better or for worse.

Furthermore, the editor support appears to be top-notch, but only on the surface. There’s a JetBrains’s plugin for CLion, an extension for Visual Studio Code (VS Code)… Or is it? Suggestions are often a miss, and the functionality often crashes, and it’s slow.

Overall, there are definitely more shortcomings, and we can’t pretend there aren’t. The optimistic accent is how the wider project handles flaws and challenges. One example is how the community handled one highly requested feature: asynchronous programming.

See for yourself at https://areweasyncyet.rs/. In short, there was a popular movement of programmers to co-create the necessary foundations for the feature.

Rust’s Use Cases

Specifics aside, there are use cases In the same way that we won’t see a supercar making deliveries, or a delivery van race on a track - programming languages have their use cases that they're built for.

Rust excels in all the (most frequently) multi-platform, high-performance scenarios, where security cannot be an afterthought:

  • Blockchains
  • Browsers
  • Operating Systems
  • Cybersecurity Products

These all successfully use the airtight language to improve their offering.

There are some scenarios, however, where we have to resort to using C, or C++ instead. Embedded development is one such area. In this case, engineers have to apply solutions that are sometimes older than they are. It’s a sad necessity since memory and CPU speed are a luxury. Though that might be for worse. As a matter of fact, C may have been indirectly responsible for a series of car crashes, and billions of dollars of losses for one automotive company (pages 36, 38, 40, 43).

Sadly, the affair happened before 2010, therefore the only way to produce better code back then was to voluntarily adhere to standards.

In cases of web back-ends, developing them in JavaScript, Java or C# are the best suited tools. It’s an active sacrifice of the app’s performance for quicker iterations and shorter development time. Little do people know, however, that Rust apps make terrific front-end web apps.

Did you know that Figma allows people to create their designs using the super safe language under the hood?

Blockchain projects running based on Rust

Safety, easy multi-platform development, speed, and quality is just what blockchain developers need - and where Rust excels.

For all the enthusiasts out there, you may even find a dedicated newsletter updating everybody on advances of “Rust in Blockchain”. The amount of high-profile projects in this area alone is impressive, just to mention Zcash, and MobileCoin.

We want to highlight different projects, however. Some higher-profiles ones are:

Solana

The project started in November 2017 and had one goal from day one. They wanted “a blockchain built from the ground up for scale.”

The story began in 2017, with a scientific paper by Anatoly Yakovenko. Few years down the line, and we have a top project with numerous contributors, and a strong community. Solana and Polkadot are fighting Ethereum on their quest to become the choice for Web3. Will they be successful? Only time will tell.

Question: how do you build something extremely fast, and safe at the same time? The Clear Answer: You develop it in Rust.

Engineers from Geneva, Switzerland, use the programming language to ensure the highest levels of safety and speed. To achieve higher efficiency, the team even restricted the language features available.

The effect? “710,000 transactions per second on a standard gigabit network if the transactions are, on average, no more than 176 bytes.”

Note: The name Solana is “a nod to a small beach town North of San Diego called Solana Beach, where Anatoly, Greg and Stephen [the founders] lived and surfed for three years when they worked for Qualcomm.”

Polkadot

Polkadot, a London-based organization, “envision[s] a Web where our identity and our data is our own – safely secured from any central authority.”

That’s not their only goal either. The team sees their mission being “connecting private and consortium chains, public and permissionless networks, oracles, and future technologies that are yet to be created” as well.

How do they want to do all that? You guessed it: build a solution on top of Rust.

While the team, primarily based in London, explicitly highlights the foundation is Hoare’s child, the project also states that Go and C++ are among the languages in use “making Polkadot accessible to a wide range of developers.”

Hyperledger Sawtooth

If you played “spot the odd one out”, then here is the correct answer. A little different from their colleagues, Hyperledger solves other problems altogether. While the former two are public blockchains, Sawtooth is an “enterprise solution for building, deploying, and running distributed ledgers.”

The company, based in San Francisco, USA, uses Rust to “to give application developers and administrators more control, more flexibility, and greater security for their blockchain networks.” The team switched to Mozilla’s language from… Python.

Guido van Rossum’s creation had one purpose: to facilitate prototyping. After a year, in 2019, the team decided to rewrite the project to Rust, enabling them to ship better code. Teams have “account for all possible error and edge cases”, thus low-quality code will not get a pass from the compiler.

Comparing that to C++, or even Python, the solution will be of higher quality, due to the strictness of the language and its compiler.

Conclusion

But… is Blockchain development, and low-level (advanced operations where speed is a must) development the only things I can do with Rust? No! In fact, full-stack development is not only the domain of JavaScript. Maybe a Nest.js and Angular (JavaScript frameworks) are enterprise favorites. However, nobody says you can’t make an app with Actix Web, and Yew (Rust alternatives to the aforementioned solutions) just as well! If you prefer to keep your current web engineers, then that’s quite alright as well. You may just compile your code to run inside, e.g., a React, Vue or Angular app.

Whatever you are using Rust for, should you want to have a conversation about your project, don't hesitate to get in touch with us here to talk about our Blockchain Development Services. We would love to talk to you.

Liked the article? subscribe to updates!
360° IT Check is a weekly publication where we bring you the latest and greatest in the world of tech. We cover topics like emerging technologies & frameworks, news about innovative startups, and other topics which affect the world of tech directly or indirectly.

Like what you’re reading? Make sure to subscribe to our weekly newsletter!
Categories:
Share

Join 17,850 tech enthusiasts for your weekly dose of tech news

The data controller is ITMAGINATION sp. z o.o. Your personal data included in the contact form will be processed for the purpose of marketing of controller’s products and services. You can withdraw your consent at any time. SHOW MORE
Thank you! Your submission has been received!
We will send you at most one email per week with our latest tech news and insights.

In the meantime, feel free to explore this page or our Resources page for eBooks, technical guides, GitHub Demos, and more!
Oops! Something went wrong while submitting the form.

Related articles

Our Partners & Certifications
Microsoft Gold Partner Certification 2021 for ITMAGINATION
AWS Partner Network ITMAGINATION
ISO 9001 ITMAGINATIONISO-IEC 27001:2013 ITMAGINATION
Great Place To Work
ITMAGINATION Winner Great Place To Work Best Workplaces Poland 2021
© 2022 ITMAGINATION. All Rights Reserved. Privacy Policy