Skip to main content
Connect to an FHE-enabled contract, encrypt a value, send it on-chain, and decrypt the result — all from JavaScript.

Prerequisites

  • Node.js 18+
  • A deployed FHE contract on a supported network (e.g. Sepolia)
  • A wallet with testnet ETH

1. Install

2. Create and connect the client

Import from @cofhe/sdk/web for browser apps or @cofhe/sdk/node for Node.js scripts.
If you use Ethers.js instead of viem, see the Client Setup guide for adapter usage.

3. Encrypt and send

4. Decrypt for display

Next steps