Skip to content

NarutoLab/fhevm-zama-mail-app

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

131 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FHEZmail Logo

License: MIT Sepolia Testnet Ethereum React Next.js

FHEZmail is a decentralized, privacy email platform on the Ethereum Sepolia testnet. Using Fully Homomorphic Encryption (FHE), all emails are encrypted on-chain, and only the sender and recipient can read their content.


🌐 Live Demo


📖 Project Overview

FHEZmail combines blockchain and FHE encryption to create an email system that is:

  • Decentralized: All emails stored on-chain, no central server.
  • Encrypted: Subjects and bodies encrypted with Fully Homomorphic Encryption.
  • Threaded: Supports replies and forwards while preserving privacy.
  • Organized: Emails sorted into Inbox, Sent, Archive, Star, Spam, Trash, and Read.

🏗 Technologies Used

Smart Contract (On-chain)

  • Solidity 0.8.24
  • Fully Homomorphic Encryption (FHE):
  • SepoliaConfig – Preconfigured Sepolia testnet setup

Frontend (User Interface)

  • React – Modern, responsive UI
  • Next.js – Server-side rendering & optimized builds
  • @zama-fhe/relayer-sdk – Integrates FHE encryption/decryption on FE

⚡ Key Features

  1. Send Emails

    • Encrypts subject & body using FHE
    • Creates copies for sender (Sent) and recipient (Inbox)
    • Permission management for encryption
  2. Reply

    • Replies within existing threads
    • Updates boxes and maintains encryption
  3. Forward

    • Securely forward emails
    • Updates permissions for new recipients
  4. Move Emails

    • Move emails between boxes
    • TRASH box is handled specially
  5. View Emails & Threads

    • Fetch mails by box type
    • Fetch full threads with encrypted replies

🛠 Getting Started

Prerequisites

  • Node.js >= 20
  • Yarn or npm
  • MetaMask or Web3 wallet
  • Sepolia testnet ETH

Installation

git clone https://github.com/NarutoLab/fhevm-zama-mail-app.git
cd pakages/site
npm install

Running Frontend

npm run dev

Open http://localhost:3000 to access the dApp.


💻 Smart Contract Interaction

Contract Address: 0xCB45011ca6B8CDce01792CBB9B4c999479E94a0E

Key Functions:

// Send a new email
sendMail(to, subjectExternal, subjectProofs, bodyExternal, bodyProofs);

// Reply to a thread
reply(threadId, subjectExternal, subjectProofs, bodyExternal, bodyProofs);

// Forward an email
forward(mailId, to);

// Move emails between boxes
move(mailIds, newBox);

// Fetch emails
(inbox(user),
  sent(user),
  archive(user),
  star(user),
  spam(user),
  trash(user),
  read(user));

🌟 Future Potential

FHEZmail lays the foundation for next-gen decentralized communication:

  • Cross-chain Encrypted Messaging
  • Decentralized Identity Integration (ENS, DIDs)
  • Encrypted Search & Filters without decryption

🔒 Security & Privacy

  • Emails are encrypted on-chain; only allowed participants can decrypt
  • No plaintext stored on-chain
  • Full control of permissions using FHE primitives

Documentation

License

This project is licensed under the BSD-3-Clause-Clear License - see the LICENSE file for details.

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • TypeScript 82.3%
  • CSS 12.7%
  • JavaScript 3.4%
  • Shell 1.6%