Local development
How to use the cleartext relayer for local Hardhat nodes and custom chain deployments without a KMS or gateway.
The SDK ships a cleartext() relayer factory that creates a cleartext relayer, replacing FHE operations with cleartext operations. Values are stored as plaintext on-chain — no KMS, no gateway, no WASM. Use it for local Hardhat nodes, custom testnets, or any chain where you deploy FHEVM contracts in cleartext mode.
The cleartext() relayer factory implements the same RelayerSDK interface as web() and node(), so the rest of your code stays unchanged.
Cleartext mode is blocked on Ethereum Mainnet (chain 1) and Sepolia (chain 11155111). It is intended for development and testing only.
SDK setup
1. Install packages
npm install @zama-fhe/sdk viem2. Use the cleartext() relayer with createConfig
import { createConfig } from "@zama-fhe/sdk/viem";
import { cleartext, ZamaSDK, memoryStorage } from "@zama-fhe/sdk";
import { hardhat } from "@zama-fhe/sdk/chains";3. Create the config with a Hardhat chain
For a local Hardhat network, use the built-in hardhat chain object:
const config = createConfig({
chains: [{ ...hardhat, executorAddress: "0xYourExecutorAddress" }],
publicClient,
walletClient,
storage: memoryStorage,
relayers: { [hardhat.id]: cleartext() },
});
const sdk = new ZamaSDK(config);The executorAddress is the deployed CleartextFHEVMExecutor contract address from your Hardhat setup. It must be set on the chain definition — cleartext() picks it up automatically.
4. Use the SDK normally
The wrapper API works the same as in production setups:
5. (Optional) Create a custom config for your own chain
If you deploy FHEVM contracts on a custom chain or at different addresses than the default ones, pass all required fields to the chain definition used with the cleartext() relayer factory:
Where to find these addresses:
aclContractAddress
Deployed ACL contract address
executorAddress
Deployed CleartextFHEVMExecutor contract address
verifyingContractAddressDecryption
Decryption contract on the gateway chain
verifyingContractAddressInputVerification
InputVerification contract on the gateway chain
gatewayChainId
The chain ID where gateway contracts are deployed
Next steps
RelayerCleartext reference — the cleartext relayer and its chain-definition fields
Configuration — production setup with
web()ornode()relayer factoriesChain Objects — pre-configured chain definitions for Mainnet, Sepolia, and more
Last updated