custom-ocean.xyz-dashboard/README.md
DJObleezy 5a6331d032 Enhance earnings features and improve data handling
- Updated `App.py` to add a datetime formatting filter and enhance the earnings route with better error handling and currency conversion.
- Revised `README.md` to document new features, including earnings breakdown and API endpoints.
- Added default currency setting in `config.json` and a function to retrieve it in `config.py`.
- Improved `data_service.py` with a new method for fetching payment history and enhanced error handling.
- Updated `setup.py` to include new CSS and JS files for the earnings page.
- Enhanced styling in `common.css`, `dashboard.css`, and `earnings.css` for better responsiveness.
- Optimized `workers.js` for improved performance with a progressive loading approach.
- Updated multiple HTML files to reflect new dashboard structure and features.
- Enhanced `worker_service.py` for consistent hashrate values and improved logging.
2025-04-28 09:20:56 -07:00

302 lines
13 KiB
Markdown

# DeepSea Dashboard
## A Retro Mining Monitoring Solution
This open-source dashboard provides real-time monitoring for Ocean.xyz pool miners, offering detailed insights on hashrate, profitability, worker status, and network metrics. Designed with a retro terminal aesthetic and focused on reliability, it helps miners maintain complete oversight of their operations.
---
## Gallery:
![DeepSea Boot](https://github.com/user-attachments/assets/77222f13-1e95-48ee-a418-afd0e6b7a920)
![DeepSea Config](https://github.com/user-attachments/assets/e23859bd-76f3-4239-aa6b-060b5bf13f1b)
![DeepSea Dashboard](https://github.com/user-attachments/assets/8a96fd5e-5ba2-4e0e-be83-965ecb046671)
![DeepSea Workers](https://github.com/user-attachments/assets/075d3f25-bbfb-4e0d-a4d1-1e7f23b96715)
![DeepSea Blocks](https://github.com/user-attachments/assets/078fc533-62c7-4375-bdb4-5f33e4a07925)
![DeepSea Notifications](https://github.com/user-attachments/assets/881ffac0-e447-4455-8b6e-39e2aac1b94e)
---
## Key Features
### Real-Time Mining Metrics
- **Live Hashrate Tracking**: Monitor 60-second, 10-minute, 3-hour, and 24-hour average hashrates
- **Profitability Analysis**: View daily and monthly earnings in both BTC and USD
- **Financial Calculations**: Automatically calculate revenue, power costs, and net profit
- **Network Statistics**: Track current Bitcoin price, difficulty, and network hashrate
- **Payout Monitoring**: View unpaid balance and estimated time to next payout
- **Pool Fee Analysis**: Monitor pool fee percentages with visual indicator when optimal rates (0.9-1.3%) are detected
### Multi-Currency Support
- **Flexible Currency Configuration: Set your preferred fiat currency for displaying Bitcoin value and earnings
- **Wide Currency Selection: Choose from USD, EUR, GBP, JPY, CAD, AUD, CNY, KRW, BRL, CHF and more
- **Real-Time Exchange Rates: Automatically fetches up-to-date exchange rates from public APIs
- **Persistent Configuration: Currency preferences saved and restored between sessions
- **Adaptive Notifications: Financial notifications display in your selected currency
### Worker Management
- **Fleet Overview**: Comprehensive view of all mining devices in one interface
- **Status Monitoring**: Real-time status indicators for online and offline devices
- **Performance Data**: Individual hashrate, temperature, and acceptance rate metrics
- **Filtering Options**: Sort and search by device type or operational status
### Bitcoin Block Explorer
- **Recent Blocks**: View the latest blocks added to the blockchain
- **Block Details**: Examine transaction counts, fees, and mining pool information
- **Visual Indicators**: Track network difficulty and block discovery times
### Earnings Page
- **Detailed Earnings Breakdown**: View earnings by time period (daily, weekly, monthly)
- **Currency Conversion**: Automatically convert earnings to your preferred fiat currency
- **Historical Data**: Access past earnings data for analysis
### System Resilience
- **Connection Recovery**: Automatic reconnection after network interruptions
- **Backup Polling**: Fallback to traditional polling if real-time connection fails
- **Cross-Tab Synchronization**: Data consistency across multiple browser tabs
- **Server Health Monitoring**: Built-in watchdog processes ensure reliability
- **Error Handling**: Displays a user-friendly error page (`error.html`) for unexpected issues.
### Distinctive Design Elements
- **Retro Terminal Aesthetic**: Nostalgic interface with modern functionality
- **Boot Sequence Animation**: Engaging initialization sequence on startup
- **System Monitor**: Floating status display with uptime and refresh information
- **Responsive Interface**: Adapts to desktop and mobile devices
### DeepSea Theme
- **Underwater Effects**: Light rays and digital noise create an immersive experience.
- **Retro Glitch Effects**: Subtle animations for a nostalgic feel.
- **Theme Toggle**: Switch between Bitcoin and DeepSea themes with a single click.
## Quick Start
### Installation
1. Clone the repository
```
git clone https://github.com/Djobleezy/DeepSea-Dashboard.git
cd DeepSea-Dashboard
```
2. Install dependencies:
```
pip install -r requirements.txt
```
3. Run the setup script:
```
python setup.py
```
4. Start the application:
```
python App.py
```
5. Open your browser at `http://localhost:5000`
For detailed deployment instructions with Redis persistence and Gunicorn configuration, see [deployment_steps.md](deployment_steps.md).
## Using docker-compose (with Redis)
The `docker-compose.yml` file makes it easy to deploy the dashboard and its dependencies.
### Steps to Deploy
1. **Start the services**:
Run the following command in the project root:
```
docker-compose up -d
```
2. **Access the dashboard**:
Open your browser at `http://localhost:5000`.
3. **Stop the services**:
To stop the services, run:
```
docker-compose down
```
### Customization
You can modify the following environment variables in the `docker-compose.yml` file:
- `WALLET`: Your Bitcoin wallet address.
- `POWER_COST`: Cost of power per kWh.
- `POWER_USAGE`: Power usage in watts.
- `NETWORK_FEE`: Additional fees beyond pool fees (e.g., firmware fees).
- `TIMEZONE`: Local timezone for displaying time information.
- `CURRENCY`: Preferred fiat currency for earnings display.
Redis data is stored in a persistent volume (`redis_data`), and application logs are saved in the `./logs` directory.
For more details, refer to the [docker-compose documentation](https://docs.docker.com/compose/).
## Dashboard Components
### Main Dashboard
- Interactive hashrate visualization with trend analysis
- Real-time profitability metrics with cost calculations
- Network statistics with difficulty and price tracking
- Payout information with estimation timing
- Visual indicators for metric changes
### Workers Dashboard
- Fleet summary with aggregate statistics
- Individual worker cards with detailed metrics
- Status indicators with color-coded alerts
- Search and filtering functionality
- Performance trend mini-charts
### Earnings Page
- Detailed earnings breakdown by time period
- Currency conversion for earnings in selected fiat
- Historical data for earnings analysis
### Blocks Explorer
- Recent block visualization with mining details
- Transaction statistics and fee information
- Mining pool attribution
- Block details modal with comprehensive data
### Notifications
- Real-time alerts for important events
- Notification history with read/unread status
### System Monitor
- Floating interface providing system statistics
- Progress indicator for data refresh cycles
- System uptime display
- Real-time connection status
## System Requirements
The application is designed for efficient resource utilization:
- **Server**: Any system capable of running Python 3.9+
- **Memory**: Minimal requirements (~100MB RAM)
- **Storage**: Less than 50MB for application files
- **Database**: Optional Redis for persistent state
- **Compatible with**: Windows, macOS, and Linux
## Technical Architecture
Built with a modern stack for reliability and performance:
- **Backend**: Flask with Server-Sent Events for real-time updates
- **Frontend**: Vanilla JavaScript with Chart.js for visualization
- **Data Processing**: Concurrent API calls with smart caching
- **Resilience**: Automatic recovery mechanisms and state persistence
- **Configuration**: Environment variables and JSON-based settings
## API Endpoints
- `/api/metrics`: Provides real-time mining metrics.
- `/api/available_timezones`: Returns a list of supported timezones.
- `/api/config`: Fetches or updates the mining configuration.
- `/api/health`: Returns the health status of the application.
- `/api/notifications`: Manages notifications for the user.
- `/api/workers`: Manages worker data and status.
- `api/time`: Returns the current server time.
- `api/timezone`: Returns the current timezone.
- `api/scheduler-health`: Returns the health status of the scheduler.
- `api/fix-scheduler`: Fixes the scheduler if it is not running.
- `api/force-refresh`: Forces a refresh of the data.
- `api/reset-chart-data`: Resets the chart data.
- `api/memory-profile`: Returns the memory profile of the application.
- `api/memory-history`: Returns the memory history of the application.
- `api/force-gc`: Forces garbage collection to free up memory.
- `api/notifications/clear`: Clears all notifications.
- `api/notifications/delete`: Deletes a specific notification.
- `api/notifications/mark_read`: Marks a notification as read.
- `api/notifications/unread_count`: Returns the count of unread notifications.
## Project Structure
The project follows a modular architecture with clear separation of concerns:
```
DeepSea-Dashboard/
├── App.py # Main application entry point
├── config.py # Configuration management
├── config.json # Configuration file
├── data_service.py # Service for fetching mining data
├── models.py # Data models
├── state_manager.py # Manager for persistent state
├── worker_service.py # Service for worker data management
├── notification_service.py # Service for notifications
├── minify.py # Script for minifying assets
├── setup.py # Setup script for organizing files
├── requirements.txt # Python dependencies
├── Dockerfile # Docker configuration
├── docker-compose.yml # Docker Compose configuration
DeepSea-Dashboard/
├── templates/ # HTML templates
│ ├── base.html # Base template with common elements
│ ├── boot.html # Boot sequence animation
│ ├── dashboard.html # Main dashboard template
│ ├── workers.html # Workers dashboard template
│ ├── blocks.html # Bitcoin blocks template
│ ├── notifications.html # Notifications template
│ ├── earnings.html # Earnings page template
│ └── error.html # Error page template
├── static/ # Static assets
│ ├── css/ # CSS files
│ │ ├── common.css # Shared styles across all pages
│ │ ├── dashboard.css # Main dashboard styles
│ │ ├── workers.css # Workers page styles
│ │ ├── boot.css # Boot sequence styles
│ │ ├── blocks.css # Blocks page styles
│ │ ├── notifications.css # Notifications page styles
│ │ ├── earnings.css # Earnings page styles
│ │ ├── error.css # Error page styles
│ │ ├── retro-refresh.css # Floating refresh bar styles
│ │ └── theme-toggle.css # Theme toggle styles
│ │
│ └── js/ # JavaScript files
│ ├── main.js # Main dashboard functionality
│ ├── workers.js # Workers page functionality
│ ├── blocks.js # Blocks page functionality
│ ├── notifications.js # Notifications functionality
│ ├── earnings.js # Earnings page functionality
│ ├── block-animation.js # Block mining animation
│ ├── BitcoinProgressBar.js # System monitor functionality
│ └── theme.js # Theme toggle functionality
├── deployment_steps.md # Deployment guide
├── project_structure.md # Additional structure documentation
├── LICENSE.md # License information
└── logs/ # Application logs (generated at runtime)
```
For more detailed information on the architecture and component interactions, see [project_structure.md](project_structure.md).
## Troubleshooting
For optimal performance:
1. Ensure your wallet address is correctly configured
2. Check network connectivity for consistent updates
3. Use the system monitor to verify connection status
4. Access the health endpoint at `/api/health` for diagnostics
5. For stale data issues, use the Force Refresh function
6. Use hotkey Shift+R to clear chart and Redis data (as needed, not required)
7. Check the currency settings if financial calculations appear incorrect
8. Verify timezone settings for accurate time displays
9. Alt + W on Dashboard resets wallet configuration and redirects to Boot sequence
## License
Available under the MIT License. This is an independent project not affiliated with Ocean.xyz.
## Acknowledgments
- Ocean.xyz mining pool for their service
- mempool.guide
- The open-source community for their contributions
- Bitcoin protocol developers