AvaCloud UI Kit
Components

Privacy flows

eERC

Use the eERC entrypoint when your product needs encrypted balances, private transfers, and optional converter flows that move between public and encrypted value.

Separate entrypointStandalone + converterLive demos included

Modes

Standalone and converter

Use standalone when the encrypted token is the source of truth, or converter mode when bridging from a public ERC-20.

Operational needs

Circuit artifacts required

Both modes depend on browser-loadable circuit URLs for register, transfer, mint, withdraw, and burn.

Docs coverage

Theory + live flow

This page combines config guidance with runnable standalone and converter demos.

Understand the contract shape

Start with shared circuit configuration, then decide between standalone and converter deployment modes.

Validate the flow in-browser

Use the live demos to exercise setup, balance inspection, deposit/withdraw, and transfer behavior.

Install

For apps already using the kit:

pnpm add @avalabs/eerc-sdk

Minimal base install before eERC:

pnpm add @avalabs/avacloud-kit-ui-preview react react-dom

If your workspace requires explicit peer installs, add:

pnpm add wagmi viem @tanstack/react-query @connectrpc/connect @connectrpc/connect-query

For browser apps, import the polyfill entry once before your app renders:

import '@avalabs/avacloud-kit-ui-preview/eerc-polyfills';

If you use Next.js with webpack, you also need the webpack workaround below. next/dynamic(..., { ssr: false }) is not enough on its own because webpack still resolves the EERC SDK module graph at build time.

const nextConfig = {
  webpack: (config, { isServer, webpack }) => {
    config.plugins.push(
      new webpack.NormalModuleReplacementPlugin(/^node:/, (resource) => {
        resource.request = resource.request.replace(/^node:/, '');
      }),
    );

    if (!isServer) {
      config.resolve.fallback = {
        ...config.resolve.fallback,
        crypto: false,
        fs: false,
        path: false,
        stream: false,
        os: false,
        buffer: false,
      };
    }

    return config;
  },
};

export default nextConfig;

Shared Config

Standalone and converter mode both use the same five circuit artifacts. Only the contract config changes.

import type { EercCircuitConfig, EercContractConfig } from '@avalabs/avacloud-kit-ui-preview/eerc';

export const EERC_STANDALONE: EercContractConfig = {
  contractAddress: '0x...',
};

export const EERC_CONVERTER: EercContractConfig = {
  contractAddress: '0x...',
  tokenAddress: '0x...',
};

const CUSTOM_CIRCUITS: EercCircuitConfig = {
  register: {
    wasm: 'https://example.com/eerc/registration/registration.wasm',
    zkey: 'https://example.com/eerc/registration/circuit_final.zkey',
  },
  transfer: {
    wasm: 'https://example.com/eerc/transfer/transfer.wasm',
    zkey: 'https://example.com/eerc/transfer/transfer.zkey',
  },
  mint: {
    wasm: 'https://example.com/eerc/mint/mint.wasm',
    zkey: 'https://example.com/eerc/mint/mint.zkey',
  },
  withdraw: {
    wasm: 'https://example.com/eerc/withdraw/withdraw.wasm',
    zkey: 'https://example.com/eerc/withdraw/circuit_final.zkey',
  },
  burn: {
    wasm: 'https://example.com/eerc/burn/burn.wasm',
    zkey: 'https://example.com/eerc/burn/burn.zkey',
  },
};

export const EERC_DEMO_OVERRIDE: EercContractConfig = {
  contractAddress: '0x...',
  circuitUrls: CUSTOM_CIRCUITS,
};

circuitUrls is optional in both EercContractConfig and EercProviderProps. When you omit it, EercProvider uses the shared AvaCloud bundle under https://assets.avacloud.io/eerc/v0.0.4/<circuit>/... by default. For example, registration resolves to .../registration/registration.wasm and .../registration/circuit_final.zkey. Pass circuitUrls only when you need a different bundle, such as demo contracts or a self-hosted verifier set. The package also exports DEFAULT_EERC_CIRCUIT_URLS if you want to inspect or reuse the hosted defaults directly.

Any override must still include all five entries: register, transfer, mint, withdraw, and burn. Circuit URLs must be browser-loadable paths or HTTPS URLs.

The predeployed demo contracts on this page use demo-specific circuit overrides. Fresh kit deployments target the shared v0.0.4 bundle by default.

Mode Overview

ModeRequired configPrimary UI surfaceCommon actions
StandalonecontractAddress + optional circuitUrls overrideEercTransferForm, EercMintForm, EercBurnFormsetup, register, view decrypted balance, private transfer, owner mint, user burn
ConvertercontractAddress + optional circuitUrls override (tokenAddress when selecting a public token)EercConverterDepositForm, EercConverterWithdrawForm, useEercConvertersetup, register, deposit, withdraw, private transfer

Standalone Mode

Use standalone mode when the encrypted token is the token of record.

import {
  EercBalance,
  EercBurnForm,
  EercGate,
  EercMintForm,
  EercProvider,
  EercTransferForm,
} from '@avalabs/avacloud-kit-ui-preview/eerc';

export function StandaloneExample() {
  return (
    <EercProvider {...EERC_STANDALONE}>
      <EercGate featureName="encrypted transfers" withCard={false}>
        <EercBalance />
        <EercTransferForm />
        <EercMintForm />
        <EercBurnForm />
      </EercGate>
    </EercProvider>
  );
}

Use standalone when:

  • there is no separate public ERC-20 backing asset
  • you want direct encrypted balance operations
  • the contract owner can mint to any registered standalone recipient
  • registered users can burn from their own encrypted balance

Converter Mode

Use converter mode when you want to wrap a public ERC-20 and move between public and encrypted balances.

import {
  EercBalance,
  EercConverterDepositForm,
  EercConverterWithdrawForm,
  EercGate,
  EercProvider,
  EercTransferForm,
  useEercConverter,
} from '@avalabs/avacloud-kit-ui-preview/eerc';

function CustomConverterActions() {
  const { deposit, withdraw, status, error } = useEercConverter();

  return null;
}

export function ConverterExample() {
  return (
    <EercProvider {...EERC_CONVERTER}>
      <EercGate featureName="encrypted converter" withCard={false}>
        <EercBalance />
        <EercConverterDepositForm />
        <EercConverterWithdrawForm />
        <EercTransferForm />
      </EercGate>
    </EercProvider>
  );
}

Converter-specific notes:

  • converter deployment is not permanently bound to one ERC-20; tokenAddress is just the currently selected public token for converter balance, deposit, and withdraw flows
  • converter decimals are the encrypted-side precision stored on the eERC contract, not the underlying ERC-20's decimals
  • when the selected ERC-20 uses a different decimal count, deposits and withdrawals scale against the converter contract's fixed precision
  • 18 is the safest default if one converter should support many different ERC-20s
  • EercConverterDepositForm handles ERC-20 approval automatically when allowance is too low
  • approval defaults to exact amount rather than unlimited approval
  • EercConverterWithdrawForm converts encrypted balance back into the public ERC-20
  • the docs demo includes a faucet so you can test the full flow on Fuji without leaving the page

Fuji Demo Addresses

The docs demos run on Fuji chain 43113. Keep these contract addresses nearby while testing the standalone and converter flows.

Standalone
eERC Standalone Contract
Use this address when testing the standalone setup, balance, and private transfer flow.
0x5E9c6F952fB9615583182e70eDDC4e6E4E0aC0e0
View on Explorer
Converter
eERC Converter Contract
Use this address when testing deposit, withdraw, and private transfer in converter mode.
0x372dAB27c8d223Af11C858ea00037Dc03053B22E
View on Explorer
Token
Demo ERC-20 Token
This is the public token wrapped by the converter demo before balances become encrypted.
0xb0Fe621B4Bd7fe4975f7c58E3D6ADaEb2a2A35CD
View on Explorer

Live Demos

Standalone Live Demo

Connect a Fuji wallet to complete eERC setup, view your encrypted balance, and test standalone transfer and the demo contract's custom mint policy. The burn card is shown but disabled because this predeployed standalone contract uses an older burn implementation than the current kit target.

Converter Live Demo

Connect a Fuji wallet to request demo tokens, move between public and encrypted balance, and test a private transfer in converter mode.

Deploy Your Own eERC

Use the deployment wizard to deploy a full eERC contract stack (cryptographic library, verifiers, registrar, and token) to any EVM chain. The wizard walks through chain selection, mode configuration, infrastructure deployment, token deployment, and optional auditor assignment.

After deployment, you will receive all contract addresses and can download them as JSON for your records.

Fresh deployments use the shared v0.0.4 artifact set by default, and this docs wizard now uses that default directly.

Bundler Notes

For Vite/browser SPA apps, the eerc-polyfills import above is enough.

For Next.js, use the webpack config above in addition to the polyfill import.

On this page