Setup
To use Cofhejs for interacting with FHE-enabled smart contracts, you must first initialize it. Thecofhejs client handles key operations such as encrypting input data, creating permits, and decrypting output data from the blockchain.
1
Import required modules
Import the Cofhejs library and your web3 provider library (Ethers.js or Viem).
2
Initialize your web3 provider
Set up your provider and signer based on your environment.
3
Initialize Cofhejs
Initialize the Cofhejs client with your provider and signer.
Next Steps
Now that you have Cofhejs installed and initialized, you’re ready to start building with FHE-enabled smart contracts. Here are the key concepts to learn next:- Learn how encryption works - Understand how to encrypt input data before sending it to smart contracts
- Learn how permits work - Discover how to create permits and manage permissions for encrypted data
- Learn about sealing and unsealing - Master the process of decrypting output data from FHE-enabled contracts
- Understand error handling - Learn how to handle errors and edge cases in your FHE applications