Skip to content

Repository files navigation

node-probe

License: GPL v3Version

A Bitcoin node observatory that combines eBPF kernel-level behavioral tracing of bitcoind with Bitcoin RPC/P2P semantic data, streamed live to a Phoenix LiveView dashboard.

Your node, from two simultaneous angles: what the kernel sees (raw behavioral truth) and what Bitcoin sees (semantic meaning).


Architecture

 ┌─────────────────────────────────────────────┐
│ bitcoind │
└──────┬──────────────────────┬───────────────┘
│ kernel events │ JSON-RPC
┌────────────────▼──────────┐ ┌───────▼───────────────┐
│ node-probe-loader │ │ RpcCollector │
│ (Rust/Aya eBPF) │ │ (GenServer) │
│ syscall | latency │ │ getblockchaininfo │
│ net | cpu sample │ │ getpeerinfo │
└────────────────┬──────────┘ │ getmempoolinfo │
│ JSON stdout └───────┬───────────────┘
┌────────────────▼──────────┐ │
│ EbpfCollector │ │
│ (GenServer + Port) │ │
└────────────────┬──────────┘ │
│ decode JSON │
└──────────► Metrics.ingest_ebpf / ETS (syscall/latency paths)
│
PubSub "rpc:events"
│
┌───────────────────────────────▼────────┐
│ Aggregator │
│ forwards RPC → dashboard PubSub │
│ mempool history / block arrivals │
└──────────────────┬──────────────────┘
│ PubSub "node_probe:events"
┌────────────────────────────┼────────────────────────────┐
│ │ │ │ │
┌────▼───┐ ┌─────▼──┐ ┌───────▼──┐ ┌───────▼──┐ ┌───────▼──┐
│ Pulse │ │ Block │ │ Peers │ │ Mempool │ │ I/O │
│ Live │ │ Live │ │ Live │ │ Live │ │ Live │
└────────┘ └────────┘ └──────────┘ └──────────┘ └──────────┘
Browser (LiveView)

Prerequisites

RequirementVersionNotes
Linux kernel>= 5.8eBPF ring buffer, bpf_get_stackid
Elixir>= 1.15OTP 26+
RustnightlyFor eBPF kernel programs (aya-ebpf, no_std)
bpf-linkerlatestcargo install bpf-linker
bitcoindanyMust be running on the same host
CapabilitiesCAP_BPF, CAP_PERFMONOr run loader as root

Quickstart

# 1. Clone and install Elixir deps
git clone https://github.com/151henry151/node-probe.git
cd node-probe
mix deps.get
# 2. Install Rust nightly + bpf-linker (one-time setup)
rustup toolchain install nightly --component rust-src
cargo install bpf-linker
# 3. Build eBPF programs and loader
make ebpf
# 4. Configure Bitcoin RPC connectionexport BITCOIN_RPC_URL=http://127.0.0.1:8332
export BITCOIN_COOKIE_PATH=~/.bitcoin/.cookie # or use user/pass:# export BITCOIN_RPC_USER=bitcoin# export BITCOIN_RPC_PASS=yourpassword# 5. Start the dashboard
mix phx.server
# Open http://localhost:4000

Dashboard

RouteDescription
/Single-page dashboard: overview (chain, mempool, eBPF, live pulse), latest block + fee histogram, mempool sparkline, peers table, kernel I/O, anomaly log
/block, /peers, /mempool, /io, /anomaliesHTTP redirects to / (bookmark-compatible)

Configuration Reference

All configuration is via environment variables at runtime.

VariableDefaultDescription
BITCOIN_RPC_URLhttp://127.0.0.1:8332Bitcoin Core JSON-RPC endpoint
BITCOIN_RPC_USERbitcoinRPC username (cookie auth preferred)
BITCOIN_RPC_PASS(empty)RPC password
BITCOIN_COOKIE_PATH~/.bitcoin/.cookiePath to .cookie file for cookie auth
EBPF_LOADER_PATH./priv/ebpf/target/release/node-probe-loaderPath to compiled eBPF loader binary
EBPF_ENABLEDtrueSet false to disable eBPF tracing entirely
P2P_TAP_ENABLEDfalseEnable raw P2P message tapping
RPC_POLL_MS2000RPC polling interval in milliseconds
LITE_MODEfalseSee Lite Mode below
PORT4000HTTP port for the Phoenix server
SECRET_KEY_BASE(dev only)Required in production — generate with mix phx.gen.secret

Lite Mode

Set LITE_MODE=true for Raspberry Pi or constrained hardware.

Disabled in lite mode:

  • CPU flame graph sampling — the 99Hz perf_event eBPF sampler is not loaded
  • P2P message tapping
  • High-frequency eBPF syscall tracing

The dashboard remains fully functional; you lose CPU profiling and fine-grained syscall data.

# Development
LITE_MODE=true mix phx.server
# Production release
make release-lite

Building

make all # build eBPF programs + compile Elixir
make ebpf # build only eBPF workspace (kernel programs + loader)
make ebpf-lite # build eBPF workspace in lite mode
make elixir # deps.get + compile
make test# run Rust unit tests + Elixir test suite
make release # MIX_ENV=prod mix release (creates tarball)
make release-lite # LITE_MODE=true production release
make clean # cargo clean + mix clean

Deployment

eBPF Capabilities

The loader binary needs kernel privileges. Grant capabilities instead of running as root:

sudo setcap cap_bpf,cap_perfmon+ep ./priv/ebpf/target/release/node-probe-loader

Or set AmbientCapabilities=CAP_BPF CAP_PERFMON in the systemd unit (see below).

When the loader is spawned as an Erlang Port, its stdout is a pipe. The loader flushes stdout after each NDJSON line so the Phoenix EbpfCollector receives events in real time — without that, lines can sit in a libc block buffer and the dashboard stays empty even while probes fire.

Tracefs permissions (syscall / sock tracepoints)

Attaching tracepoints reads metadata under /sys/kernel/tracing/events/ (for example …/syscalls/sys_enter_openat/id). On many kernels those directories and files are 0750 / 0640 (root:root), so a non-root loader fails with Permission denied before any BPF maps fill — the dashboard Kernel I/O section stays empty.

Relax only what node-probe needs at boot:

  • Repo unit: scripts/tracefs-perms.service — enables 755 on tracing and events, then chmod -R a+rX on events/syscalls and events/sock (for inet_sock_set_state).

Install and enable on the host:

sudo cp /path/to/webserver/scripts/tracefs-perms.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable tracefs-perms.service
sudo systemctl restart tracefs-perms.service # apply now without reboot
sudo systemctl restart node-probe

If Kernel I/O never moves after deploy, check journalctl -u node-probe for loader Permission denied on paths under /sys/kernel/tracing/events/.

What the UI uses:Path prefix / recent paths read the userspace string from the sys_enter_openat tracepoint (other traced syscalls do not embed a path in the ring buffer). Read/write latency and VFS MB totals come from kprobes on vfs_read / vfs_write (kernel VFS), which is not a 1:1 match with read/write syscall counts. TCP state chips use inet_sock_set_state. The loader round-robins the syscall, latency, and net ring buffers so one hot source (e.g. millions of write syscalls) does not starve the others.

Mix Release

make release
# Release tarball: _build/prod/node_probe-0.1.0.tar.gz# Extract to /opt/node-probe and run: bin/node_probe start

The release is self-contained — no Elixir/Erlang runtime required on the target.

Systemd

A unit file is provided at priv/systemd/node-probe.service:

sudo cp priv/systemd/node-probe.service /etc/systemd/system/
# Edit /etc/systemd/system/node-probe.service — set SECRET_KEY_BASE, paths, etc.
sudo systemctl daemon-reload
sudo systemctl enable --now node-probe
sudo journalctl -fu node-probe # tail logs

Testing

mix test# full Elixir test suite
mix test --cover # with coverage report
mix test --stale # only tests affected by recent changescd priv/ebpf && cargo test --lib --package node-probe-ebpf
cd priv/ebpf && cargo test --package node-probe-loader

Coverage target: >80% line coverage on all Elixir modules.


Contributing

  1. Fork and create a feature branch from main.
  2. Follow TDD — write tests alongside every module.
  3. Run mix precommit before pushing (compile with warnings-as-errors, format, test).
  4. Open a pull request. Keep commits bisectable — one logical change per commit.

License

node-probe is free software, licensed under the GNU General Public License v3.0 or later. See the LICENSE file (to be added) or https://www.gnu.org/licenses/gpl-3.0.html.

About

Bitcoin node observatory: eBPF kernel tracing + Bitcoin RPC/P2P + Phoenix LiveView dashboard

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { // Add copy buttons to all
 blocks
(function() {
function addCopyButtons() {
document.querySelectorAll('pre code').forEach(function(codeBlock) {
if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;
codeBlock.parentElement.setAttribute('data-copy-added', 'true');
var btn = document.createElement('button');
btn.textContent = 'Copy';
btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';
btn.onmouseover = function() { this.style.opacity = '1'; };
btn.onmouseout = function() { this.style.opacity = '0.7'; };
btn.onclick = function() {
navigator.clipboard.writeText(codeBlock.textContent).then(function() {
btn.textContent = 'Copied!';
setTimeout(function() { btn.textContent = 'Copy'; }, 1500);
});
};
codeBlock.parentElement.style.position = 'relative';
codeBlock.parentElement.appendChild(btn);
});
}
addCopyButtons();
// Re-run on dynamic content
var observer = new MutationObserver(addCopyButtons);
observer.observe(document.body, { childList: true, subtree: true });
})();
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
GitHub - 151henry151/node-probe: Bitcoin node observatory: eBPF kernel tracing + Bitcoin RPC/P2P + Phoenix LiveView dashboard · GitHub
Skip to content

Repository files navigation

node-probe

License: GPL v3Version

A Bitcoin node observatory that combines eBPF kernel-level behavioral tracing of bitcoind with Bitcoin RPC/P2P semantic data, streamed live to a Phoenix LiveView dashboard.

Your node, from two simultaneous angles: what the kernel sees (raw behavioral truth) and what Bitcoin sees (semantic meaning).


Architecture

 ┌─────────────────────────────────────────────┐
│ bitcoind │
└──────┬──────────────────────┬───────────────┘
│ kernel events │ JSON-RPC
┌────────────────▼──────────┐ ┌───────▼───────────────┐
│ node-probe-loader │ │ RpcCollector │
│ (Rust/Aya eBPF) │ │ (GenServer) │
│ syscall | latency │ │ getblockchaininfo │
│ net | cpu sample │ │ getpeerinfo │
└────────────────┬──────────┘ │ getmempoolinfo │
│ JSON stdout └───────┬───────────────┘
┌────────────────▼──────────┐ │
│ EbpfCollector │ │
│ (GenServer + Port) │ │
└────────────────┬──────────┘ │
│ decode JSON │
└──────────► Metrics.ingest_ebpf / ETS (syscall/latency paths)
│
PubSub "rpc:events"
│
┌───────────────────────────────▼────────┐
│ Aggregator │
│ forwards RPC → dashboard PubSub │
│ mempool history / block arrivals │
└──────────────────┬──────────────────┘
│ PubSub "node_probe:events"
┌────────────────────────────┼────────────────────────────┐
│ │ │ │ │
┌────▼───┐ ┌─────▼──┐ ┌───────▼──┐ ┌───────▼──┐ ┌───────▼──┐
│ Pulse │ │ Block │ │ Peers │ │ Mempool │ │ I/O │
│ Live │ │ Live │ │ Live │ │ Live │ │ Live │
└────────┘ └────────┘ └──────────┘ └──────────┘ └──────────┘
Browser (LiveView)

Prerequisites

RequirementVersionNotes
Linux kernel>= 5.8eBPF ring buffer, bpf_get_stackid
Elixir>= 1.15OTP 26+
RustnightlyFor eBPF kernel programs (aya-ebpf, no_std)
bpf-linkerlatestcargo install bpf-linker
bitcoindanyMust be running on the same host
CapabilitiesCAP_BPF, CAP_PERFMONOr run loader as root

Quickstart

# 1. Clone and install Elixir deps
git clone https://github.com/151henry151/node-probe.git
cd node-probe
mix deps.get
# 2. Install Rust nightly + bpf-linker (one-time setup)
rustup toolchain install nightly --component rust-src
cargo install bpf-linker
# 3. Build eBPF programs and loader
make ebpf
# 4. Configure Bitcoin RPC connectionexport BITCOIN_RPC_URL=http://127.0.0.1:8332
export BITCOIN_COOKIE_PATH=~/.bitcoin/.cookie # or use user/pass:# export BITCOIN_RPC_USER=bitcoin# export BITCOIN_RPC_PASS=yourpassword# 5. Start the dashboard
mix phx.server
# Open http://localhost:4000

Dashboard

RouteDescription
/Single-page dashboard: overview (chain, mempool, eBPF, live pulse), latest block + fee histogram, mempool sparkline, peers table, kernel I/O, anomaly log
/block, /peers, /mempool, /io, /anomaliesHTTP redirects to / (bookmark-compatible)

Configuration Reference

All configuration is via environment variables at runtime.

VariableDefaultDescription
BITCOIN_RPC_URLhttp://127.0.0.1:8332Bitcoin Core JSON-RPC endpoint
BITCOIN_RPC_USERbitcoinRPC username (cookie auth preferred)
BITCOIN_RPC_PASS(empty)RPC password
BITCOIN_COOKIE_PATH~/.bitcoin/.cookiePath to .cookie file for cookie auth
EBPF_LOADER_PATH./priv/ebpf/target/release/node-probe-loaderPath to compiled eBPF loader binary
EBPF_ENABLEDtrueSet false to disable eBPF tracing entirely
P2P_TAP_ENABLEDfalseEnable raw P2P message tapping
RPC_POLL_MS2000RPC polling interval in milliseconds
LITE_MODEfalseSee Lite Mode below
PORT4000HTTP port for the Phoenix server
SECRET_KEY_BASE(dev only)Required in production — generate with mix phx.gen.secret

Lite Mode

Set LITE_MODE=true for Raspberry Pi or constrained hardware.

Disabled in lite mode:

  • CPU flame graph sampling — the 99Hz perf_event eBPF sampler is not loaded
  • P2P message tapping
  • High-frequency eBPF syscall tracing

The dashboard remains fully functional; you lose CPU profiling and fine-grained syscall data.

# Development
LITE_MODE=true mix phx.server
# Production release
make release-lite

Building

make all # build eBPF programs + compile Elixir
make ebpf # build only eBPF workspace (kernel programs + loader)
make ebpf-lite # build eBPF workspace in lite mode
make elixir # deps.get + compile
make test# run Rust unit tests + Elixir test suite
make release # MIX_ENV=prod mix release (creates tarball)
make release-lite # LITE_MODE=true production release
make clean # cargo clean + mix clean

Deployment

eBPF Capabilities

The loader binary needs kernel privileges. Grant capabilities instead of running as root:

sudo setcap cap_bpf,cap_perfmon+ep ./priv/ebpf/target/release/node-probe-loader

Or set AmbientCapabilities=CAP_BPF CAP_PERFMON in the systemd unit (see below).

When the loader is spawned as an Erlang Port, its stdout is a pipe. The loader flushes stdout after each NDJSON line so the Phoenix EbpfCollector receives events in real time — without that, lines can sit in a libc block buffer and the dashboard stays empty even while probes fire.

Tracefs permissions (syscall / sock tracepoints)

Attaching tracepoints reads metadata under /sys/kernel/tracing/events/ (for example …/syscalls/sys_enter_openat/id). On many kernels those directories and files are 0750 / 0640 (root:root), so a non-root loader fails with Permission denied before any BPF maps fill — the dashboard Kernel I/O section stays empty.

Relax only what node-probe needs at boot:

  • Repo unit: scripts/tracefs-perms.service — enables 755 on tracing and events, then chmod -R a+rX on events/syscalls and events/sock (for inet_sock_set_state).

Install and enable on the host:

sudo cp /path/to/webserver/scripts/tracefs-perms.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable tracefs-perms.service
sudo systemctl restart tracefs-perms.service # apply now without reboot
sudo systemctl restart node-probe

If Kernel I/O never moves after deploy, check journalctl -u node-probe for loader Permission denied on paths under /sys/kernel/tracing/events/.

What the UI uses:Path prefix / recent paths read the userspace string from the sys_enter_openat tracepoint (other traced syscalls do not embed a path in the ring buffer). Read/write latency and VFS MB totals come from kprobes on vfs_read / vfs_write (kernel VFS), which is not a 1:1 match with read/write syscall counts. TCP state chips use inet_sock_set_state. The loader round-robins the syscall, latency, and net ring buffers so one hot source (e.g. millions of write syscalls) does not starve the others.

Mix Release

make release
# Release tarball: _build/prod/node_probe-0.1.0.tar.gz# Extract to /opt/node-probe and run: bin/node_probe start

The release is self-contained — no Elixir/Erlang runtime required on the target.

Systemd

A unit file is provided at priv/systemd/node-probe.service:

sudo cp priv/systemd/node-probe.service /etc/systemd/system/
# Edit /etc/systemd/system/node-probe.service — set SECRET_KEY_BASE, paths, etc.
sudo systemctl daemon-reload
sudo systemctl enable --now node-probe
sudo journalctl -fu node-probe # tail logs

Testing

mix test# full Elixir test suite
mix test --cover # with coverage report
mix test --stale # only tests affected by recent changescd priv/ebpf && cargo test --lib --package node-probe-ebpf
cd priv/ebpf && cargo test --package node-probe-loader

Coverage target: >80% line coverage on all Elixir modules.


Contributing

  1. Fork and create a feature branch from main.
  2. Follow TDD — write tests alongside every module.
  3. Run mix precommit before pushing (compile with warnings-as-errors, format, test).
  4. Open a pull request. Keep commits bisectable — one logical change per commit.

License

node-probe is free software, licensed under the GNU General Public License v3.0 or later. See the LICENSE file (to be added) or https://www.gnu.org/licenses/gpl-3.0.html.

About

Bitcoin node observatory: eBPF kernel tracing + Bitcoin RPC/P2P + Phoenix LiveView dashboard

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { // Force GitHub README to respect dark mode (function() { var style = document.createElement('style'); style.textContent = ' .markdown-body { color-scheme: dark light; } .markdown-body pre { background: #161b22 !important; } .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; } .markdown-body table th, .markdown-body table td { border-color: #30363d !important; } .markdown-body img { background: #0d1117; } .markdown-body blockquote { border-left-color: #8b949e; } .markdown-body hr { border-color: #30363d; } '; document.head.appendChild(style); })(); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' GitHub - 151henry151/node-probe: Bitcoin node observatory: eBPF kernel tracing + Bitcoin RPC/P2P + Phoenix LiveView dashboard · GitHub
Skip to content

Repository files navigation

node-probe

License: GPL v3Version

A Bitcoin node observatory that combines eBPF kernel-level behavioral tracing of bitcoind with Bitcoin RPC/P2P semantic data, streamed live to a Phoenix LiveView dashboard.

Your node, from two simultaneous angles: what the kernel sees (raw behavioral truth) and what Bitcoin sees (semantic meaning).


Architecture

 ┌─────────────────────────────────────────────┐
│ bitcoind │
└──────┬──────────────────────┬───────────────┘
│ kernel events │ JSON-RPC
┌────────────────▼──────────┐ ┌───────▼───────────────┐
│ node-probe-loader │ │ RpcCollector │
│ (Rust/Aya eBPF) │ │ (GenServer) │
│ syscall | latency │ │ getblockchaininfo │
│ net | cpu sample │ │ getpeerinfo │
└────────────────┬──────────┘ │ getmempoolinfo │
│ JSON stdout └───────┬───────────────┘
┌────────────────▼──────────┐ │
│ EbpfCollector │ │
│ (GenServer + Port) │ │
└────────────────┬──────────┘ │
│ decode JSON │
└──────────► Metrics.ingest_ebpf / ETS (syscall/latency paths)
│
PubSub "rpc:events"
│
┌───────────────────────────────▼────────┐
│ Aggregator │
│ forwards RPC → dashboard PubSub │
│ mempool history / block arrivals │
└──────────────────┬──────────────────┘
│ PubSub "node_probe:events"
┌────────────────────────────┼────────────────────────────┐
│ │ │ │ │
┌────▼───┐ ┌─────▼──┐ ┌───────▼──┐ ┌───────▼──┐ ┌───────▼──┐
│ Pulse │ │ Block │ │ Peers │ │ Mempool │ │ I/O │
│ Live │ │ Live │ │ Live │ │ Live │ │ Live │
└────────┘ └────────┘ └──────────┘ └──────────┘ └──────────┘
Browser (LiveView)

Prerequisites

RequirementVersionNotes
Linux kernel>= 5.8eBPF ring buffer, bpf_get_stackid
Elixir>= 1.15OTP 26+
RustnightlyFor eBPF kernel programs (aya-ebpf, no_std)
bpf-linkerlatestcargo install bpf-linker
bitcoindanyMust be running on the same host
CapabilitiesCAP_BPF, CAP_PERFMONOr run loader as root

Quickstart

# 1. Clone and install Elixir deps
git clone https://github.com/151henry151/node-probe.git
cd node-probe
mix deps.get
# 2. Install Rust nightly + bpf-linker (one-time setup)
rustup toolchain install nightly --component rust-src
cargo install bpf-linker
# 3. Build eBPF programs and loader
make ebpf
# 4. Configure Bitcoin RPC connectionexport BITCOIN_RPC_URL=http://127.0.0.1:8332
export BITCOIN_COOKIE_PATH=~/.bitcoin/.cookie # or use user/pass:# export BITCOIN_RPC_USER=bitcoin# export BITCOIN_RPC_PASS=yourpassword# 5. Start the dashboard
mix phx.server
# Open http://localhost:4000

Dashboard

RouteDescription
/Single-page dashboard: overview (chain, mempool, eBPF, live pulse), latest block + fee histogram, mempool sparkline, peers table, kernel I/O, anomaly log
/block, /peers, /mempool, /io, /anomaliesHTTP redirects to / (bookmark-compatible)

Configuration Reference

All configuration is via environment variables at runtime.

VariableDefaultDescription
BITCOIN_RPC_URLhttp://127.0.0.1:8332Bitcoin Core JSON-RPC endpoint
BITCOIN_RPC_USERbitcoinRPC username (cookie auth preferred)
BITCOIN_RPC_PASS(empty)RPC password
BITCOIN_COOKIE_PATH~/.bitcoin/.cookiePath to .cookie file for cookie auth
EBPF_LOADER_PATH./priv/ebpf/target/release/node-probe-loaderPath to compiled eBPF loader binary
EBPF_ENABLEDtrueSet false to disable eBPF tracing entirely
P2P_TAP_ENABLEDfalseEnable raw P2P message tapping
RPC_POLL_MS2000RPC polling interval in milliseconds
LITE_MODEfalseSee Lite Mode below
PORT4000HTTP port for the Phoenix server
SECRET_KEY_BASE(dev only)Required in production — generate with mix phx.gen.secret

Lite Mode

Set LITE_MODE=true for Raspberry Pi or constrained hardware.

Disabled in lite mode:

  • CPU flame graph sampling — the 99Hz perf_event eBPF sampler is not loaded
  • P2P message tapping
  • High-frequency eBPF syscall tracing

The dashboard remains fully functional; you lose CPU profiling and fine-grained syscall data.

# Development
LITE_MODE=true mix phx.server
# Production release
make release-lite

Building

make all # build eBPF programs + compile Elixir
make ebpf # build only eBPF workspace (kernel programs + loader)
make ebpf-lite # build eBPF workspace in lite mode
make elixir # deps.get + compile
make test# run Rust unit tests + Elixir test suite
make release # MIX_ENV=prod mix release (creates tarball)
make release-lite # LITE_MODE=true production release
make clean # cargo clean + mix clean

Deployment

eBPF Capabilities

The loader binary needs kernel privileges. Grant capabilities instead of running as root:

sudo setcap cap_bpf,cap_perfmon+ep ./priv/ebpf/target/release/node-probe-loader

Or set AmbientCapabilities=CAP_BPF CAP_PERFMON in the systemd unit (see below).

When the loader is spawned as an Erlang Port, its stdout is a pipe. The loader flushes stdout after each NDJSON line so the Phoenix EbpfCollector receives events in real time — without that, lines can sit in a libc block buffer and the dashboard stays empty even while probes fire.

Tracefs permissions (syscall / sock tracepoints)

Attaching tracepoints reads metadata under /sys/kernel/tracing/events/ (for example …/syscalls/sys_enter_openat/id). On many kernels those directories and files are 0750 / 0640 (root:root), so a non-root loader fails with Permission denied before any BPF maps fill — the dashboard Kernel I/O section stays empty.

Relax only what node-probe needs at boot:

  • Repo unit: scripts/tracefs-perms.service — enables 755 on tracing and events, then chmod -R a+rX on events/syscalls and events/sock (for inet_sock_set_state).

Install and enable on the host:

sudo cp /path/to/webserver/scripts/tracefs-perms.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable tracefs-perms.service
sudo systemctl restart tracefs-perms.service # apply now without reboot
sudo systemctl restart node-probe

If Kernel I/O never moves after deploy, check journalctl -u node-probe for loader Permission denied on paths under /sys/kernel/tracing/events/.

What the UI uses:Path prefix / recent paths read the userspace string from the sys_enter_openat tracepoint (other traced syscalls do not embed a path in the ring buffer). Read/write latency and VFS MB totals come from kprobes on vfs_read / vfs_write (kernel VFS), which is not a 1:1 match with read/write syscall counts. TCP state chips use inet_sock_set_state. The loader round-robins the syscall, latency, and net ring buffers so one hot source (e.g. millions of write syscalls) does not starve the others.

Mix Release

make release
# Release tarball: _build/prod/node_probe-0.1.0.tar.gz# Extract to /opt/node-probe and run: bin/node_probe start

The release is self-contained — no Elixir/Erlang runtime required on the target.

Systemd

A unit file is provided at priv/systemd/node-probe.service:

sudo cp priv/systemd/node-probe.service /etc/systemd/system/
# Edit /etc/systemd/system/node-probe.service — set SECRET_KEY_BASE, paths, etc.
sudo systemctl daemon-reload
sudo systemctl enable --now node-probe
sudo journalctl -fu node-probe # tail logs

Testing

mix test# full Elixir test suite
mix test --cover # with coverage report
mix test --stale # only tests affected by recent changescd priv/ebpf && cargo test --lib --package node-probe-ebpf
cd priv/ebpf && cargo test --package node-probe-loader

Coverage target: >80% line coverage on all Elixir modules.


Contributing

  1. Fork and create a feature branch from main.
  2. Follow TDD — write tests alongside every module.
  3. Run mix precommit before pushing (compile with warnings-as-errors, format, test).
  4. Open a pull request. Keep commits bisectable — one logical change per commit.

License

node-probe is free software, licensed under the GNU General Public License v3.0 or later. See the LICENSE file (to be added) or https://www.gnu.org/licenses/gpl-3.0.html.

About

Bitcoin node observatory: eBPF kernel tracing + Bitcoin RPC/P2P + Phoenix LiveView dashboard

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { // Highlight search terms from Google/DuckDuckGo/Bing referrer (function() { var ref = document.referrer; var terms = []; if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) { var url = new URL(ref); var q = url.searchParams.get('q') || url.searchParams.get('p'); if (q) { terms = q.split(/\s+/).filter(function(t) { return t.length > 2; }); } } if (terms.length === 0) return; var style = document.createElement('style'); style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }'; document.head.appendChild(style); function highlight(node) { if (node.nodeType === 3) { // text node var text = node.textContent; var found = false; terms.forEach(function(term) { var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\]\\]/g, '\\') + ')', 'gi'); if (regex.test(text)) { found = true; var frag = document.createDocumentFragment(); var parts = text.split(regex); parts.forEach(function(part, i) { if (i % 2 === 0) { frag.appendChild(document.createTextNode(part)); } else { var span = document.createElement('span'); span.className = 'userscript-highlight'; span.textContent = part; frag.appendChild(span); } }); node.parentNode.replaceChild(frag, node); } }); } else if (node.nodeType === 1 && node.childNodes) { // element var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT']; if (!skipTags.includes(node.tagName)) { Array.from(node.childNodes).forEach(highlight); } } } highlight(document.body); // Re-highlight on dynamic content var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1 || node.nodeType === 3) highlight(node); }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' GitHub - 151henry151/node-probe: Bitcoin node observatory: eBPF kernel tracing + Bitcoin RPC/P2P + Phoenix LiveView dashboard · GitHub
Skip to content

Repository files navigation

node-probe

License: GPL v3Version

A Bitcoin node observatory that combines eBPF kernel-level behavioral tracing of bitcoind with Bitcoin RPC/P2P semantic data, streamed live to a Phoenix LiveView dashboard.

Your node, from two simultaneous angles: what the kernel sees (raw behavioral truth) and what Bitcoin sees (semantic meaning).


Architecture

 ┌─────────────────────────────────────────────┐
│ bitcoind │
└──────┬──────────────────────┬───────────────┘
│ kernel events │ JSON-RPC
┌────────────────▼──────────┐ ┌───────▼───────────────┐
│ node-probe-loader │ │ RpcCollector │
│ (Rust/Aya eBPF) │ │ (GenServer) │
│ syscall | latency │ │ getblockchaininfo │
│ net | cpu sample │ │ getpeerinfo │
└────────────────┬──────────┘ │ getmempoolinfo │
│ JSON stdout └───────┬───────────────┘
┌────────────────▼──────────┐ │
│ EbpfCollector │ │
│ (GenServer + Port) │ │
└────────────────┬──────────┘ │
│ decode JSON │
└──────────► Metrics.ingest_ebpf / ETS (syscall/latency paths)
│
PubSub "rpc:events"
│
┌───────────────────────────────▼────────┐
│ Aggregator │
│ forwards RPC → dashboard PubSub │
│ mempool history / block arrivals │
└──────────────────┬──────────────────┘
│ PubSub "node_probe:events"
┌────────────────────────────┼────────────────────────────┐
│ │ │ │ │
┌────▼───┐ ┌─────▼──┐ ┌───────▼──┐ ┌───────▼──┐ ┌───────▼──┐
│ Pulse │ │ Block │ │ Peers │ │ Mempool │ │ I/O │
│ Live │ │ Live │ │ Live │ │ Live │ │ Live │
└────────┘ └────────┘ └──────────┘ └──────────┘ └──────────┘
Browser (LiveView)

Prerequisites

RequirementVersionNotes
Linux kernel>= 5.8eBPF ring buffer, bpf_get_stackid
Elixir>= 1.15OTP 26+
RustnightlyFor eBPF kernel programs (aya-ebpf, no_std)
bpf-linkerlatestcargo install bpf-linker
bitcoindanyMust be running on the same host
CapabilitiesCAP_BPF, CAP_PERFMONOr run loader as root

Quickstart

# 1. Clone and install Elixir deps
git clone https://github.com/151henry151/node-probe.git
cd node-probe
mix deps.get
# 2. Install Rust nightly + bpf-linker (one-time setup)
rustup toolchain install nightly --component rust-src
cargo install bpf-linker
# 3. Build eBPF programs and loader
make ebpf
# 4. Configure Bitcoin RPC connectionexport BITCOIN_RPC_URL=http://127.0.0.1:8332
export BITCOIN_COOKIE_PATH=~/.bitcoin/.cookie # or use user/pass:# export BITCOIN_RPC_USER=bitcoin# export BITCOIN_RPC_PASS=yourpassword# 5. Start the dashboard
mix phx.server
# Open http://localhost:4000

Dashboard

RouteDescription
/Single-page dashboard: overview (chain, mempool, eBPF, live pulse), latest block + fee histogram, mempool sparkline, peers table, kernel I/O, anomaly log
/block, /peers, /mempool, /io, /anomaliesHTTP redirects to / (bookmark-compatible)

Configuration Reference

All configuration is via environment variables at runtime.

VariableDefaultDescription
BITCOIN_RPC_URLhttp://127.0.0.1:8332Bitcoin Core JSON-RPC endpoint
BITCOIN_RPC_USERbitcoinRPC username (cookie auth preferred)
BITCOIN_RPC_PASS(empty)RPC password
BITCOIN_COOKIE_PATH~/.bitcoin/.cookiePath to .cookie file for cookie auth
EBPF_LOADER_PATH./priv/ebpf/target/release/node-probe-loaderPath to compiled eBPF loader binary
EBPF_ENABLEDtrueSet false to disable eBPF tracing entirely
P2P_TAP_ENABLEDfalseEnable raw P2P message tapping
RPC_POLL_MS2000RPC polling interval in milliseconds
LITE_MODEfalseSee Lite Mode below
PORT4000HTTP port for the Phoenix server
SECRET_KEY_BASE(dev only)Required in production — generate with mix phx.gen.secret

Lite Mode

Set LITE_MODE=true for Raspberry Pi or constrained hardware.

Disabled in lite mode:

  • CPU flame graph sampling — the 99Hz perf_event eBPF sampler is not loaded
  • P2P message tapping
  • High-frequency eBPF syscall tracing

The dashboard remains fully functional; you lose CPU profiling and fine-grained syscall data.

# Development
LITE_MODE=true mix phx.server
# Production release
make release-lite

Building

make all # build eBPF programs + compile Elixir
make ebpf # build only eBPF workspace (kernel programs + loader)
make ebpf-lite # build eBPF workspace in lite mode
make elixir # deps.get + compile
make test# run Rust unit tests + Elixir test suite
make release # MIX_ENV=prod mix release (creates tarball)
make release-lite # LITE_MODE=true production release
make clean # cargo clean + mix clean

Deployment

eBPF Capabilities

The loader binary needs kernel privileges. Grant capabilities instead of running as root:

sudo setcap cap_bpf,cap_perfmon+ep ./priv/ebpf/target/release/node-probe-loader

Or set AmbientCapabilities=CAP_BPF CAP_PERFMON in the systemd unit (see below).

When the loader is spawned as an Erlang Port, its stdout is a pipe. The loader flushes stdout after each NDJSON line so the Phoenix EbpfCollector receives events in real time — without that, lines can sit in a libc block buffer and the dashboard stays empty even while probes fire.

Tracefs permissions (syscall / sock tracepoints)

Attaching tracepoints reads metadata under /sys/kernel/tracing/events/ (for example …/syscalls/sys_enter_openat/id). On many kernels those directories and files are 0750 / 0640 (root:root), so a non-root loader fails with Permission denied before any BPF maps fill — the dashboard Kernel I/O section stays empty.

Relax only what node-probe needs at boot:

  • Repo unit: scripts/tracefs-perms.service — enables 755 on tracing and events, then chmod -R a+rX on events/syscalls and events/sock (for inet_sock_set_state).

Install and enable on the host:

sudo cp /path/to/webserver/scripts/tracefs-perms.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable tracefs-perms.service
sudo systemctl restart tracefs-perms.service # apply now without reboot
sudo systemctl restart node-probe

If Kernel I/O never moves after deploy, check journalctl -u node-probe for loader Permission denied on paths under /sys/kernel/tracing/events/.

What the UI uses:Path prefix / recent paths read the userspace string from the sys_enter_openat tracepoint (other traced syscalls do not embed a path in the ring buffer). Read/write latency and VFS MB totals come from kprobes on vfs_read / vfs_write (kernel VFS), which is not a 1:1 match with read/write syscall counts. TCP state chips use inet_sock_set_state. The loader round-robins the syscall, latency, and net ring buffers so one hot source (e.g. millions of write syscalls) does not starve the others.

Mix Release

make release
# Release tarball: _build/prod/node_probe-0.1.0.tar.gz# Extract to /opt/node-probe and run: bin/node_probe start

The release is self-contained — no Elixir/Erlang runtime required on the target.

Systemd

A unit file is provided at priv/systemd/node-probe.service:

sudo cp priv/systemd/node-probe.service /etc/systemd/system/
# Edit /etc/systemd/system/node-probe.service — set SECRET_KEY_BASE, paths, etc.
sudo systemctl daemon-reload
sudo systemctl enable --now node-probe
sudo journalctl -fu node-probe # tail logs

Testing

mix test# full Elixir test suite
mix test --cover # with coverage report
mix test --stale # only tests affected by recent changescd priv/ebpf && cargo test --lib --package node-probe-ebpf
cd priv/ebpf && cargo test --package node-probe-loader

Coverage target: >80% line coverage on all Elixir modules.


Contributing

  1. Fork and create a feature branch from main.
  2. Follow TDD — write tests alongside every module.
  3. Run mix precommit before pushing (compile with warnings-as-errors, format, test).
  4. Open a pull request. Keep commits bisectable — one logical change per commit.

License

node-probe is free software, licensed under the GNU General Public License v3.0 or later. See the LICENSE file (to be added) or https://www.gnu.org/licenses/gpl-3.0.html.

About

Bitcoin node observatory: eBPF kernel tracing + Bitcoin RPC/P2P + Phoenix LiveView dashboard

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { // Strip utm_, fbclid, gclid, etc. from all links on page (function() { var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content', 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid', 'ref', 'ref_src', 'source', 'medium', 'campaign']; function cleanUrl(url) { try { var u = new URL(url, window.location.origin); var changed = false; trackingParams.forEach(function(p) { if (u.searchParams.has(p)) { u.searchParams.delete(p); changed = true; } }); return changed ? u.toString() : url; } catch (e) { return url; } } function cleanLinks() { document.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } cleanLinks(); var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1) { if (node.tagName === 'A') cleanLinks(); node.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + ' GitHub - 151henry151/node-probe: Bitcoin node observatory: eBPF kernel tracing + Bitcoin RPC/P2P + Phoenix LiveView dashboard · GitHub
Skip to content

Repository files navigation

node-probe

License: GPL v3Version

A Bitcoin node observatory that combines eBPF kernel-level behavioral tracing of bitcoind with Bitcoin RPC/P2P semantic data, streamed live to a Phoenix LiveView dashboard.

Your node, from two simultaneous angles: what the kernel sees (raw behavioral truth) and what Bitcoin sees (semantic meaning).


Architecture

 ┌─────────────────────────────────────────────┐
│ bitcoind │
└──────┬──────────────────────┬───────────────┘
│ kernel events │ JSON-RPC
┌────────────────▼──────────┐ ┌───────▼───────────────┐
│ node-probe-loader │ │ RpcCollector │
│ (Rust/Aya eBPF) │ │ (GenServer) │
│ syscall | latency │ │ getblockchaininfo │
│ net | cpu sample │ │ getpeerinfo │
└────────────────┬──────────┘ │ getmempoolinfo │
│ JSON stdout └───────┬───────────────┘
┌────────────────▼──────────┐ │
│ EbpfCollector │ │
│ (GenServer + Port) │ │
└────────────────┬──────────┘ │
│ decode JSON │
└──────────► Metrics.ingest_ebpf / ETS (syscall/latency paths)
│
PubSub "rpc:events"
│
┌───────────────────────────────▼────────┐
│ Aggregator │
│ forwards RPC → dashboard PubSub │
│ mempool history / block arrivals │
└──────────────────┬──────────────────┘
│ PubSub "node_probe:events"
┌────────────────────────────┼────────────────────────────┐
│ │ │ │ │
┌────▼───┐ ┌─────▼──┐ ┌───────▼──┐ ┌───────▼──┐ ┌───────▼──┐
│ Pulse │ │ Block │ │ Peers │ │ Mempool │ │ I/O │
│ Live │ │ Live │ │ Live │ │ Live │ │ Live │
└────────┘ └────────┘ └──────────┘ └──────────┘ └──────────┘
Browser (LiveView)

Prerequisites

RequirementVersionNotes
Linux kernel>= 5.8eBPF ring buffer, bpf_get_stackid
Elixir>= 1.15OTP 26+
RustnightlyFor eBPF kernel programs (aya-ebpf, no_std)
bpf-linkerlatestcargo install bpf-linker
bitcoindanyMust be running on the same host
CapabilitiesCAP_BPF, CAP_PERFMONOr run loader as root

Quickstart

# 1. Clone and install Elixir deps
git clone https://github.com/151henry151/node-probe.git
cd node-probe
mix deps.get
# 2. Install Rust nightly + bpf-linker (one-time setup)
rustup toolchain install nightly --component rust-src
cargo install bpf-linker
# 3. Build eBPF programs and loader
make ebpf
# 4. Configure Bitcoin RPC connectionexport BITCOIN_RPC_URL=http://127.0.0.1:8332
export BITCOIN_COOKIE_PATH=~/.bitcoin/.cookie # or use user/pass:# export BITCOIN_RPC_USER=bitcoin# export BITCOIN_RPC_PASS=yourpassword# 5. Start the dashboard
mix phx.server
# Open http://localhost:4000

Dashboard

RouteDescription
/Single-page dashboard: overview (chain, mempool, eBPF, live pulse), latest block + fee histogram, mempool sparkline, peers table, kernel I/O, anomaly log
/block, /peers, /mempool, /io, /anomaliesHTTP redirects to / (bookmark-compatible)

Configuration Reference

All configuration is via environment variables at runtime.

VariableDefaultDescription
BITCOIN_RPC_URLhttp://127.0.0.1:8332Bitcoin Core JSON-RPC endpoint
BITCOIN_RPC_USERbitcoinRPC username (cookie auth preferred)
BITCOIN_RPC_PASS(empty)RPC password
BITCOIN_COOKIE_PATH~/.bitcoin/.cookiePath to .cookie file for cookie auth
EBPF_LOADER_PATH./priv/ebpf/target/release/node-probe-loaderPath to compiled eBPF loader binary
EBPF_ENABLEDtrueSet false to disable eBPF tracing entirely
P2P_TAP_ENABLEDfalseEnable raw P2P message tapping
RPC_POLL_MS2000RPC polling interval in milliseconds
LITE_MODEfalseSee Lite Mode below
PORT4000HTTP port for the Phoenix server
SECRET_KEY_BASE(dev only)Required in production — generate with mix phx.gen.secret

Lite Mode

Set LITE_MODE=true for Raspberry Pi or constrained hardware.

Disabled in lite mode:

  • CPU flame graph sampling — the 99Hz perf_event eBPF sampler is not loaded
  • P2P message tapping
  • High-frequency eBPF syscall tracing

The dashboard remains fully functional; you lose CPU profiling and fine-grained syscall data.

# Development
LITE_MODE=true mix phx.server
# Production release
make release-lite

Building

make all # build eBPF programs + compile Elixir
make ebpf # build only eBPF workspace (kernel programs + loader)
make ebpf-lite # build eBPF workspace in lite mode
make elixir # deps.get + compile
make test# run Rust unit tests + Elixir test suite
make release # MIX_ENV=prod mix release (creates tarball)
make release-lite # LITE_MODE=true production release
make clean # cargo clean + mix clean

Deployment

eBPF Capabilities

The loader binary needs kernel privileges. Grant capabilities instead of running as root:

sudo setcap cap_bpf,cap_perfmon+ep ./priv/ebpf/target/release/node-probe-loader

Or set AmbientCapabilities=CAP_BPF CAP_PERFMON in the systemd unit (see below).

When the loader is spawned as an Erlang Port, its stdout is a pipe. The loader flushes stdout after each NDJSON line so the Phoenix EbpfCollector receives events in real time — without that, lines can sit in a libc block buffer and the dashboard stays empty even while probes fire.

Tracefs permissions (syscall / sock tracepoints)

Attaching tracepoints reads metadata under /sys/kernel/tracing/events/ (for example …/syscalls/sys_enter_openat/id). On many kernels those directories and files are 0750 / 0640 (root:root), so a non-root loader fails with Permission denied before any BPF maps fill — the dashboard Kernel I/O section stays empty.

Relax only what node-probe needs at boot:

  • Repo unit: scripts/tracefs-perms.service — enables 755 on tracing and events, then chmod -R a+rX on events/syscalls and events/sock (for inet_sock_set_state).

Install and enable on the host:

sudo cp /path/to/webserver/scripts/tracefs-perms.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable tracefs-perms.service
sudo systemctl restart tracefs-perms.service # apply now without reboot
sudo systemctl restart node-probe

If Kernel I/O never moves after deploy, check journalctl -u node-probe for loader Permission denied on paths under /sys/kernel/tracing/events/.

What the UI uses:Path prefix / recent paths read the userspace string from the sys_enter_openat tracepoint (other traced syscalls do not embed a path in the ring buffer). Read/write latency and VFS MB totals come from kprobes on vfs_read / vfs_write (kernel VFS), which is not a 1:1 match with read/write syscall counts. TCP state chips use inet_sock_set_state. The loader round-robins the syscall, latency, and net ring buffers so one hot source (e.g. millions of write syscalls) does not starve the others.

Mix Release

make release
# Release tarball: _build/prod/node_probe-0.1.0.tar.gz# Extract to /opt/node-probe and run: bin/node_probe start

The release is self-contained — no Elixir/Erlang runtime required on the target.

Systemd

A unit file is provided at priv/systemd/node-probe.service:

sudo cp priv/systemd/node-probe.service /etc/systemd/system/
# Edit /etc/systemd/system/node-probe.service — set SECRET_KEY_BASE, paths, etc.
sudo systemctl daemon-reload
sudo systemctl enable --now node-probe
sudo journalctl -fu node-probe # tail logs

Testing

mix test# full Elixir test suite
mix test --cover # with coverage report
mix test --stale # only tests affected by recent changescd priv/ebpf && cargo test --lib --package node-probe-ebpf
cd priv/ebpf && cargo test --package node-probe-loader

Coverage target: >80% line coverage on all Elixir modules.


Contributing

  1. Fork and create a feature branch from main.
  2. Follow TDD — write tests alongside every module.
  3. Run mix precommit before pushing (compile with warnings-as-errors, format, test).
  4. Open a pull request. Keep commits bisectable — one logical change per commit.

License

node-probe is free software, licensed under the GNU General Public License v3.0 or later. See the LICENSE file (to be added) or https://www.gnu.org/licenses/gpl-3.0.html.

About

Bitcoin node observatory: eBPF kernel tracing + Bitcoin RPC/P2P + Phoenix LiveView dashboard

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { // Auto-enable theater mode on YouTube (function() { function tryTheater() { var btn = document.querySelector('button[aria-label="Theater mode"], ytd-player #player button[title="Theater mode"]'); if (btn && !btn.classList.contains('activated')) { btn.click(); } } // Try immediately tryTheater(); // Try after navigation (SPA) var lastUrl = location.href; setInterval(function() { if (location.href !== lastUrl) { lastUrl = location.href; setTimeout(tryTheater, 500); } }, 1000); // Also try on player load var observer = new MutationObserver(tryTheater); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' GitHub - 151henry151/node-probe: Bitcoin node observatory: eBPF kernel tracing + Bitcoin RPC/P2P + Phoenix LiveView dashboard · GitHub
Skip to content

Repository files navigation

node-probe

License: GPL v3Version

A Bitcoin node observatory that combines eBPF kernel-level behavioral tracing of bitcoind with Bitcoin RPC/P2P semantic data, streamed live to a Phoenix LiveView dashboard.

Your node, from two simultaneous angles: what the kernel sees (raw behavioral truth) and what Bitcoin sees (semantic meaning).


Architecture

 ┌─────────────────────────────────────────────┐
│ bitcoind │
└──────┬──────────────────────┬───────────────┘
│ kernel events │ JSON-RPC
┌────────────────▼──────────┐ ┌───────▼───────────────┐
│ node-probe-loader │ │ RpcCollector │
│ (Rust/Aya eBPF) │ │ (GenServer) │
│ syscall | latency │ │ getblockchaininfo │
│ net | cpu sample │ │ getpeerinfo │
└────────────────┬──────────┘ │ getmempoolinfo │
│ JSON stdout └───────┬───────────────┘
┌────────────────▼──────────┐ │
│ EbpfCollector │ │
│ (GenServer + Port) │ │
└────────────────┬──────────┘ │
│ decode JSON │
└──────────► Metrics.ingest_ebpf / ETS (syscall/latency paths)
│
PubSub "rpc:events"
│
┌───────────────────────────────▼────────┐
│ Aggregator │
│ forwards RPC → dashboard PubSub │
│ mempool history / block arrivals │
└──────────────────┬──────────────────┘
│ PubSub "node_probe:events"
┌────────────────────────────┼────────────────────────────┐
│ │ │ │ │
┌────▼───┐ ┌─────▼──┐ ┌───────▼──┐ ┌───────▼──┐ ┌───────▼──┐
│ Pulse │ │ Block │ │ Peers │ │ Mempool │ │ I/O │
│ Live │ │ Live │ │ Live │ │ Live │ │ Live │
└────────┘ └────────┘ └──────────┘ └──────────┘ └──────────┘
Browser (LiveView)

Prerequisites

RequirementVersionNotes
Linux kernel>= 5.8eBPF ring buffer, bpf_get_stackid
Elixir>= 1.15OTP 26+
RustnightlyFor eBPF kernel programs (aya-ebpf, no_std)
bpf-linkerlatestcargo install bpf-linker
bitcoindanyMust be running on the same host
CapabilitiesCAP_BPF, CAP_PERFMONOr run loader as root

Quickstart

# 1. Clone and install Elixir deps
git clone https://github.com/151henry151/node-probe.git
cd node-probe
mix deps.get
# 2. Install Rust nightly + bpf-linker (one-time setup)
rustup toolchain install nightly --component rust-src
cargo install bpf-linker
# 3. Build eBPF programs and loader
make ebpf
# 4. Configure Bitcoin RPC connectionexport BITCOIN_RPC_URL=http://127.0.0.1:8332
export BITCOIN_COOKIE_PATH=~/.bitcoin/.cookie # or use user/pass:# export BITCOIN_RPC_USER=bitcoin# export BITCOIN_RPC_PASS=yourpassword# 5. Start the dashboard
mix phx.server
# Open http://localhost:4000

Dashboard

RouteDescription
/Single-page dashboard: overview (chain, mempool, eBPF, live pulse), latest block + fee histogram, mempool sparkline, peers table, kernel I/O, anomaly log
/block, /peers, /mempool, /io, /anomaliesHTTP redirects to / (bookmark-compatible)

Configuration Reference

All configuration is via environment variables at runtime.

VariableDefaultDescription
BITCOIN_RPC_URLhttp://127.0.0.1:8332Bitcoin Core JSON-RPC endpoint
BITCOIN_RPC_USERbitcoinRPC username (cookie auth preferred)
BITCOIN_RPC_PASS(empty)RPC password
BITCOIN_COOKIE_PATH~/.bitcoin/.cookiePath to .cookie file for cookie auth
EBPF_LOADER_PATH./priv/ebpf/target/release/node-probe-loaderPath to compiled eBPF loader binary
EBPF_ENABLEDtrueSet false to disable eBPF tracing entirely
P2P_TAP_ENABLEDfalseEnable raw P2P message tapping
RPC_POLL_MS2000RPC polling interval in milliseconds
LITE_MODEfalseSee Lite Mode below
PORT4000HTTP port for the Phoenix server
SECRET_KEY_BASE(dev only)Required in production — generate with mix phx.gen.secret

Lite Mode

Set LITE_MODE=true for Raspberry Pi or constrained hardware.

Disabled in lite mode:

  • CPU flame graph sampling — the 99Hz perf_event eBPF sampler is not loaded
  • P2P message tapping
  • High-frequency eBPF syscall tracing

The dashboard remains fully functional; you lose CPU profiling and fine-grained syscall data.

# Development
LITE_MODE=true mix phx.server
# Production release
make release-lite

Building

make all # build eBPF programs + compile Elixir
make ebpf # build only eBPF workspace (kernel programs + loader)
make ebpf-lite # build eBPF workspace in lite mode
make elixir # deps.get + compile
make test# run Rust unit tests + Elixir test suite
make release # MIX_ENV=prod mix release (creates tarball)
make release-lite # LITE_MODE=true production release
make clean # cargo clean + mix clean

Deployment

eBPF Capabilities

The loader binary needs kernel privileges. Grant capabilities instead of running as root:

sudo setcap cap_bpf,cap_perfmon+ep ./priv/ebpf/target/release/node-probe-loader

Or set AmbientCapabilities=CAP_BPF CAP_PERFMON in the systemd unit (see below).

When the loader is spawned as an Erlang Port, its stdout is a pipe. The loader flushes stdout after each NDJSON line so the Phoenix EbpfCollector receives events in real time — without that, lines can sit in a libc block buffer and the dashboard stays empty even while probes fire.

Tracefs permissions (syscall / sock tracepoints)

Attaching tracepoints reads metadata under /sys/kernel/tracing/events/ (for example …/syscalls/sys_enter_openat/id). On many kernels those directories and files are 0750 / 0640 (root:root), so a non-root loader fails with Permission denied before any BPF maps fill — the dashboard Kernel I/O section stays empty.

Relax only what node-probe needs at boot:

  • Repo unit: scripts/tracefs-perms.service — enables 755 on tracing and events, then chmod -R a+rX on events/syscalls and events/sock (for inet_sock_set_state).

Install and enable on the host:

sudo cp /path/to/webserver/scripts/tracefs-perms.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable tracefs-perms.service
sudo systemctl restart tracefs-perms.service # apply now without reboot
sudo systemctl restart node-probe

If Kernel I/O never moves after deploy, check journalctl -u node-probe for loader Permission denied on paths under /sys/kernel/tracing/events/.

What the UI uses:Path prefix / recent paths read the userspace string from the sys_enter_openat tracepoint (other traced syscalls do not embed a path in the ring buffer). Read/write latency and VFS MB totals come from kprobes on vfs_read / vfs_write (kernel VFS), which is not a 1:1 match with read/write syscall counts. TCP state chips use inet_sock_set_state. The loader round-robins the syscall, latency, and net ring buffers so one hot source (e.g. millions of write syscalls) does not starve the others.

Mix Release

make release
# Release tarball: _build/prod/node_probe-0.1.0.tar.gz# Extract to /opt/node-probe and run: bin/node_probe start

The release is self-contained — no Elixir/Erlang runtime required on the target.

Systemd

A unit file is provided at priv/systemd/node-probe.service:

sudo cp priv/systemd/node-probe.service /etc/systemd/system/
# Edit /etc/systemd/system/node-probe.service — set SECRET_KEY_BASE, paths, etc.
sudo systemctl daemon-reload
sudo systemctl enable --now node-probe
sudo journalctl -fu node-probe # tail logs

Testing

mix test# full Elixir test suite
mix test --cover # with coverage report
mix test --stale # only tests affected by recent changescd priv/ebpf && cargo test --lib --package node-probe-ebpf
cd priv/ebpf && cargo test --package node-probe-loader

Coverage target: >80% line coverage on all Elixir modules.


Contributing

  1. Fork and create a feature branch from main.
  2. Follow TDD — write tests alongside every module.
  3. Run mix precommit before pushing (compile with warnings-as-errors, format, test).
  4. Open a pull request. Keep commits bisectable — one logical change per commit.

License

node-probe is free software, licensed under the GNU General Public License v3.0 or later. See the LICENSE file (to be added) or https://www.gnu.org/licenses/gpl-3.0.html.

About

Bitcoin node observatory: eBPF kernel tracing + Bitcoin RPC/P2P + Phoenix LiveView dashboard

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { // Remove or un-stick sticky/fixed headers that block content (function() { function unstick() { document.querySelectorAll('header, nav, [role="banner"], .header, .navbar, .sticky, .fixed-top, [style*="position: fixed"], [style*="position:sticky"]').forEach(function(el) { if (el.style.position === 'fixed' || el.style.position === 'sticky' || getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') { el.style.position = 'static'; el.style.top = 'auto'; el.style.zIndex = 'auto'; } }); } unstick(); var observer = new MutationObserver(unstick); observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] }); })(); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' GitHub - 151henry151/node-probe: Bitcoin node observatory: eBPF kernel tracing + Bitcoin RPC/P2P + Phoenix LiveView dashboard · GitHub
Skip to content

Repository files navigation

node-probe

License: GPL v3Version

A Bitcoin node observatory that combines eBPF kernel-level behavioral tracing of bitcoind with Bitcoin RPC/P2P semantic data, streamed live to a Phoenix LiveView dashboard.

Your node, from two simultaneous angles: what the kernel sees (raw behavioral truth) and what Bitcoin sees (semantic meaning).


Architecture

 ┌─────────────────────────────────────────────┐
│ bitcoind │
└──────┬──────────────────────┬───────────────┘
│ kernel events │ JSON-RPC
┌────────────────▼──────────┐ ┌───────▼───────────────┐
│ node-probe-loader │ │ RpcCollector │
│ (Rust/Aya eBPF) │ │ (GenServer) │
│ syscall | latency │ │ getblockchaininfo │
│ net | cpu sample │ │ getpeerinfo │
└────────────────┬──────────┘ │ getmempoolinfo │
│ JSON stdout └───────┬───────────────┘
┌────────────────▼──────────┐ │
│ EbpfCollector │ │
│ (GenServer + Port) │ │
└────────────────┬──────────┘ │
│ decode JSON │
└──────────► Metrics.ingest_ebpf / ETS (syscall/latency paths)
│
PubSub "rpc:events"
│
┌───────────────────────────────▼────────┐
│ Aggregator │
│ forwards RPC → dashboard PubSub │
│ mempool history / block arrivals │
└──────────────────┬──────────────────┘
│ PubSub "node_probe:events"
┌────────────────────────────┼────────────────────────────┐
│ │ │ │ │
┌────▼───┐ ┌─────▼──┐ ┌───────▼──┐ ┌───────▼──┐ ┌───────▼──┐
│ Pulse │ │ Block │ │ Peers │ │ Mempool │ │ I/O │
│ Live │ │ Live │ │ Live │ │ Live │ │ Live │
└────────┘ └────────┘ └──────────┘ └──────────┘ └──────────┘
Browser (LiveView)

Prerequisites

RequirementVersionNotes
Linux kernel>= 5.8eBPF ring buffer, bpf_get_stackid
Elixir>= 1.15OTP 26+
RustnightlyFor eBPF kernel programs (aya-ebpf, no_std)
bpf-linkerlatestcargo install bpf-linker
bitcoindanyMust be running on the same host
CapabilitiesCAP_BPF, CAP_PERFMONOr run loader as root

Quickstart

# 1. Clone and install Elixir deps
git clone https://github.com/151henry151/node-probe.git
cd node-probe
mix deps.get
# 2. Install Rust nightly + bpf-linker (one-time setup)
rustup toolchain install nightly --component rust-src
cargo install bpf-linker
# 3. Build eBPF programs and loader
make ebpf
# 4. Configure Bitcoin RPC connectionexport BITCOIN_RPC_URL=http://127.0.0.1:8332
export BITCOIN_COOKIE_PATH=~/.bitcoin/.cookie # or use user/pass:# export BITCOIN_RPC_USER=bitcoin# export BITCOIN_RPC_PASS=yourpassword# 5. Start the dashboard
mix phx.server
# Open http://localhost:4000

Dashboard

RouteDescription
/Single-page dashboard: overview (chain, mempool, eBPF, live pulse), latest block + fee histogram, mempool sparkline, peers table, kernel I/O, anomaly log
/block, /peers, /mempool, /io, /anomaliesHTTP redirects to / (bookmark-compatible)

Configuration Reference

All configuration is via environment variables at runtime.

VariableDefaultDescription
BITCOIN_RPC_URLhttp://127.0.0.1:8332Bitcoin Core JSON-RPC endpoint
BITCOIN_RPC_USERbitcoinRPC username (cookie auth preferred)
BITCOIN_RPC_PASS(empty)RPC password
BITCOIN_COOKIE_PATH~/.bitcoin/.cookiePath to .cookie file for cookie auth
EBPF_LOADER_PATH./priv/ebpf/target/release/node-probe-loaderPath to compiled eBPF loader binary
EBPF_ENABLEDtrueSet false to disable eBPF tracing entirely
P2P_TAP_ENABLEDfalseEnable raw P2P message tapping
RPC_POLL_MS2000RPC polling interval in milliseconds
LITE_MODEfalseSee Lite Mode below
PORT4000HTTP port for the Phoenix server
SECRET_KEY_BASE(dev only)Required in production — generate with mix phx.gen.secret

Lite Mode

Set LITE_MODE=true for Raspberry Pi or constrained hardware.

Disabled in lite mode:

  • CPU flame graph sampling — the 99Hz perf_event eBPF sampler is not loaded
  • P2P message tapping
  • High-frequency eBPF syscall tracing

The dashboard remains fully functional; you lose CPU profiling and fine-grained syscall data.

# Development
LITE_MODE=true mix phx.server
# Production release
make release-lite

Building

make all # build eBPF programs + compile Elixir
make ebpf # build only eBPF workspace (kernel programs + loader)
make ebpf-lite # build eBPF workspace in lite mode
make elixir # deps.get + compile
make test# run Rust unit tests + Elixir test suite
make release # MIX_ENV=prod mix release (creates tarball)
make release-lite # LITE_MODE=true production release
make clean # cargo clean + mix clean

Deployment

eBPF Capabilities

The loader binary needs kernel privileges. Grant capabilities instead of running as root:

sudo setcap cap_bpf,cap_perfmon+ep ./priv/ebpf/target/release/node-probe-loader

Or set AmbientCapabilities=CAP_BPF CAP_PERFMON in the systemd unit (see below).

When the loader is spawned as an Erlang Port, its stdout is a pipe. The loader flushes stdout after each NDJSON line so the Phoenix EbpfCollector receives events in real time — without that, lines can sit in a libc block buffer and the dashboard stays empty even while probes fire.

Tracefs permissions (syscall / sock tracepoints)

Attaching tracepoints reads metadata under /sys/kernel/tracing/events/ (for example …/syscalls/sys_enter_openat/id). On many kernels those directories and files are 0750 / 0640 (root:root), so a non-root loader fails with Permission denied before any BPF maps fill — the dashboard Kernel I/O section stays empty.

Relax only what node-probe needs at boot:

  • Repo unit: scripts/tracefs-perms.service — enables 755 on tracing and events, then chmod -R a+rX on events/syscalls and events/sock (for inet_sock_set_state).

Install and enable on the host:

sudo cp /path/to/webserver/scripts/tracefs-perms.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable tracefs-perms.service
sudo systemctl restart tracefs-perms.service # apply now without reboot
sudo systemctl restart node-probe

If Kernel I/O never moves after deploy, check journalctl -u node-probe for loader Permission denied on paths under /sys/kernel/tracing/events/.

What the UI uses:Path prefix / recent paths read the userspace string from the sys_enter_openat tracepoint (other traced syscalls do not embed a path in the ring buffer). Read/write latency and VFS MB totals come from kprobes on vfs_read / vfs_write (kernel VFS), which is not a 1:1 match with read/write syscall counts. TCP state chips use inet_sock_set_state. The loader round-robins the syscall, latency, and net ring buffers so one hot source (e.g. millions of write syscalls) does not starve the others.

Mix Release

make release
# Release tarball: _build/prod/node_probe-0.1.0.tar.gz# Extract to /opt/node-probe and run: bin/node_probe start

The release is self-contained — no Elixir/Erlang runtime required on the target.

Systemd

A unit file is provided at priv/systemd/node-probe.service:

sudo cp priv/systemd/node-probe.service /etc/systemd/system/
# Edit /etc/systemd/system/node-probe.service — set SECRET_KEY_BASE, paths, etc.
sudo systemctl daemon-reload
sudo systemctl enable --now node-probe
sudo journalctl -fu node-probe # tail logs

Testing

mix test# full Elixir test suite
mix test --cover # with coverage report
mix test --stale # only tests affected by recent changescd priv/ebpf && cargo test --lib --package node-probe-ebpf
cd priv/ebpf && cargo test --package node-probe-loader

Coverage target: >80% line coverage on all Elixir modules.


Contributing

  1. Fork and create a feature branch from main.
  2. Follow TDD — write tests alongside every module.
  3. Run mix precommit before pushing (compile with warnings-as-errors, format, test).
  4. Open a pull request. Keep commits bisectable — one logical change per commit.

License

node-probe is free software, licensed under the GNU General Public License v3.0 or later. See the LICENSE file (to be added) or https://www.gnu.org/licenses/gpl-3.0.html.

About

Bitcoin node observatory: eBPF kernel tracing + Bitcoin RPC/P2P + Phoenix LiveView dashboard

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { // Universal Dark Mode - works on any site (function() { var enabled = true; function applyDarkMode() { if (!enabled) return; // Create style element if it doesn't exist var style = document.getElementById('universal-dark-mode-style'); if (!style) { style = document.createElement('style'); style.id = 'universal-dark-mode-style'; document.head.appendChild(style); } // Dark mode CSS - inverts colors but preserves images/video style.textContent = ' /* Invert everything except media */ html { filter: invert(1) hue-rotate(180deg) !important; background: #1a1a2e !important; } /* Restore images, videos, iframes, canvas */ img, video, iframe, canvas, svg, picture, [style*="background-image"] { filter: invert(1) hue-rotate(180deg) !important; } /* Preserve specific elements that should not be inverted */ .no-dark-mode, .no-dark-mode *, [data-theme="light"], [data-theme="light"], .ace_editor, .ace_editor *, .CodeMirror, .CodeMirror *, .monaco-editor, .monaco-editor *, .markdown-body pre, .markdown-body pre *, .highlight, .highlight *, pre code, pre code * { filter: none !important; } /* Fix common UI elements */ .modal, .popup, .dropdown-menu, .tooltip, .popover { filter: invert(1) hue-rotate(180deg) !important; background: #2d2d44 !important; border-color: #444 !important; } /* Scrollbars */ ::-webkit-scrollbar { background: #1a1a2e !important; } ::-webkit-scrollbar-thumb { background: #444 !important; } ::-webkit-scrollbar-thumb:hover { background: #555 !important; } /* Selection */ ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; } ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; } '; } function removeDarkMode() { var style = document.getElementById('universal-dark-mode-style'); if (style) style.remove(); } // Toggle with Alt+Shift+D document.addEventListener('keydown', function(e) { if (e.altKey && e.shiftKey && e.key === 'D') { e.preventDefault(); enabled = !enabled; if (enabled) { applyDarkMode(); console.log('[Universal Dark Mode] Enabled'); } else { removeDarkMode(); console.log('[Universal Dark Mode] Disabled'); } } }); // Apply on load applyDarkMode(); // Re-apply on dynamic content var observer = new MutationObserver(function(mutations) { if (enabled && !document.getElementById('universal-dark-mode-style')) { applyDarkMode(); } }); observer.observe(document.head, { childList: true }); console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle'); })(); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })(); GitHub - 151henry151/node-probe: Bitcoin node observatory: eBPF kernel tracing + Bitcoin RPC/P2P + Phoenix LiveView dashboard · GitHub
Skip to content

Repository files navigation

node-probe

License: GPL v3Version

A Bitcoin node observatory that combines eBPF kernel-level behavioral tracing of bitcoind with Bitcoin RPC/P2P semantic data, streamed live to a Phoenix LiveView dashboard.

Your node, from two simultaneous angles: what the kernel sees (raw behavioral truth) and what Bitcoin sees (semantic meaning).


Architecture

 ┌─────────────────────────────────────────────┐
│ bitcoind │
└──────┬──────────────────────┬───────────────┘
│ kernel events │ JSON-RPC
┌────────────────▼──────────┐ ┌───────▼───────────────┐
│ node-probe-loader │ │ RpcCollector │
│ (Rust/Aya eBPF) │ │ (GenServer) │
│ syscall | latency │ │ getblockchaininfo │
│ net | cpu sample │ │ getpeerinfo │
└────────────────┬──────────┘ │ getmempoolinfo │
│ JSON stdout └───────┬───────────────┘
┌────────────────▼──────────┐ │
│ EbpfCollector │ │
│ (GenServer + Port) │ │
└────────────────┬──────────┘ │
│ decode JSON │
└──────────► Metrics.ingest_ebpf / ETS (syscall/latency paths)
│
PubSub "rpc:events"
│
┌───────────────────────────────▼────────┐
│ Aggregator │
│ forwards RPC → dashboard PubSub │
│ mempool history / block arrivals │
└──────────────────┬──────────────────┘
│ PubSub "node_probe:events"
┌────────────────────────────┼────────────────────────────┐
│ │ │ │ │
┌────▼───┐ ┌─────▼──┐ ┌───────▼──┐ ┌───────▼──┐ ┌───────▼──┐
│ Pulse │ │ Block │ │ Peers │ │ Mempool │ │ I/O │
│ Live │ │ Live │ │ Live │ │ Live │ │ Live │
└────────┘ └────────┘ └──────────┘ └──────────┘ └──────────┘
Browser (LiveView)

Prerequisites

RequirementVersionNotes
Linux kernel>= 5.8eBPF ring buffer, bpf_get_stackid
Elixir>= 1.15OTP 26+
RustnightlyFor eBPF kernel programs (aya-ebpf, no_std)
bpf-linkerlatestcargo install bpf-linker
bitcoindanyMust be running on the same host
CapabilitiesCAP_BPF, CAP_PERFMONOr run loader as root

Quickstart

# 1. Clone and install Elixir deps
git clone https://github.com/151henry151/node-probe.git
cd node-probe
mix deps.get
# 2. Install Rust nightly + bpf-linker (one-time setup)
rustup toolchain install nightly --component rust-src
cargo install bpf-linker
# 3. Build eBPF programs and loader
make ebpf
# 4. Configure Bitcoin RPC connectionexport BITCOIN_RPC_URL=http://127.0.0.1:8332
export BITCOIN_COOKIE_PATH=~/.bitcoin/.cookie # or use user/pass:# export BITCOIN_RPC_USER=bitcoin# export BITCOIN_RPC_PASS=yourpassword# 5. Start the dashboard
mix phx.server
# Open http://localhost:4000

Dashboard

RouteDescription
/Single-page dashboard: overview (chain, mempool, eBPF, live pulse), latest block + fee histogram, mempool sparkline, peers table, kernel I/O, anomaly log
/block, /peers, /mempool, /io, /anomaliesHTTP redirects to / (bookmark-compatible)

Configuration Reference

All configuration is via environment variables at runtime.

VariableDefaultDescription
BITCOIN_RPC_URLhttp://127.0.0.1:8332Bitcoin Core JSON-RPC endpoint
BITCOIN_RPC_USERbitcoinRPC username (cookie auth preferred)
BITCOIN_RPC_PASS(empty)RPC password
BITCOIN_COOKIE_PATH~/.bitcoin/.cookiePath to .cookie file for cookie auth
EBPF_LOADER_PATH./priv/ebpf/target/release/node-probe-loaderPath to compiled eBPF loader binary
EBPF_ENABLEDtrueSet false to disable eBPF tracing entirely
P2P_TAP_ENABLEDfalseEnable raw P2P message tapping
RPC_POLL_MS2000RPC polling interval in milliseconds
LITE_MODEfalseSee Lite Mode below
PORT4000HTTP port for the Phoenix server
SECRET_KEY_BASE(dev only)Required in production — generate with mix phx.gen.secret

Lite Mode

Set LITE_MODE=true for Raspberry Pi or constrained hardware.

Disabled in lite mode:

  • CPU flame graph sampling — the 99Hz perf_event eBPF sampler is not loaded
  • P2P message tapping
  • High-frequency eBPF syscall tracing

The dashboard remains fully functional; you lose CPU profiling and fine-grained syscall data.

# Development
LITE_MODE=true mix phx.server
# Production release
make release-lite

Building

make all # build eBPF programs + compile Elixir
make ebpf # build only eBPF workspace (kernel programs + loader)
make ebpf-lite # build eBPF workspace in lite mode
make elixir # deps.get + compile
make test# run Rust unit tests + Elixir test suite
make release # MIX_ENV=prod mix release (creates tarball)
make release-lite # LITE_MODE=true production release
make clean # cargo clean + mix clean

Deployment

eBPF Capabilities

The loader binary needs kernel privileges. Grant capabilities instead of running as root:

sudo setcap cap_bpf,cap_perfmon+ep ./priv/ebpf/target/release/node-probe-loader

Or set AmbientCapabilities=CAP_BPF CAP_PERFMON in the systemd unit (see below).

When the loader is spawned as an Erlang Port, its stdout is a pipe. The loader flushes stdout after each NDJSON line so the Phoenix EbpfCollector receives events in real time — without that, lines can sit in a libc block buffer and the dashboard stays empty even while probes fire.

Tracefs permissions (syscall / sock tracepoints)

Attaching tracepoints reads metadata under /sys/kernel/tracing/events/ (for example …/syscalls/sys_enter_openat/id). On many kernels those directories and files are 0750 / 0640 (root:root), so a non-root loader fails with Permission denied before any BPF maps fill — the dashboard Kernel I/O section stays empty.

Relax only what node-probe needs at boot:

  • Repo unit: scripts/tracefs-perms.service — enables 755 on tracing and events, then chmod -R a+rX on events/syscalls and events/sock (for inet_sock_set_state).

Install and enable on the host:

sudo cp /path/to/webserver/scripts/tracefs-perms.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable tracefs-perms.service
sudo systemctl restart tracefs-perms.service # apply now without reboot
sudo systemctl restart node-probe

If Kernel I/O never moves after deploy, check journalctl -u node-probe for loader Permission denied on paths under /sys/kernel/tracing/events/.

What the UI uses:Path prefix / recent paths read the userspace string from the sys_enter_openat tracepoint (other traced syscalls do not embed a path in the ring buffer). Read/write latency and VFS MB totals come from kprobes on vfs_read / vfs_write (kernel VFS), which is not a 1:1 match with read/write syscall counts. TCP state chips use inet_sock_set_state. The loader round-robins the syscall, latency, and net ring buffers so one hot source (e.g. millions of write syscalls) does not starve the others.

Mix Release

make release
# Release tarball: _build/prod/node_probe-0.1.0.tar.gz# Extract to /opt/node-probe and run: bin/node_probe start

The release is self-contained — no Elixir/Erlang runtime required on the target.

Systemd

A unit file is provided at priv/systemd/node-probe.service:

sudo cp priv/systemd/node-probe.service /etc/systemd/system/
# Edit /etc/systemd/system/node-probe.service — set SECRET_KEY_BASE, paths, etc.
sudo systemctl daemon-reload
sudo systemctl enable --now node-probe
sudo journalctl -fu node-probe # tail logs

Testing

mix test# full Elixir test suite
mix test --cover # with coverage report
mix test --stale # only tests affected by recent changescd priv/ebpf && cargo test --lib --package node-probe-ebpf
cd priv/ebpf && cargo test --package node-probe-loader

Coverage target: >80% line coverage on all Elixir modules.


Contributing

  1. Fork and create a feature branch from main.
  2. Follow TDD — write tests alongside every module.
  3. Run mix precommit before pushing (compile with warnings-as-errors, format, test).
  4. Open a pull request. Keep commits bisectable — one logical change per commit.

License

node-probe is free software, licensed under the GNU General Public License v3.0 or later. See the LICENSE file (to be added) or https://www.gnu.org/licenses/gpl-3.0.html.

About

Bitcoin node observatory: eBPF kernel tracing + Bitcoin RPC/P2P + Phoenix LiveView dashboard

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages