> For AI agents: the documentation index is at https://sdk.nimbusprivacy.xyz/llms.txt, and every page is available as Markdown at its URL with .md appended.

# Prover worker and CLI (/helpers/prover-worker)

The SDK builds each proof in a Web Worker, from WebAssembly it ships. Your app serves those files
one of two ways:

| Way                                                  | When to use it                                                              |
| ---------------------------------------------------- | --------------------------------------------------------------------------- |
| Copy the shipped files with `copy-assets`            | Almost always. The SDK starts its own worker and checks every file it runs. |
| Bundle the prover yourself and start your own worker | Only when your build must produce every script and WebAssembly file itself. |

## Copy the shipped files

The package installs a command, `nimbus-solana-web`, with one subcommand:

```bash
nimbus-solana-web copy-assets <directory>
```

It copies the browser files the SDK runs into `<directory>`, which your app serves as static files.
It takes exactly one argument and no options. Run it from a package script, as the example app
does:

```json title="package.json"
{
  "scripts": {
    "assets": "nimbus-solana-web copy-assets public/nimbus"
  }
}
```

Then pass the URL that directory is served at to `loadNimbusSdk`:

```ts
import { loadNimbusSdk } from "@umbra/nimbus-solana-web";

const sdk = await loadNimbusSdk(
  { cluster: "mainnet" },
  { assetsBaseUrl: "/nimbus/" },
);
```

### What it copies

- **`nimbus_primitives_wasm_bg.wasm`**, the WebAssembly `loadNimbusSdk` loads.
- **`prover-worker.js`**, the worker each proof runs in.
- **`prover/` and `witness-graph/`**, the WebAssembly the worker proves with.

It creates the directory when it does not exist. It overwrites files of the same names and touches
no other file. Run it again each time you update the package, so the files match the version you
installed.

[`copy-assets`](https://sdk.nimbusprivacy.xyz/reference/prover-worker#copy-assets) lists its exit codes.

## Start your own worker

Skip this section unless your build must bundle the prover's WebAssembly itself.

Your worker module answers each message with `proveWorkerRequest`, from the package's
`./prover-worker` entry. Its whole body is:

```ts
import initGraph, * as graph from "./umbra_witness_graph.js";
import initProver, * as wasm from "./umbra_prover.js";
import { proveWorkerRequest } from "@umbra/nimbus-solana-web/prover-worker";

self.addEventListener("message", (event) => {
  void Promise.all([initGraph(), initProver()])
    .then(async () => proveWorkerRequest(event.data, { graph, wasm }))
    .then((answer) => self.postMessage(answer));
});
```

This block is not type-checked here. It imports two files that your own build writes: the
witness-graph and prover glue code.

Then pass a function that starts your worker as `platform.startProverWorker`:

```ts
import { loadNimbusSdk } from "@umbra/nimbus-solana-web";

const sdk = await loadNimbusSdk(
  { cluster: "mainnet" },
  {
    endpoints: { primitivesWasm: "/wasm/nimbus_primitives_wasm_bg.wasm" },
    platform: {
      startProverWorker: () => new Worker(proverWorkerUrl, { type: "module" }),
    },
  },
);
```

Without `assetsBaseUrl`, pass `endpoints.primitivesWasm` too. It is the URL your app serves the
SDK's main WebAssembly file at.

The SDK starts a fresh worker for each proof and terminates it afterwards. Each request carries the
user's private inputs, so a worker is never reused.

> **Your worker is not checked**
>
> The shipped worker checks every file it loads against the SHA-256 the package pins. A worker of
> your own skips those checks, unless you add them.

## Next

- [Set up your app](https://sdk.nimbusprivacy.xyz/getting-started/setup): Serve the SDK's files and turn on cross-origin isolation.
- [Load the SDK](https://sdk.nimbusprivacy.xyz/helpers/load): Point the SDK at the files you serve.
- [Browser support](https://sdk.nimbusprivacy.xyz/production/browser-support): What the prover needs from the browser.
- [API reference](https://sdk.nimbusprivacy.xyz/reference/prover-worker): proveWorkerRequest and the copy-assets command.


Last updated 21 October 2026
