Skip to content

fapulito/musd

Β 
Β 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

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

No packages published

Languages

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