π ETH Mexico 2025 Hackathon Project
Web3 payment platform connecting ENS identities with Mexican fiscal invoicing (CFDI)
Contract deployed on Scroll Sepolia: https://sepolia.scrollscan.com/address/0x60814008211E98dbc88E08266FB220F41F1b850E#code
PayChain enables businesses and freelancers in Mexico to receive cryptocurrency payments using memorable ENS names while automatically generating legally valid tax receipts (CFDI 4.0).
- π ENS Integration: Accept payments at
yourcompany.ethinstead of0x742d35... - β‘ Scroll L2: Fast (<5s) and cheap (<$0.50) transactions
- π Auto-Invoicing: CFDI 4.0 compliant invoices via Facturapi
- π Provider Dashboard: View payments and download invoices
- π§ Email Notifications: Automatic receipt delivery
- π± Multi-Currency: Support for ETH, USDC, USDT with automatic MXN conversion
βββββββββββββββββββ
β Next.js UI β Frontend (Vercel)
β + wagmi/viem β
ββββββββββ¬βββββββββ
β HTTPS
βΌ
βββββββββββββββββββ ββββββββββββββββ
β Express API ββββββββΊβ PostgreSQL β
β + TypeScript β ββββββββββββββββ
ββββββββββ¬βββββββββ ββββββββββββββββ
β β Redis β
β β (Job Queue) β
β ββββββββββββββββ
ββββΊ Scroll L2 (Events)
ββββΊ Facturapi (Invoices)
ββββΊ CoinGecko (Exchange Rates)
ββββΊ Resend (Emails)
- Node.js 20+
- PostgreSQL 15+
- Redis 7+
- Foundry (for smart contracts)
- MetaMask or compatible Web3 wallet
- Clone the repository
git clone https://github.com/yourusername/paychain.git
cd paychain- Install dependencies
# Smart contracts
cd contracts && forge install && cd ..
# Backend
cd backend && npm install && cd ..
# Frontend
cd frontend && npm install && cd ..- Set up environment variables
# Copy example files
cp .env.example .env
cp backend/.env.example backend/.env
cp frontend/.env.example frontend/.env.local
# Edit each .env file with your actual API keys and configuration- Set up the database
# Create database
createdb paychain
# Run migrations
psql paychain < backend/database/schema.sqlRun these commands in separate terminals:
# Terminal 1: Start Redis
redis-server
# Terminal 2: Start Backend API
cd backend && npm run dev
# Terminal 3: Start Background Worker
cd backend && npm run worker
# Terminal 4: Start Frontend
cd frontend && npm run devVisit http://localhost:3000 to see the application.
paychain/
βββ contracts/ # Solidity smart contracts
β βββ src/
β β βββ PayChain.sol # Main payment contract
β βββ test/ # Contract tests
β βββ script/ # Deployment scripts
β
βββ backend/ # Express.js API
β βββ src/
β β βββ routes/ # API endpoints
β β βββ services/ # Business logic
β β βββ repositories/ # Database access
β β βββ workers/ # Background jobs
β βββ database/
β βββ schema.sql # Database schema
β
βββ frontend/ # Next.js application
β βββ app/ # App router pages
β βββ components/ # React components
β βββ lib/ # Utilities
β βββ hooks/ # Custom React hooks
β
βββ docs/ # Additional documentation
cd contracts
forge test -vvcd backend
npm testcd frontend
npm testcd contracts
# Deploy to Scroll Sepolia
forge script script/Deploy.s.sol \
--rpc-url $SCROLL_RPC_URL \
--broadcast \
--verify
# Update CONTRACT_ADDRESS in .env filescd backend
railway login
railway init
railway upcd frontend
vercel --prod-
Facturapi (Mexican invoice generation)
- Sign up at dashboard.facturapi.io
- Get your API key and Organization ID
-
Resend (Email service)
- Sign up at resend.com
- Get your API key
-
WalletConnect (Optional, for wallet connections)
- Sign up at cloud.walletconnect.com
- Get your Project ID
-
CoinGecko (Optional, for exchange rates)
- Free tier available at coingecko.com
See .env.example files for complete configuration details.
| Layer | Technology |
|---|---|
| Frontend | Next.js 14, TypeScript, Tailwind CSS, shadcn/ui |
| Smart Contracts | Solidity 0.8.20, Foundry, OpenZeppelin |
| Backend | Node.js, Express, TypeScript |
| Database | PostgreSQL, Kysely ORM |
| Blockchain | Scroll Sepolia L2, ENS |
| Web3 | wagmi, viem, ethers.js |
| Invoicing | Facturapi API (CFDI 4.0) |
| Resend | |
| Job Queue | BullMQ + Redis |
- Architecture Guide - System design and data flow
- Deployment Guide - Production deployment
- Local Setup - Development environment setup
- Contributing - Contribution guidelines
- API Documentation - Backend API reference
We welcome contributions! Please see our Contributing Guide for details.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- Never commit
.envfiles - Keep private keys secure
- Use environment variables for all sensitive data
- Report security vulnerabilities to security@paychain.app
This project is licensed under the MIT License - see the LICENSE file for details.
Built with β€οΈ by the PayChain Team for ETH Mexico 2025
- ENS - Ethereum Name Service
- Scroll - Layer 2 scaling solution
- Facturapi - Mexican invoice generation
- OpenZeppelin - Smart contract libraries
- π§ Email: support@paychain.app
- π¦ Twitter: @paychain
- π¬ Discord: Join our community
Made with β€οΈ using ENS, Scroll, and Facturapi