Documentation Index
Fetch the complete documentation index at: https://cofhe-docs.fhenix.zone/llms.txt
Use this file to discover all available pages before exploring further.
@cofhe/hardhat-plugin extends Hardhat with everything you need to build and test FHE-enabled contracts locally — mock contracts, a pre-configured CoFHE client, and test utilities.
What the plugin provides
- Mock contracts deployed automatically on every
npx hardhat test/npx hardhat noderun, simulating the full CoFHE coprocessor stack on the Hardhat network. hre.cofhe— a namespaced API for creating and connecting CoFHE clients with Hardhat signers.hre.cofhe.mocks— utilities for reading raw plaintext values and interacting with mock contracts directly in tests.- Pre-configured networks —
localcofhe,eth-sepolia, andarb-sepoliaare injected automatically.
Installation
Configuration
The plugin adds an optionalcofhe key to your Hardhat config:
hardhat.config.ts
mocksDeployVerbosity controls how much output the plugin prints while deploying the mock contracts at the start of each npx hardhat test / npx hardhat node run:
| Value | Output |
|---|---|
'' | Silent — no deploy lines. |
'v' | Single summary line per mock (default since 0.5.0). |
'vv' | Full per-contract deployment log, including each contract’s deployed address. |
logMocks, which controls runtime FHE-op logging (printed when your tests actually call FHE.*).
Pre-configured networks
The following networks are injected automatically. You can override any of them by defining the same key undernetworks in your config.
| Network | URL | Chain ID |
|---|---|---|
localcofhe | http://127.0.0.1:42069 | — |
eth-sepolia | Ethereum Sepolia public RPC | 11155111 |
arb-sepolia | Arbitrum Sepolia public RPC | 421614 |
PRIVATE_KEY (and optionally SEPOLIA_RPC_URL / ARBITRUM_SEPOLIA_RPC_URL) in your environment.
Auto-deployment
Mock contracts are deployed automatically before:npx hardhat testnpx hardhat node
Next steps
- Client — create and connect a CoFHE client in tests.
- Mock Contracts — read plaintext values and interact with mock contracts.
- Logging — inspect FHE operations in test output.
- Testing — end-to-end test patterns.