Simple homomorphic addition

I wanted to do a simple homomorhic addition on my smart contract but i am facing the following problems:
1.The bytes calldata which is the encrypted data what am i supposed to give there?
2.Is this suitable for truffle suite as i am working using it.
3.I am getting invalid opcode whie trying to deploy your simple counter code ??
Please help .


  1. The bytes calldata is the encrypted input with the FHE blockchain public key. You need to use fhevmjs to encrypt your data with the blockchain public key. Getting started - fhEVM
  2. No, the library calls precompiled contract so you need these precompiles contract. To run your contract, you need to run your test suite on a real fhEVM. You can run a node using the fhEVM with docker Local dev node - fhEVM
    Also, you can use our hardhat template which includes everything Using Hardhat - fhEVM
    Last thing regarding this subject, we introduced “mocks” to run your contract on a simple EVM node. Since it needs some wire, you need to use our hardhat template to use it.
  3. It’s probably because you compiled your contract with a Solidity ^0.8.20 and our previous stack doesn’t support new introduced opcode PUSH0. This has been solved with our new stack and this kind of issue won’t appear if you’re using our template since everything is configured correctly.