[dev] while creating an instance. from where can I get the fhe lib address on other networks

Hey Zama team, while creating an instance. from where can I get the fhe lib address on other networks ?

const initInstance = async () => {
  // 1. Get chain id
  const chainIdHex = await window.ethereum.request({ method: "eth_chainId" });
  const chainId = parseInt(chainIdHex, 16);

  // Get blockchain public key
  const ret = await provider.call({
    // fhe lib address, may need to be changed depending on network
    to: "0x000000000000000000000000000000000000005d",
    // first four bytes of keccak256('fhePubKey(bytes1)') + 1 byte for library
    data: "0xd9d47bb001",
  });
  const decoded = ethers.AbiCoder.defaultAbiCoder().decode(["bytes"], ret);
  const publicKey = decoded[0];

  // Create instance
  return createInstance({ chainId, publicKey, keypairs });
};

@benoit @clement

It depends of the network, you can see the address in their documentation. By default, it’s this address for all network using fhEVM.

No ser, check below . The red one is the error that I am getting when I am trying to create that instance.

data out-of-bounds (buffer=0x, length=0, offset=32, code=BUFFER_OVERRUN, version=6.6.4)

instance = await getInstance();

Which network are you using? If you’re using our devnet, you need fhevmjs 0.4.0. If you’re using INCO or Fhenix network, check their documentation.

I am using an L3 network deployed using conduit[dot]xyz

Does your blockchain integrate fhEVM? fhEVM is a modified EVM which integrates FHE operators. If not, you can’t use fhevm packages and libraries.