Fhevmjs: Unable to generateKeypair

Hello,

I’m having trouble getting started with the fhevmjs library (updated version). Specifically while trying to generate key pair.

I get RuntimeError: unreachable
at wasm: //wasm/00238686:wasm-function[325]:0x5cfa4
.
.
at module.exports.cryptobox_keygen

Following is part of my js code:
const { createInstance } = require(“fhevmjs”);

const getInstance = async () => {
const { initFhevm } = await import(“fhevmjs”);
await initFhevm(); // Load needed WASM
return createInstance({
chainId: 8009,
networkUrl: “https://devnet.zama.ai/”,
gatewayUrl: “https://gateway.zama.ai”,
// networkUrl: “http://localhost:8545
});
};

const instance = await getInstance();
const { publicKey, privateKey } = instance.generateKeypair();

I’m using the following:
Node 18.18.0
fhevm 0.5.9
fhevmjs 0.5.8

I added ZAMA network to metamask back when Chain ID was 8009, could that be the problem or is it related to a specific library version?

Thanks

Hello!
Probably the issue is related to the chain id. The chain id of the devnet is 9000 now. Also, fhevmjs is working only on node >= 20

updating node version solved the problem. Thank you