fhEVM
WebsiteLibrariesProduct & ServicesDevelopersSupport
0.6
0.6
  • Welcome to fhEVM
  • White paper
  • Getting Started
    • Overview
    • Quick Start
      • Remix
        • 1. Setting up Remix
        • 2. Connect your wallet to Remix
        • 3. Deploying ConfidentialERC20
        • 4. Interacting with the contract
      • Hardhat
        • Prerequisites
        • 1. Setting up Hardhat
        • 2. Writing contracts
        • 3. Testing in mocked mode
        • 4. Deploying the contract
        • 5. Interacting with the contract
  • Tutorials
    • See all tutorials
  • Smart contract
    • Key features
    • Configuration
    • FhEVM contracts
    • Supported types
    • Operations on encrypted types
    • Access Control List
      • ACL examples
    • Encrypted Inputs
    • Decryption
      • Decryption
      • Decryption in depth
      • Re-encryption
    • If sentences
    • Branching in FHE
    • AsEbool, asEuintXX, asEaddress and asEbytesXX operations
    • Generate random numbers
    • Error handling
    • Gas estimation
    • Debug decrypt
    • Using Foundry
  • Frontend
    • Setup
    • Build a web application
    • Using React.js
    • Using Next.js
    • Using Vue.js
    • Using Node or Typescript
    • Using the CLI
    • Common webpack errors
  • Explanations
    • Architectural overview
    • FHE on blockchain
    • fhEVM components
    • Encryption, decryption, re-encryption, and computation
  • References
    • Table of all addresses
    • Smart contracts - fhEVM API
    • Frontend - fhevmjs lib
    • Repositories
  • Developer
    • Contributing
    • Development roadmap
    • Release note
    • Feature request
    • Bug report
    • Status
Powered by GitBook

Libraries

  • TFHE-rs
  • Concrete
  • Concrete ML
  • fhEVM

Developers

  • Blog
  • Documentation
  • Github
  • FHE resources

Company

  • About
  • Introduction to FHE
  • Media
  • Careers
On this page
  • Installation
  • Encrypting Data
  • Syntax
  • Example Usage

Was this helpful?

Export as PDF
  1. Frontend

Using the CLI

PreviousUsing Node or TypescriptNextCommon webpack errors

Last updated 3 months ago

Was this helpful?

The fhevmjs Command-Line Interface (CLI) tool provides a simple and efficient way to encrypt data for use with the blockchain's Fully Homomorphic Encryption (FHE) system. This guide explains how to install and use the CLI to encrypt integers and booleans for confidential smart contracts.

Installation

Ensure you have installed on your system before proceeding. Then, globally install the fhevmjs package to enable the CLI tool:

npm install -g fhevmjs

Once installed, you can access the CLI using the fhevm command. Verify the installation and explore available commands using:

fhevm help

To see specific options for encryption, run:

fhevm encrypt help

Encrypting Data

The CLI allows you to encrypt integers and booleans for use in smart contracts. Encryption is performed using the blockchain's FHE public key, ensuring the confidentiality of your data.

Syntax

fhevm encrypt --node <NODE_URL> <CONTRACT_ADDRESS> <USER_ADDRESS> <DATA:TYPE>...
  • --node: Specifies the RPC URL of the blockchain node (e.g., http://localhost:8545).

  • <CONTRACT_ADDRESS>: The address of the contract interacting with the encrypted data.

  • <USER_ADDRESS>: The address of the user associated with the encrypted data.

  • <DATA:TYPE>: The data to encrypt, followed by its type:

    • :64 for 64-bit integers

    • :1 for booleans

Example Usage

Encrypt the integer 71721075 (64-bit) and the boolean 1 for the contract at 0x8Fdb26641d14a80FCCBE87BF455338Dd9C539a50 and the user at 0xa5e1defb98EFe38EBb2D958CEe052410247F4c80:

fhevm encrypt --node http://localhost:8545 0x8Fdb26641d14a80FCCBE87BF455338Dd9C539a50 0xa5e1defb98EFe38EBb2D958CEe052410247F4c80 71721075:64 1:1
Node.js