Skip to content

fapulito/musd

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1,366 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

💵 MUSD - Bitcoin-Native Stablecoin on Mezo

Mezo Hackathon Submission - Enabling Bitcoin holders to transact with USD stability using Mezo's smart account abstraction

License: GPL v3 Mezo Deployed

🎯 What is MUSD?

MUSD is a stablecoin payment system built on Mezo that enables Bitcoin holders to transact with USD-pegged tokens without leaving the Bitcoin ecosystem. Users sign transactions with their Bitcoin wallet through Mezo Passport, while smart accounts execute ERC-20 token transfers on Matsnet.

The Problem

  • Bitcoin's volatility makes it impractical for everyday payments
  • Merchants need price stability but want Bitcoin exposure
  • Converting BTC to stablecoins requires leaving the Bitcoin ecosystem
  • Traditional stablecoins don't integrate with Bitcoin wallets natively

Our Solution

MUSD leverages Mezo's account abstraction to bridge Bitcoin wallets with stablecoin functionality:

  1. Connect with Bitcoin Wallet - Users authenticate using their existing Bitcoin wallet via Mezo Passport
  2. Smart Account Abstraction - Mezo creates a smart account that executes transactions on behalf of the Bitcoin wallet
  3. Sign with Bitcoin, Transact with Stablecoins - Users sign with their Bitcoin wallet, smart account executes MUSD transfers
  4. Merchant Integration - Payment service enables easy merchant adoption with USD-stable settlement

🚀 Hackathon Deliverables

✅ What We Built

1. Smart Contracts (Solidity)

  • ERC-20 MUSD token contract deployed on Matsnet
  • Comprehensive test suite with Hardhat
  • Deployment scripts for Matsnet network
  • Located in /solidity directory

2. React dApp (Frontend)

  • Modern React 19 + TypeScript + Vite application
  • Mezo Passport Integration (@mezo-org/passport@0.12.0)
    • useBitcoinAccount() - Bitcoin wallet connection and balance
    • useSendTransaction() - Transaction signing and execution
    • useWalletInfo() - Unified wallet information display
  • Wagmi + Viem for Ethereum interactions
  • Tailwind CSS for responsive UI
  • Custom hooks for MUSD transfers (useSendMUSD)

3. Payment Service (Backend)

  • Node.js + Express API for merchant integration
  • Transaction monitoring and webhook support
  • Payment link generation
  • Invoice management

4. Comprehensive Documentation

  • 📚 Complete deployment guides (Vercel, Railway, Boar Network, Spectrum)
  • 🚀 Quick start guide (5-minute local setup)
  • 🐛 Troubleshooting documentation
  • 📖 System architecture overview in /docs

5. Production-Ready Deployment

  • Vercel deployment configuration
  • Railway backend hosting setup
  • Environment variable management
  • CI/CD pipeline ready

🔧 Technical Highlights

Mezo Integration:

// Bitcoin wallet authentication
const { btcAddress, btcBalance } = useBitcoinAccount()

// Send MUSD with Bitcoin wallet signature
const { sendTransaction } = useSendTransaction()
const hash = await sendTransaction(
  MUSD_TOKEN_ADDRESS,  // to
  0n,                   // value
  encodedTransferData   // data
)

Key Features:

  • ✅ Bitcoin wallet-based authentication (no seed phrases!)
  • ✅ Smart account abstraction for gasless transactions
  • ✅ ERC-20 token transfers signed by Bitcoin wallets
  • ✅ Real-time balance tracking (Bitcoin + Matsnet)
  • ✅ Merchant payment integration
  • ✅ Production deployment infrastructure

📦 Installation & Setup

Prerequisites

  • Node.js 18+ and pnpm
  • Bitcoin wallet (for testing with Mezo Passport)
  • Matsnet testnet access

Quick Start (5 minutes)

# Install dependencies
pnpm install --frozen-lockfile

# Install smart contract dependencies
cd solidity
pnpm install --frozen-lockfile
cd ..

# Set up environment variables
cp .env.example .env
# Edit .env with your configuration

# Run development server
pnpm dev

Visit http://localhost:5173 to see the dApp.

Smart Contract Deployment

cd solidity
cp .env.example .env
# Add your private key and RPC URL
pnpm run deploy --network matsnet

🏗️ Architecture

┌─────────────────┐
│  Bitcoin Wallet │ (User's existing wallet)
└────────┬────────┘
         │ Signs transactions
         ▼
┌─────────────────┐
│  Mezo Passport  │ (Account abstraction SDK)
└────────┬────────┘
         │ Creates & manages
         ▼
┌─────────────────┐
│  Smart Account  │ (On Matsnet)
└────────┬────────┘
         │ Executes
         ▼
┌─────────────────┐
│  MUSD Contract  │ (ERC-20 on Matsnet)
└─────────────────┘

Flow:

  1. User connects Bitcoin wallet via Mezo Passport
  2. Mezo creates a smart account on Matsnet
  3. User initiates MUSD transfer in dApp
  4. dApp encodes ERC-20 transfer call
  5. User signs with Bitcoin wallet
  6. Smart account executes transfer on Matsnet
  7. MUSD tokens transferred, transaction confirmed

🎨 Tech Stack

Blockchain & Smart Contracts

  • Solidity - Smart contract development
  • Hardhat - Development environment
  • OpenZeppelin - Contract libraries
  • Matsnet - Mezo testnet deployment

Frontend

  • React 19 - UI framework
  • TypeScript - Type safety
  • Vite - Build tool & dev server
  • Mezo Passport SDK - Bitcoin wallet integration
  • Wagmi - Ethereum interactions
  • Viem 2.22.8 - Ethereum utilities
  • Tailwind CSS - Styling

Backend

  • Node.js - Runtime
  • Express - API framework
  • TypeScript - Type safety

DevOps

  • Vercel - Frontend hosting
  • Railway - Backend hosting
  • pnpm - Package management
  • ESLint + Prettier - Code quality

🌟 Key Features

For Users

  • 🔐 Bitcoin Wallet Authentication - Use your existing Bitcoin wallet, no new accounts
  • 💰 USD Stability - Transact with price-stable MUSD tokens
  • Instant Transfers - Fast transactions on Matsnet
  • 🔒 Self-Custody - Maintain control of your Bitcoin wallet
  • 📱 Simple UX - Connect wallet, send MUSD, done

For Merchants

  • 💵 USD Settlement - Accept Bitcoin-backed payments with no volatility
  • 🔌 Easy Integration - REST API and payment links
  • 📊 Real-Time Tracking - Monitor transactions and balances
  • 🌐 Global Reach - Accept payments from Bitcoin holders worldwide
  • 💸 Low Fees - Cheaper than traditional payment processors

For Developers

  • 📚 Comprehensive Docs - Detailed guides and API documentation
  • 🛠️ Modern Stack - React, TypeScript, Vite, Mezo SDK
  • 🧪 Test Suite - Smart contract tests with Hardhat
  • 🚀 Easy Deployment - One-click Vercel + Railway setup
  • 🔧 Extensible - Clean architecture for adding features

📊 Project Status

✅ Completed for Hackathon

  • Smart contracts deployed on Matsnet
  • Mezo Passport integration (Bitcoin wallet auth)
  • React dApp with MUSD transfer functionality
  • Payment service backend
  • Comprehensive deployment documentation
  • Production deployment infrastructure
  • Custom hooks for wallet and transaction management
  • Responsive UI with Tailwind CSS

🚧 In Progress

  • Vercel production deployment (build in progress)
  • Merchant dashboard
  • Payment plugin integrations (WooCommerce, Shopify)

🎯 Future Roadmap

Q1 2025 - MVP Launch

  • Complete production deployment
  • Onboard 10-20 beta merchants
  • Process first $10K in transactions
  • User feedback and UX iteration

Q2 2025 - Mainnet & Growth

  • Deploy to Mezo mainnet
  • Onboard 100+ merchants
  • Multi-currency support (MEUR, MGBP)
  • Reach $100K monthly volume

Q3 2025 - Scale & Features

  • Recurring payments & subscriptions
  • Mobile app (React Native)
  • Point-of-sale integrations
  • 1,000+ merchants, $1M monthly volume

Q4 2025 - Enterprise

  • Enterprise API
  • Multi-signature support
  • Compliance & reporting tools
  • 10,000+ merchants, $10M monthly volume

🎯 Unique Value Proposition

MUSD is the first stablecoin that lets you sign transactions with a Bitcoin wallet.

Thanks to Mezo's account abstraction:

  • ✅ No seed phrase management
  • ✅ No new wallet setup
  • ✅ No leaving the Bitcoin ecosystem
  • ✅ Just your existing Bitcoin wallet controlling USD-stable value

For Bitcoin Holders: Spend with USD stability while maintaining Bitcoin wallet custody

For Merchants: Accept Bitcoin-backed payments with USD price stability and instant settlement

For the Ecosystem: Brings Bitcoin liquidity to stablecoin use cases, enabling Bitcoin to compete with traditional payment rails

📖 Documentation

Quick Links

Deployment Options

  • Vercel + Railway: $0-5/month (dev), $40-70/month (prod)
  • Boar Network: $5/month + custom pricing (premium)
  • Spectrum Enterprise: $250-400/month (99.9% SLA)

🧪 Testing

Smart Contracts

cd solidity
pnpm test

Frontend (Coming Soon)

pnpm test

🤝 Contributing

We welcome contributions! Please see our contributing guidelines.

Development Workflow

  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

Pre-commit Hooks

# Install pre-commit
brew install pre-commit

# Install hooks
pre-commit install

# Run manually
pre-commit run --all-files

📄 License

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

🔗 Links

🏆 Hackathon Submission

This project was built for the Mezo Hackathon, demonstrating:

  1. Deep Mezo Integration - Extensive use of Mezo Passport SDK for Bitcoin wallet authentication and smart account transactions
  2. Production-Ready Code - Comprehensive testing, documentation, and deployment infrastructure
  3. Real-World Use Case - Solving actual problems for Bitcoin holders and merchants
  4. Technical Excellence - Modern stack, clean architecture, type safety, and best practices
  5. Complete Solution - Smart contracts, frontend, backend, and deployment all working together

Mezo-Specific Features

  • ✅ Bitcoin wallet authentication via Mezo Passport
  • ✅ Smart account abstraction for gasless transactions
  • ✅ Custom hooks leveraging Mezo SDK (useBitcoinAccount, useSendTransaction)
  • ✅ Matsnet deployment with comprehensive guides
  • ✅ Bitcoin-native UX (sign with BTC wallet, execute on Matsnet)

Built with ❤️ for the Mezo ecosystem

Enabling Bitcoin to power the future of payments

About

Fiat-to-Crypto via Stripe Onramp | Deploy on Vercel, Spectrum, Boar | Railway Backend

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • TypeScript 67.6%
  • Solidity 31.3%
  • Other 1.1%