Skip to content

Tommybuild/creatipjar

Β 
Β 

Repository files navigation

CreatipJar - Decentralized Tipping dApp

A beautiful, fast, and secure tipping application for creatives built on Hedera Hashgraph. Send HBAR tips instantly with minimal fees using MetaMask wallet integration.

CreatipJar

✨ Features

  • πŸš€ Lightning Fast: 3-5 second transaction finality
  • πŸ’° Ultra Low Fees: ~$0.0001 per transaction
  • πŸ”’ Secure: Built on Hedera's secure hashgraph consensus
  • 🌱 Eco-Friendly: Carbon negative network
  • πŸ“± Responsive: Beautiful UI that works on all devices
  • πŸ”— MetaMask Integration: Easy wallet connection via JSON-RPC Relay
  • πŸ“Š Real-time Analytics: Live transaction tracking and statistics
  • 🎯 User-Friendly: Simple 3-step tipping process

πŸ—οΈ Tech Stack

  • Frontend: React 18 + TypeScript + Vite
  • Styling: Tailwind CSS + shadcn/ui components
  • Blockchain: Hedera SDK + JSON-RPC Relay
  • Wallet: MetaMask integration
  • API: Hedera Mirror Node REST API
  • State Management: React Query + React Hooks

πŸš€ Quick Start

Prerequisites

  • Node.js 18+ and npm
  • MetaMask browser extension
  • Git

Installation

  1. Clone the repository
git clone <YOUR_GIT_URL>
cd hedera-tipjar
  1. Install dependencies
npm install
  1. Set up environment
cp .env.example .env
  1. Start development server
npm run dev
  1. Open your browser Navigate to http://localhost:8080

πŸ“– How to Use/ Demo Video:

For Tippers

  1. Connect Wallet: Click "Connect MetaMask" and approve the connection
  2. Enter Details: Add recipient's Hedera account ID (format: 0.0.123456) and tip amount
  3. Send Tip: Click "Send Tip" and confirm the transaction in MetaMask

For Recipients

  1. Share your Hedera account ID with supporters
  2. Receive tips instantly with notifications
  3. View transaction history in real-time

πŸ”§ Configuration

Environment Variables

Create a .env file based on .env.example:

# Network configuration (testnet/mainnet)
VITE_HEDERA_NETWORK=testnet

# Optional: Custom endpoints
VITE_TESTNET_MIRROR_URL=https://testnet.mirrornode.hedera.com
VITE_MAINNET_MIRROR_URL=https://mainnet-public.mirrornode.hedera.com

Network Switching

To switch from testnet to mainnet:

  1. Update VITE_HEDERA_NETWORK=mainnet in .env
  2. Update the network configuration in src/lib/hedera.ts
  3. Restart the development server

πŸ› οΈ Development

Available Scripts

# Development
npm run dev          # Start dev server
npm run build        # Build for production
npm run preview      # Preview production build

# Code Quality
npm run lint         # Run ESLint
npm run type-check   # Run TypeScript checks

# Testing
npm test             # Run unit tests
npm run test:watch   # Run tests in watch mode

Project Structure

src/
β”œβ”€β”€ components/          # Reusable UI components
β”‚   β”œβ”€β”€ ui/             # shadcn/ui components
β”‚   β”œβ”€β”€ WalletConnect.tsx
β”‚   β”œβ”€β”€ TipForm.tsx
β”‚   β”œβ”€β”€ TransactionHistory.tsx
β”‚   └── Analytics.tsx
β”œβ”€β”€ hooks/              # Custom React hooks
β”‚   β”œβ”€β”€ useWallet.ts
β”‚   └── use-toast.ts
β”œβ”€β”€ lib/                # Utility libraries
β”‚   β”œβ”€β”€ hedera.ts       # Hedera SDK integration
β”‚   β”œβ”€β”€ api.ts          # Mirror Node API
β”‚   └── utils.ts
β”œβ”€β”€ pages/              # Main application pages
β”‚   β”œβ”€β”€ Landing.tsx
β”‚   β”œβ”€β”€ TipApp.tsx
β”‚   └── NotFound.tsx
└── App.tsx             # Main application component

πŸš€ Deployment

Vercel (Recommended)

  1. Connect repository
# Install Vercel CLI
npm i -g vercel

# Deploy
vercel --prod
  1. Set environment variables in Vercel dashboard:
    • VITE_HEDERA_NETWORK=mainnet (for production)

Netlify

  1. Build command: npm run build
  2. Publish directory: dist
  3. Environment variables:
    • VITE_HEDERA_NETWORK=mainnet

Custom Server

# Build the project
npm run build

# Serve the dist folder with any static file server
npx serve dist

πŸ§ͺ Testing

Unit Tests

# Run all tests
npm test

# Run with coverage
npm run test:coverage

# Run specific test file
npm test -- WalletConnect.test.tsx

Manual Testing

  1. Testnet Testing: Use testnet HBAR from Hedera Portal faucet
  2. MetaMask Setup: Add Hedera testnet to MetaMask
  3. Transaction Verification: Check transactions on HashScan

πŸ” Security

  • βœ… Client-side wallet integration only
  • βœ… No private keys stored in application
  • βœ… All transactions signed by user's wallet
  • βœ… Input validation and sanitization
  • βœ… Secure communication with Hedera network

πŸ“Š Analytics & Monitoring

The app includes built-in analytics:

  • Total Tips: All-time tip count
  • Total HBAR: Total value tipped
  • Unique Tippers: Number of different accounts
  • Recent Activity: Last 24 hours statistics

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/new-feature
  3. Make your changes
  4. Add tests if applicable
  5. Commit: git commit -m 'Add new feature'
  6. Push: git push origin feature/new-feature
  7. Submit a pull request

πŸ“ API Reference

Hedera SDK Integration

import { executeTransferWithWallet } from '@/lib/hedera'

// Send a tip
const result = await executeTransferWithWallet(
  fromAccountId,
  toAccountId,
  amount,
  window.ethereum
)

Mirror Node API

import { fetchRecentTransactions } from '@/lib/api'

// Get recent transactions
const transactions = await fetchRecentTransactions(accountId)

πŸ› Troubleshooting

Common Issues

MetaMask not connecting

  • Ensure MetaMask is installed and unlocked
  • Check that you're on the correct network
  • Clear browser cache and try again

Transaction failing

  • Verify account ID format (0.0.123456)
  • Ensure sufficient HBAR balance
  • Check network connectivity

Mirror Node errors

  • Verify network configuration
  • Check if Mirror Node is accessible
  • Try refreshing the page

Debug Mode

Enable debug logging by setting:

localStorage.setItem('debug', 'hedera-tipjar:*')

πŸ“„ License

MIT License - see LICENSE file for details.

πŸ™ Acknowledgments

πŸ“ž Support


Built with ❀️ for the Hedera community. Happy tipping! πŸŽ‰

About

A reward system for creatives onchain

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 96.1%
  • CSS 2.6%
  • Other 1.3%