Skip to main content

Overview

The ShieldedZcashKeystoreAdapter runs a WebZjs light-client in the browser to:
  • Derive shielded (zs1...) and unified (u1...) addresses from a mnemonic.
  • Scan the blockchain for shielded notes belonging to the wallet.
  • Build and sign shielded transfer transactions.
Shielded ZEC is the only privacy-preserving asset LeoKit supports natively in-wallet. Transparent (t1.../t3...) ZEC is handled by the regular UTXO flow.

Connect

The adapter is lazy-loaded — pulling in the WebZjs WASM only when the user actually opts in.

Read Balance

Sync the Light Client

Shielded ZEC requires scanning the chain for notes belonging to the wallet. The first sync can take minutes; subsequent syncs are incremental.
The scan runs in the background; getShieldedZcashBalance reads from the in-memory note set, so refresh whenever a onProgress event reports new notes.

Address Helpers

Shielded Transfers

Shielded transfers are built via the protocol layer rather than sdk.transfer(). The shielded protocol handler exposes:
Through sdk.executeSwap, the SDK automatically selects the shielded protocol when the source asset is shielded ZEC. For non-swap shielded sends, see the SDK README’s “Shielded Transfers” section.

Notes

  • The first chain scan downloads ~1 GB of compact-block data. Run it on a fast connection and persist the WebZjs state to IndexedDB across sessions.
  • Shielded ZEC swaps are routed through mayachain (and increasingly near via shielded-pool support); the ShieldedZcashProtocol handler abstracts this.
  • A user-friendly setup wizard is built into LeoDex; reuse the same ShieldedZcashKeystoreAdapter API to clone that flow.