Bee Rust-Framework – Why was the Rust programming language chosen for Bee?
Rust is a multi-paradigm system programming language developed by Mozilla Research with the aim of being particularly secure and practical. Rust combines approaches from different programming paradigms, including functional, object-oriented, and concurrent programming, allowing for a high level of abstraction.
The IOTA Foundation aims to incorporate machines of all performance levels into the IOTA network: from microcontrollers to phones to servers. Some of these systems have minimal computing resources and no operating system of their own. Aside from microcontrollers, the IF also focuses on energy efficiency, high performance, and an excellent user and developer experience. Of the available language choices, the IF felt that Rust was the best fit.
Rust is a low-level system programming language and is so efficient that it does not require automatic garbage collection; in doing so, Rust operates at a high level of performance while maintaining high memory safety, providing similar performance to C and C++. Along with its well-integrated modern tools, Rust helps to work faster on IOTA designs while being more confident that the code is doing what the IF intended. Rust is a relatively new systems programming language, with many loyal fans in the developer community. It is a safer alternative to languages like C and C ++, as well as a faster alternative to languages like Python and Ruby.
The Bee Framework
Bee is a framework written in the Rust programming language for building IOTA nodes and tools that interact with the IOTA network. The final product is intended to be a highly modular collection of basic Rust-Crates* that can be combined and extended. To that end, the IOTA Foundation’s various libraries will also be merged into Rust-Crates. Bee will also enable foreign function interfaces (FFI) that can be used in higher level languages. These will form the basis for client APIs.
*Crates are the basic compilation unit of Rust code and can be considered libraries or projects.
Entering the IOTA developer ecosystem should be as easy as possible so that people can use the Bee framework to contribute, extend, and build their ideas for the IOTA network. Bee will provide a central reference implementation of key data structures and algorithms that will be verified and eventually certified. Through this approach, improvements in all core components are expected to quickly propagate to all other libraries built on top of them. This will prevent any future implementation from having to be fixed or corrected.
The IOTA Foundation wants to enable machines of all performance levels to join the network, from microcontrollers and single-board computers to phones, web browsers, desktop machines and servers. To do this, the Bee component libraries are to be implemented from scratch. Each library can be imported individually to have as few dependencies as possible. With microcontrollers in mind, these libraries should not rely on runtime – this includes language runtimes such as garbage collection, but also operating system integration (which in the case of Rust is provided by the libstd standard library).
The Bee Framework was developed primarily to support the implementation of IOTA Coordicide. As we move towards Coordicide, the IF would like to make this framework as open, verifiable, and usable as possible by supporting the creation of tools, clients, nodes….
The following four milestones have been set by the IF:
- Fundamental crates: specification and implementation of the fundamental Crates Bee-trinary, Bee-model, and Bee-crypto. These are the essential building blocks for IOTA development.
- FFI: Foreign Function Interface to make the Bee Crates available to other languages. The first project to rely on Bee Crates through FFI will be Firefly. We will also investigate to what extent WebAssembly, wasm, could be an intermediate target.
- Rust IRI: specification and implementation of node-specific crates Bee-Network, Bee-Tangle, Bee-Api, Bee-Consensus, and Bee-Gossip. To demonstrate the modularity and robustness of the Bee framework, a node for the current mainnet will be implemented. Some of these crates will be reused for the Coordicide node.
- Coordicide: specification and implementation of new Coordicide node-specific Crates after delivery of the research specifications.
Last Updated on 14. April 2021