Skip to content

yaji33/azend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

76 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

AZEND Logo

Live Demo License

AZEND: Confidential Event Management on FHEVM

A privacy-first ticketing and event management platform built on the Zama Protocol.
Submitted to the Zama Developer Program - Builder Track

πŸ“– Overview

AZEND redefines how we manage private gatherings and exclusive events on-chain. Traditional blockchain ticketing exposes attendee data, wallet connections, and movement history to the public.

AZEND utilizes Fully Homomorphic Encryption (FHE) to ensure that ticket ownership, check-in status, and attendee lists remain encrypted on-chain. The smart contract validates check-in criteria (time, ticket validity) mathematically over encrypted data without ever revealing the underlying values to the public or validators.


πŸ› οΈ Tech Stack & Versioning

We are utilizing the latest Zama v0.9 ecosystem tools to ensure compatibility with the Sepolia Testnet and Gateway.

Core FHE Libraries

Package Version Purpose
@fhevm/solidity v0.9.1 Smart Contracts. Provides the TFHE library for on-chain encrypted operations (euint64, ebool, TFHE.asEuint64, TFHE.le).
@zama-fhe/relayer-sdk v0.3.0-5 Decryption/Gateway. Crucial for v0.9: Enables the new self-relaying decryption model for viewing private analytics.
@fhevm/hardhat-plugin v0.3.0-1 Development. Latest tooling support for deployment and local mocking.

DApp Architecture

  • Framework: Next.js 14 (App Router)
  • Language: TypeScript
  • Blockchain Interaction: Wagmi v2, Viem, Ethers v6
  • Storage: IPFS (via Pinata) for Event Banners/Metadata
  • Styling: Tailwind CSS, Shadcn/UI, Lucide React

πŸ”’ Confidential Architecture

AZEND demonstrates "Original Tech Architecture" by moving beyond simple encrypted counters. We implement a Bitwise Packed Check-In System.

1. The Encrypted Check-In Flow

Instead of sending separate encrypted values (which costs more gas), the client packs data into a single 64-bit integer before encryption.

  1. Client Side:

    • We take the current Timestamp (32 bits).
    • We pack them: packedValue = (Timestamp << 8) | TicketType.
    • We generate a Native FHE Ciphertext (approx 2kb) using the fhevm library.
  2. On-Chain (Smart Contract):

    • The contract receives the ciphertext.
    • It converts it to an euint64 using TFHE.asEuint64(input, proof).
    • It validates the time window: TFHE.le(packedTimestamp, eventEndTime).
    • It updates the user's attendance status (hasAttended[user]) strictly using homomorphic logic.

Use Case Diagram

AZEND-UseCase-Diagram

Context FLow Diagram

AZEND-Context-Flow-Diagram

Sequence Diagram

AZEND-Sequence-Diagram

πŸš€ Getting Started

This is a Monorepo containing both the Hardhat environment and the Next.js frontend.

Prerequisites

  • Node.js v20+
  • pnpm (recommended) or npm
  • Metamask (Configured for Sepolia)

1. Installation

https://github.com/yaji33/azend.git
cd azend

# Install dependencies for root, hardhat, and nextjs
pnpm install

2. Environment Setup

You must configure the environment variables for both the Smart Contract environment and the Frontend.

A. Hardhat Configuration

Create a file at packages/hardhat/.env

# Your Exported Wallet Private Key (Must have Sepolia ETH)
PRIVATE_KEY=0x...

# Standard Sepolia RPC (e.g., Alchemy, Infura, or Public Node)
SEPOLIA_RPC_URL=https://ethereum-sepolia-rpc.publicnode.com

# For verifying contracts (Optional)
ETHERSCAN_API_KEY=...

B. Next.js Configuration

Create a file at packages/nextjs/.env.local:

# Pinata JWT for uploading Event Banners to IPFS
PINATA_JWT=...

# WalletConnect Project ID (from cloud.walletconnect.com)
NEXT_PUBLIC_WALLET_CONNECT_PROJECT_ID=...

# Public Sepolia RPC for the frontend to read chain data
NEXT_PUBLIC_SEPOLIA_RPC_URL=https://ethereum-sepolia-rpc.publicnode.com

3. Deploy Contracts (Optional)

The project comes with pre-configured addresses, but if you wish to deploy your own:

cd packages/hardhat
npx hardhat deploy --network sepolia

Run the DApp

pnpm start

πŸ§ͺ Testing

We have end-to-end tests ensuring the packing logic and encryption work correctly using the hardhat-fhevm mock mode.

cd packages/hardhat
npx hardhat test

Test Scenarios:

βœ… Event Creation with encrypted boolean flags.
βœ… Encrypted Check-In: Validating the bitwise packed timestamp logic via fhevm instance.
βœ… Access Control: Verifying that only the organizer can request re-encryption of analytics.

About

A privacy-first ticketing and event management platform built on the Zama Protocol

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors