Skip to content

achi777/cryptowallet

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

7 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ’° Crypto Wallet Application

A full-stack cryptocurrency wallet application built with Java 21 + Spring Boot backend and React + TypeScript frontend, featuring Bitcoin and USDT (TRC-20) wallet management.

πŸš€ Quick Start

Prerequisites

Before running the application, ensure you have the following installed:

  • Java 21 or later
  • Maven 3.6+
  • Node.js 16+ and npm
  • Git (optional, for cloning)

🎯 One-Command Startup

# Start both backend and frontend
./startwallet.sh

# Stop both services
./stopwallet.sh

πŸ“‹ Manual Setup (Alternative)

If you prefer to run services manually:

Backend (Spring Boot)

cd backend
mvn spring-boot:run

Frontend (React)

cd frontend
npm install  # First time only
npm start

🌐 Application URLs

Once started, access the application at:

πŸ“± Features

πŸ” Authentication

  • User Registration: Create new accounts with secure password hashing
  • Login System: Secure authentication with session management
  • Auto-Login: Remember user sessions between visits

πŸ’Ό Wallet Management

  • Multi-Currency Support: Bitcoin (BTC) and USDT (TRC-20)
  • Wallet Creation: Generate secure wallets with private keys
  • Balance Tracking: Real-time balance updates
  • Address Management: Secure address generation

πŸ’Έ Transactions

  • Send Crypto: Transfer Bitcoin and USDT to any address
  • Transaction History: Complete transaction log with status tracking
  • Fee Calculation: Automatic fee estimation
  • Transaction Status: Pending, Confirmed, Failed states

πŸ“± Mobile-Responsive Design

  • Mobile-First: Optimized for all screen sizes
  • Touch-Friendly: Large buttons and intuitive gestures
  • Modern UI: Glass morphism design with smooth animations
  • Responsive Navigation: Adaptive navigation for all devices

πŸ› οΈ Technology Stack

Backend

  • Java 21 - Latest LTS version
  • Spring Boot 3.2 - Application framework
  • Spring Data JPA - Database abstraction
  • Spring Security - Authentication & authorization
  • H2 Database - In-memory database for development
  • Lombok - Reduce boilerplate code
  • Maven - Dependency management

Frontend

  • React 18 - UI library
  • TypeScript - Type safety
  • Modern CSS - Custom responsive design
  • Axios - HTTP client
  • Local Storage - Session persistence

Crypto Libraries

  • BitcoinJ - Bitcoin operations
  • Web3j - Ethereum/Tron operations

πŸ“‚ Project Structure

cryptowallet/
β”œβ”€β”€ backend/                 # Spring Boot application
β”‚   β”œβ”€β”€ src/main/java/
β”‚   β”‚   └── com/cryptowallet/
β”‚   β”‚       β”œβ”€β”€ controller/  # REST controllers
β”‚   β”‚       β”œβ”€β”€ service/     # Business logic
β”‚   β”‚       β”œβ”€β”€ repository/  # Data access
β”‚   β”‚       β”œβ”€β”€ entity/      # JPA entities
β”‚   β”‚       β”œβ”€β”€ dto/         # Data transfer objects
β”‚   β”‚       └── config/      # Configuration
β”‚   β”œβ”€β”€ src/main/resources/
β”‚   β”‚   └── application.yml  # Application configuration
β”‚   └── pom.xml             # Maven dependencies
β”œβ”€β”€ frontend/                # React application
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ components/      # React components
β”‚   β”‚   β”œβ”€β”€ services/        # API services
β”‚   β”‚   β”œβ”€β”€ types/           # TypeScript types
β”‚   β”‚   └── styles/          # CSS styles
β”‚   β”œβ”€β”€ public/              # Static assets
β”‚   └── package.json         # npm dependencies
β”œβ”€β”€ logs/                    # Application logs
β”œβ”€β”€ startwallet.sh          # Startup script
β”œβ”€β”€ stopwallet.sh           # Stop script
└── README.md               # This file

πŸ”§ Scripts Documentation

startwallet.sh

Comprehensive startup script that:

  • βœ… Checks all prerequisites (Java, Maven, Node.js, npm)
  • πŸ”„ Stops any existing instances on ports 3000 and 8080
  • πŸš€ Starts backend and frontend in correct order
  • ⏱️ Waits for services to be ready before proceeding
  • πŸ“Š Shows real-time startup progress
  • πŸ“ Creates detailed logs in logs/ directory
  • 🎯 Provides all necessary URLs and information

stopwallet.sh

Clean shutdown script that:

  • πŸ›‘ Gracefully stops all services
  • 🧹 Cleans up hanging processes
  • βœ… Verifies all services are stopped
  • πŸ“‹ Provides manual cleanup commands if needed

πŸ” API Endpoints

Authentication

  • POST /api/users/register - Register new user
  • POST /api/users/login - User login

Users

  • GET /api/users/{id} - Get user by ID
  • GET /api/users/username/{username} - Get user by username
  • PUT /api/users/{id} - Update user
  • DELETE /api/users/{id} - Delete user

Wallets

  • POST /api/wallets/user/{userId} - Create wallet
  • GET /api/wallets/user/{userId} - Get user wallets
  • GET /api/wallets/{walletId} - Get wallet by ID
  • POST /api/wallets/{walletId}/refresh-balance - Refresh balance

Transactions

  • POST /api/transactions/send - Send transaction
  • GET /api/transactions/wallet/{walletId} - Get wallet transactions
  • GET /api/transactions/user/{userId} - Get user transactions
  • GET /api/transactions/hash/{txHash} - Get transaction by hash

πŸš€ Development

Running in Development Mode

  1. Start Backend in Development Mode:

    cd backend
    mvn spring-boot:run -Dspring-boot.run.profiles=dev
  2. Start Frontend in Development Mode:

    cd frontend
    npm start

Building for Production

  1. Build Backend:

    cd backend
    mvn clean package
    java -jar target/crypto-wallet-backend-0.0.1-SNAPSHOT.jar
  2. Build Frontend:

    cd frontend
    npm run build
    # Serve the build directory with a static server

πŸ› Troubleshooting

Common Issues

  1. Port Already in Use:

    # Kill processes on specific ports
    lsof -ti:8080 | xargs kill -9
    lsof -ti:3000 | xargs kill -9
  2. Java Version Issues:

    # Check Java version
    java -version
    # Should be 21 or later
  3. Maven Issues:

    # Clean and reinstall dependencies
    cd backend
    mvn clean install
  4. Node.js Issues:

    # Clear npm cache and reinstall
    cd frontend
    rm -rf node_modules package-lock.json
    npm install

Log Files

Check the log files for detailed error information:

  • Backend: logs/backend.log
  • Frontend: logs/frontend.log

Real-time Log Monitoring

# Monitor backend logs
tail -f logs/backend.log

# Monitor frontend logs  
tail -f logs/frontend.log

πŸ”’ Security Notes

  • This is a development application with placeholder crypto implementations
  • Do not use in production without implementing real blockchain integrations
  • Private keys are stored in plain text for development purposes
  • Always use HTTPS in production environments

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Test thoroughly
  5. Submit a pull request

πŸ“„ License

This project is licensed under the MIT License.

πŸ†˜ Support

If you encounter any issues:

  1. Check the log files in the logs/ directory
  2. Ensure all prerequisites are installed
  3. Try running ./stopwallet.sh then ./startwallet.sh
  4. Check if ports 3000 and 8080 are available

Happy Trading! πŸš€πŸ’°

About

Crypto wallet

Resources

License

Stars

Watchers

Forks

Packages

No packages published