- β‘ Stored Procedures: 7 optimiz### π§ Technical Implementation
- Database Integration: Two dedicated blockchain tables
blockchain: Store blockchain blocks with hash chainsblockchain_transactions: Store blockchain-specific transaction data
- Python Implementation: Complete blockchain classes and utilities
- API Endpoints: REST APIs for blockchain verification and analytics
- Real-time Processing: Blockchain validation during transaction processing
FinGuard uses a comprehensive MySQL database with 14 core tables:
users: User account information with balance trackingroles: Role-based access control (USER, ADMIN, AGENT)permissions: System permissions and capabilitiesrole_permissions: Role-permission mappingstransactions: All financial transactions with audit trailcontact_info: User contact information (email, phone)addresses: User address information
blockchain: Immutable blockchain blocks with hash chainsblockchain_transactions: Blockchain-specific transaction data
fraud_list: Fraud reports and investigationsuser_passwords: Secure password hashesadmin_logs: Complete audit trail of all actions
budgets: User budget planningbudget_expense_categories: Budget expense categoriesbudget_expense_items: Individual budget itemsuser_expense_habit: User spending patterns and habits
- Foreign Key Constraints: Complete referential integrity
- Indexes: Optimized queries with strategic indexing
- Triggers: Automatic validation and audit logging
- Stored Procedures: Complex operations with error handling
- Functions: Analytical functions for risk assessment
- π§ Functions: 4 analytical functions for risk and spending analysis
- ποΈ Views: 3 comprehensive views for reporting and monitoring
- π Triggers: 4 audit triggers for automatic logging and fraud detection
- π Blockchain Integration: Immutable transaction records with SHA-256 hashingnking Features**
- πΈ Enhanced Money Transfers: Fraud detection, balance validation
- π Transaction Rollbacks: 72-hour rollback window with audit trail
- π Risk Assessment: Real-time user risk scoring
- π‘οΈ Fraud Protection: Automatic fraud flagging and prevention
- π Blockchain Security: SHA-256 blockchain for transaction integrity
- π Immutable Records: Tamper-proof transaction history
π INSTANT SETUP: Just run
setup.batβ Open http://localhost:5000
Login: admin/admin, agent/agent, or user/user
FinGuard is a comprehensive personal finance management web application with advanced PL/SQL optimizations, rollback functionality, modern UI, role-based access control, budget planning, and transaction management.
Just double-click: setup.bat
The setup will prompt you for MySQL credentials, then everything happens automatically:
- β Installs MySQL (if needed)
- β Installs Python packages
- π Creates fresh database (removes existing if found)
- π§ Updates app/config.py with your MySQL credentials
- β Deploys comprehensive PL/SQL optimizations
- β Adds test data and user accounts
- β Starts the application
fin_guard database for a clean installation.
- Windows OS
- Python 3.8+ (will be installed if missing)
- MySQL 5.7+ (will be installed if missing)
- Internet connection (for package installation)
No need to install MySQL manually - the setup script handles it!
After running setup.bat, login with these accounts:
| Username | Password | Role |
|---|---|---|
| admin | admin | Admin |
| agent | agent | Agent |
| user | user | User |
Access: http://localhost:5000 (opens automatically)
- οΏ½ Enhanced Money Transfers: Fraud detection, balance validation
- π Transaction Rollbacks: 72-hour rollback window with audit trail
- π Risk Assessment: Real-time user risk scoring
- π‘οΈ Fraud Protection: Automatic fraud flagging and prevention
- β‘ Stored Procedures: 7 optimized procedures for core operations
- οΏ½ Functions: 4 analytical functions for risk and spending analysis
- ποΈ Views: 3 comprehensive views for reporting and monitoring
- π Triggers: 3 audit triggers for automatic logging
- Admin Dashboard: User management, system monitoring, fraud reports
- Agent Dashboard: Customer service, transaction assistance
- User Dashboard: Personal finance, budgets, transaction history
- π Dark Theme: Professional dark mode interface
- π± Responsive Design: Works on all devices
- π Real-time Charts: Interactive financial analytics
- π Security: Role-based permissions, session management
- πΈ Enhanced Money Transfers: Secure transfers with fraud detection
- π Transaction Rollbacks: Undo transactions within 72 hours
- π Budget Planning: Create and manage personal budgets
- π Transaction Analytics: Real-time financial insights
- π‘οΈ Fraud Protection: Automatic fraud detection and reporting
- π Blockchain Security: Immutable transaction records with SHA-256 hashing
- π Transaction Integrity: Tamper-proof blockchain validation
- π§ Admin Panel: User management, system monitoring, fraud reports, blockchain analytics
- π― Agent Tools: Customer service, money operations, transaction assistance
- π€ User Portal: Personal finance, budgets, transaction history
- π Risk Scoring: AI-powered user risk assessment
- π° Spending Analysis: Daily/weekly/monthly spending patterns
- π Audit Trails: Complete transaction logging and monitoring
- π Reporting: Comprehensive financial reports
- π Blockchain Analytics: Real-time blockchain integrity monitoring
- π Fraud Detection: Advanced blockchain-based fraud detection
FinGuard features a complete blockchain implementation for transaction security and fraud detection:
- Block Class: Immutable blocks with SHA-256 hashing
- Genesis Block: System-initialized first block
- Chain Validation: Complete blockchain integrity verification
- Tamper Detection: Automatic detection of blockchain manipulation
- SHA-256 Hashing: Cryptographic security for each block
- Immutable Records: Tamper-proof transaction history
- Chain Validation: Real-time blockchain integrity checks
- Fraud Detection: Advanced fraud detection through blockchain analysis
- Real-time Monitoring: Live blockchain status and health
- Block Statistics: Total blocks, validation status, chain health
- Fraud Reports: Blockchain-based fraud detection results
- Transaction Verification: Verify individual transactions via blockchain
- Transaction Validation: Every transaction validated against blockchain
- Inconsistency Detection: Automatic detection of blockchain inconsistencies
- User Flagging: Automatic fraud flagging based on blockchain analysis
- Audit Trail: Complete audit trail of all blockchain operations
- Database Integration: Two dedicated blockchain tables
blockchain: Store blockchain blocks with hash chainsblockchain_transactions: Store blockchain-specific transaction data
- Python Implementation: Complete blockchain classes and utilities
- API Endpoints: REST APIs for blockchain verification and analytics
- Real-time Processing: Blockchain validation during transaction processing
ProcessMoneyTransferEnhanced: Enhanced money transfer with fraud detectionRollbackTransaction: Rollback completed transactionsGetTransactionStatus: Check transaction status and rollback eligibilityBackupUserBalance: Create user balance backupsRestoreUserBalance: Restore user balance from backupAutoRollbackFailedTransactions: Auto-rollback failed transactionsCleanupOldFraudReports: Clean up old fraud reportsAddColumnIfNotExists: Dynamic database schema modifications
GetUserRiskScore: Calculate user risk score (0-100)GetUserDailySpending: Get daily spending amountIsWithinSpendingLimit: Check if user is within spending limitsGetUserTransactionCount: Get transaction count for specified period
v_transaction_analytics: Comprehensive transaction analysisv_user_risk_analysis: User risk and spending analysisv_rollback_monitoring: Rollback eligibility monitoring
tr_transaction_audit: Automatic transaction audit loggingtr_balance_validation: Prevent negative balances and log changestr_fraud_detection: Real-time fraud detection and flaggingtr_user_registration: Handle new user registration tasks
BlockClass: Immutable blocks with SHA-256 hashingFinGuardBlockchainClass: Complete blockchain management- Blockchain Tables:
blockchain: Store blockchain blocksblockchain_transactions: Store blockchain-specific transaction data
- Fraud Detection: Advanced blockchain-based fraud detection
- Transaction Integrity: Tamper-proof transaction validation
- Real-time Monitoring: Blockchain analytics and monitoring dashboard
FinGuard/
βββ setup.bat # π One-click setup script (run this!)
βββ auto_setup.py # Automatic MySQL installation and setup
βββ database_seed.py # Database seeding with test data
βββ run.py # Start the application
βββ FinGuard_Complete_PL_SQL.sql # π Complete PL/SQL optimizations
βββ deploy_complete.bat # Deploy all PL/SQL features
βββ fix_collations.sql # Fix database collation issues
βββ DatabaseSchema_MySQL.sql # MySQL database schema
βββ app/ # Main application code
β βββ routes/ # Web pages and API endpoints
β β βββ blockchain.py # π Blockchain routes and analytics
β β βββ admin.py # Admin dashboard
β β βββ agent.py # Agent operations
β β βββ user.py # User operations
β β βββ fraud.py # Fraud detection
β βββ templates/ # HTML templates
β β βββ blockchain_dashboard.html # π Blockchain monitoring dashboard
β β βββ admin_dashboard.html # Admin interface
β β βββ ... # Other templates
β βββ static/ # CSS, JavaScript, images
β βββ utils/ # Business logic and database operations
β βββ blockchain_utils.py # π Complete blockchain implementation
β βββ advanced_sql_utils.py # Advanced SQL operations
β βββ fraud_utils.py # Fraud detection utilities
β βββ ... # Other utilities
βββ PL_SQL_Documentation.md # π Complete PL/SQL documentation
- MySQL installation fails: The script will prompt to install manually from https://dev.mysql.com/downloads/
- Permission denied: Run
setup.batas administrator - Python not found: Install Python 3.8+ from https://python.org
- MySQL connection fails: Double-check your MySQL credentials (host, port, username, password)
- Collation errors: Run
fix_collations.batto fix database collation issues
- Can't login: Use test accounts (admin/admin, agent/agent, user/user)
- Page errors: Restart by running
python run.py - Missing data: Rerun
setup.batto recreate sample data
- Custom MySQL settings: Edit
mysql_config_template.pybefore running setup - Production deployment: Set environment variables for database credentials
- Development: All source code is in the
app/directory
- Double-click:
setup.bat - Enter MySQL credentials: When prompted (host, port, username, password)
- Wait: Automatic setup completes (2-5 minutes)
- Access: Browser opens to http://localhost:5000
- Login: Use admin/admin, agent/agent, or user/user
If you prefer manual control:
# Install dependencies
pip install PyMySQL cryptography Flask-SQLAlchemy
# Setup database and seed data
python auto_setup.py
# Start application
python run.pyAll accounts start with 10,000 balance for testing:
| Role | Username | Password | Features |
|---|---|---|---|
| Admin | admin | admin | User management, admin dashboard, blockchain analytics |
| Agent | agent | agent | Add money, cash out, agent dashboard |
| User | user | user | Send money, budgets, profile |
- Admin Users: Access full blockchain analytics at
/blockchain-dashboard - Real-time Monitoring: Live blockchain health and integrity status
- Fraud Detection: View blockchain-based fraud detection results
- Transaction Verification: Verify individual transactions via blockchain
- Database: MySQL 8.0+ (
fin_guarddatabase) - Schema:
DatabaseSchema_MySQL.sqlwith proper ENUM constraints - Setup: Fully automated via
setup.bat - Connection: PyMySQL with robust error handling
- Features:
- β Foreign key relationships
- β ENUM constraints for data integrity
- β Automatic installation and configuration
- Python Flask - Web framework
- MySQL - Database
- Bootstrap 5 - Modern UI
- Chart.js - Data visualization
β
Enterprise-Grade Security: Complete blockchain implementation with SHA-256 hashing
β
Advanced Fraud Detection: Multi-layered fraud detection with automatic flagging
β
Fully Working: All features tested and functional including blockchain validation
β
One-Click Setup: Single script does everything automatically
β
Modern Design: Dark theme, responsive layout with blockchain analytics
β
Real-World Ready: Role permissions, security features, immutable audit trail
β
Zero Configuration: Automatic MySQL installation and setup
β
Comprehensive Database: 14 tables with stored procedures, functions, and triggers
β
Complete Documentation: Full database documentation in /app/utils/README.md
- Blockchain Integrity: Every transaction secured with SHA-256 blockchain
- Immutable Records: Tamper-proof transaction history
- Fraud Detection: Advanced fraud detection through blockchain analysis
- Role-Based Access: Multi-level permission system
- Audit Trail: Complete logging of all system actions
- Password Security: Bcrypt hashing with salt
- Real-time Blockchain Analytics: Live monitoring of blockchain health
- Transaction Analytics: Comprehensive transaction analysis
- Risk Assessment: AI-powered user risk scoring
- Fraud Reports: Detailed fraud investigation reports
- System Monitoring: Complete system health monitoring
- Performance Metrics: Database and application performance tracking
Ready to explore personal finance management with enterprise-grade blockchain security? Just run setup.bat and start in under 5 minutes!
/app/utils/README.md: Complete database documentation including:- All 14 database tables with column descriptions
- Stored procedures, functions, and triggers
- Common database queries used throughout the application
- Blockchain implementation details
- Security features and fraud detection mechanisms
PL_SQL_Documentation.md: Comprehensive PL/SQL documentationFinGuard_Complete_PL_SQL.sql: Complete PL/SQL implementation
- π Database Schema: Complete 14-table schema documentation
- π Blockchain Implementation: SHA-256 blockchain with fraud detection
- π§ Stored Procedures: 8 optimized procedures for core operations
- π Functions: 4 analytical functions for risk assessment
- π Triggers: 4 audit triggers for automatic logging
- π‘οΈ Security Features: Role-based access, fraud detection, audit trails
- π Query Reference: Common database queries used in application