# MINERS: how to join

Every bot in the mine is a GPU someone connected. While the GPU works, its bot digs. Every job it gets verified counts in units (one unit is 2^20 multiply-adds) for the wallet it mines for. Keep the tab open to stay in the program. At the end of each daily round, the MINERS treasury splits the pool between wallets by verified units.

## Connect from the browser

1. Open the mine (`/play`) or Earn (`/earn`) in Chrome or Edge on a computer. It needs WebGPU.
2. Press **Connect wallet** and approve in your Solana wallet (Phantom, Solflare, Backpack, …) through Privy. That address is who gets paid.
3. The same button becomes **Connect GPU**. Press it to send your bot down.
4. **Keep this tab open to stay in the program.** Closing it or pressing Stop takes your bot offline. Payouts settle daily.

One wallet can have 3 GPUs connected at once. Programs that mine over the API still pass `wallet` on `POST /api/gpu/join` (see below).

## The work

Each job is two n×n matrices of unsigned 32-bit integers, A and B, grown from seeds the mine sends:

```
gen(seed, i):  x = (imul(i, 0x9e3779b1) ^ seed) >>> 0
               x ^= x >>> 16;  x = imul(x, 0x85ebca6b)
               x ^= x >>> 13;  x = imul(x, 0xc2b2ae35)
               x ^= x >>> 16;  return x >>> 0
A[i] = gen(a_seed, i),  B[i] = gen(b_seed, i)        (row-major, i = row * n + col)
C = A · B, with every multiply and add wrapping mod 2^32
```

Send back one fingerprint per row of C, an FNV-1a over its 32-bit values:

```
h = 2166136261;  for each value v in the row: h = imul(h ^ v, 16777619);  return h >>> 0
```

After all the fingerprints come in, the mine picks 3 rows at random, works them out itself and compares. A wrong answer is a missed swing, and 3 wrong in a row means a minute out. Job sizes run from 256 to 640 and adapt so each answer comes back in about a second.

## The API

All requests are JSON. After joining, send `Authorization: Bearer <key>` on every request.

| Call | Body | Returns |
|---|---|---|
| `POST /api/gpu/join` | `{ "wallet", "gpu"?, "key"? }` (`key` resumes the same bot) | `{ node_id, name, key, look }` |
| `POST /api/gpu/job` | `{}` | `{ job_id, n, a_seed, b_seed }`, or 429 with `retry_in_ms` |
| `POST /api/gpu/result` | `{ "job_id", "rows": [n fingerprints], "gpu_ms"? }` | `{ ok, units, jobs, total_units }` |
| `POST /api/gpu/leave` | `{}` | `{ ok }` |
| `GET /api/earnings?address=` | | `{ earnedLamports, claimableLamports (owed), claimedLamports (paid) }` |

Any program that can do the maths can mine this way, not only the browser.
