This project implements a digital cash system similar to Chaum's blind signature scheme, demonstrating how to create, spend, and detect double-spending of digital coins while maintaining user privacy.
- Blind signature implementation for secure coin creation
- Double-spending detection
- Merchant cheating detection
- Privacy-preserving transactions
- Identity revelation only for double-spenders
- Node.js
- npm (Node Package Manager)
- Clone the repository
- Install dependencies:
npm install blind-signaturesdriver.js: Main execution file containing the core logiccoin.js: Coin class implementationutils.js: Utility functions for cryptographic operations
-
Coin Creation:
- A user creates a coin with a specific amount
- The coin contains blinded identity strings (RIS - Reveal Identity String)
- The bank signs the blinded coin
-
Transaction Process:
- User unblinds the signature
- Merchant verifies the coin's signature
- Merchant randomly selects left or right half of the identity string
- Transaction is completed
-
Security Features:
- Blind signatures ensure bank can't track coins
- Double-spending detection reveals cheater's identity
- Merchant cheating detection prevents RIS reuse
Run the demo:
node driver.js=== Digital Cash System Demo ===
Creating a new coin...
Created coin for: [User]
Amount: 20 units
Coin ID: [Unique ID]
=== Bank Operations ===
✓ Coin signed and unblinded successfully
=== Merchant Transactions ===
Merchant 1 accepting the coin...
✓ Transaction 1 completed
Merchant 2 accepting the same coin...
✓ Transaction 2 completed
=== Double-Spending Detection Results ===
🚫 ALERT: Double-Spending Detected!
Cheater Identity: [User]
-
Privacy:
- Regular users remain anonymous
- Only double-spenders are identified
-
Anti-Fraud:
- Double-spending detection
- Merchant cheating detection
- Secure blind signatures
-
Verification:
- Bank signature verification
- RIS validation
- Transaction integrity checks
- Uses RSA blind signatures
- Implements one-time pad (OTP) for identity strings
- SHA-256 hashing for security
- 2048-bit key length for bank signatures
Feel free to submit issues and enhancement requests!