Skip to content

Latest commit

 

History

History
49 lines (41 loc) · 1.98 KB

File metadata and controls

49 lines (41 loc) · 1.98 KB

Setup

The use of @zama-fhe/relayer-sdk requires a setup phase. This consists of the instantiation of the FhevmInstance. This object holds all the configuration and methods needed to interact with an FHEVM using a Relayer. It can be created using the following code snippet:

import { createInstance } from '@zama-fhe/relayer-sdk';

const instance = await createInstance({
  // ACL_CONTRACT_ADDRESS (FHEVM Host chain)
  aclContractAddress: '0xf0Ffdc93b7E186bC2f8CB3dAA75D86d1930A433D',
  // KMS_VERIFIER_CONTRACT_ADDRESS (FHEVM Host chain)
  kmsContractAddress: '0xbE0E383937d564D7FF0BC3b46c51f0bF8d5C311A',
  // INPUT_VERIFIER_CONTRACT_ADDRESS (FHEVM Host chain)
  inputVerifierContractAddress: '0xBBC1fFCdc7C316aAAd72E807D9b0272BE8F84DA0',
  // DECRYPTION_ADDRESS (Gateway chain)
  verifyingContractAddressDecryption:
    '0x5D8BD78e2ea6bbE41f26dFe9fdaEAa349e077478',
  // INPUT_VERIFICATION_ADDRESS (Gateway chain)
  verifyingContractAddressInputVerification:
    '0x483b9dE06E4E4C7D35CCf5837A1668487406D955',
  // FHEVM Host chain id
  chainId: 11155111,
  // Gateway chain id
  gatewayChainId: 10901,
  // Optional RPC provider to host chain
  network: 'https://eth-sepolia.public.blastapi.io',
  // Relayer URL
  relayerUrl: 'https://relayer.testnet.zama.org',
});

or the even simpler:

import { createInstance, SepoliaConfig } from '@zama-fhe/relayer-sdk';

const instance = await createInstance(SepoliaConfig);

The information regarding the configuration of Sepolia's FHEVM and associated Relayer maintained by Zama can be found in the SepoliaConfig object or in the contract addresses page. The gatewayChainId is 10901. The chainId is the chain-id of the FHEVM chain, so for Sepolia it would be 11155111.

{% hint style="info" %} For more information on the Relayer's part,please refer to the Relayer SDK documentation. {% endhint %}