Having its own underlying blockchain, Witnet requires code that is as fast as C or C++ but memory safe to prevent security vulnerabilities. At the same time, we want to produce concurrent code that can take advantage of modern hardware. After analyzing the possible languages to use, we found that Rust is a fast, memory safe and highly concurrent language which allows for writing complex multithreaded code without race conditions or dangling pointers. It allows fearless concurrency without compromising on performance.
Having an undeniable influence from functional languages like ML or Haskell, Rust is very expressive yet it uses high level abstractions. This makes it easy to write correct and readable code, which in turn translates into faster and more productive development.
Rust is statically typed but it sports a really nice type inferer which makes code succinct and readable. The absence of a garbage collector and low runtime requirements makes it easy to embed Rust code inside other languages like Python, Ruby or Nodejs. This is fundamental for building the bridges between Witnet and other blockchains as well as with the headless browser that will allow Witnet to perform web content retrievals.
The Rust compiler is simply awesome, offering the most helpful messages we have seen in a compiler. It also has incremental compilation, which helps developers save their valuable time.
No more reinventing the wheel. Unlike C or C++, Rust has a package manager — a tool called cargo. Besides managing the dependencies of the project, cargo gives you the option to build, run, test, generate documentation and publish your own package to a community driven package repository.
Metaprogramming. Rust macros allow for reusing code in a concise, well-abstracted way with a powerful compile-time correctness checking.
And last but not least, Rust has an ever-welcoming community that is always willing to help and is currently growing at a very healthy pace.
Summing up, here are the 8 reasons why Witnet will make the most of Rust :
Influence from functional languages
Statically typed with type inference
Awesome compiler and tooling
By the way, do you love Rust and want to join one of the most exciting projects using it in the blockchain space? We’re hiring!