5596bcf4fba7362340e7a960cfeb00994d81b353 bitcoind: set default rpcuser (Erik Arvstedt) c4cf323873b040a6ae9e0f8834020dd0455b51a8 electrs: add option 'extraArgs' (Erik Arvstedt) e731d7123240b1354f49fb223549835b44dd8549 electrs: add option 'address' (Erik Arvstedt) 1e62456ed1890c249fb6b631094ce17153167231 electrs: test RPC connection to bitcoind (Erik Arvstedt) 0be67c325e29f3ef6826fd67c3f0433791be48dc electrs: use cfg.user, cfg.group (Erik Arvstedt) 48be5a79faff1984e2d472883ee04cda941c7d9b electrs.enable: use mkEnableOption (Erik Arvstedt) b75b2a16264f24b8b0fa3353142bdc08ba178432 electrs: improve description (Erik Arvstedt) fa3455d01fe0cf62fe69c6efe115797be9c4dcf8 electrs: don't leak bitcoinrpc secret through process ARGV (Erik Arvstedt) f30aadbef26c406d3fb43f1cc583e4b57c72da79 electrs: enable unstable build, pin pkg to unstable (Erik Arvstedt) 5c6571654efef7c92520262a8b27ab7bbd1ecbbf electrs: 0.7.1 -> 0.8.3 (Erik Arvstedt) 47481b26421f992064a459cc5a756feb3cdb005b electrs: quote dataDir in shell cmd (Erik Arvstedt) 8fb33d1099bbd98d96aba43aecfedb61e9bfd739 electrs: use bitcoind.dataDir option (Erik Arvstedt) 45ba1f1fb3a5db4eae73b4056572db00a02499ea electrs: don't print timestamps to log (Erik Arvstedt) 88080a58bfebbacdc5c5e5ee2e732146c12fe7e0 electrs: wrap long lines in preStart (Erik Arvstedt) 301bb91ae51cef360bd280a37f7453c8e88aa4aa simplify setting high-memory options (Erik Arvstedt) 93fd2329b811af10c888a7eba1d319c663c26e8b electrs: make nginx TLS proxy optional (Erik Arvstedt) acde24ce439efa65e56a1f9581b4263600d9e04d electrs: move user/group definitions to bottom (Erik Arvstedt) 148327326b8319fcf71718fae4adc590fd5964da electrs: formatting (Erik Arvstedt) cce9932b621a26f698723cc31fd3f79a02abf034 make pinned pkgs accessible through pkgs/default.nix (Erik Arvstedt) Pull request description: ACKs for top commit: jonasnick: ACK 5596bcf4fba7362340e7a960cfeb00994d81b353 Tree-SHA512: 2064b352839a1787ccb05930ac2cf1f0d3596aaea81135086e8a91b9eebf319868087a27cdf9f2fd0152ab652d338680cdf9e866185e86777fcdd87931651b39
nix-bitcoin
Nix packages and nixos modules for easily installing Bitcoin nodes and higher layer protocols with an emphasis on security. This is a work in progress - don't expect it to be bug free or secure.
The default configuration sets up a Bitcoin Core node and c-lightning. The user can enable spark-wallet in configuration.nix
to make c-lightning accessible with a smartphone using spark-wallet.
A simple webpage shows the lightning nodeid and links to nanopos letting the user receive donations.
It also includes elements-daemon.
Outbound peer-to-peer traffic is forced through Tor, and listening services are bound to onion addresses.
A demo installation is running at http://6tr4dg3f2oa7slotdjp4syvnzzcry2lqqlcvqkfxdavxo6jsuxwqpxad.onion. The following screen cast shows a fresh deployment of a nix-bitcoin node.
The goal is to make it easy to deploy a reasonably secure Bitcoin node with a usable wallet. It should allow managing bitcoin (the currency) effectively and providing public infrastructure. It should be a reproducible and extensible platform for applications building on Bitcoin.
Available modules
By default the configuration.nix
provides:
- bitcoind with outbound connections through Tor and inbound connections through a hidden service. By default loaded with banlist of spy nodes.
- clightning with outbound connections through Tor, not listening
- includes "nodeinfo" script which prints basic info about the node
- adds non-root user "operator" which has access to bitcoin-cli and lightning-cli
In configuration.nix
the user can enable:
- a clightning hidden service
- liquid
- lightning charge
- nanopos
- an index page using nginx to display node information and link to nanopos
- spark-wallet
- electrs
- recurring-donations, a module to repeatedly send lightning payments to recipients specified in the configuration.
- bitcoin-core-hwi.
- You no longer need extra software to connect your hardware wallet to Bitcoin Core. Use Bitcoin Core's own Hardware Wallet Interface with one
configuration.nix
setting.
- You no longer need extra software to connect your hardware wallet to Bitcoin Core. Use Bitcoin Core's own Hardware Wallet Interface with one
The data directories of the services can be found in /var/lib
on the deployed machines.
Installation
The easiest way is to run nix-shell
(on a Linux machine) in the nix-bitcoin directory and then create a NixOps deployment with the provided network.nix
in the network
directory.
Fix the FIXMEs in configuration.nix and deploy with nixops in nix-shell.
See install.md for a detailed tutorial.
Security
- Simplicity: Only services you select in
configuration.nix
and their dependencies are installed, packages and dependencies are pinned, most packages are built from the nixos stable channel, with a few exceptions that are built from the nixpkgs unstable channel, builds happen in a sandboxed environment, code is continiously reviewed and refined. - Integrity: Nix package manager, NixOS and packages can be built from source to reduce reliance on binary caches, nix-bitcoin merge commits are signed, all commits are approved by multiple nix-bitcoin developers, upstream packages are cryptographically verified where possible, we use this software ourselves.
- Principle of Least Privilege: Services operate with least privileges; they each have their own user and are restricted further with systemd options, there's a non-root user operator to interact with the various services.
- Defense-in-depth: nix-bitcoin is built with a hardened kernel by default, services are confined through discretionary access control, Linux namespaces, and seccomp-bpf with continuous improvements.
Note that nix-bitcoin is still experimental. Also, by design if the machine you're deploying from is insecure, there is nothing nix-bitcoin can do to protect itself.
Hardware requirements
- Disk space: 300 GB (235GB for Bitcoin blockchain + some room)
- Bitcoin Core pruning is not supported at the moment because it's not supported by c-lightning. It's possible to use pruning but you need to know what you're doing.
- RAM: 2GB of memory. ECC memory is better. Additionally, it's recommended to use DDR4 memory with targeted row refresh (TRR) enabled (https://rambleed.com/).
Tested hardware includes pcengine's apu2c4, GB-BACE-3150, GB-BACE-3160. Some hardware (including Intel NUCs) may not be compatible with the hardened kernel turned on by default (see https://github.com/fort-nix/nix-bitcoin/issues/39#issuecomment-517366093 for a workaround).
Usage
For usage instructions, such as how to connect to spark-wallet, electrs and the ssh Tor Hidden Service, see usage.md.
Troubleshooting
If you are having problems with nix-bitcoin check the FAQ or submit an issue.
There's also a #nix-bitcoin
IRC channel on freenode.
We are always happy to help.