Complete cryptocurrency implementation with blockchain, P2P networking, transaction validation, and mining system.
- Node.js 18+
- MongoDB running on
localhost:27017 - Two terminal windows
Terminal 1 - Backend:
cd backend
npm install
cp .env.example .env # Copy environment configuration
npm run devTerminal 2 - Frontend:
cd frontend
npm install
npm run devAccess: Open http://localhost:5173 in your browser
# Start a new node (auto-assigns ports)
npm run dev
# Start specific nodes
npm run dev:node1 # Port 3000
npm run dev:node2 # Port 3001
npm run dev:node3 # Port 3002
npm run dev:node4 # Port 3003
# Network management
npm run dev:status # Check running nodes
npm run dev:kill # Kill all nodes
npm run dev:reset # Kill all nodes and reset network- ✅ Complete blockchain with transaction validation
- ✅ Transaction pool for pending transactions
- ✅ Mining with reward transactions
- ✅ Proof-of-work consensus mechanism
- ✅ Multi-node support (WebSocket-based)
- ✅ Automatic blockchain synchronization
- ✅ Transaction broadcasting across nodes
- ✅ MongoDB for blockchain, blocks, transactions, and users
- ✅ Persistent storage with automatic loading
- ✅ User registration and login required
- ✅ JWT token validation for API access
- ✅ Role-based access control
- ✅ Protection against NoSQL injection, XSS, DDoS
- ✅ User registration and authentication
- ✅ Create new transactions (send coins)
- ✅ View transaction history
- ✅ Browse blockchain and blocks
- ✅ Mine new blocks interface
- ✅ 67 passing tests for transaction handling
- ✅ Clean Code, SOC, MVC architecture
- ✅ TypeScript for type safety
- Create new account with email/password
- Login receives JWT token for API access
- Send coins to other users (by email or wallet address)
- Transactions added to pool, confirmed when mined
- Click "Mine Block" to process pending transactions
- Receive mining reward (50 SandiCoins)
# Start multiple backend nodes
cd backend && PORT=3001 npm run dev # Node 1
cd backend && PORT=3002 npm run dev # Node 2
cd backend && PORT=3003 npm run dev # Node 3- Explore all blocks with transactions
- View network statistics and node information
- Backend: Node.js, TypeScript, Express, MongoDB, WebSockets, JWT
- Frontend: React, TypeScript, Vite, Axios
- Testing: Vitest (67 tests)
- Security: Input validation, CORS, rate limiting, sanitization
POST /api/auth/register- User registrationPOST /api/auth/login- User loginPOST /api/transactions- Create transactionGET /api/transactions- View user transactionsPOST /api/mining/mine- Mine new blockGET /api/blockchain- Get full blockchain
Assignment: Kryptovaluta och nätverk - Backend Development Course
Author: Manuel Lopez
Features: All G and VG requirements implemented