Skip to content

About

Fork of Start9Labs/mempool-startos for upstream contributions: Mempool for StartOS.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

 
 

Repository files navigation

Mempool Logo

Mempool on StartOS

Everything not listed in this document should behave the same as upstream Mempool. If a feature, setting, or behavior is not mentioned here, the upstream documentation is accurate and fully applicable — see the Documentation section of instructions.md for links.

Mempool is a mempool visualizer, block explorer, and fee-market API. On StartOS it runs entirely against your own Bitcoin node and your own Electrum indexer, with every external data source that upstream reaches for either disabled or optional.


Table of Contents


Image and Container Runtime

Three upstream images run as four daemons in a fixed order. mempool/backend is built through backend.Dockerfile, a temporary layer that replaces its Node.js 26.12.1 with the official 26.13.1 build, which carries the November 2026 Node.js security fixes, and its ws 8.19.0 with 8.23.0, which fixes memory-exhaustion DoSes in the WebSocket server every visitor connects to; it comes out once upstream's backend image ships both. The other two run unmodified.

Property Value
Images mempool/frontend, mempool/backend + backend.Dockerfile, mariadb
Architectures x86_64, aarch64
Subcontainer Daemon Starts after Purpose
mariadb-sub mariadb — The bundled database, bound to loopback
pools-server pools — The bundled mining-pool snapshot, on loopback
backend-api api mariadb, pools The indexer and API — the one to attach to
user-interface webui api The web frontend, which proxies the API
clear-backend-cache — — Temporary; the Clear Backend Cache action

The backend does not run the image's entrypoint directly. It runs a short shell guard first, then execs node. The guard writes a sentinel file into the cache directory on every start and the API health check removes it on the first healthy report; if the sentinel is still there at the next start, the previous start never became healthy, so the guard wipes the on-disk cache before starting. That breaks the boot loop where an oversized cache exhausts the heap while loading, over and over. It says nothing and clears nothing when the cache is already empty, and it does not attribute the failure to memory — a crash loop with any other cause leaves the same sentinel behind, and the guard cannot tell them apart.

pools exists because upstream will not start without mining pool definitions. The backend exits 1 when it has neither a pools-v2.json sha stored in its database nor a reachable source for one, so a database that has not been seeded yet — a fresh install, a restore, or an upstream schema migration that nulled the sha — plus an unreachable source is a permanent boot loop. A snapshot of pools-v2.json ships in the package's assets, mounted read-only at /assets, and pools serves it and a matching one-entry git-tree document on loopback. The sha it reports is the file's git blob hash, which is exactly what api.github.com reports for the same bytes, so it stays comparable with upstream's own source. Nothing in the package fetches pool data from GitHub any more: AUTOMATIC_POOLS_UPDATE is off, so a remote source could only ever seed an empty database, and the bundled snapshot does that without a network.

The heap ceiling itself is computed at every start rather than fixed. It takes the RAM StartOS grants the container, subtracts 6 GB for the co-resident stack (Bitcoin, the indexer, any Lightning node), and takes a third of the remainder — half, with any indexing toggle on, since the working set is larger. It is a ceiling and not a reservation: raising it does not increase steady-state memory, it only lets a transient startup peak finish.

Volume and Data Layout

Five volumes are declared and four carry data.

Volume Mount Point Purpose
config /backend/mempool-config.json, read-only file The upstream configuration file
cache /backend/cache The backend's mempool and RBF disk cache
db /var/lib/mysql in mariadb-sub The MariaDB data directory
startos — (host side) store.json; never mounted into a container
main — (unused) Retained only for the 3.3.1:3 migration path

config is mounted as a single read-only file, not as a directory, so the backend can read its configuration but cannot rewrite it — every change goes through the package.

File Models

Two models: upstream's configuration file, and a small store for state that has no place in it.

File Volume Format Modelled Written by
mempool-config.json config JSON Yes — FileHelper.json Install, every init, and four actions
store.json startos JSON Yes — FileHelper.json The Bitcoin Node, Select Indexer and Tor actions

store.json holds which Bitcoin node Mempool reads from (the Bitcoin service on this server, or an external node), which Electrum indexer you selected and whether external requests should go over Tor. All three are StartOS state — intent, and the discriminator that decides which optional dependencies exist — and deliberately not part of upstream's file. The addresses that intent resolves to are written into mempool-config.json instead, which is what lets the Tor proxy be switched off when Tor is uninstalled without forgetting that you asked for it.

Within mempool-config.json:

Enforced — rewritten to a fixed value whenever the package writes the file: the whole DATABASE section bar the password (the bundled MariaDB on loopback), the two MEMPOOL.POOLS_JSON URLs (the bundled snapshot on loopback), CORE_RPC.COOKIE_PATH, LND's certificate and macaroon paths, Core Lightning's socket path, and the SYSLOG, MAXMIND, REDIS, REPLICATION, and STRATUM sections, all held off.

Derived — written from live addresses by init on every start: CORE_RPC.HOST/PORT (while the node is the Bitcoin service on this server), ELECTRUM.HOST/PORT (while the indexer is one on this server), LND.REST_API_URL, and SOCKS5PROXY.HOST/PORT/ENABLED. Each is a reactive read of the dependency's address over the LXC bridge, so init re-runs and the backend restarts precisely when an address changes — an install, an uninstall, a port change — and not on a routine dependency update. An absent dependency resolves to nothing and its key is omitted entirely rather than written as a placeholder that would fail to connect; the write heals when the dependency returns. MEMPOOL.BACKEND is written alongside ELECTRUM — electrum when a local indexer address resolved or an external indexer is selected, none otherwise.

Entered — written by the action that collected them and left alone by init: for an external node, CORE_RPC.HOST/PORT/USERNAME/PASSWORD with COOKIE: false; for an external Electrum server, ELECTRUM.HOST/PORT/TLS_ENABLED. Choosing this server's Bitcoin again clears the credentials and restores cookie auth.

Seeded once — DATABASE.PASSWORD, generated at install for the bundled database.

Yours — everything else, including the whole EXTERNAL_DATA_SERVER section and the fiat-price settings. Those are seeded with upstream's own values and never re-asserted, so a hand edit survives.

Two defaults depart from upstream's:

Key Here Upstream in-source Why
MEMPOOL.POLL_RATE_MS / MEMPOOL_BLOCKS_AMOUNT 8000 ms / 4 blocks 2000 ms / 8 blocks Home hardware is the common case; the Responsive profile restores upstream's values
MEMPOOL.STDOUT_LOG_MIN_PRIORITY info debug Debug is very noisy in normal operation — but see Actions before a backfill
MEMPOOL.EXTERNAL_MAX_RETRY / _RETRY_INTERVAL 3 / 5 s 1 / 0 s One attempt made a momentary blip indistinguishable from an outage, and left Tor's per-retry circuit rotation with no second circuit to try
MEMPOOL.POOLS_JSON_URL / _TREE_URL loopback GitHub The bundled snapshot, so no start needs the network and no boot reaches out to api.github.com

SOCKS5PROXY is wired to Tor's SOCKS bridge address (<osIp>:9050) and off until you turn it on — see Route External Requests Over Tor. While it is off, no HOST is written at all rather than a placeholder, because anonymizing traffic must never be dialled at an address that is not Tor.

Dependencies

Every dependency is a choice, Bitcoin included, and each choice changes which dependency exists. Mempool cannot run without a Bitcoin node, but that node need not be on this server.

Dependency Kind Required Health checks
bitcoind running While Bitcoin Node selects Bitcoin on this server (the default); none with an external node bitcoind, sync-progress
fulcrum or electrs running Whichever local indexer the action selects; none with None or an external server The indexer's ready and sync checks
lnd or c-lightning running Only with Lightning enabled The node's ready and sync checks
tor running Only with the Tor proxy enabled tor

Bitcoin must be archival with transaction indexing. For the Bitcoin service on this server, Mempool raises a critical task asking for prune=0 and txindex=true, and that task re-raises whenever the settings stop matching — it is not a one-time prompt. Address lookups additionally need an Electrum indexer, which is what the indexer selection is for.

While it is the node in use, only Bitcoin's public volume, which holds a copy of its RPC cookie, is mounted read-only at /mnt/bitcoind, never its data directory or wallets; an external node is reached with the entered credentials and nothing of it is mounted; for the chosen Lightning node, only the read-only public tier holding the credential is mounted — LND's readonly/ (readonly.macaroon, tls.cert) at /mnt/lnd, or Core Lightning's rpc/ (the lightning-rpc socket) at /mnt/cln. The read-only mount does not restrict a socket: lightning-rpc is Core Lightning's full RPC, so with it selected the backend can call any method, spending included. Lightning credentials stay in the node's public volume. External Bitcoin RPC credentials are stored in mempool-config.json on the config volume and included in configuration backups.

Network Access and Interfaces

One interface. The frontend serves it and reverse-proxies the API and websocket to the backend, so the backend's own port is not published.

The image ships one external nginx upstream — proxy_pass https://mempool.space for the accelerator endpoint — and nginx resolves a literal hostname when it loads its config, with no resolver directive anywhere in the image. A failed lookup was therefore fatal to the whole UI. The package sets the image's own PROXIED_SERVICES pair to redirect that one line at the backend, so the frontend starts without needing to resolve anything and a call to the disabled accelerator gets a 404.

The browser gets the same 404. The frontend's config.js names a SERVICES_API base that the viewer's browser calls for mempool.space's account, accelerator, and payment endpoints; the package sets it to the same-origin /api/v1/services instead of upstream's https://mempool.space/api/v1/services, and sets ACCELERATOR_BUTTON to false, so a transaction page offers no Accelerate button. On a .onion address the frontend substitutes mempool.space's own onion service for SERVICES_API whatever the package sets, so the accelerator pages nothing links to (/acceleration, /acceleration/list, /graphs/acceleration/fees) still reach mempool.space over Tor when opened by URL.

Interface Id Type Port Description
Web UI webui ui 8080 The web interface of Mempool

The port is bound on the main MultiHost and is not masked. Other packages resolve that host over the bridge — Am I Exposed does exactly this.

Installation and First-Run Flow

Install generates the database password and raises two critical tasks: choose an indexer, and configure Bitcoin for archival mode with transaction indexing (the latter only while the Bitcoin service on this server is the node in use). Nothing else is required, and no credential is shown — Mempool has no accounts.

The order that matters: Bitcoin must be synced, and the indexer must have finished its own initial index, before Mempool shows a complete picture. Until then the API is up but blocks and addresses are missing. Mempool itself has no separate sync of its own to wait for unless you enable indexing.

Actions

Six actions, all user-facing.

Bitcoin Node

Chooses the Bitcoin node Mempool reads from — Bitcoin on this server (the default; every install before the choice existed behaves as if it had chosen it) or an External node: the host, RPC port, username and password of a Bitcoin Core node on another machine. Cookie auth is not offered for an external node, since the cookie is a local file.

  • What it changes: node in store.json, and through it whether bitcoind is a dependency and whether its public volume is mounted; for an external node, CORE_RPC directly. Init resolves this server's Bitcoin on the next start and leaves an external node's address alone.
  • Cost: seconds, then a restart.
  • Repeat safety: idempotent for the same node. This changes only the RPC connection: MEMPOOL.NETWORK, the frontend's network configuration, the database and the cache are preserved. A different network or chain needs a fresh installation configured for that network. Clear Backend Cache deletes only mempool/RBF cache files, not the historical MariaDB database. The external-node health check verifies archival mode and transaction indexing without changing the node's settings.
  • Plain HTTP, local network only. Upstream's backend has no TLS option for CORE_RPC (its config has no SSL field and its JSON-RPC client is never given one), so the RPC password and every response cross the network unencrypted, even when the node also offers an https endpoint. The form says so on the host field: use a node on the same local network, never a public address.
  • Health: while external, the external-node check (see Health Checks) replaces what the local dependency's checks would report.

Select Indexer

Chooses which Electrum server backs address lookups — Fulcrum, Electrs, an External Electrum server (host, port, TLS), or None. Nothing is preselected; the form cannot be submitted until you pick one.

  • What it changes: indexer in store.json, and through it the package's optional dependency. An indexer on this server has its address resolved by init on the next start; an external server's host, port and TLS setting go into ELECTRUM directly, and MEMPOOL.BACKEND is electrum either way.
  • Cost: seconds, then a restart.
  • Repeat safety: idempotent; switching indexers loses nothing, since none of them stores Mempool's data. None turns address lookups off and drops the dependency. An external server must index the same chain as the node Mempool reads from; nothing checks that.

Enable Lightning

Selects the Lightning node whose network data fills the Lightning tab, or turns the tab off.

  • What it changes: the LIGHTNING section, plus the paths for whichever node was picked; the frontend also gets LIGHTNING=true.
  • Cost: seconds, then a restart.
  • Repeat safety: idempotent, and nothing is deleted when it is switched off.
  • Core Lightning means full access. The form always warns that choosing it gives Mempool full control of the node and its funds; LND gets only its read-only macaroon.
  • This is the memory-hungry option. Lightning graph data is large; on a device under 12 GiB the form warns before you commit.

Indexing and Performance

The tuning form: a performance profile, mempool statistics, the log level, and four indexing toggles.

  • What it changes: the corresponding keys in the MEMPOOL and STATISTICS sections.
  • Cost: seconds for the write and the restart — but enabling any indexing toggle starts a historical backfill that can run for many hours and consume significant disk space.
  • Repeat safety: idempotent as a write; turning an indexing toggle back off does not undo a backfill already done.
  • The backfill looks like nothing is happening. Upstream logs per-block progress at debug priority only, so at the default log level the service log sits idle for hours while the backfill runs. The service announces this at every start with indexing on, and the form's Log Level control is what surfaces the progress. Restarting the service interrupts the backfill and delays completion. Intermittent 503 retries from Bitcoin during it are expected.
  • Block Audit requires Block Summaries Indexing, which the form's descriptions state but does not enforce.

Route External Requests Over Tor

Sends everything Mempool asks of the internet — fiat exchange rates, mining pool updates, and the external data server — through the Tor service on your server.

  • What it changes: torProxy in store.json, and through it SOCKS5PROXY in mempool-config.json and the package's optional Tor dependency. The pools snapshot is unaffected — upstream's pools updater installs its SOCKS agent as httpsAgent only, so the plain-http loopback fetch is exempt from the proxy and keeps working.
  • Cost: seconds, then a restart. External requests get slower, and upstream raises its own timeout from 10 s to 30 s to suit.
  • Repeat safety: idempotent, and turning it off restores the local pools source.
  • Tor must be installed and running. While this is on, Tor is a running dependency, so StartOS reports Mempool as unhealthy whenever Tor is missing or stopped — it does not hold the service back from starting. With no address to write, external requests go over clearnet until Tor returns; the dependency status is what makes that visible rather than silent. The setting itself is remembered, so the proxy heals on its own.
  • When it helps: where an ISP or national firewall blocks the endpoints Mempool reads from, and where the server's own name resolution is unreliable — a SOCKS proxy resolves hostnames at the proxy rather than locally.

Clear Backend Cache

Deletes the backend's on-disk mempool and RBF cache.

  • When to run it: when the backend fails to start with a JavaScript heap out-of-memory error while loading its cache. The boot guard does this automatically after a failed start; this action is the manual route.
  • What it changes: nothing in configuration — only the cache volume's contents.
  • Cost: seconds, then a short mempool resync on the next start. Blocks, the database, and settings are untouched.
  • Availability: only while the service is stopped. Clearing the cache under a running backend would race its periodic cache writes.

Tasks

Two tasks, both critical — the service will not start while either is unresolved.

Task On Raised when Cleared when
Select Indexer This package No indexer choice has been made The action runs
Bitcoin's Auto-Configure bitcoind Bitcoin's settings are not prune=0 with txindex=true Bitcoin's settings match

Both are critical because Mempool cannot do what it is installed for until they are answered: address lookups need an indexer, and a pruned or unindexed node cannot answer the historical queries the explorer is built on. Choosing None answers the first deliberately — Mempool then runs without address lookups.

The Bitcoin task is the one to know about. It is registered with once: false, so it comes back if Bitcoin's configuration later stops matching — for example after restoring Bitcoin from a backup taken with pruning on.

Health Checks

Four checks, one per daemon, and their ordering carries meaning; a fifth exists only while an external node is selected.

Check Displayed Method Grace
mariadb Hidden The image's own healthcheck.sh 2 min
pools Hidden Port 8998 is listening —
api "API" Port 8999 is listening 45 s
webui "Web Interface" Port 8080 is listening —
external-node "External node" getblockchaininfo and getindexinfo over the configured CORE_RPC 30 s

external-node stands in for the local dependency's checks. With Bitcoin on this server, StartOS reports the node through the bitcoind dependency's bitcoind and sync-progress checks. An external node has no dependency, so startos/externalNode.ts asks it directly with the entered credentials and names the cause when something is wrong: unreachable (host, port, rpcbind), credentials rejected (HTTP 401), access denied (HTTP 403: rpcallowip or rpcwhitelist), pruned, no txindex, index still building (with its height), chain still syncing (with the percentage). A missing txindex is a configuration failure even during initial block download; sync progress is shown only after the required index exists. Only a synced node with a built transaction index reports success, with the node's height. The check is created by a factory that returns null when the node is local, so it does not appear at all then.

The database check reports starting while it initialises and retries every second until it is ready. It is not displayed, because a user has nothing to do about it.

webui is gated on api, which makes it a truthful "Mempool is usable" signal rather than a report that a web server is running: the frontend proxies everything to the backend and is useless without it. StartOS holds the frontend while the API is unhealthy and brings it back when the API recovers, and dependent packages rely on that.

An api failure after the grace period is most often the backend unable to reach Bitcoin, the indexer, or its own database — the service log names which. Failing repeatedly with a heap out-of-memory message while loading the cache is the case Clear Backend Cache exists for.

A name-resolution warning at the top of the log is about the server, not Mempool. The service resolves one external hostname at every start and logs a warning if it cannot. Everything Mempool does keeps working — Bitcoin, the indexer, and the database are all reached by address, and the frontend no longer depends on an external lookup either — but fiat prices go missing. The fix is on the server: set explicit resolvers under System → DNS. A populated list is not evidence of a working one — a VPN gateway's DNS = line becomes the only upstream the container resolver has, and it dies with the tunnel (start-technologies#3603).

Backups and Restore

Only configuration is backed up — sdk.Backups.ofVolumes('config', 'startos').

  • Included: mempool-config.json with every setting, including external RPC credentials, and store.json with the Bitcoin node, indexer and Tor proxy choices.
  • Excluded, deliberately: the MariaDB volume and the backend cache. Both are derived from Bitcoin and the indexer, and both are rebuilt after a restore. The database in particular grows large enough on an indexed install that dumping it failed outright, and it holds nothing that cannot be re-derived.
  • Restore: settings come back intact and no task is raised, but the historical database does not. If indexing was enabled, the backfill starts over from the beginning on the first start, which takes as long as it took the first time.

Limitations and Differences

  1. The database is not backed up. A restore replays settings, not history; any enabled indexing backfills again from scratch.
  2. Bitcoin must be archival with transaction indexing, enforced by a re-raising critical task rather than merely recommended — for the Bitcoin service on this server; an external node is taken on trust.
  3. An Electrum indexer is required for address lookups, and which one is yours to choose — nothing is preselected, and None is a valid answer that leaves lookups off.
  4. Indexing is memory-hungry and slow, and its progress is invisible at the default log level.
  5. Telemetry and the maxmind, syslog, redis, replication, and stratum integrations are held off.
  6. Acceleration services are off, and the web interface offers no Accelerate button. The frontend's accelerator upstream and the browser's services base both point at the backend rather than mempool.space, with one exception: a .onion visitor on the unlinked accelerator pages (see Network Access and Interfaces). The external data servers upstream ships go over clearnet unless the Tor proxy action is enabled.
  7. The backend runs as root, which the boot guard needs in order to clear a cache written by the daemon.
  8. No riscv64 build. x86_64 and aarch64 only.
  9. Bundled mining pool data goes stale between releases. The snapshot is imported once, on the first start of an unseeded database; after that upstream's AUTOMATIC_POOLS_UPDATE is off, so a newer snapshot in a later package release is logged as available and not applied — the same behaviour a GitHub-sourced install has always had.
  10. The backend drives the CPU up in short, heavy bursts for as long as it runs, idle or not, even on the Low-CPU profile — often enough that the fan never spins down and the temperature stays high. It is the usual cause of a loud fan or a high CPU temperature on a server running it, and users are told to run Mempool only while they are using it.

Quick Reference for AI Consumers

package_id: mempool
image: mempool/backend # plus mempool/frontend and mariadb
architectures:
  - x86_64
  - aarch64
subcontainers:
  - mariadb-sub # the bundled database
  - pools-server # serves the bundled pools-v2.json on 127.0.0.1:8998
  - backend-api # the API/indexer; the one to attach to
  - user-interface # the frontend, proxies the API
  - clear-backend-cache # temporary; the Clear Backend Cache action
volumes:
  config: /backend/mempool-config.json (read-only file mount)
  cache: /backend/cache
  db: /var/lib/mysql (in mariadb-sub)
  startos: host side (store.json)
  main: unused; legacy
file_models:
  - mempool-config.json
  - store.json
startos_managed_env_vars:
  - NODE_OPTIONS # backend heap ceiling, computed per start
  - MARIADB_RANDOM_ROOT_PASSWORD
  - MYSQL_DATABASE
  - MYSQL_USER
  - MYSQL_PASSWORD
  - PROXIED_SERVICES # frontend; redirects the accelerator upstream off mempool.space
  - PROXIED_SERVICES_HOST
  - SERVICES_API # frontend; the browser's services base, a same-origin path
  - ACCELERATOR_BUTTON # frontend; false, so no Accelerate button
  - LIGHTNING # frontend, only when a Lightning node is selected
dependencies:
  - bitcoind # running; only while Bitcoin on this server is selected; its public volume mounted read-only
  - fulcrum # or electrs; whichever the indexer action selects
  - electrs
  - lnd # or c-lightning; only with Lightning enabled
  - c-lightning
  - tor # only with the Tor proxy enabled
interfaces:
  webui: { type: ui, port: 8080 }
actions:
  - select-node
  - select-indexer
  - enable-lightning
  - indexing-and-performance
  - tor-proxy
  - clear-backend-cache # only-stopped
tasks:
  - { action: select-indexer, severity: critical } # until a choice is made
  - { action: autoconfig, severity: critical } # on bitcoind; re-raises
health_checks:
  - mariadb # hidden
  - pools # hidden
  - api # displayed "API"
  - webui # displayed "Web Interface"; gated on api

About

Fork of Start9Labs/mempool-startos for upstream contributions: Mempool for StartOS.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages