Skip to content

oxatik/fhenix-cli-toolkit

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

53 Commits
 
 
 
 

Repository files navigation

Fhenix CLI Toolkit

A developer CLI for interacting with Fhenix CoFHE — the FHE Coprocessor powering confidential computation on Ethereum.


What is Fhenix CoFHE?

CoFHE (Confidential on Fully Homomorphic Encryption) is Fhenix's off-chain FHE Coprocessor. It executes encrypted computations on behalf of EVM smart contracts — without ever decrypting the data on-chain.

Smart Contract → emits FHE event → CoFHE Pipeline → Encrypted Result → On-chain
                                         │
                            ┌────────────▼──────────────┐
                            │  Validation → fheOS       │
                            │  Execution → Publishing   │
                            │  Threshold Network (MPC)  │
                            └───────────────────────────┘

Key features:

  • 50x faster decryption than competitors via Threshold Network
  • Single Solidity importimport {FHE} from "@fhenixprotocol/cofhe-contracts/FHE.sol"
  • EVM-compatible — Arbitrum, Ethereum, any L2
  • Quantum-resistant — TFHE lattice-based cryptography
  • EigenLayer-secured — cryptoeconomic fraud proof guarantees

Installation

# Clone the repo
git clone https://github.com/oxatik/fhenix-cli
cd fhenix-cli

# Install dependencies
npm install

# Build TypeScript
npm run build

# Link globally (optional)
npm link

Usage

fhenix <command> [options]

Commands

Command Description
fhenix encrypt Encrypt a value using CoFHE FHE types
fhenix decrypt Unseal a ciphertext via Threshold Network
fhenix wallet Generate/import/show/balance wallet
fhenix network List/switch/status of CoFHE networks
fhenix permit Create/show/revoke PermitV2 access tokens
fhenix contract View Solidity templates, call contracts
fhenix info CoFHE architecture, FHE types, resources

fhenix encrypt

Encrypt a plaintext value into an FHE ciphertext handle (ctHash).

fhenix encrypt --value 42 --type uint32
fhenix encrypt --value true --type bool
fhenix encrypt --value 0xDEAD...BEEF --type address
fhenix encrypt --value 100 --type uint32 --show-pipeline

Supported FHE types: bool, uint8, uint16, uint32, uint64, uint128, uint256, address


fhenix decrypt / fhenix unseal

Unseal an encrypted ciphertext handle via CoFHE Threshold Decryption Network.

fhenix decrypt --cthash 0xabc123... --type uint32
fhenix unseal  --cthash 0xabc123... --type bool --show-pipeline

fhenix wallet

Manage your local Ethereum wallet for testnet interaction.

fhenix wallet generate          # Create a new wallet
fhenix wallet import --key 0x.. # Import by private key
fhenix wallet show              # Show address
fhenix wallet show --reveal-key # Show private key (dangerous!)
fhenix wallet balance           # Fetch ETH balance from RPC

Wallets are saved to ~/.fhenix/wallet.json with mode 600.


fhenix network

Switch between CoFHE-supported networks.

fhenix network list                          # Show all networks
fhenix network use arbitrum-sepolia          # Switch network
fhenix network use eth-sepolia
fhenix network use localhost
fhenix network status                        # Ping RPC + show CoFHE components

Supported Networks:

ID Name Chain ID
arbitrum-sepolia Arbitrum Sepolia (CoFHE Testnet) 421614
eth-sepolia Ethereum Sepolia 11155111
localhost Local Hardhat 31337

fhenix permit

Generate and manage PermitV2 — CoFHE's access control system for decrypting sealed values.

fhenix permit create                          # Create a permit (30 days default)
fhenix permit create --contract 0x... --project FHERC20 --days 7
fhenix permit show                            # Show active permit
fhenix permit revoke                          # Delete local permit

Permits are saved to ~/.fhenix/permit.json.


fhenix contract

View Solidity templates and interact with CoFHE contracts.

fhenix contract template --list              # List all templates
fhenix contract template --name counter      # View EncryptedCounter template
fhenix contract template --name fherc20      # View fhERC-20 token template
fhenix contract template --name vote         # View Private Voting template
fhenix contract template --name counter > Counter.sol  # Save to file
fhenix contract call --address 0x... --function "getCount()" --type uint32
fhenix contract addresses                    # Known CoFHE contract addresses

fhenix info

Display CoFHE architecture and resources.

fhenix info                  # Overview
fhenix info --pipeline       # Visual CoFHE pipeline diagram
fhenix info --fhe-types      # All FHE Solidity types (euint32, ebool, etc.)

CoFHE Pipeline

[1] Event Ingestion       Smart contract emits FHE operation event
[2] Validation            ZK-proves encrypted input correctness
[3] Queued Execution      Batched TFHE ops (100 ops/worker)
[4] FHE Computation       fheOS runs encrypted computation
[5] Result Publishing     Encrypted result posted back on-chain
[6] Threshold Decryption  MPC nodes cooperate to decrypt (only if needed)

Solidity Templates

Encrypted Counter

import {FHE, euint32, InEuint32} from "@fhenixprotocol/cofhe-contracts/FHE.sol";

contract EncryptedCounter {
    euint32 private counter;

    function add(InEuint32 calldata encryptedValue) public {
        euint32 value = FHE.asEuint32(encryptedValue);
        counter = counter + value;
    }
}

View all templates: fhenix contract template --list


Resources

Resource Link
Fhenix Docs https://fhenix.io
CoFHE Docs https://cofhe-docs.fhenix.zone
cofhejs SDK https://github.com/FhenixProtocol/cofhejs
Hardhat Starter https://github.com/FhenixProtocol/cofhe-hardhat-starter
Discord https://discord.gg/fhenix
Arbitrum Sepolia Faucet https://faucet.arbitrum.io

Project Structure

fhenix-cli/
├── src/
│   ├── index.ts              # CLI entry point
│   ├── commands/
│   │   ├── encrypt.ts        # fhenix encrypt
│   │   ├── decrypt.ts        # fhenix decrypt / unseal
│   │   ├── wallet.ts         # fhenix wallet
│   │   ├── network.ts        # fhenix network
│   │   ├── permit.ts         # fhenix permit
│   │   ├── contract.ts       # fhenix contract
│   │   └── info.ts           # fhenix info
│   └── utils/
│       ├── config.ts         # Network configs, FHE types, file I/O
│       └── logger.ts         # Chalk-based display utilities
├── package.json
├── tsconfig.json
└── README.md

License

MIT © oxatik

About

CLI toolkit for Fhenix CoFHE — encrypt, decrypt, wallet, permits & FHE contract templates.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Shell 100.0%