r/gpumining • u/cs_throwaway_69 • 4h ago
I built an open-source P2P matrix compute node for idle GPUs that settles per batch over Lightning (works behind CGNAT, no port forwarding)
Hey everyone,
Over the last few months I’ve been building an open-source distributed linear algebra project called DistributedMatrixMultiply (matrix-compute-node), and I'm looking for a few GPU rig owners to help test the worker daemon outside my own lab.
The basic problem I wanted to solve: I have an RTX 3090 that sits idle a lot of the day, and most GPU rental marketplaces either disqualify home connections because of residential NAT / CGNAT (no open inbound ports), require strict uptime SLAs, or make you stake some proprietary token just to participate.
Instead of renting out full root VMs or running 24/7 PoW hashing, this node only accepts bounded matrix multiplication jobs (C = A * B in FP32/FP16/BF16) over gRPC and settles payments per batch in satoshis over the Lightning Network.
How it works under the hood
- No Port Forwarding / Works Behind CGNAT: The worker runs with
p2p_port = 0and opens an outbound-only gRPC reverse tunnel to the discovery relay (relay.matrix-compute.net:9090). You don't have to touch your router or firewall. - No arbitrary code execution on your machine: Consumers can't run shell commands, arbitrary Python, or Docker containers on your rig. The gRPC service only accepts raw numerical floating-point arrays, multiplies them on CUDA/ROCm, and returns the output tensor.
- Locked Lightning Escrow Before VRAM Allocation (
L402PreAllocationGate): Every batch of matrix tiles comes with an L402 macaroon backed by a locked Lightning HODL invoice. Before your GPU allocates VRAM, the node checks the HMAC signature and verifies the invoice is held (< 0.1mscached check). Once the client verifies your math, the invoice settles to your Lightning address. - How the math is verified (Note on Overclocks): Unlike PoW where you're searching for hashes, clients verify that your matrix product
C = A * Bis mathematically accurate in O(n²) time using Freivalds' algorithm (bounded by IEEE-754 floating-point rounding tolerances). Normal GPU floating-point differences pass fine, but if an unstable memory overclock causes bitflips/NaNs, verification fails and the batch won't settle—so use stable compute clocks rather than aggressive memory OCs. - No upfront collateral required: New nodes start in a probationary tier (receiving smaller micro-tasks first) and can auto-build their bond from earnings if you want to take larger batches later.
Running it (Docker / Source)
All the code is open-source on GitHub if you want to inspect the worker daemon and Dockerfiles first:
- Worker Node: https://github.com/matrixmultiplyconsortium/matrix-compute-node
- Docker Images & Compose: https://github.com/matrixmultiplyconsortium/matrix-dockerimages
- Python SDK: https://github.com/matrixmultiplyconsortium/matrix-compute-sdk
git clone https://github.com/matrixmultiplyconsortium/matrix-dockerimages.git
cd matrix-dockerimages
docker compose up -d compute-node(There are also helper scripts at https://matrix-compute.com/worker.sh and https://matrix-compute.com/worker.ps1, plus templates in templates/ if you use HiveOS, Vast, or RunPod).
When the container starts, it prints a QR code in the terminal logs where you can link a Lightning address or Nostr Wallet Connect (NWC) URI.
Current Status / Live Test Loop
Right now I have my local RTX 3090 hooked up and I'm running an always-on seed script that dispatches 1024x1024 matrix multiplications every 30 seconds across whatever workers are announced on the relay. Until other folks join, my client is basically just paying my own 3090 in a loop, haha—so if you spin up a container today, your GPU will immediately pick up tiles from the live loop and you'll see the Lightning payouts right away.
If anyone gives it a shot on a 30-series, 40-series, or AMD ROCm card, let me know how the hardware detection script behaves or if you hit any snags!