Skip to content

Cannon07/BitSpend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

49 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ’³ BitSpend

🌟 Introduction

BitSpend is an innovative self-custodial payment card solution that bridges the gap between cryptocurrency and real-world payments. Built on Mezo Testnet, BitSpend enables seamless MUSD token transactions through NFC-enabled cards, combining the security of blockchain technology with the convenience of traditional payment methods. Our project consists of three main components:

  1. BitSpend Smart Contracts πŸ”: Secure on-chain card management and transaction processing using Shamir Secret Sharing
  2. BitSpend Console πŸ–₯️: A user-friendly web interface for card registration, top-ups, and transaction management
  3. BitSpend Backend API βš™οΈ: Secure intermediary server handling card authentication and transaction authorization

At the core of our project is a revolutionary approach to self-custodial payments: customers maintain full control of their funds through split-key cryptography, while merchants enjoy the simplicity of tap-to-pay transactionsβ€”no complex wallet interactions required at the point of sale.

🎯 Problem Statement

Cryptocurrency adoption for everyday payments faces significant barriers: customers struggle with complex wallet UIs during transactions, merchants require technical expertise to accept crypto, and existing solutions compromise either security (custodial services) or usability (non-custodial wallets). While physical payment cards offer familiar UX, current crypto card solutions are custodialβ€”users don't truly own their funds. BitSpend solves this through Shamir Secret Sharing, enabling truly self-custodial payment cards that are as easy to use as traditional debit cards, making cryptocurrency payments accessible to everyone without sacrificing security or user control.

πŸŽ₯ Demo Materials

  1. Demo Video πŸ“Ή
  2. Live Demo 🌐
  3. Presentation πŸ“Š

πŸ† Track

  • Track: Financial Access & Mass Adoption - For everyday users and underbanked communities

πŸ› οΈ Workflow

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   Customer  │────────▢│   Merchant   │────────▢│ Blockchain  β”‚
β”‚  (NFC Card) β”‚ Tap Cardβ”‚  (Phone/POS) β”‚ Submit  β”‚   (Mezo)    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜         β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜         β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
      β”‚                        β”‚                         β”‚
      β”‚ Share 2 (NFC)          β”‚ Share 1 (Encrypted)     β”‚
      β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                         β”‚
                   β”‚                                     β”‚
                   β–Ό                                     β”‚
            β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                             β”‚
            β”‚  Share 3     β”‚β—€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
            β”‚ (PIN-derived)β”‚    Transaction Confirmed
            β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                   β”‚
                   β–Ό
            Key Reconstructed
            Transaction Signed

✨ Key Features

πŸ” Security First

  • Shamir Secret Sharing (SSS): Private key split into 3 shares
    • Share 1: Encrypted and stored in database
    • Share 2: Written to NFC card
    • Share 3: Derived from user's PIN
  • Self-Custodial: Users maintain complete controlβ€”no third party can access funds
  • PIN Protection: Transactions require customer's PIN for authorization
  • Daily Spending Limits: Built-in protection against unauthorized use

πŸ’³ Seamless User Experience

  • Tap to Pay: NFC-enabled cards for contactless payments
  • Familiar Flow: Works like traditional debit cardsβ€”tap, enter PIN, done
  • No Wallet Required: Merchants don't need crypto walletsβ€”just a phone
  • Instant Settlement: Transactions confirm in seconds on Mezo Testnet
  • Manual Entry Fallback: Works on devices without NFC support

πŸ–₯️ BitSpend Console Features

  • One-Click Card Registration: Register new payment cards in under 30 seconds
  • Easy Top-Ups: Add MUSD tokens to cards instantly
  • Dual Payment Modes: NFC scan or manual card entry
  • Transaction History: Complete analytics for both merchants and cardholders
  • Real-Time Balance Tracking: Monitor card balances and spending limits
  • Multi-Wallet Support: MetaMask and WalletConnect integration

βš™οΈ Smart Contract Architecture

  • CardManager Contract: Handles card registration, balance management, and spending limits
  • MUSD Token: ERC-20 stablecoin for payments
  • On-Chain Verification: All transactions recorded on Mezo blockchain
  • Gas Optimization: Efficient contract design for minimal transaction costs
  • Daily Limit Enforcement: Automatic reset at midnight UTC

πŸ“Š Analytics & Reporting

  • Merchant Dashboard: Track sales, revenue, and unique customers
  • Card Transaction History: View all payments and top-ups
  • Spending Analytics: Monitor daily limits and spending patterns
  • Export Capabilities: Download transaction history for accounting

πŸ—οΈ Technical Architecture

πŸ” Smart Contracts (Solidity)

  • CardManager.sol: Core contract managing card lifecycle
    • Card registration with owner verification
    • Balance tracking and transfer logic
    • Daily spending limit enforcement
    • Card activation and deactivation
  • MUSD.sol: ERC-20 stablecoin for payments
  • Deployed on: Mezo Testnet (Chain ID: 31611)

πŸ–₯️ BitSpend Console (React Frontend)

  • React 18 with React Router for navigation
  • Ethers.js v6 for blockchain interactions
  • WalletConnect v2 for mobile wallet support
  • TailwindCSS for responsive design
  • NFC Web API for contactless card reading
  • Hosted on: Vercel

βš™οΈ BitSpend API (Node.js Backend)

  • Express.js REST API
  • PostgreSQL database for card data
  • Shamir Secret Sharing implementation
  • PIN rate limiting and security
  • Transaction processing and validation
  • Hosted on: Render

πŸ”„ Payment Flow

1. Card Registration

  • User connects wallet and registers card
  • Smart contract records card address and owner
  • Private key split into 3 SSS shares
  • Share 2 written to NFC card

2. Top-Up

  • User approves MUSD spending
  • Transfers tokens to card address
  • Balance updated on-chain

3. Payment Processing

  • Customer taps NFC card on merchant's phone
  • Merchant enters payment amount
  • Customer enters PIN on merchant's device
  • Backend reconstructs private key from 3 shares
  • Transaction signed and submitted to blockchain
  • Confirmation returned to both parties

πŸ”’ Security Features

  • End-to-End Encryption: Sensitive data encrypted in transit and at rest
  • No Single Point of Failure: Key cannot be reconstructed without all 3 shares
  • PIN Rate Limiting: Protection against brute force attacks
  • Transaction Verification: All payments validated on-chain
  • Audit Trail: Complete transaction history on blockchain

πŸš€ Innovation Highlights

πŸ’‘ Unique Value Propositions

  1. True Self-Custody: First payment card solution that's genuinely non-custodial
  2. Zero Learning Curve: Familiar payment UXβ€”no crypto knowledge required
  3. Merchant-Friendly: Accept crypto payments with just a smartphone
  4. Blockchain Transparency: All transactions verifiable on-chain
  5. Flexible Entry: Works with or without NFC support

🎯 Target Use Cases

  • Retail Payments: Coffee shops, restaurants, convenience stores
  • Peer-to-Peer Payments: Send money between friends
  • Micro-Transactions: Small purchases under daily limits
  • Remittances: Cross-border payments with instant settlement
  • Event Payments: Festivals, conferences, farmers markets

πŸ“ˆ Future Roadmap

Phase 1 (Current - MVP) βœ…

  • βœ… Card registration and management
  • βœ… NFC tap-to-pay functionality
  • βœ… Manual entry fallback
  • βœ… Basic transaction history
  • βœ… MetaMask & WalletConnect integration

Phase 2 (Next 3 Months)

  • Multi-currency support (ETH, USDC, DAI)
  • Mobile app (iOS & Android)
  • QR code payment option
  • Advanced analytics dashboard
  • Merchant API for POS integration

Phase 3 (6+ Months)

  • Physical card manufacturing partnership
  • Multi-chain support (Ethereum, Polygon, etc.)
  • Recurring payment subscriptions
  • Loyalty rewards program
  • Integration with existing POS systems

Phase 4 (Future Vision)

  • Decentralized card issuance network
  • Zero-knowledge proof authentication
  • Hardware wallet integration
  • SDK for third-party integrations
  • Governance token for ecosystem participants

πŸ‘₯ Team Information

Jay Shitre 🎨

  • Role: Full-Stack Developer
  • Expertise: React, Solidity, Node.js, Blockchain Integration
  • Responsibilities: Frontend development, smart contract development, backend API

Nidhi Tikone 🎨

  • Role: Full-Stack Developer
  • Expertise: React, Node.js, UX Design, Blockchain Integration
  • Responsibilities: Frontend development, backend API

πŸ”— Links & Resources

πŸŽ“ Technical Stack

Frontend

  • React 18
  • React Router
  • TailwindCSS
  • Ethers.js v6
  • WalletConnect v2
  • Web NFC API

Backend

  • Node.js
  • Express.js
  • PostgreSQL
  • Shamir Secret Sharing library

Blockchain

  • Solidity 0.8.x
  • Hardhat development environment
  • Mezo Testnet (EVM-compatible)

DevOps

  • Vercel (Frontend)
  • Render (Backend)
  • GitHub Actions (CI/CD)
  • PostgreSQL (Managed Database)

πŸ“¦ Repository Structure

bitspend/
β”œβ”€β”€ frontend/           # React web application
β”œβ”€β”€ backend/            # Node.js API server
β”œβ”€β”€ contracts/          # Solidity smart contracts
└── README.md          # This file

πŸš€ Quick Start

Prerequisites

  • Node.js v18+
  • PostgreSQL
  • MetaMask wallet
  • Git

Installation

# Clone the repository
git clone https://github.com/your-username/bitspend.git
cd bitspend

# Install frontend dependencies
cd frontend
npm install

# Install backend dependencies
cd ../backend
npm install

# Install contract dependencies
cd ../contracts
npm install

Environment Setup

Frontend (.env)

REACT_APP_API_URL=http://localhost:5000
REACT_APP_CARD_MANAGER_ADDRESS=0x...
REACT_APP_MUSD_ADDRESS=0x...
REACT_APP_WALLETCONNECT_PROJECT_ID=your_project_id

Backend (.env)

PORT=5000
DATABASE_URL=postgresql://...
JWT_SECRET=your_secret
ENCRYPTION_KEY=your_encryption_key
MEZO_RPC_URL=https://rpc.test.mezo.org
CARD_MANAGER_ADDRESS=0x...

Running Locally

# Terminal 1 - Start backend
cd backend
npm run dev

# Terminal 2 - Start frontend
cd frontend
npm start

# Terminal 3 - Deploy contracts (if needed)
cd contracts
npx hardhat run scripts/deploy.js --network mezo-testnet

πŸ§ͺ Testing

# Run frontend tests
cd frontend
npm test

# Run backend tests
cd backend
npm test

# Run contract tests
cd contracts
npx hardhat test

πŸ™ Acknowledgments

We're excited to present BitSpend and demonstrate how it can revolutionize everyday cryptocurrency payments. Our solution combines the security of self-custodial wallets with the simplicity of traditional payment cards, making blockchain technology accessible for real-world transactions. BitSpend proves that crypto payments can be both secure and user-friendlyβ€”no compromises necessary.


Built with ❀️ for the future of payments


🌟 Star Us!

If you find BitSpend interesting, please consider giving us a star ⭐ on GitHub!

About

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •