Skip to content

bitcoind: remove bitcoind-knots - #143

Closed
seberm wants to merge 1 commit into
masterfrom
bitcoind/remove-knots
Closed

seberm wants to merge 1 commit into
masterfrom
bitcoind/remove-knots

Conversation

@seberm

@seberm seberm commented Oct 24, 2026

Copy link
Copy Markdown
Contributor

Remove the bitcoind-knots package. bitcoinix only tests and supports Bitcoin Core; Knots is still based on Core 29, so services that need newer Core features can't support it.

  • Drop the bitcoind-knots pin and the Knots example in services.bitcoind.package.
  • Add a config version 0.1.3 entry for users running Knots, with migration steps in docs/configuration.md.
  • services.bitcoind.package still accepts any package; other implementations are unsupported.

Only the pin is removed from pkgs/pinned.nix. Regenerating it would also move electrs to nixpkgs-unstable, which is out of scope here.

bitcoinix only tests and supports Bitcoin Core. Knots lags behind Core
(it is still based on Core 29), so services that need newer Core
features can't support it.

Drop the bitcoind-knots pin and the Knots example in the
services.bitcoind.package description. Users who run Knots get a
config version 0.1.3 notice explaining how to switch back to Bitcoin
Core. services.bitcoind.package still accepts any package, but other
implementations are unsupported.

Only the pin is removed from pkgs/pinned.nix. Regenerating the file
would also move electrs to nixpkgs-unstable, which is an unrelated
update.

Assisted-by: Claude Code (claude-opus-5-5)
@github-actions github-actions Bot added area: docs docs/, README, examples/, SECURITY.md, book.toml, assets area: modules modules/ and pkgs/lib.nix area: packages pkgs/ and flake pins labels Oct 24, 2026
@seberm seberm mentioned this pull request Oct 24, 2026
2 tasks done
@prusnak

prusnak commented Oct 24, 2026

Copy link
Copy Markdown
Contributor

alternative PR that also drops the option: #145

@seberm

seberm commented Oct 24, 2026

Copy link
Copy Markdown
Contributor Author

Superseded by #145, which also removes services.bitcoind.package.

@seberm seberm closed this Oct 24, 2026
@seberm
seberm deleted the bitcoind/remove-knots branch October 24, 2026 16:47
prusnak added a commit that referenced this pull request Oct 24, 2026
Blocked by:
- [x] bitcoin-knots removal
  - ~#143
  - #145
- [x] Release of
[v0.1.2](https://github.com/bitcoinix/bitcoinix/releases/tag/v0.1.2)

--- 

Two commits: `electrs: 0.11.0 -> 0.12.0` and
`electrs: refuse to start on an index of electrs < 0.12`.

## What changes

electrs 0.12.0 switched to
[bindex](https://github.com/romanz/bindex-rs):
- **Reindex required**: a few hours up to about a day, depending on the
hardware. The
final index is ~7% of `blocks/*.dat`, up to ~14% during the sync.
Meanwhile electrs,
and mempool if it uses electrs, answers with incomplete history and
balances. See
  "Old index" below.
- **Bitcoin Core 31+ required**: bindex uses the `/rest/blockpart`
endpoint. An
eval-time assertion on `nix-bitcoin.pkgs.bitcoind` fails evaluation for
an older
  Core ("electrs requires Bitcoin Core 31 or later."), e.g. with
  `useVersionLockedPkgs = false`.
- **Reads blocks through bitcoind's REST interface**: the module enables
`services.bitcoind.rest.enable`. REST is unauthenticated: if
`rpc.allowip` has
non-local sources, evaluation fails unless `rest.allowNonLocal` is set,
which means
accepting unauthenticated REST for those sources. Raw
`rpcallowip`/`includeconf` in
`extraConfig` need `rest.allowUncheckedConfig`. The versioning entry and
docs say so.
- `--daemon-p2p-addr` was removed upstream, so electrs no longer enables
bitcoind's
  whitelisted p2p listener (btcpayserver still enables it for itself).
- `pkgs/pinned.nix` is regenerated by `helper/update-flake.sh`, which
moves electrs to
  unstable (the pin update held it on stable by hand until this lands).
- Docs: "Upgrading to config version 0.1.3" (steps, disk, downtime,
REST) and `rest=1`
  on the other node when using a remote bitcoind.

## Old index: manual reindex, no crash loop

electrs 0.12.0 doesn't convert or delete the old index, which uses the
same path
(`<dataDir>/bitcoin`, or `regtest`). On it, bindex panics with
`Unsupported DB format
(0 < 1) - please reindex!`, and with `Restart=on-failure` the unit would
restart every
10 s.

The reindex stays **manual**: it takes up to a day on a big node, so the
operator picks
the moment, and nothing deletes user data from a start script. A 0.1.3
versioning entry
gives the steps: `systemctl stop electrs`, `rm -r <dataDir>/<network>`,
then deploy.

If the old index is still there, the unit fails once with a clear
message instead of
crash-looping:
- A marker `<dataDir>/<network>.bindex` identifies a 0.12 index. It is
written when
electrs starts and no index directory exists yet (fresh install, or
after the `rm -r`).
- If the index directory exists without the marker, the start wrapper
prints the reindex
steps and exits with status 78, which `RestartPreventExitStatus`
excludes from
  restarts. Nothing is deleted.
- The check runs in the main process (a wrapper that `exec`s electrs),
not in
`preStart`: a failing ExecStartPre still triggers `Restart=on-failure`,
and
  `RestartPreventExitStatus` only applies to the main process.

## Tests

- The `regtest` test now waits until electrs has indexed all blocks
(0.12 serves requests
while it is still indexing) and queries the history of the address that
mined the
regtest blocks over the Electrum protocol. That exercises bindex's REST
block fetches
  end to end.
- The `electrs` test removes the marker and checks that the unit ends
`failed` (not
auto-restarting) with exit status 78 and the reindex message, then
restores the marker
  and checks that electrs starts again.
- electrs now enables REST in all CI scenarios, so the "REST disabled ⇒
404" path of the
`bitcoind-rest` test only runs in scenarios without electrs (e.g.
`lndPruned`).

On the current head: `-s electrs` and `netnsRegtest` passed locally,
`nix flake check`
passed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: docs docs/, README, examples/, SECURITY.md, book.toml, assets area: modules modules/ and pkgs/lib.nix area: packages pkgs/ and flake pins

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants