ProvingKeyManager
Manages proving key provisioning, caching, and version tracking for local ZK proving.
The protocol-level wallet keys (~24MB total) are provisioned once into app internal storage; the phone can then prove transactions offline. Provisioning prefers the APK bundle (installWalletKeysFromAssets, staged at build time by the contract Gradle plugin) so a fresh device never depends on the network, and falls back to an S3 downloadWalletKeys only when the app didn't bundle them. See ensureWalletKeysAvailable for the priority order.
Key locations match the SDK's WasmProver.makeDefaultKeyMaterialProvider():
zswap/{ver}/spend.prover(10.5 MB)zswap/{ver}/output.prover(5.5 MB)zswap/{ver}/sign.prover(2.7 MB)dust/{ver}/spend.prover(2.1 MB)bls_midnight_2p13(1.5 MB)Corresponding
.verifierand.bzkirfiles
Properties
Functions
Total size of cached keys in bytes.
Delete all cached proving keys.
Directory for a specific contract's proving keys. Keys are stored at: proving_keys/contracts/{contractName}/{circuit}.{prover,verifier,bzkir}
Download all wallet proving keys from S3.
One-call wallet-key provisioning. Tries the dev shortcut first (installFromLocalTmp — adb-pushed files in /data/local/tmp/), then falls back to the S3 download (downloadWalletKeys) when the local-tmp pass didn't populate the BLS params + zswap/dust keys. After this returns, hasWalletKeys is true unless the download itself failed (in which case the underlying IOException propagates).
Whether BLS parameters are available (needed for all proving).
Whether all required circuit keys are cached for a contract.
Whether the prover can find circuit keys at the root keys directory.
Whether all wallet-required proving keys are cached and current version.
Install a dApp's own contract circuit keys from the APK's bundled assets into the prover's keysDir, where the local prover resolves them.
Dev-only convenience: install proving keys from a local-tmp staging area pushed via adb push (the convention used by Kicks's build script, the SDK e2e test, and BBoard's canary). Looks at two well-known directories on the device:
Install the protocol-level wallet keys (zswap/dust/BLS) from the APK's bundled assets — the offline-bundle counterpart to the S3 downloadWalletKeys.
Remove all cached keys for a contract.