Solve a BTX service challenge to produce a (nonce, digest, proof) tuple
that btxd will accept on redemption.
Modes:
'rpc': delegate to btxd's solvematmulservicechallenge RPC. Pass an
authenticated BtxChallengeClient in opts.rpcClient. Production
note: the solve RPC shares the matmul backend with block-template
mining; consumers MUST point at a dedicated non-mining btxd, otherwise
individual solves can queue behind mining work for 10+ minutes.
'wasm': solve locally with the optional @btx-tools/matmul-wasm kernel —
byte-identical proof to 'pure-js', ~24× faster. Throws a clear error if
the package isn't installed. No node required.
'pure-js': solve locally with the ported TypeScript MatMul. Browser-
compatible, no optional package. Slower than 'rpc'/'wasm'.
'auto': prefers 'rpc' if a client is provided, else 'wasm' if the
kernel is installed, else 'pure-js'.
// Solve a challenge with no server-side help. Slow at default difficulty; // for production browser use cases, calibrate via `target_solve_time_s`. constproof = awaitSolver.solve(challenge, { mode:'pure-js', pureJs: { maxTries:100_000 }, });
// ~24× the pure-JS kernel; byte-identical proof. Great for server/edge // solving without a btxd. (`'auto'` uses it automatically when installed.) constproof = awaitSolver.solve(challenge, { mode:'wasm', wasm: { maxTries:1_000_000 }, });
Solve a BTX service challenge to produce a (nonce, digest, proof) tuple that btxd will accept on redemption.
Modes:
'rpc': delegate to btxd'ssolvematmulservicechallengeRPC. Pass an authenticatedBtxChallengeClientinopts.rpcClient. Production note: the solve RPC shares the matmul backend with block-template mining; consumers MUST point at a dedicated non-mining btxd, otherwise individual solves can queue behind mining work for 10+ minutes.'wasm': solve locally with the optional@btx-tools/matmul-wasmkernel — byte-identical proof to'pure-js', ~24× faster. Throws a clear error if the package isn't installed. No node required.'pure-js': solve locally with the ported TypeScript MatMul. Browser- compatible, no optional package. Slower than'rpc'/'wasm'.'auto': prefers'rpc'if a client is provided, else'wasm'if the kernel is installed, else'pure-js'.Example: Server-side (Node, RPC mode)
Example: Browser-side (pure-JS mode)
Example: No-node, faster (WASM mode — install `@btx-tools/matmul-wasm`)