Skip to main content

Multi-Chain

Privacy Boost supports operating across multiple EVM-compatible blockchains from a single SDK instance. Your cryptographic identity (keys) is shared across all chains, while each chain maintains its own authentication state, balances, and transaction history.

How It Works

The multi-chain architecture has two layers:
  1. Parent SDK (PrivacyBoost): initialized once with your primary chain. Holds your identity keys.
  2. Chain clients: created per chain from the parent. Each has its own server connection, JWT, and chain state, but shares the parent’s identity. On TypeScript and React this is a ChainClient from sdk.forChain(); on React Native, iOS, and Android it is a ChainContextHandle from sdk.createChainContext().
This means you authenticate once per chain, but your privacy address is consistent across all of them, on every platform.

Quick Example

ChainClient Configuration

Only serverUrl is required. All other fields are auto-discovered from the chain’s server /api/v1/info endpoint. On React Native, iOS, and Android the equivalent record is ChainContextConfig. It takes the same serverUrl, shieldContractAddress, wethContractAddress, rpcUrl, and teePublicKey, but chainId and timeoutMs (request timeout in milliseconds) are required, and there is no tokenRegistryAddress field.

Caching

Chain clients are cached by serverUrl. Calling sdk.forChain() with the same URL returns the same instance:
This means you can call sdk.forChain() freely in components or functions without worrying about creating duplicate clients. createChainContext() on React Native, iOS, and Android does not cache: every call returns a new handle with its own session, so create each handle once and hold on to it.

Per-Chain Authentication

Each chain client must be authenticated independently. The authentication uses shared identity keys from the parent SDK, but obtains a separate JWT for each chain’s server.
On React Native, iOS, and Android, ChainContextHandle.authenticate(wallet) takes only the wallet delegate; the key source and token provider come from the parent, and the handle exposes chainId(), isAuthenticated(), and isRegistered() as methods.

Available Operations

A ChainClient provides the same core operations as the parent SDK: A native ChainContextHandle carries the operations whose state is per chain: shield, unshield, send and batch send, WETH unwrapping, note consolidation, balances and the token catalog, fees, status polling, history (including queryTransactionHistory), unspent notes, pending-transaction tracking, and claimable transfers. Portal deposits, earn and swap, and the private treasury (contacts and labels) stay on the root PrivacyBoost instance, as do identity lookup and the amount utilities. The two do not scope an identical set, and the difference is worth knowing before you write code against both: Gifts are root-bound on TypeScript because the browser key vault they run in is fixed to the root SDK’s chain; audit and campaigns are root-only on the native bindings because the core chain context does not carry them yet. Anything marked root only rejects on a chain-scoped client rather than silently reading the wrong chain.

Identity Lookup

Look up a user’s privacy address on a specific chain:
On React Native, iOS, and Android, resolveIdentity lives on the parent PrivacyBoost. A privacy address is chain-independent, so the result is valid on every handle.

Cleanup

Chain clients are disposed automatically when the parent SDK is disposed. You can also dispose individual clients:
On React Native, iOS, and Android each handle has clearSession(), which drops that chain’s JWT while the parent’s identity stays intact. The parent’s clearSession() and lock() do not reach handles (lock() wipes the keys they share but leaves each handle’s JWT in place), so clear each one you created; logout() on the parent clears the identity every handle shares.

Next Steps

TypeScript Multi-Chain Guide

Detailed TypeScript examples and patterns

React Multi-Chain Guide

React hooks and component patterns for multi-chain

React Native Multi-Chain Guide

ChainContextHandle patterns for React Native

iOS Multi-Chain Guide

ChainContextHandle patterns in Swift

Android Multi-Chain Guide

ChainContextHandle patterns in Kotlin

Configuration

SDK configuration and auto-discovery

Authentication

Authentication methods and wallet integration