Skip to main content

Installation & Basics

Installation

To get started with fhenix.js, you need to install it as a dependency in your JavaScript project. You can do this using npm (Node Package Manager) or Yarn. Open your terminal and navigate to your project's directory, then run the following:

yarn add fhenixjs

Usage

When initializing a new Fhenix Client we need to inject it with a provider - this can be a provider from any of your favorite web3 libraries - ethers, hardhat, web3js, etc.

import { FhenixClient } from 'fhenixjs';
import { JsonRpcProvider } from 'ethers';

// initialize your web3 provider
const provider = new JsonRpcProvider('https://api.helium.fhenix.zone');

// initialize Fhenix Client
const client = new FhenixClient({provider});

// to encrypt data for a Fhenix contract
let encrypted = await client.encrypt(5, EncryptionTypes.uint8);

// ...
// contract logic goes here
// ...

// to unseal data returned from a Fhenix contract
const cleartext = client.unseal(contractAddress, sealed);

Full Documentation

For a full list of all fhenix.js methods and classes please visit the fhenixjs documentation here.

Help!

If you experience any issues, or for general questions, support, or anything else join our Discord!