Privacy-enhance Cosmos with the Nym Rust SDK
The Nym Rust SDK brings the powerful pattern protection of the mixnet into blockchains.
The Nym Rust SDK brings the powerful pattern protection of the mixnet into blockchains.
A new tutorial from the Nym core team reveals how Cosmos broadcasts can be run over the Nym mixnet, securing traffic patterns against snooping adversaries.
Languages: Française // Türkçe // Bahasa Indonesia // 日本 // 中文 // Русский
By using the Nym Rust SDK with the Cosmos SDK, developers can query blockchains and request services anonymously via the mixnet, with all traffic patterns fully protected.
Almost all blockchains are vulnerable to traffic analysis with no pattern protection built in, and therefore leak metadata and IP addresses. This information can be used to target, dox or censor users and validators.
While the binary in the following tutorial is built for Cosmos, in theory, the principles should work on enabling pattern protection for any blockchain with the Nym mixnet.
Chains leak metadata
The purpose of the tutorial is not to build production-grade code, but to familiarise developers with connecting Nym to the Cosmos blockchain.
Interoperability is crucial for the future of Web3. If ecosystems remain siloed they will become deserted islands. From the start, Cosmos has sought to resolve dependence on L1 blockchains by enabling an ‘internet of blockchains’ with the Inter-Blockchain Communication Protocol (IBC) and CosmWasm smart contracts, allowing projects to interact with one another but retain their own distinct character and utility — like a sprawling archipelago of islands, all connected.
But the design of Cosmos means that all of the network traffic on and between chains — the boats connecting these islands, so to speak — is visible, and therefore vulnerable to attacks, surveillance, and censorship.
This is not only a problem with dApps, decentralised projects and blockchains of Web3, but with the internet as a whole.
However, what makes decentralised infrastructure particularly vulnerable is the sheer amount of traffic that has to move across open networks in interchain and peer-to-peer broadcasts.
It is these patterns of ‘metadata’ traffic that are analysed by criminals, governments, big tech, and shady data broker businesses. And it is precisely these patterns that the Nym mixnet protects.
Build with the Nym Rust SDK on Cosmos
The first part of this tutorial teaches users how to take a first step towards building a service which can interact with a Cosmos SDK blockchain via Nym, thus securing the network layer.
Think of the service you’ll build as a kind of proxy: it interacts with the blockchain on the client’s behalf, shielding the client from the validator that it interacts with. At the same time, the service is also shielded from the client by the mixnet.
Let’s look at an example. Imagine you want to make a transaction. Generally speaking this would entail:
- Querying the blockchain for relevant information to construct the transaction;
- receiving that back from the blockchain;
- then constructing and signing the transaction and sending this to the blockchain;
- and receiving a transaction hash back as confirmation.
Using this tutorial, the queries and transactions will be sent from your client via the mixnet and a proxy service rather than directly from you, protecting your patterns of queries and transactions from the blockchain as well as any network observers.
Conversely, the validator would send information and transaction hashes back via the proxy service, which would send this through the mixnet (using something called SURBS) before it reaches your client.
NOTE: if you are a wallet developer and your wallet runs SOCKS5, SOCKS4a, or SOCKS4, check out using the socks client via the SDK instead of the websocket client. There is an example of how you’d connect here.
The tutorial covers writing two pieces of code in Rust.
The first piece of code is a client-side binary for constructing a blockchain query, which sends this to the Cosmos SDK blockchain before passing the response back to the client. The example in this tutorial is to query the balance of an account.
The second piece of code listens out for requests from the mixnet, acts on those requests, and anonymously replies to the client sending those requests.
The tutorial is in five parts:
- Prepare your environment
- Prepare your library
- Prepare your client
- Prepare your service
- Querying the chain
By the end of the tutorial, you’ll have learned how to integrate the Nym mixnet for traffic transport — allowing you to build privacy-preserving apps for real-world use cases much more simply.
Most blockchains are not private — yet
Most blockchains are not designed with privacy in mind. They are designed to be immutable public ledgers that record transactions and remain unchanged and unalterable.
The Nym Rust SDK introduces pattern protection for Cosmos traffic. But it does not provide privacy once information is stored on a given blockchain itself.
Now, if you are simply querying a blockchain, the mixnet will effectively protect those queries. But if you want to write to a blockchain, the mixnet only protects transactions in transit. This means you will need a privacy L1 (such as Anoma or Penumbra) if you want to ensure on-chain privacy.
The Nym Rust SDK is general purpose and can communicate with any blockchain — including those designed with privacy in mind. So integrate Nym for network layer privacy and choose your stack carefully!
The Nym mixnet is a general purpose, advanced privacy system for the whole internet, whether Web 2.0 or Web3, or a dApp, L1, or L2 blockchain. This tutorial shows that privacy primitives are becoming increasingly usable to build with privacy as the default.
Developers! Try the tutorial today, join the Nym dev chat and shield users and operators against global adversaries by taking advantage of the powerful pattern protection offered by the Nym mixnet.
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 // 한국인