LogoLogo
zkBob AppLinks & Resources
  • 🦹zkBob Overview
    • zkBob
    • Basic Concepts
      • Getting Started
      • Open-Source and Decentralized
      • Multichain Deployment
      • Usage Statistics
      • Use Cases
        • Employee Salary
        • Vendor Purchasing
      • Development Timeline
      • zk Privacy Solution Comparison
    • zkBob Pools
      • USDC Pool on Polygon (sunsets January 31, 2025)
      • USDC Pool on Optimism
      • ETH Pool on Optimism
      • USDT Pool on Tron (sunsets Oct 29, 2024)
    • Fees
      • Unspent note handling
    • Deposit & Withdrawal Limits
    • Compliance & Security
      • TRM Labs Integration
    • Conferences, Workshops, Videos
      • International Videos
    • Governance
    • BOB Stablecoin
    • zkBob FAQ
  • πŸ¦Έβ€β™‚οΈzkBob Application
    • UI Overview
    • Account Creation
      • Login to an existing account
      • Lost Password
      • Metamask / Web3 Wallet Warning
    • Deposits
    • Transfers
      • Multitransfers
    • Withdrawals
      • Native Token Conversion
    • Generate a Receiving Address
    • Optional KYC
    • zkBob Direct Deposits
    • Support ID
    • Payment Links
    • Integrated Services
    • Multilingual support
      • PortuguΓͺs
      • Русский
      • δΈ­ζ–‡
  • πŸ‘©β€βš•οΈTechnical Implementation
    • zkBob Application Overview
    • Deployed Contracts
    • Smart Contracts
      • zkBob Pool Contract
        • Transaction Calldata
      • Bob Token Contract
      • Verifier contracts
      • Operator Manager Contract
        • Mutable Operator Manager
      • Voucher (XP) Token Contract
    • Accounts and Notes
      • Accounts
      • Notes
    • Relayer Node
      • Relayer Operations
      • Optimistic State
      • REST API
    • zkBob Keys
      • Address derivation
      • Ephemeral keys
    • zkSNARKs & Circuits
      • Transfer verifier circuit overview
    • zkBob Merkle Tree
      • The Poseidon Hash
    • Elliptic Curve Cryptography
    • Transaction Overview
      • Common Structure
      • Memo Block
        • Memo Block Encryption
      • Transaction Types
      • Nullifiers
      • Signing a Transaction
      • The Transaction Lifecycle
    • Client Library SDK
      • Configuration
        • Initializing the client
          • Client Configuration
        • Attaching a User Account
          • Account Configuration
        • Switching Between Pools
      • Account-less Mode Operations
        • Converting Token Amounts
        • Transaction Fees
        • Transaction Constraints
        • Using the Delegated Prover
        • Getting the State
        • Gift Cards
        • Client Library Status
        • Helpers
        • Versioning
      • Full Mode Operations
        • Balances and History
        • Shielded Addresses
        • Account State
        • Fee Estimations
        • Transaction Configuration
        • Sending Transactions
        • Transaction Maintenance
        • Direct Deposits
        • Gift Cards Maintenance
        • Ephemeral Deposits
        • Forced Exit
        • Other Routines
      • Common Types
      • Full Functions List
      • Utilities
  • πŸ‘©β€πŸ«Deployment
    • Trusted Setup Ceremony
    • Contract Deployment
    • Relayer Subsystem
  • πŸ‘·β€β™‚οΈRoadmap
    • On the Roadmap
    • Exploratory Features
      • XP (Experience Points)
        • XP-based Auctions
      • Multi-chain Custom Rollup Deployment
      • Round-robin Operator Manager
      • Compounding
  • πŸ§‘β€πŸ’»Jobs
    • Zero-Knowledge Researcher & Protocol Developer
  • 🧩Resources
    • Visual Assets
    • Hackathons
      • zkBob Cloud
    • Release Notes
      • October 11, 2023
      • July 13, 2023
      • June 13, 2023
      • March 28, 2023
      • January 30, 2023
      • January 16, 2023
      • January 2, 2023
      • Releases 2022
    • Security Audit
    • Github
    • Link tree
Powered by GitBook
On this page
  • AccountConfig.sk
  • AccountConfig.pool
  • AccountConfig.birthindex
  • AccountConfig.proverMode
  • Account Configuration Example

Was this helpful?

  1. Technical Implementation
  2. Client Library SDK
  3. Configuration
  4. Attaching a User Account

Account Configuration

Configure the customer's wallet

PreviousAttaching a User AccountNextSwitching Between Pools

Last updated 1 year ago

Was this helpful?

During client onboarding you should first request unique account credentials (mnemonic phrase, Metamask signature etc), then you can login the user. Fill the following configuration before starting:

interface AccountConfig {
  sk: Uint8Array;
  pool: string;
  birthindex?: number;
  proverMode: ProverMode;
}

AccountConfig.sk

AccountConfig.sk is a spending key - the top secret account credentials. Anyone who know it can get full control over the client's funds.

To produce a valid spending key from the mnemonic phrase use the helper routine.

AccountConfig.pool

AccountConfig.pool is a pool alias which should be activated on login. For example you can initialize the client to support multiple pool configurations (sepolia/goerli) and want to activate goerli pool after client login. The pool can be switched later without logout.

AccountConfig.birthindex

AccountConfig.birthindex is an account "birthday" within the Merkle tree. No transactions associated with the account should exist lower than that index. If you create a NEW account you can pass -1 here to create account with the birthindex which equals the current one. Always use undefined if you do not known the index exactly to avoid loss of any assets.

Please use this field with care because if the client account has been initialized with the incorrect birthindex the input transfers sent to the account before that index could be lost.

AccountConfig.proverMode

AccountConfig.proverMode defines the prover behavior. The following modes are supported:

  • ProverMode.Local - using local prover. It's the most secure way (because you won't share transaction details with 3rd-parties). But it could be slow on weak devices

  • ProverMode.Delegated - send proving request to the designated external server (the server URL must be defined in associated Pool.delegatedProverUrls field). In case of any errors during external proving (e.g. in case of prover unavailable) the transaction will rejected. Please keep in mind the remote prover will have access to the transaction details

  • ProverMode.DelegatedWithFallback - try to use external prover; in case of any error the local proving will be used

Account Configuration Example

const accountConfig: AccountConfig = {
  sk: Uint8Array.from([199,146,184,107,97,216,254,23,76,10,31,212,74,35,170,141,
                       182,77,24,244,217,79,158,53,176,73,180,201,175,75,132,1]),
  pool: 'BOB-sepolia',
  birthindex: 0,
  proverMode: ProverMode.Local,
};
πŸ‘©β€βš•οΈ
deriveSpendingKeyZkbob