Skip to main content

Multi-Chain

The Android SDK currently does not expose a native chain-context API — PrivacyBoost is initialized against a single chain via its config. Multi-chain support exists in the underlying Rust core and is exposed today on the TypeScript, React Native, and Web/WASM SDKs.
For an architectural overview of how multi-chain identity works, see Multi-Chain Concepts. The same identity keys and privacy address apply across chains regardless of which SDK creates them.

Single-Chain Setup

Pick a chain at SDK init time:
Switching chains is a config swap — tear down the current SDK and instantiate a new one with the new server URL and chainId.

Multiple SDK Instances (Workaround)

If you need to operate on more than one chain in a single app session, you can instantiate one PrivacyBoost per chain. Each instance keeps its own JWT and chain state, but you must authenticate each one separately.

Caveats

  • Persistence collisions. Both instances will try to read/write the same Keystore entries if you pass persistenceStorage/persistenceUnlock. Either leave persistence off (null) on the secondary instances, or use distinct appIds — but distinct app IDs mean distinct identities, which defeats the multi-chain story.
  • Re-derivation per chain. Each instance derives keys via the wallet signature and re-issues a JWT, so the user signs once per chain.
  • No cross-instance state. Pending transactions, balances, and history are siloed per instance — your app code must aggregate.
  • No proper resource sharing. The multi-chain ChainContext API on TS/RN/Web shares one identity and only multiplexes the chain JWT; with multiple Android SDK instances you pay the full proving / state init cost on each one.
This pattern is suitable for showing balances or running occasional cross-chain operations. For production multi-chain UX, prefer the chain-context API on the platforms that expose it, or wait for native Android support.

Operating per Chain

Once authenticated, the API surface is identical across instances:

Parallel Operations

Use coroutines to fan out:

Aggregating Balances

Roadmap

A native ChainContextHandle for Android — mirroring the React Native and TypeScript surfaces — is planned. When available, it will replace the multi-instance workaround with a single SDK instance that multiplexes JWTs and shares identity keys.

Next Steps