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
  • Sending Direct Deposit
  • Parameters
  • Example
  • Getting Pending Direct Deposits
  • Returns
  • Example
  • Getting Direct Deposit Fee
  • Getting Direct Deposit Contract
  • Returns
  • Example

Was this helpful?

  1. Technical Implementation
  2. Client Library SDK
  3. Full Mode Operations

Direct Deposits

External transactions to the privacy pool

PreviousTransaction MaintenanceNextGift Cards Maintenance

Last updated 1 year ago

Was this helpful?

Direct deposits allow other dApps and partners to make direct zkBob deposits by knowing the receiver's zk-address, without dealing with zk-cryptography. This greatly simplifies integration with other dApps and smart contracts

Sending Direct Deposit

You can deposit to your account via the direct deposit scheme.

Direct deposit processing can take up to 20 minutes.

async directDeposit(
    type: DirectDepositType,
    fromAddress: string,
    amount: bigint,
    sendTxCallback: (tx: PreparedTransaction) => Promise<string>,
    blockNumber?: number,
): Promise<void>

Parameters

type - (token or native)

For DD with DirectDepositType.Token type you must ensure the has the allowance to spend your tokens. Before sending the direct deposit you must approve the required amount of tokens (do not forget the fee).

DirectDepositType.Native is only available for pools which serve native wrapped tokens like WETH. Such pools must have isNative = true in the Client Configuration

fromAddress - the 0x-address which will be used to deposit funds

amount - token amount to deposit into an account (in pool dimension)

The direct deposit fee will be fetched and added to the amount under the hood. Do not include it yourself.

blockNumber - the client will wait until the internal provider becomes synced with that block before input account balance validation. The waiting interval is hardcoded to 60 seconds. If the provider doesn't become synced within that interval the transaction will be sent anyway.

Example

const myAddress = '0x49C92c016d2c7A245aAF5351BD932D9D61536eC0';
await zkClient.directDeposit(
    DirectDepositType.Token,
    myAddress,
    50000000000n,  // 50 BOB
    async (tx: PreparedTransaction) => {
      const txObject: TransactionConfig = {
        from: myAddress,
        to: tx.to,
        value: tx.amount.toString(),
        data: tx.data,
      };

      const gas = await this.web3.eth.estimateGas(txObject);
      const gasPrice = Number(await this.web3.eth.getGasPrice());
      txObject.gas = gas;
      txObject.gasPrice = `0x${BigInt(gasPrice).toString(16)}`;
      txObject.nonce = await this.web3.eth.getTransactionCount(address);
  
      const signedTx = await this.web3.eth.signTransaction(txObject);
      const receipt = await this.web3.eth.sendSignedTransaction(signedTx.raw);
  
      return receipt.transactionHash;
    }
);

Getting Pending Direct Deposits

Until sent direct deposits are processed and included in the privacy pool you can fetch the queued DD transactions belonging to your account.

Direct deposit processing can take up to 20 minutes.

public async getPendingDDs(): Promise<DirectDeposit[]>

Returns

Example

const pendingDDs = await zkClient.getPendingDDs();
console.log(`You have ${pendingDDs.length} pending direct deposit(s) in queue`);
// output: You have 3 pending direct deposit(s) in queue

Getting Direct Deposit Fee

Getting Direct Deposit Contract

The DD contract is a part of the privacy pool solution - so each pool has own direct deposit queue contract.

async directDepositContract(): Promise<string>

Returns

Promise returns the direct deposit queue contract address.

Example

console.log(`${await zkClient.directDepositContract()}`);
// output: 0xE3Dd183ffa70BcFC442A0B9991E682cA8A442Ade

sendTxCallback - a callback with transaction data (of type ) which should be sent by the user. After sending the user should return a transaction hash.

Promise returns array of pending s.

Use the associated accountless mode routine

πŸ‘©β€βš•οΈ
direct deposit contract address
directDepositFee
direct deposit type
PreparedTransaction
DirectDeposit