Skip to main content
Reputation discovery and proof generation require WASM. On-chain verification uses OpaqueReputationVerifier (bundled address per chain).

Discovery

discoverTraitsV2(rows, options)

Use this for schema-bound V2 attestations created by issueAttestation. V2 announcements use marker 0xB2, include 130 bytes of metadata, and are validated against the target chain’s schema registry before the SDK returns them.
Params Returns: Promise<DiscoveredTrait[]>. For V2, DiscoveredTrait includes schemaId, schemaName, issuer, attestationUid, dataHex, nonce, merkleLeafPreimage, isValid, and issuerAuthorized in addition to the shared stealth address, tx hash, block/slot, discovery time, and ephemeral pubkey. generateReputationProof consumes merkleLeafPreimage automatically. Attestation metadata never arrives over the cross-chain UAB because the Wormhole payload only carries a 24-byte metadata tail. Fetch trait rows natively on each chain.

discoverTraits(rows)

Legacy V1 discovery for 0xA7 metadata markers. New schema-bound attestations issued by issueAttestation use V2, so call discoverTraitsV2 for current app flows.
Returns: Promise<DiscoveredTrait[]> with V1 fields: attestationId, stealthAddress, txHash, blockNumber, discoveredAt, and ephemeralPubkey.

getReputationTraitsFromAnnouncements(rows)

Legacy alias for discoverTraits.

announcementsJsonForReputationWitness(rows)

Serialize announcements for the prover witness.

getStealthSignerPrivateKeyForReputationTrait(trait)

Reconstruct signing key for a discovered trait.

Proof generation

generateReputationProof(params)

Generate Groth16 proof bundle (requires snarkjs).
For traits returned by discoverTraitsV2, the prover reads issuerPkX, traitDataHash, and nonce from trait.merkleLeafPreimage. You can still pass those fields manually to override the trait context. If they are absent, the prover fills deterministic dev-mode defaults. Returns: ProofData: { proof, publicSignals, nullifier, attestationId }. The public signals are [merkle_root, attestation_id, external_nullifier, nullifier_hash] and nullifier carries nullifier_hash.

Merkle roots

fetchLatestValidReputationRoot()

Latest non-expired root from verifier rootHistory.

isReputationRootValid(root)

Whether the verifier currently accepts this root.

fetchReputationRootHistory()

Full root history with per-entry validity.

Verification

verifyReputationProofView(args)

Read-only on-chain view; does not consume the nullifier.

simulateReputationVerification(wallet, args)

Simulate verifyReputation for gas / revert checks (Ethereum).

submitReputationVerification(chain, args)

Broadcast the proof to the verifier. Consumes the nullifier on success.
Signers: ethereumWalletClient (EVM) or solanaWallet (Solana). This facade covers Ethereum and Solana only; for Starknet, see Verify on Starknet below.

Verify on Starknet

generateReputationProof is chain-agnostic, and a bundle from the shared trusted setup verifies on Ethereum, Solana, and Starknet. Starknet verification does not go through submitReputationVerification; instead build an unsigned Starknet call with @opaquecash/psr-chain-starknet and let the app’s Starknet wallet broadcast it.
Starknet is at testnet-preview maturity on Sepolia. The verifier stack (OpaqueReputationVerifierV2 + Garaga Groth16 verifier, addresses in STARKNET_SEPOLIA_PSR) only verifies and gates proofs — schema registration and attestation issuance stay on Ethereum and Solana. See Starknet for the full flow and caveats.

Static scope helpers

Equivalent to buildActionScope / externalNullifierFromScope from @opaquecash/psr-core.

Full E2E

See Generate a reputation proof.