Quick start
Get from zero to a working confidential transfer in under 5 minutes.
Pick your stack. Each tab gets you from install to a working confidential transfer.
The first three tabs are for browser apps (React dApp, vanilla viem, or ethers). The Node.js tabs are for backend services, scripts, and bots that operate on confidential tokens server-side — they run the same FHE runtime server-side and store keys in memory.
In browser apps, prefix client-side variables with NEXT_PUBLIC_ (Next.js) or VITE_ (Vite) so the bundler exposes them.
The SDK runs on all major browsers and Node.js 22+; see Supported environments for the exact floors.
Authentication
The sepolia testnet relayer needs no API key — the preset works as-is, so leave auth unset and move on. You only need a key for the Zama-hosted mainnet relayer; when you deploy there, see Authentication for the backend-proxy (browser) and direct-key (server) patterns.
Install
pnpm add @zama-fhe/sdk @zama-fhe/react-sdk @tanstack/react-query wagmi viempnpm add @zama-fhe/sdk viempnpm add @zama-fhe/sdk etherspnpm add @zama-fhe/sdk viempnpm add @zama-fhe/sdk ethersSet up the SDK
import { WagmiProvider, createConfig, http } from "wagmi";
import { sepolia } from "wagmi/chains";
import { injected } from "wagmi/connectors";
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import { ZamaProvider } from "@zama-fhe/react-sdk";
import { web } from "@zama-fhe/sdk/web";
import { createConfig as createZamaConfig } from "@zama-fhe/react-sdk/wagmi";
import { sepolia as sepoliaFhe, type FheChain } from "@zama-fhe/sdk/chains";
const wagmiConfig = createConfig({
chains: [sepolia],
connectors: [injected()],
transports: { [sepolia.id]: http("https://sepolia.infura.io/v3/YOUR_KEY") },
});
const mySepolia = {
...sepoliaFhe,
relayerUrl: "https://your-app.com/api/relayer/11155111",
} as const satisfies FheChain;
const zamaConfig = createZamaConfig({
chains: [mySepolia],
wagmiConfig,
relayers: { [mySepolia.id]: web() },
});
const queryClient = new QueryClient();
function App() {
return (
<WagmiProvider config={wagmiConfig}>
<QueryClientProvider client={queryClient}>
<ZamaProvider config={zamaConfig}>
<MyTokenPage />
</ZamaProvider>
</QueryClientProvider>
</WagmiProvider>
);
}Your first confidential transfer
The hooks and SDK methods handle FHE encryption, wallet signing, ERC-20 approvals, and cache invalidation automatically.
Next steps
Configuration -- chains, relayers, provider, signer, storage, and authentication setup
Shield Tokens -- move tokens into confidential form
Chain Objects -- pre-configured chain definitions for Sepolia, Mainnet, and more
React Hooks -- provider setup and all available hooks
Security Model -- understand the cryptography and trust assumptions
Last updated