Skip to content

Latest commit

Β 

History

158 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸš€ ZetaPay - Omnichain Crypto Payment Gateway

License: MIT ZetaChain Version

Pay with crypto on any e-commerce site using ZetaChain's omnichain technology. ZetaPay is a browser extension that enables seamless cryptocurrency payments across the web.


🌟 Features

  • βœ… Universal Payment Gateway - Works on any e-commerce website
  • βœ… Multi-Token Support - Pay with USDC, ETH, ZETA, or other tokens
  • βœ… Omnichain Technology - Powered by ZetaChain for cross-chain transactions
  • βœ… Non-Custodial - Users maintain full control of their funds
  • βœ… MetaMask Integration - Seamless wallet connection
  • βœ… Real-Time Price Conversion - Automatic fiat-to-crypto conversion
  • βœ… Transaction History - Complete payment tracking
  • βœ… Professional Dark Mode UI - Modern, sleek design

πŸ“¦ Project Structure

zetachain-payment-app/
β”œβ”€β”€ contracts/              # Smart contracts (Solidity)
β”‚   β”œβ”€β”€ UniversalPayment.sol
β”‚   β”œβ”€β”€ SwapHelperLib.sol
β”‚   └── test/
β”œβ”€β”€ web/
β”‚   └── public/            # Browser extension
β”‚       β”œβ”€β”€ index.html     # Popup interface
β”‚       β”œβ”€β”€ popup.js       # Extension logic
β”‚       β”œβ”€β”€ wallet-manager.js
β”‚       β”œβ”€β”€ content.js     # Page injection
β”‚       └── manifest.json
β”œβ”€β”€ backend/               # API server (Node.js)
└── test-checkout.html    # Test page

πŸ”— Smart Contract

Deployed on ZetaChain Athens Testnet

  • Contract Address: 0xaC24d3E7b5cFDCf2DD1c3a1feB0AbCCd98301852
  • Network: ZetaChain Athens 3 Testnet (Chain ID: 7001)
  • Explorer: View Contract

Contract Features:

  • Multi-token payment processing
  • Automatic token swapping via UniswapV2
  • Payment state management (pending β†’ completed/cancelled)
  • Secure fund transfers with reentrancy protection

πŸ› οΈ Tech Stack

Frontend

  • Chrome Extension (Manifest V3)
  • Vanilla JavaScript
  • Web3.js / Ethers.js
  • MetaMask Integration

Smart Contracts

  • Solidity ^0.8.26
  • Hardhat
  • OpenZeppelin
  • ZetaChain Protocol

Backend

  • Node.js + Express
  • PostgreSQL
  • WebSocket (real-time updates)
  • JWT Authentication

πŸš€ Quick Start

1. Install Extension

Load Unpacked Extension (Development)

1. Open Chrome
2. Navigate to chrome://extensions/
3. Enable "Developer mode"
4. Click "Load unpacked"
5. Select: zetachain-payment-app/web/public

2. Configure MetaMask

Add ZetaChain Athens Testnet:

Network Name: ZetaChain Athens
RPC URL: https://zetachain-athens-evm.blockpi.network/v1/rpc/public
Chain ID: 7001
Currency Symbol: ZETA
Block Explorer: https://athens.explorer.zetachain.com

3. Get Testnet Tokens

Get testnet ZETA for gas fees:

4. Test the Extension

  1. Open test-checkout.html in your browser
  2. Click the ZetaPay extension icon
  3. Connect your MetaMask wallet
  4. Click "Pay with Crypto" on the test page
  5. Confirm the transaction

πŸ“– Usage

For Users

  1. Connect Wallet

    • Click the ZetaPay extension icon
    • Click "Connect Wallet"
    • Approve in MetaMask
  2. Make a Payment

    • Browse any e-commerce site
    • ZetaPay automatically detects checkout pages
    • Click "Pay with Crypto" button
    • Select your preferred token (USDC, ETH, ZETA)
    • Confirm the transaction
  3. View History

    • Click the extension icon
    • Navigate to "History" tab
    • View all past transactions with blockchain links

πŸ”§ Development Setup

Prerequisites

  • Node.js v18+
  • npm or yarn
  • MetaMask browser extension
  • Git

Install Dependencies

Smart Contracts

cd contracts
npm install

Browser Extension

cd web
npm install

Backend API

cd backend
npm install

Environment Variables

Create .env files in each directory:

contracts/.env

PRIVATE_KEY=your_wallet_private_key
ZETA_TESTNET_RPC=https://zetachain-athens-evm.blockpi.network/v1/rpc/public

backend/.env

DATABASE_URL=postgresql://user:password@localhost:5432/zetapay
JWT_SECRET=your_secret_key
PORT=3000

Deploy Smart Contract

cd contracts
npx hardhat compile
npx hardhat run scripts/deploy.ts --network zeta_testnet

Run Backend

cd backend
npm run dev

Build Extension

cd web
npm run build

πŸ§ͺ Testing

Smart Contract Tests

cd contracts
npx hardhat test

Run Test Checkout Page

# Open test-checkout.html in browser
# Or serve with a local server:
npx serve . -p 8000
# Navigate to http://localhost:8000/test-checkout.html

πŸ“Š Architecture

Payment Flow

User β†’ E-commerce Site β†’ ZetaPay Extension β†’ MetaMask β†’ Smart Contract β†’ ZetaChain
                                                              ↓
                                                    Transaction Confirmed
                                                              ↓
                                                    Backend API (tracking)
                                                              ↓
                                                    Transaction History

Key Components

  1. Content Script (content.js)

    • Detects checkout pages
    • Injects "Pay with Crypto" button
    • Extracts order details
  2. Popup Interface (index.html + popup.js)

    • Wallet connection
    • Payment confirmation
    • Transaction status
  3. Wallet Manager (wallet-manager.js)

    • MetaMask integration
    • Account management
    • Transaction signing
  4. Smart Contract (UniversalPayment.sol)

    • Payment processing
    • Token swapping
    • State management
  5. Backend API

    • Transaction tracking
    • User authentication
    • Payment history

πŸ” Security

  • βœ… Non-custodial - Users control their private keys
  • βœ… Reentrancy protection - OpenZeppelin ReentrancyGuard
  • βœ… Secure contract - Audited code patterns
  • βœ… No private key storage - MetaMask handles all signing
  • βœ… Content Security Policy - Prevents XSS attacks

πŸ—ΊοΈ Roadmap

Phase 1: Core Functionality βœ…

  • Smart contract development
  • Browser extension UI
  • MetaMask integration
  • Basic payment flow

Phase 2: Testing & Deployment βœ…

  • Contract deployment to testnet
  • Extension testing
  • Test checkout page

Phase 3: Enhanced Features πŸ”„

  • Multi-chain support (Ethereum, Polygon, BSC)
  • Merchant dashboard
  • Payment gateway API
  • Off-ramp integration (crypto β†’ fiat)

Phase 4: Production πŸ”œ

  • Security audit
  • Mainnet deployment
  • Chrome Web Store submission
  • Partnership with payment processors

🀝 Contributing

Contributions are welcome! Please follow these steps:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

πŸ“ License

This project is licensed under the MIT License - see the LICENSE file for details.


πŸ”— Links


πŸ‘₯ Team

Developer: Parthkk90


πŸ“ž Support

For issues, questions, or suggestions:

  • Open an Issue
  • Contact via GitHub

πŸ™ Acknowledgments

  • ZetaChain for omnichain infrastructure
  • OpenZeppelin for secure smart contract libraries
  • MetaMask for wallet integration
  • Community for feedback and support

Made with ❀️ using ZetaChain

⭐ Star this repo if you find it useful!

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages