A Huge Step Forward: WalletCore's Migration from C++ to Rust
We're excited to announce landmark progress in WalletCore's evolution.
We're excited to announce landmark progress in WalletCore's evolution. After intense work during Q2 and Q3, we're thrilled to share that we've successfully migrated from C++ to Rust, starting with the first and biggest blockchain, Ethereum.
Wallet Core Release: 4.0.0
A Transformative Journey to Rust
Initiated in 2018, WalletCore emerged in response to a pressing need for mobile platform support. At that time we had an important choice to make; which language would meet our requirements. Only C++ met our needs in a sustainable way.
Despite its advantages, C++ has several drawbacks: it lacks a dedicated package manager for modularity, a unified build system, and a native static analyser. The presence of multiple compilers further complicates the development process. Additionally, its typically slow compilation, absence of inherent safe checks within the language, and a propensity for crashes without the necessary expertise pose considerable challenges. Given these limitations, we decided to switch to Rust.
Rust is widely recognised in the blockchain and wallet development space for its numerous advantages:
Memory Safety: Rust's ownership model and strong type system help prevent memory-related bugs, making it ideal for developing secure wallet software.
Concurrency: Rust's mechanisms for preventing data races and concurrency-related bugs enable easier development of high-performance, parallel, and concurrent systems.
Performance: Designed with performance comparable to C++, Rust allows developers to write efficient code capable of handling the demands of blockchain and wallet operations without sacrificing safety.
Interoperability: Rust's C-compatible FFI ensures seamless integration with existing C++ codebases, facilitating the gradual transition from C++ to Rust while maintaining compatibility.
Modern Language Features: Rust's rich ecosystem, libraries, tools, and modern syntax, including pattern matching and type inference, enhance development productivity.
Growing Ecosystem: Rust's popularity in the blockchain space has fostered a thriving ecosystem of libraries and tools tailored for blockchain and wallet development, streamlining the development process.
Active Community: Rust's engaged community offers excellent support and resources, ensuring developers can access help and stay up-to-date with best practices and new developments.
Breaching New Frontiers
During the Q2 and Q3 this year, we worked relentlessly and accomplished several key milestones. Let's delve into the significant highlights of our migration journey:
Introducing the Robust Rust Project Architecture: We architected the Rust project similar to our existing C++ model while trying to avoid its most significant shortcomings. Our focus was on promoting modularity, leveraging the power of Rust's strong typing, and improving error handling. Exploiting Rust's robust type system, the Wallet Core project structure has been massively enhanced to promote easier implementation of features and long-term code maintainability.
Successful Migration of Supported Elliptic Curves to Rust: Our team effectively migrated most of the currently supported elliptic curves to Rust. This was made easier by using public Rust crates including RustCrypto/k256, RustCrypto/p256, curve25519-dallek. To ensure the highest levels of security, we engaged in an external and independent audit for the cryptographic algorithms developed by us and for the Rust crates not audited before.
Moving Ethereum Functionality from C++ to Rust: Ethereum is one of the most feature-rich blockchains supported by WalletCore. We provide users the ability not only to generate transactions but also to manipulate the Smart Contract Calls through the full support of Ethereum ABI and RLP encoding algorithms. This migration effort became a catalyst to expand support for Ethereum ABI and RLP. We've extended the interface that empowers users to call any Smart Contract without the need for a new WalletCore release.
The Future is here!
This landmark shift to Rust brings us one step closer to offering a more seamless, efficient, and robust WalletCore. We believe this transformation is just the beginning of a new chapter where our users can look forward to a continuous roll-out of improvements to provide optimal user experiences. We hope to continue serving our users with the same dedication and focus on security in our pursuit of progress. Stay tuned for more updates and thank you for believing in WalletCore!
Join the Trust Wallet community on Telegram Follow us on X (formerly Twitter) Instagram Facebook Reddit
Note: Any cited numbers, figures, or illustrations are reported at the time of writing, and are subject to change.