Nimiq: Past, Present & Future

Blog Series — Upgrades & Research

We recently concluded two special Nimiq Hackathons, starting off with the Nimiq Core Hackathon porting the Nimiq Core to Rust for increased performance, followed by the Nimiq Front-end Hackathon revising the Nimiq Keyguard for increased security.

Nimiq Core in Rust

JavaScript on Node.js with a shared code base between client and server allowed for quick development. While we will continue supporting the popular Node.js platform, porting the Nimiq Core to Rust is an investment into the future as Rust provides several clear advantages:

Native support for concurrent code execution, real multithreading on the CPU

Rust compiles to WebAssembly, thus the browser nodes will benefit as well

Performance at par with C and C++

Memory-safe like Java

Rust combines the best of both worlds: memory safety and high performance. In more detail, a lot of potential issues common to C, C++ or common to scripting languages such as JavaScript can be checked statically and thus avoided at compilation time. Not having garbage collection improves performance while having a more explicit memory model makes it less prone to memory leaks. At the same time, Rust is still a rather young language and thus more flexible and agile but also future proof and proper open source as solid sponsors such as Mozilla ensure.

In general, while the mining power will not be increased as such, hash rate stability is expected to be significantly increased as the overall hardware performance will be heavily improved. Most importantly, the limiting factor of the current client is the number of transactions per second because the implementations is bound to one core for everything not related to mining— Rust with native concurrent code execution will remove this bottleneck. Additionally, the software stack is much smaller, the code runs directly on the CPU, all cores can work on all tasks in parallel taking advantage of all hardware features.

In short, while Node.js is a powerful platform Rust compiles to native code, giving us all the power of the machine.

The implementation is still in progress, cryptographic primitives and multiple components have been ported, but not yet fully integrated. Asking the Core team how porting to Rust felt so far: “refreshing”!

Websockets and Community Seed Nodes

Based on the connection statistics of our seed nodes, almost 95% of backbone nodes run in “dumb” configuration thus supporting our network with hashing power but not supporting communication among nodes (see our post on network performance for more details). With Nimiq Core release 1.2.0, websocket support has been added allowing nodes to talk to each other via plain websockets and their public IP, thus removing the need to setup a domain name and certificate. While this has not yet been publicly announced, we already witness 500 nodes using this new feature and the curves of the network statistics suggest a quick adoption going forward. We are confident that with this new setup, some of the nodes currently running in dumb mode will be able to make use of their public IP address and thus start supporting the communication within the network. Additionally with version 1.2.0, a limit for accepting connections for dumb nodes can be configured.

We highly encourage everyone running a full node to upgrade.

With version 1.2.1 we plan on shipping the community seed nodes feature. Currently, we are working on hosting the seed nodes list as well as arranging secure access for community members. Also, the increase of Nimiq seed nodes from eight to 20 will be integrated into the source code. The seed nodes are distributed globally, minimizing risks and at the same time improving response time for nodes worldwide. As a matter of fact the new seed nodes are already being used by the network, demonstrating that the highly randomized propagation algorithm works very well.

Keyguard and Accounts Manager

The ultimate goal of revising the Nimiq Keyguard is to remove all external software dependencies, bringing it to a similar level of reviewability as the Nimiq Core code.

While analysing the current source code and structure of the Nimiq Keyguard, we realized that a more fine grained architecture will allow for a higher degree of separation of concerns. Which led us to this new architecture:

In this new architecture, the Nimiq Keyguard’s refined responsibility is to serve as a software-based key store, i.e. a piece of highly secure software dedicated to protecting your keys, and doing nothing but that in order to minimize complexity and maximize security.

“In front” of the Keyguard, also as form of protection, will be the all-new

Nimiq Accounts Manager where keys from the Nimiq Keyguard or your

Ledger Nano S come together with labels and user-defined permissions regarding third party applications.

The Nimiq Account Manager is going to be the new common interface orchestrating and protecting the key storage interactions behind it.

During the hackathon we made major progress towards rewriting the Nimiq Keyguard in vanilla JavaScript, HTML, and CSS, removing all external dependencies, thus achieving full code reviewability and therefore getting it ready for being added to the HackerOne bug bounty program. In parallel, we started planning and designing the Nimiq Account Manager and will update on the progress as applicable.

On a side note, work on the Nimiq Safe has continued and in order to increase social interaction and usability, an easy-to-use contact list feature has been added. Early contributors will also be happy to know that a new payout function is now published and available for vested NIM amounts.

This concludes our special “Blog Series”. Stay tuned for more updates as well as one of the next planned posts which will cover operational transparency. Follow Nimiq on Twitter, Discord and Telegram to be notified about updates on Nimiq Core, Keyguard, Safe, and Wallet.