Skip to content

erikarvstedt/nix-bitcoin-mempool

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Mempool module for nix-bitcoin.

Mempool is a fully featured Bitcoin visualizer, explorer and API service.

Note

Mempool currently has a bug where the Mempool backend stops serving Electrum server requests (like address queries) after running for 20-30 days.

As a workaround, this module contains a helper service that auto-restarts the backend after one week.
This is configurable via option mempool.autoRestartInterval.
Sample values: 5 days, 1 week (default), null (to disable restarting).

As soon as the bug is fixed, this module will be added to nix-bitcoin.

Install

  1. Import the mempool module in your nix-bitcoin config.

    • If you use flakes, add this flake to your system flake.nix:
      {
        inputs.nix-bitcoin.url = "github:fort-nix/nix-bitcoin/release";
        inputs.nix-bitcoin-mempool = {
          url = "github:fort-nix/nix-bitcoin-mempool/release";
          inputs.nix-bitcoin.follows = "nix-bitcoin";
        };
      
        outputs = { self, nix-bitcoin, nix-bitcoin-mempool, ... }: {
          nixosConfigurations.mynode = nixpkgs.lib.nixosSystem {
            modules = [
              nix-bitcoin.nixosModules.default
              nix-bitcoin-mempool.nixosModules.default
              # ...
            ];
          };
        };
      }
    • In a non-flakes config::
      {
        imports = [
          (import (builtins.fetchTarball {
            # FIXME:
            # Replace `<SHA1>` in `url` below.
            # You can fetch the release SHA1 like so:
            # curl -fsS https://api.github.com/repos/fort-nix/nix-bitcoin-mempool/git/refs/heads/release | jq -r .object.sha
            url = "https://github.com/fort-nix/nix-bitcoin-mempool/archive/<SHA1>.tar.gz";
            # FIXME:
            # Add hash.
            # The hash is automatically shown when you evaluate your config.
            sha256 = "";
          })).nixosModules.default
        ];
        # ...
      }
  2. Edit your NixOS configuration

    Enable Mempool:

    services.mempool.enable = true;

    There are two Electrum backend servers you can use:

    • electrs (enabled by default):
      Small database size, slow when querying new addresses.

    • fulcrum:
      Large database size, quickly serves arbitrary address queries.
      Enable with:

      services.mempool.electrumServer = "fulcrum";

    Set this to create an onion service to make the Mempool web interface available via Tor:

    nix-bitcoin.onionServices.mempool-frontend.enable = true;

    Set this to route all external backend requests (e.g. rate fetching) through Tor:

    services.mempool.tor = {
      proxy = true;
      enforce = true;
    };

    Make sure to set the above when using the secure-node.nix template.

    See modules/mempool.nix for all available options.

    After deploying, run nodeinfo to show the Mempool web interface address.

Developing

Run all tests:

nix flake check

See also: dev/dev.sh.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published