SLUDI (Sri Lankan Unique Digital Identity) is a comprehensive blockchain-based digital identity management system that provides secure, decentralized identity verification using Hyperledger Fabric, IPFS, and AI-powered biometric authentication.
- Decentralized Identity (DID): Blockchain-based identity creation and management
- Biometric Authentication: Fingerprint, face recognition, and signature verification
- Verifiable Credentials: Issue and verify government credentials (Identity, Driving License)
- Digital Wallet: Secure credential storage with cryptographic authentication
- AI-Powered Security: Deepfake detection and liveness checks
- Privacy-Preserving: Selective disclosure via Verifiable Presentations
- Distributed Storage: IPFS for encrypted biometric data
- Multi-Organization Support: Role-based access control for organizations
- Field-level AES-256 encryption for PII
- Dual JWT authentication (Citizen & Organization)
- Digital signatures (SHA256withECDSA)
- Hash-based indexing for privacy
- Immutable blockchain audit trail
- TLS/SSL encrypted communications
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Spring Boot Backend β
β ββββββββββββββββ ββββββββββββββββ ββββββββββββββββ β
β β Controllers β β Services β β Repositories β β
β ββββββββ¬ββββββββ ββββββββ¬ββββββββ ββββββββ¬ββββββββ β
β β β β β
β βββββββββββββββββββ΄ββββββββββββββββββ β
βββββββββββββββββββ¬ββββββββββββββββββββ¬ββββββββββββββββββββββββ
β β
βββββββββββ΄ββββββββββ ββββββββ΄βββββββ
β Hyperledger β β IPFS β
β Fabric Network β β Storage β
β (DID & VCs) β β (Biometrics)β
βββββββββββββββββββββ βββββββββββββββ
β
βββββββββββ΄ββββββββββ
β PostgreSQL DB β
β (User Metadata) β
βββββββββββββββββββββ
- Java: JDK 21 or higher
- Docker: 20.10+ and Docker Compose
- Hyperledger Fabric: Test network running
- PostgreSQL: 16+ (or use Docker)
- IPFS: Kubo node (or use Docker)
- Redis: Latest (or use Docker)
- Gradle: 6.5+ or Maven 3.6+
git clone https://github.com/Tishan-001/SLUDI-Backend.git
cd SLUDI-BackendCreate a .env file or update docker-compose.yml with your configuration:
# Application
SERVER_PORT=5000
SPRING_BASE_URL=https://your-domain.com
# Database
SPRING_DATASOURCE_URL=jdbc:postgresql://postgres:5432/sluditest
SPRING_DATASOURCE_USERNAME=postgres
SPRING_DATASOURCE_PASSWORD=your_secure_password
# Redis
SPRING_REDIS_HOST=redis
SPRING_REDIS_PORT=6379
SPRING_REDIS_PASSWORD=your_redis_password
# IPFS
IPFS_API_HOST=ipfs
IPFS_API_PORT=5001
IPFS_GATEWAY_URL=http://ipfs:8080/ipfs/
# Hyperledger Fabric
FABRIC_MSP_ID=Org1MSP
FABRIC_CHANNEL_NAME=sludi-channel
FABRIC_CHAINCODE_NAME=sludiChaincode
FABRIC_PEER_ENDPOINT=peer0.org1.example.com:7051
# Security
JWT_SECRET_KEY=your_base64_encoded_secret_key# Start PostgreSQL, IPFS, and Redis
docker-compose up -d postgres ipfs redisUsing Gradle:
./gradlew clean buildUsing Maven:
mvn clean installUsing Gradle:
./gradlew bootRunUsing Maven:
mvn spring-boot:runUsing Docker:
docker-compose up -d backendThe application will start on http://localhost:5000
Once the application is running, access the interactive API documentation:
- Swagger UI: http://localhost:5000/swagger-ui.html
- OpenAPI Spec: http://localhost:5000/v3/api-docs
POST /api/citizen-user/register # Register new citizen
GET /api/citizen-user/profile?id={uuid} # Get user profile
PUT /api/citizen-user/{id}/profile # Update profile
POST /api/citizen-user/{id}/profile-photo # Upload profile photo
POST /api/citizen-user/save-biometric # Save biometric dataPOST /api/did/register # Create new DID
GET /api/did/{didId} # Retrieve DID document
PUT /api/did/{didId} # Update DID document
DELETE /api/did/{didId} # Deactivate DIDPOST /api/vc/issue/identity # Issue identity credential
POST /api/vc/issue/driving-license # Issue driving license
GET /api/vc/{credentialId} # Retrieve credential
POST /api/vc/verify # Verify credentialPOST /api/wallet/initiate # Initiate wallet creation
POST /api/wallet/create # Create wallet
POST /api/wallet/challenge # Generate auth challenge
POST /api/wallet/verify-challenge # Verify signed challenge
GET /api/wallet/retrieve?did={did} # Retrieve wallet dataPOST /api/deepfake/detect # Detect image deepfakes
POST /api/deepfake/detect-video # Detect video deepfakes
POST /api/deepfake/quick-check # Quick liveness checkGET /api/blockchain/health # Check blockchain health
GET /api/blockchain/network-info # Get network details
GET /api/blockchain/stats # System statisticsKey configuration options in application.properties:
# Server
server.port=5000
# Fabric Configuration
fabric.msp-id=Org1MSP
fabric.channel-name=sludi-channel
fabric.chaincode-name=sludiChaincode
fabric.crypto-path=/path/to/fabric/crypto
fabric.peer-endpoint=localhost:7051
# IPFS Settings
ipfs.api.host=localhost
ipfs.api.port=5001
sludi.ipfs.encryption.enabled=true
sludi.ipfs.pin.enabled=true
sludi.ipfs.timeout.seconds=30
sludi.ipfs.retry.attempts=3
# JWT Settings
security.jwt.access.expiration-time=900000 # 15 minutes
security.jwt.refresh.expiration-time=604800000 # 7 days
# File Upload
spring.servlet.multipart.max-file-size=5MB
spring.servlet.multipart.max-request-size=5MB
# Database Pool
spring.datasource.hikari.maximum-pool-size=10
spring.datasource.hikari.minimum-idle=2- Registration: User registers with biometrics β DID created on blockchain
- Wallet Setup: OTP verification β Wallet created with public key
- Login: Challenge-response authentication with digital signature
- Access: JWT token issued for API access
- Login: Credentials-based authentication
- Authorization: Role-based access control with permission templates
- Access: JWT token with organization-specific claims
- At Rest: AES-256 encryption for all PII in PostgreSQL
- In Transit: TLS/SSL for all communications
- IPFS Storage: Encrypted before upload with integrity hashes
- Indexing: SHA-256 hashes for unique constraints (privacy-preserving)
docker-compose up -dThis starts:
- PostgreSQL (port 5432)
- IPFS (ports 4001, 5001, 8080)
- Redis (port 6379)
- SLUDI Backend (port 5000)
# Start only database
docker-compose up -d postgres
# Start only IPFS
docker-compose up -d ipfs
# View logs
docker-compose logs -f backendUser Submits Form β Validate Data β Deepfake Detection β
Store Biometrics (IPFS) β Generate DID β Sign DID β
Submit to Blockchain β Save to PostgreSQL β Send Verification Email
Officer Generates QR β Citizen Scans β Wallet Retrieves Request β
Citizen Approves β Wallet Submits VP β System Verifies β
Officer Reviews β Issues VC β Store on Blockchain β Add to Wallet
Request Challenge β Generate Nonce β Wallet Signs β
Verify Signature β Issue JWT Token
- CitizenUser: User profiles with encrypted PII
- DIDDocument: Blockchain-based identity documents
- VerifiableCredential: Government-issued credentials
- Wallet: Digital wallet for credential storage
- Organization: Multi-org support with RBAC
- Appointment: Appointment scheduling system
- IPFSContent: Metadata for IPFS-stored files
# Run all tests
./gradlew test
# Run with coverage
./gradlew test jacocoTestReport
# Run specific test class
./gradlew test --tests "CitizenUserServiceTest"- Spring Boot: 3.5.4
- Hyperledger Fabric Gateway: 1.8.0
- IPFS Java API: 1.3.3
- JWT (JJWT): 0.11.5
- BouncyCastle: 1.78
- PostgreSQL Driver: 42.7.3
- Redis: Spring Data Redis
- Lombok: 1.18.34
- SpringDoc OpenAPI: 2.8.0
- ZXing (QR Codes): 3.5.3
src/main/java/org/example/
βββ config/ # Configuration classes
βββ controller/ # REST API controllers (10)
βββ dto/ # Data Transfer Objects (97+)
βββ entity/ # JPA entities (25)
βββ exception/ # Custom exceptions
βββ integration/ # External integrations (IPFS, Fabric, AI)
βββ repository/ # Data repositories (17)
βββ security/ # Security filters & configs
βββ service/ # Business logic (16 services)
βββ utils/ # Utility classes
- Follow Java naming conventions
- Use Lombok for boilerplate reduction
- Document public APIs with JavaDoc
- Write unit tests for services
1. Blockchain Connection Failed
# Check Fabric network is running
docker ps | grep hyperledger
# Verify peer endpoint
curl -k https://peer0.org1.example.com:70512. IPFS Connection Error
# Check IPFS daemon
docker logs ipfs_node
# Test IPFS API
curl http://localhost:5001/api/v0/version3. Database Connection Issues
# Check PostgreSQL
docker logs postgres-container
# Test connection
psql -h localhost -U postgres -d sluditest- Connection Pooling: HikariCP with optimized settings
- Redis Caching: Cache frequently accessed data
- Async Processing: Use
@Asyncfor heavy operations - IPFS Pinning: Ensure data persistence
- Database Indexing: Hash-based indexes for fast lookups
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- Write meaningful commit messages
- Add tests for new features
- Update documentation
- Follow existing code style
- Ensure all tests pass
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
- Hyperledger Fabric - Blockchain framework
- IPFS - Distributed storage
- Spring Framework - Application framework
- BouncyCastle - Cryptography library
For issues and questions:
- Email: infosludi@gmail.com
- Issues: GitHub Issues
- Multi-language support
- Mobile SDK for wallet integration
- Advanced analytics dashboard
- Biometric template matching
- Cross-chain interoperability
- Zero-knowledge proof integration
- Decentralized key recovery
Built with β€οΈ for secure digital identity management