Skip to content

Smart Wallet: Application Flow

Below we provide the application flow that assumes the application directly calls the Smart Wallet Backend and ZK Prover APIs.

Web2 login flow

  1. When the user presses "Continue with Google" button, the app navigates to the Google's account selection page. The credentials for Google APIs can be dynamically fetched from the Smart Wallet Backend by calling the /v0/oauth/credentials endpoint.
  2. After the user selects the account, the user is sent back to the app with the authentication token.
  3. The app exchanges the authentication token for the signed JSON Web Token (JWT) by calling the Google API.
  4. Now the user is logged in using their Gmail account.

Smart Wallet activation

  1. Get encryption keys: Before submitting a proof request, fetch the public encryption keys from the ZK Prover server using the /v0/keys endpoint.
  2. Submit proof request: To spend funds from the Smart Wallet, the user needs to activate it. Encrypt the JWT using the public key and submit the proof request to the ZK Prover server via the /v0/prove endpoint. This returns a unique proof ID that must be stored within the app.
  3. Check proof status: The proving takes 4-5 minutes. You can retrieve the result by polling the /v0/proof-status endpoint with the proof ID until the status shows "Completed".
  4. Create wallet: Once you receive the completed proof object (ZKProofBytes), you can activate the wallet by calling the /v0/wallet/create endpoint of the Smart Wallet Backend. This publishes a minting transaction on the blockchain. Alternatively, you can use the /v0/wallet/create-and-send-funds endpoint to create the wallet and send funds to another address in the same transaction.

Smart Wallet payments

  1. Get recipient address: To send funds with a Smart Wallet, you need to get a Cardano address of the recipient first. If the recipient is another Smart Wallet user, you can query their address using the /v0/wallet/address endpoint with their email address.
  2. Build transaction: Once you know the recipient's blockchain address, use the /v0/wallet/send-funds endpoint to construct the transaction. This endpoint requires the sender's email, payment key hash created during wallet activation, and the transfer information.
  3. Submit transaction: The constructed transaction can be submitted to the blockchain using the /v0/tx/submit endpoint. This endpoint can also send email notifications to recipients if their email addresses are provided in the request.