Nym Rust SDK update

New C/C++ bindings open the door for deeper Bitcoin, Zcash, Firo integrations and more.

Author: Nym
4 mins read
Network-1.svg

New C/C++ bindings open the door for deeper Bitcoin, Zcash, Firo integrations and more.

The Nym mixnet is a powerful plug-and-play privacy infrastructure that protects any kind of communication in transit. Not only does the mixnet protect your data, but by shuffling traffic it protects metadata too, making your internet habits invisible. In order for the mixnet to be really plug and play, though, it needs to be able to communicate outside of its native Rust code base.

Languages: Bahasa Indonesia // Русский // 日本 // Türkçe

Now, any projects written in C++ will be able to more easily integrate with the Nym mixnet thanks to a new interface available in the Nym Rust SDK: C/C++ bindings. And there are a lot of projects that have C/C++ components, from the Bitcoin source code to libbitcoin, Zcash, Firo, some components of the Signal messaging app and more.

Developers: please try out these bindings! You can find a reference implementation example here for how C/C++ devs could interact with the SDK. Try to connect your application with the mixnet and see what you can do. If you have any questions or feedback, please do reach out on Matrix/Element.

For the rest of you, what do these bindings mean? Let’s take a closer look.

Why does Nym need C/C++ bindings?

The backend of the Nym stack is written in Rust. Rust is a great language and has been adopted by projects across the crypto, security, and privacy space because of its design — to be a flexible and fast low-level systems language, which aims to remove an entire class of memory-related issues that other languages fall foul of.

However, when you’re making a generic network layer for the rest of the internet, relying on a relatively new language can create issues — after all, Rust’s first stable release was in 2015. Projects use a lot of other languages, and not all of these are interoperable.

In an ideal world, one would be able to write everything in Rust and cross-compile it to be able to use it anywhere. (See the Motivation section of the UniFFI documentation for a bit more on this.)

Unfortunately this glorious future has not yet come to pass. So instead the team has to rely on writing Foreign Function Interface (FFI) code; this essentially creates a translation mechanism for code in one language to call code in another.

The Rust compiler cannot and does not understand C++ code. Therefore, the Rust compiler needs to be told about code to use on the C++ side. Language bindings are the glue to make this communication happen.

One of the nice things about Rust is that it, like many other languages, exposes a C Application Binary Interface (ABI) — something that defines how to interact with a piece of compiled code. For example, with Nym this might be how to call a function that starts a process of listening out for incoming messages from the mixnet, or how the code deals with managing data in memory such as storing incoming messages and replySURBs for your app to use later on.

Why is this important, and how does one acronym (ABI) relate to the other (FFI)? Like so:

“The FFI is the user-code interface the language provides to interact with other executables, which may have a different ABI. The FFI forms the transition layer between different ABIs.” —From the Rust ABI wiki.

Nym Rust SDK update

The first version of some FFI bindings for the Nym Rust SDK were published this week.

This means applications written in C/C++ can start experimenting with integrating mixnet functionality by interacting with the Nym Rust SDK, using these bindings.

The development team has covered the initial functions that developers will need for starting to experiment with the mixnet: creating a Nym client and sending and receiving messages. There is also a reference implementation / example of how C/C++ devs might interact with the SDK.

This is an important step in making the mixnet more accessible to third parties, so previously unsupported developers can use Nym’s Rusk SDK. Give it a try!

Join the Nym Community

Discord // Telegram // Element // Twitter

Privacy loves company

English // 中文 // Русский // Türkçe // Tiếng Việt // 日本 // Française // Español // Português // 한국인

Share
VPN-screen.svg

INTRODUCING NYMVPN

Advanced privacy built for the age of AI

Artboard 1.svg