Hello,
I’m having some trouble with re-encrypting some data and getting the final result. I’m running my code through a console with node js (no browser). so I’m not sure how to set the signature. Following is my code
contract:
contract Variance{
address public manager;constructor() { manager = msg.sender; //For contract developer specific functionalities. }
function calculateVarianceNumerator() public view returns (euint16) {
euint16 sequenceSum = TFHE.NIL16;
for(uint i=0; i<sequence.length; i++){
// sequenceSum = TFHE.add(sequenceSum, sequence[i]);
}
// address add = 0x4E755603d4DabD2C9bBd15993775073C581B54c7;
// TFHE.allow(sequenceSum, add);
return sequenceSum;
}
js:
const interact = async () => {
const instance = await getInstance();const { publicKey, privateKey } = instance.generateKeypair();
const enc_variance = await contract.calculateVarianceNumerator();
console.log(instance.reencrypt(
enc_variance, // the encrypted balance
privateKey, // the private key generated by the dApp
publicKey, // the public key generated by the dApp
ethers.Signature, // the user’s signature of the public key
CONTRACT_ADDRESS, // The contract address where the ciphertext is
USER_ADDRESS, // The user address where the ciphertext is
));
};
I’m getting the error
Promise {
Error: You must provide the ACL address.
at Object.reencrypt (C:\Users\r\node_modules\fhevmjs\lib\node.cjs:2658:15)
at interact (C:\Users\r\Downloads\calculate_variancev2.js:76:24)
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
}
I have tried TFHE.allow as well but that throws another error (sender not allowed)
How do I set the signature if I’m not using a browser and how to resolve the ACL issue? thanks