When leaking memory makes sense: Leaking memory in Rust

It is believed that it is impossible to leak memory with Rust, that is not true. Although is way more difficult to leak memory in Rust than in other languages, it can happen, sometimes by accident, and sometimes, by design. In this article we will explore some cases where leaking memory is useful. Sharing memory between threads Imagine that you have a value that it does not change and needs to be shared across several threads. If the value can be initialized with constant functions or values, you can use the static keyword. But what if the value to be shared is not constant? What are the options? ...

April 1, 2025 · 9 min · Nicolás Antinori

Cross compiling Rust using Docker

A while ago, I published an app that I originally made for myself but thought it would be useful for others: Kindly RSS Reader. Kindly RSS Reader is a self-hosted RSS aggregator designed for e-ink devices and optimized for low-end computers such as the Raspberry Pi. In fact, I run it on a Raspberry Pi 3B powered by a USB port. The only way to deploy it at the moment is via Docker (or compiling the source and running it by manually). I’ve uploaded the image in Docker Hub. In the future, I plan to create a .deb package and other formats to make deployment more flexible. ...

March 6, 2025 · 7 min · Nicolás Antinori

Accelerating Rust compilation times: Dynamic linking, code generation and cache

Having a language that does a lot of checks at compile time is not free, it will impact compilation times. Luckily there are some things we can do to speed things up: Dynamic linking, be careful with code generation and caching dependencies. Dynamic linking is a somewhat difficult thing to achieve in Rust but not impossible. The main reason is that at the time of writing this (Sept-Oct 2024) Rust does not have its own stable ABI and it must rely on the C binary representation (if we want to inter-operate with other languages or other Rust versions). This has some interesting consequences that we will explore in this post. ...

October 2, 2024 · 15 min · Nicolás Antinori

Fast data verification in the blockchain: The Merkle Tree

The bitcoin network has been running non-stop since 2009 and at the time of writing this blog post, the whole blockchain occupies more than 500GB. Verifying information in that huge amount of data is not an easy task. Luckily, as many other computer science problems, this can be solved by using the correct data structure. In our case, that data structure is the Merkle tree. What is a Merkle Tree (a.k.a Hash Tree)? As the name suggests, the Merkle tree is a data structure in form of a tree (usually binary) where: ...

May 30, 2024 · 6 min · Nicolás Antinori

Rust references and borrowing from the inside

Now it is time to talk about references and borrowing. To understand this topic, first check out this post where I talk about ownership and move semantics. As we have seen in the named article, the way Rust manages memory allocations is rather unique. This is also true when we talk about referencing some place in the memory, something that can be achieved in C with pointers. GDB In this post I am going to explore what is happening in memory using the GNU Debugger (gdb) with the special command rust-gdb: ...

March 24, 2024 · 13 min · Nicolás Antinori

Seed Phrase vs Private Key: a technical overview

Seed phrase and private key are two terms that are tightly related but are different things. When setting up a new crypto wallet such as Metamask, Ledger or Trezor, among others, a list of 12 or 24 common words is given to the user to back up. That list is the so-called seed phrase, an “easy to remember, easy to backup” word list. A private key is a large binary string used by a crypto wallet for signing the transactions that later will be sent to the chain. ...

December 4, 2023 · 6 min · Nicolás Antinori

Zero-Knowledge Proofs Decoded: A Simple Intro

It’s common to hear about web3 initiatives incorporating or aiming to incorporate ZK-proofs for increased privacy. The notion of Zero Knowledge proof (ZK-proof) is not a modern concept; it was first introduced in a paper named “The Knowledge Complexity of Interactive Proof-Systems” in 1985. In this article we will see what a ZK-proof is, offer an intuitive explanation and explore several use cases. Whether you are a developer or a user, it’s important to understand the core concept behind ZK-Proofs because it will help you understand not only what the product is trying to achieve in matters of security and privacy but also how they are trying to achieve them. ...

May 15, 2023 · 4 min · Nicolás Antinori

Rust ownership and move semantics from the inside

Ownership and move semantics is one of the things that makes Rust unique. To understand this topic, you need to understand what Stack and Heap are at a basic level. I wrote a post about that! You can check it out if you need a refresher on those concepts. It is a little bit hard to get used to this feature because it forces you to think about stuff that you didn’t have to worry about in other languages. Enough introduction, let’s cut to the chase! ...

October 18, 2022 · 10 min · Nicolás Antinori