Project case study Personal project

GhostPay.

GhostPay is an enterprise-grade confidential payroll system built natively on Fhenix using Fully Homomorphic Encryption (FHE). Designed to close the institutional adoption gap caused by public blockchain transparency, GhostPay computes salaries, budget validations, and employee balances directly on-chain using encrypted numerical types (euint32), ensuring company compensation remains confidential while preserving public verifiability.

Role
Smart Contract & Privacy Engineer
Domain
Fully Homomorphic Encryption (FHE) · Confidential EVM · Fhenix Network · CoFHE Contracts · Private Payroll

System at a glance

What the system does

01

On-chain encrypted arithmetic (euint32)

02

Client-side encryption via @cofhe/react

03

Gasless cryptographic viewing permits

04

Factory-deployed company payroll vaults

Architecture flow

From intent to verified state.

  1. 01

    A company administrator deploys an isolated payroll vault using the GhostPayFactory smart contract.

  2. 02

    Employee salaries are encrypted in the browser using the Fhenix CoFHE stack before submitting the transaction.

  3. 03

    The contract receives encrypted payloads (InEuint32) and stores them as on-chain encrypted states (euint32).

  4. 04

    When payroll executes, the contract performs homomorphic addition (FHE.add) to verify budget solvency on-chain.

  5. 05

    Employees sign gasless cryptographic permits, allowing only their authorized wallet to decrypt balances via FHE.allowSender.

01 / Homomorphic computation

Direct on-chain execution over encrypted values

Computing over encrypted balances without off-chain provers or decryption leaks.

01.1

Native confidential EVM types

Leverages Fhenix's euint32 and euint64 types to store balances and salary rates without exposing plaintext values to nodes or mempools.

01.2

Homomorphic arithmetic

Performs arithmetic operations (such as summing total payroll or adjusting balances) directly on encrypted ciphertext using FHE.add().

01.3

Eliminating off-chain ZK overhead

Unlike zero-knowledge systems that require heavy off-chain provers, FHE allows developers to write standard Solidity business logic executed by the FHE coprocessor.

02 / Edge encryption

Client-side data protection before transaction dispatch

Encrypting sensitive salary figures at the browser boundary.

02.1

Browser-based encryption

Uses @cofhe/react hooks (useEncrypt) to encrypt salary figures in the client browser before submitting blockchain transactions.

02.2

Encrypted input encapsulation

Transforms plaintext numbers into verified InEuint32 ciphertext payloads bound to the recipient contract address.

02.3

Preventing transaction snooping

Ensures RPC relays and mempool sniffers cannot inspect salary terms or deposit amounts during transaction propagation.

03 / Selective access

Cryptographic permits and granular decryption rights

Permit-based access control protecting employee privacy.

03.1

Gasless CoFHE permits

Employees sign an EIP-712-style cryptographic permit to authenticate their identity to the Fhenix threshold decryption network.

03.2

Contract permissioning

The smart contract uses FHE.allowSender() to grant read access strictly to the authenticated employee's wallet address.

03.3

Private client decryption

Decrypts balance data locally inside the employee's browser session via useDecrypt, ensuring zero server-side exposure.

04 / Contract architecture

Factory deployments and corporate vault isolation

Multi-tenant contract isolation for Web3 companies and DAOs.

04.1

Factory pattern deployment

Companies deploy independent GhostPay vault instances via GhostPayFactory, maintaining full organizational segregation.

04.2

Vault solvency verification

The contract homomorphically evaluates whether the deposited stablecoin balance covers aggregate payroll before approving distribution.

04.3

Safe withdrawal mechanisms

Enables employees to claim their available encrypted balance and withdraw unshielded stablecoins into their designated wallet.

Continue exploring

More systems, protocols, and practical tools.