project screenshot 1
project screenshot 2
project screenshot 3

Whisper Transactions

Token Transfer on public chain using ZKP and privacy-preserving token

Whisper Transactions

Created At

ETHOnline 2024

Winner of

trophy

EVM Starter Bounty

Project Description

This project represents an implementation of private transactions on a public blockchain, specifically Hedera Hashgraph, using the Hyperledger Zeto toolkit. Here's a technical description of the project:

Architecture The project combines Hedera Hashgraph's public distributed ledger with Hyperledger Zeto's privacy-preserving token toolkit to enable confidential token transfers between Hedera wallets. It leverages several key components:

  1. The native token management on the Hedera network.
  2. The deployment and execution of the privacy-preserving smart contracts.
  3. Hyperledger Zeto: A UTXO-based privacy toolkit utilizing Zero Knowledge Proofs (ZKPs).

Key Technical Features UTXO Model Unlike typical ERC-20 tokens on Ethereum-compatible chains, this project adopts a UTXO (Unspent Transaction Output) model similar to Bitcoin. This approach enhances privacy and enables better parallel processing of transactions.

Zero Knowledge Proofs The project extensively uses ZKPs to validate transactions without revealing sensitive information. The ZKP circuits support various levels of privacy, including:

  • Anonymity for sender and receiver
  • Confidentiality of transaction values
  • Masking of transaction history

Commitment Scheme Each UTXO is represented on-chain as a commitment hash, combining:

  • Token value
  • Salt (for randomness)
  • Owner's public key

Transaction Flow

  1. The sender creates a transaction, consuming one or more input UTXOs and creating new output UTXOs.
  2. A ZKP is generated to prove the transaction's validity without revealing its details.
  3. The transaction and proof are submitted to the Hedera Smart Contract Service.
  4. The smart contract verifies the ZKP and, if valid, updates the on-chain state by nullifying input UTXOs and creating new output UTXOs.

Privacy Levels Multiple level of privacy configuration is possible:

  1. Basic anonymity with unencrypted values
  2. Enhanced privacy with encrypted values
  3. Full privacy with history masking using nullifiers

For this project, we have used Basic anonymity to demonstrate the concept.

Integration with Hedera

  • The project utilizes Hedera's native token capabilities through the Hedera Token Service.
  • Smart contracts are deployed using Hedera's Solidity-compatible environment, leveraging the Ethereum Virtual Machine (EVM).
  • Transactions benefit from Hedera's high throughput and low, predictable fees.

Unique Aspects

  1. First known implementation of UTXO-based private tokens on Hedera's public network.
  2. Combines the security and efficiency of Hedera's hashgraph consensus with advanced cryptographic privacy techniques.
  3. Demonstrates the potential for enterprise-grade privacy solutions on public ledgers, addressing a key concern for institutional adoption.

This project showcases the potential for building sophisticated, privacy-preserving decentralized applications on Hedera Hashgraph, bridging the gap between public blockchain transparency and the privacy requirements of sensitive financial transactions.

How it's Made

This project implements private transactions on the Hedera Hashgraph public blockchain using the Hyperledger Zeto toolkit. Here's a breakdown of the key components and technologies:

  1. Backend (txn-backend):

    • Built with Node.js and Express.js
    • Uses TypeScript for type safety
    • Integrates with MongoDB for data storage
    • Utilizes various cryptographic libraries:
      • maci-crypto for key generation and encryption
      • snarkjs for zero-knowledge proof generation and verification
      • poseidon-lite for hash functions
  2. Frontend (txn-app):

    • Built with Next.js, a React framework
    • Uses TypeScript for type safety
    • Integrates with Web3Modal for wallet connections
    • Uses Wagmi for Ethereum interactions
    • Employs TanStack Query (React Query) for data fetching and state management
  3. Zero-Knowledge Proofs (ZKP):

    • Utilizes Circom for creating ZKP circuits
    • Implements various ZKP circuits for different privacy levels:
      • Anonymous transactions
      • Encrypted transactions
      • Transactions with nullifiers
      • KYC-compliant transactions
    • Uses snarkjs for proof generation and verification
  4. Merkle Trees:

    • Implements Sparse Merkle Trees (SMT) using @iden3/js-merkletree
    • Used for efficient storage and verification of UTXOs and identities
  5. Cryptography:

    • Employs Poseidon hash functions for various cryptographic operations
    • Uses ECDH (Elliptic Curve Diffie-Hellman) for shared key generation
    • Implements custom encryption and decryption functions
  6. Smart Contracts:

    • Utilizes Solidity for writing smart contracts
    • Implements verifier contracts for on-chain proof verification
  7. Testing:

    • Uses Mocha as the test runner
    • Implements both unit tests and integration tests for ZKP circuits and cryptographic functions

Notable technical achievements:

  1. Implementation of a UTXO model on Hedera, which is typically account-based.
  2. Integration of ZKPs with Hedera's smart contract service, enabling privacy-preserving computations on a public blockchain.
  3. Custom implementation of encrypted transactions with regulatory compliance features.
  4. Use of Sparse Merkle Trees for efficient UTXO and identity management.

The project demonstrates a sophisticated approach to privacy-preserving transactions on a public blockchain, combining advanced cryptographic techniques with the efficiency and security of Hedera Hashgraph. The modular architecture allows for different levels of privacy and compliance, making it suitable for various use cases, from simple anonymous transfers to fully regulated, KYC-compliant transactions.

background image mobile

Join the mailing list

Get the latest news and updates