Live Markets, Charts & Financial News

With Nix, Bitcoin Projects Can Accelerate Contributions And Deployment

0 44


This is an op-ed by niftynei, a developer educator who runs the Base58 Bitcoin Protocol Academy and organizer of the upcoming Nix-focused Bitcoin++ conference.

When you want to install a new app on your computer, where do you get it?

Deciding which source to use is a surprisingly difficult problem to solve, but one that every computing platform suffers from.

Before the spread of the Internet, new software “packages” were distributed on hard media, such as CDs or USB sticks. If you want your computer’s latest operating system (OS) or the latest version of Bitcoin Core, for example, you’ll need to physically buy it from a store or have it mailed to you. You will then load the disk or USB into your computer, and make a copy of the new program on your local disk.

As a developer who writes code, you should actually be distributing copies of your software to friends and family. Or you work for a large company that has relationships with companies and computer stores, which will figure out how to distribute the program you wrote to their clients and customers.

With the advent of always-connected computers, the landscape of software distribution has changed forever. Now, instead of having to grab a copy of the bits in a program, you can easily download a copy of them from the Internet.

This made it easier for new developers to write applications that anyone could download. But now the problem is the answer to the question: Where on the Internet should users download the new software?

Hacker App Store

The way mobile ecosystems solve the problem of new app distribution is through software on your phone called the “App Store” (or “Google Play Store” on Android).

Developers upload the latest version of their apps to Apple or Google servers. Those companies then send a silent notification to all the phones the app is installed on, and the app is updated in the background on users’ phones, without the users’ involvement.

If you are a user and want to add a new app to your phone, in most cases you will be able to find it in the App Store and download it from there.

But not all software is available as a mobile application. Some software projects are applications or desktop tools that developers use to write new pieces of software. These applications need a distribution channel as well. On desktop operating systems, we tend to call the App Store software package managers. They manage software packages that you download to your computer.

Modern package managers consist of a central server, sometimes called a repository, that can keep track of the latest version of an application, and a client-side application running on the package user’s computer.

If you’re a developer, you’ve probably come across “homebrew” or “apt-get install” somewhere in your life. Homebrew and apt are package managers.

In the way package managers work, the client-side application will check the central repository occasionally to see if there are any new updates for any of the currently installed packages. Or, if you have the right operating system and the right set of permissions, your computer might automatically run these checks and download and install the latest version of the app.

(As an addition, you can add other sources of software packages to your local package manager client. If the developer themselves host their applications instead of uploading them to the central repository, you will need to add the self-hosted website to the list of places to check for updates in your own package manager client application. your.)

What if we could reproduce everything?

nothing It is a package manager that aims to bring repeatable designs to all packages it helps distribute.

Nix solves problems with software distribution by keeping detailed track of all inputs to a build, uniquely identifying each input and using the same inputs as the original builder. This ensures that it can build the same thing every time, on any device.

Nix hashes every build input and output; This makes it easy to identify when an input has changed. When the inputs of a building change, the outputs will change as well.

One of the big problems with iterable builds is that different users will have different versions of the inputs that the program needs to build on. Each new program you build on your machine may need a different version of its input in order to be repeatable.

Nix fixes this by tracking builds through lists of hashes, and using only inputs that match the list of hashes you expect. The trade-off is that Nix uses much more disk space and can take a bit longer to download, as it will need to download the correct inputs for the binary generation process if you don’t already have it on your computer.

I like to joke that Nix only became possible thanks to it Moore’s Lawwhich means we now have enough extra disk space that we don’t have to worry about having multiple copies of the same program, just in slightly different versions.

Therefore, Nix allows a repeatable build of your software to be distributed more easily, which means the user can reliably rebuild your software on their machine and just run it, no questions asked.

One small thing aside, note that what “reproduce” for a Nix build means is that “if a package works on one machine, it will also work on another”. This is not the same reproduction that the Bitcoin Core developers are trying to ensure for the official Bitcoin binaries, which Have a separate process to verify that they match.

Nix and Bitcoin

Distributing open source software in a way that is easy for end users to operate, and that is repeatable on any system, is a very useful and important feature. It makes it easier for anyone to start using the project and also easier for new developers to start contributing again to the project.

A few years ago, a group of intrepid developers released a repository of the most popular Bitcoin software projects packaged as Nix packages and modules.

Packages makes it easy for anyone using the Nix package manager to install and start up a Bitcoin node on almost any architecture. You don’t have to worry about installing the correct dependencies before running the build commands, and the project will build from source on your own machine. It’s pretty perfect in terms of being able to quickly download, build, and run a Bitcoin node from scratch.

the Nix-Bitcoin Warehouse It provides Nix “modules”, which are configurations of software applications that are supposed to run on them Nexus. The Nix-Bitcoin modules allow anyone running NixOS to reproduce the architecture of Bitcoin Core and other open source Bitcoin projects, and run them quickly on their machine with minimal fuss.

In an interview for this article, Nick Jonas, Sun The main maintainers of the Nix-Bitcoin projectHe had to say about using the project:

“The main benefit Nix-Bitcoin gets from Nix/NixOS is declarative configuration management. Configuring your system with the Nix programming language allows for abstraction, so you can standardize your logic to reuse and test individual components. This allows for managing complexity, which is an inevitable thing that happens when Create systems, and helps build a correct and secure system.For example, a lot of the security features that Nix-Bitcoin provides would be very annoying if we didn’t have the module system.Reproducibility in NixOS also helps a lot of updates,because we know exactly what is being done Run it on our users’ systems. Finally, with NixOS you can also get errors at evaluation time instead of at boot time.”

Bitcoin Core is not the only project compiled for the Nix distribution.

There is also Core Lightning, BTCPay Server and a number of other projects. For the most part, these projects are added and compiled for the Nix distribution by fans of the Nix package management system, not the developers who write the software. For a complete list of available packages, check the “Modules” list in the Nix-Bitcoin GitHub repository.

Why not Knicks everywhere?

If Nix is ​​such a big change in the way Bitcoin projects are created and shipped, why isn’t everyone using it? The truth is that Nix is ​​a big project that is somewhat difficult to get into. The learning curve for using Nix is ​​quite steep, and the model for operating Nix as a package manager can be very different from what most users are used to.

NixOS started as a research project by Eelco Dolstra in 2003Since then, he has gradually built a following and user base.

Bitcoin++ Berlin: Expanding the Use of Nix in Bitcoin

By organizing the next Bitcoin++ conference In Berlin, we aim to change this. Bitcoin++ It is a developer-focused conference series that focuses on various topics in the Bitcoin developer space. Originally launched in Austin, Texas, in 2022, the most recent conference was in late April 2023 focusing on Bitcoin’s Layer 2 technologies, such as Ark, and the Lightning Network.

and validity groups.

The upcoming Berlin conference, scheduled for October 6-7, 2023, aims to be a “Nix-pilling” event for the Bitcoin developer ecosystem. The core moderators of the Nix-Bitcoin project at Fort Nix (including Nick and Pavol Rusnak and Eric Sirion, will be attending

Tip of the iceberg). The two-day event will be full of hands-on workshops and lectures

Designed to teach developers from across the ecosystem how to use Nix packages

their projects and better compile their development dependencies so that they are fresh

Contributors can start coding and contributing faster, as well as demonstrate how quick and easy it is to deploy software using modules on NixOS.

Additional article references

  1. Breeding with Knicks
  2. interview with nixbitcoindev
  3. where do I start
  4. Why Nix-Bitcoin for Bitcoin Customers?

This is another guest post by niftynei. The opinions expressed are entirely their own and do not necessarily reflect the opinions of BTC Inc or Bitcoin Magazine.

Leave A Reply

Your email address will not be published.