Upgrading to config version 0.1.3
Bitcoin Knots support removed
Bitcoin Knots support and the services.bitcoind.package option have been removed.
Remove services.bitcoind.package from your configuration, including explicit
selections of Bitcoin Core. The daemon, bitcoin-cli and Core Lightning now use
nix-bitcoin.pkgs.bitcoind (Bitcoin Core) directly. bitcoind-knots is no longer
included in bitcoinix’s pinned packages. If you used Knots, review any
Knots-specific settings in services.bitcoind.extraConfig before deploying
with Bitcoin Core.
electrs index rebuild
electrs 0.12.0 switched to bindex, which uses
a new index format. electrs must rebuild its index from scratch, and it does not
convert or delete the old one, so bitcoinix refuses to start electrs while the old
index is in place. Reindexing takes from a few hours
to about a day, depending on your hardware. The final index is about 7% of the size
of bitcoind’s blocks/*.dat files and can temporarily grow to about 14% during the
initial sync. electrs accepts connections while it indexes but answers with incomplete
history and balances until indexing has finished. The same applies to mempool if it
uses electrs as its Electrum server.
To upgrade, delete the old index before deploying (default data dir shown; for
regtest, the index is in regtest instead of bitcoin):
systemctl stop electrs && rm -r /var/lib/electrs/bitcoin
Then deploy the new system config to your node and follow the progress with
journalctl -u electrs -f.
If you roll back to the previous config after electrs 0.12 has started once, also
remove the marker file /var/lib/electrs/bitcoin.bindex. Otherwise the index check
is skipped on the next upgrade.
electrs requires Bitcoin Core REST access
electrs 0.12.0 also requires Bitcoin Core 31 or later. It reads blocks through
bitcoind’s REST interface, which bitcoinix enables automatically
(services.bitcoind.rest.enable). REST is served without
authentication on the RPC address and port: every source allowed by
services.bitcoind.rpc.allowip can read blocks, transactions, the UTXO set and the
mempool, bypassing RPC users and rpcwhitelist. If services.bitcoind.rpc.allowip
contains sources other than localhost and bitcoinix’s network namespaces, evaluation
fails. Remove them, or set services.bitcoind.rest.allowNonLocal = true to accept
unauthenticated REST access for these sources. Evaluation also fails if
services.bitcoind.extraConfig contains rpcallowip or includeconf directives:
move RPC sources to services.bitcoind.rpc.allowip, or review the raw and included
settings and set services.bitcoind.rest.allowUncheckedConfig = true.
electrs no longer connects to bitcoind’s whitelisted P2P port.
Service runtime paths become read-only
Services using nix-bitcoin.lib.defaultHardening, including Bitcoin Core, Core
Lightning and LND, now see /run and /dev (including /dev/shm) as read-only.
Before deploying, review custom service hooks (preStart, postStart,
ExecStartPre, ExecStartPost) and plugins that write there: they can now fail
with Read-only file system.
The service’s RuntimeDirectory, StateDirectory, configured data directory
and existing ReadWritePaths remain writable. Move custom writes into those
directories, or add a narrow ReadWritePaths exception for an existing path
that must remain writable. See
Write to /run or /dev/shm from a service hook
for an example. If you have no custom code writing outside the allowed
directories, no script changes are needed.
mempool database migration
mempool 3.3 migrates its MariaDB database from schema version 97 to 106 on the
first start of the backend. The migration can’t be undone: rolling back the
NixOS generation keeps the migrated database, and mempool 3.2 has no downgrade
path. The database is not covered by services.backups. To keep a way back,
dump it before deploying:
mysqldump --single-transaction mempool > mempool-3.2.sql
Run this as root, and replace mempool if you set services.mempool.database.name.
Secret setup sandbox
setup-secrets now runs in a sandbox whenever nix-bitcoin.setupSecrets is
enabled, including when nix-bitcoin.generateSecrets enables it automatically.
Before deploying:
- Replace declared secret symlinks to files outside
nix-bitcoin.secretsDirwith files inside that directory, preserving their contents. If another tool supplies or rotates these secrets, configure it to install the files there beforesetup-secretsstarts. External targets are read-only or hidden inside the sandbox. - Review custom
nix-bitcoin.generateSecretsCmds. They have no IP network access and can write only to the secrets directory and private temporary directories. Put final secret files in the secrets directory. Commands requiring writable executable memory (such as JIT compilation) or setuid/setgid file modes are blocked. If generation needs these facilities, arrange to supply all required secrets beforesetup-secrets, setnix-bitcoin.generateSecrets = false, and keepnix-bitcoin.setupSecrets = trueto set the supplied files’ permissions. - Remove setuid/setgid bits from any
nix-bitcoin.secrets.<name>.permissionsvalues; the sandbox rejects those modes when setting permissions too.
The secrets directory is now root:root 0700 while setup runs even when
generateSecrets is false. If any step fails, every service loses access to
secrets in that directory until setup succeeds. After fixing the cause reported
by journalctl -u setup-secrets, run as root:
systemctl reset-failed setup-secrets
systemctl restart setup-secrets
systemctl start nix-bitcoin-secrets.target
Then restart any dependent services that failed. Successful setup restores the
directory to 0751 and applies each declared secret’s configured owner and mode.
After migrating your configuration, set nix-bitcoin.configVersion = "0.1.3";.