Prover Request/Response Example (TypeScript)¶
This example uses the runtime façade exports for the current bounded two-input TRQ1 lane.
External adopters should import from @bch-stealth/prover-runtime package root only.
import {
prepareDirectSpendProofInput,
proveDirectSpend,
verifyDirectSpend,
} from "@bch-stealth/prover-runtime";
type Inputs = {
piv1Bytes: Uint8Array;
witnessBytes: Uint8Array;
encryptedPayloadBytes?: Uint8Array | null;
hintsBytes?: Uint8Array | null;
};
export async function proveAndVerifyDirectSpend(input: Inputs) {
const proofInput = prepareDirectSpendProofInput({
piv1Bytes: input.piv1Bytes,
witnessBytes: input.witnessBytes,
encryptedPayloadBytes: input.encryptedPayloadBytes ?? null,
hintsBytes: input.hintsBytes ?? null,
determinism: { mode: "deterministic" },
});
const proved = await proveDirectSpend(proofInput);
const verify = await verifyDirectSpend(proved);
if (!verify.ok) {
throw new Error(`verifyDirectSpend failed: ${verify.reason ?? "unknown reason"}`);
}
return {
backendId: proved.prove.backendId, // expected: 2
proofBytes: proved.prove.proofBytes,
pbv1Bytes: proved.prove.pbv1Bytes,
verifyOk: verify.ok,
};
}
Integrator Notes¶
prepareDirectSpendProofInput(...)enforces the public runtime request shape.proveDirectSpend(...)returns tx-carriable proof/PBV1 bytes for the bounded TRQ1 profile.verifyDirectSpend(...)checks the same runtime-produced proof against PIv1.standalone/prover-runtime/src/*files remain internal implementation details and are not stable integration API.- This proves the bounded confidential statement; it does not remove public shell observables.