zPass docs
  • zPass
    • Introduction
    • Quickstart
    • Background
    • Benefits & Use Cases
    • Technical Foundations
    • System Participants
    • Powered by Aleo
  • Fundamentals
    • Issuer
    • Holder
    • Verifier
    • Off-chain flow
    • On-chain flow
    • Local Execution with WASM
  • ZPass Programs
    • Background
    • Verify offchain program
    • zPass issuance program
    • zPass hiding program
    • zPass invalidate program
    • zPass invalidate hiding program
    • zPass merkle tree size 8 program
  • ZPass SDK
    • Methods References
      • constructor
      • setNewHost
      • issueZPass
      • getZPassRecord
      • proveOnChain
      • proveOffChain
      • verifyOnChain
      • verifyOffChain
      • signCredential
      • initThreadPool
      • createAleoWorker
      • getMerkleRoot
      • getMerkleTree
      • getMerkleProof
      • getLeavesHashes
      • signMerkleRoot
  • Example Usage
    • Step-by-step Guide
Powered by GitBook
On this page
  • Description
  • Parameters
  • Returns
  • Example
  1. ZPass SDK
  2. Methods References

proveOffChain

Description

The proveOffChain method generates an off-chain proof for a ZPass credential, executing the program locally without submitting to the blockchain. The program can be both deployed on-chain or a local program that is not deployed on-chain but is provided and agreed upon by all the involved parties (issuer, user, verifier).

Parameters

  • options (ProveOffChainOptions): An object containing:

    • localProgram (string): The Aleo program source code

    • functionName (string): Name of the function to execute

    • inputs (string[]): Array of input parameters for the function

    • offlineQuery (OfflineQuery, optional): An optional offline query object used to insert the global state root and state paths needed to create a valid inclusion proof offline.

Returns

Returns a Promise that resolves to an object containing:

  • outputs (string[]): Array of function outputs

  • execution (string): The execution trace

  • verifyingKey (string): The verifying key for the proof

Example

const { outputs, execution, verifyingKey } = await zpass.proveOffChain({
    localProgram: programSource,
    functionName: functionName,
    inputs: [signature, `{
      issuer: ${issuer},
      subject: ${subject},
      dob: ${dob},
      nationality: ${nationality},
      expiry: ${expiry}
    }`,
      `{ salt: ${salt} }`,
    ],
});
PreviousproveOnChainNextverifyOnChain

Last updated 4 months ago