Skip to main content

getBalance()

getBalance() is a function from privacycash-evm used to retrieve your private ETH or ERC-20 balance from Privacy Cash on an EVM network.

Parameters

Return Value

Example Usage


Auto-Refresh Pattern

Re-fetch the balance after a deposit or withdrawal completes by tracking a change counter:

How It Works

getBalance() scans all historic NewCommitment events from the Privacy Cash contract and attempts to decrypt each one locally using the key derived from your signature. UTXOs that decrypt successfully and have not been spent are summed to produce your total balance. No private data leaves the client.