ChargeMesh: ESP32 energy monitoring, tenant billing & Hedera blockchain payments.
| Category | Details | |---|---| | Project Name | ChargeMesh | | Event | ETHGlobal Mumbai 2026 | | Project Type | IoT + Blockchain + Electricity Metering and Billing | | Core Purpose | Transparent electricity monitoring, billing, and blockchain-verified payments | | Hardware | ESP32-powered electricity submeters | | Frontend | React + Vite + TypeScript | | Backend | Node.js + Express + TypeScript | | Database | PostgreSQL | | Blockchain | Hedera Hashgraph | | Blockchain Service | Hedera Consensus Service (HCS) | | Wallet Integration | HashPack | | Frontend URL | http://localhost:5174 | | Backend URL | http://localhost:4000 | | HCS Topic | 0.0.11169785 |
Project Description:
ChargeMesh is a comprehensive electricity metering and billing platform that bridges physical ESP32-powered electricity submeters with blockchain-verified transactions. It enables landlords to monitor electricity consumption and manage billing while renters can view their electricity usage, manage bills, submit payments, and access verifiable transaction records through the Hedera network.
| Layer | Technology | Responsibility | |---|---|---| | Frontend | React | Builds the user interface and dashboards | | Build Tool | Vite | Frontend development and bundling | | Programming Language | TypeScript | Type safety across the application | | Styling | Tailwind CSS | Responsive user interface | | Navigation | React Router | Landlord and renter dashboard navigation | | Backend | Node.js | Server-side runtime | | API Framework | Express | REST API and business logic | | Database | PostgreSQL | Stores users, properties, readings, bills and audit records | | Database Driver | pg | PostgreSQL connectivity | | Validation | Zod | Validates incoming data and application schemas | | Hardware | ESP32 | Collects electrical measurements | | Metering | PZEM-004T | Measures electrical parameters | | Communication | Wi-Fi | Transfers sensor data to the backend | | Blockchain | Hedera Hashgraph | Distributed consensus infrastructure | | Blockchain Service | HCS | Records payment events and audit information | | Wallet | HashPack | Hedera wallet connectivity and payments | | Web3 Library | viem | Blockchain and wallet interaction | | Hedera SDK | @hiero-ledger/sdk | Hedera-specific operations |
| Component | Address | Function | |---|---|---| | React Frontend | http://localhost:5174 | Landlord and renter dashboards | | Express Backend | http://localhost:4000 | API, validation and business logic | | PostgreSQL | Configured through environment variables | Primary application database | | Hedera Testnet | Hedera network | Blockchain consensus and audit records | | HCS Topic | 0.0.11169785 | Stores payment and audit events | | HashPack | Browser wallet extension | Wallet connectivity and payment workflows |
| Step | Component | Operation |
|---|---|---|
| 1 | ESP32 | Samples voltage, current, power, energy, frequency and power factor |
| 2 | Wi-Fi | Transmits JSON sensor payloads |
| 3 | Express API | Receives meter readings |
| 4 | Validation Layer | Checks JSON structure, room permissions and meter associations |
| 5 | PostgreSQL | Stores validated readings in metering.readings |
| 6 | Hedera HCS | Records relevant system and audit events |
| 7 | React Frontend | Displays electricity consumption and billing information |
| 8 | Landlord Dashboard | Monitors room-level electricity consumption |
| 9 | Renter Dashboard | Displays assigned room and billing information |
Overall Data Flow:
ESP32 → Wi-Fi → Express API → Validation → PostgreSQL → React Dashboard
Blockchain Audit Flow:
Application Event → Backend → Hedera HCS → Consensus Record → Verification
| Parameter | Details | |---|---| | Hardware | ESP32 | | Meter | PZEM-004T | | Sampling Interval | Every 5–10 seconds | | Communication | Wi-Fi | | Payload Format | JSON | | API Destination | ChargeMesh Backend | | Database Schema | metering | | Database Table | readings | | Blockchain Topic | 0.0.11169785 | | Signature Algorithm | Ed25519 | | Invalid Data Handling | Rejection and quarantine rules |
| Parameter | Typical Reading | |---|---| | Power Consumption | 7.6–7.8 W | | Voltage | 238–239 V | | Frequency | 50 Hz | | Power Factor | 0.98–1.00 | | Current | Depends on connected electrical load | | Energy | Cumulative kWh |
| Validation Step | Description | |---|---| | 1. JSON Validation | Checks incoming payload structure | | 2. Required Fields | Verifies powerW, roomId, meterId and timestamp | | 3. Room Accessibility | Checks room access against property ownership | | 4. Meter Association | Verifies meter-to-room association | | 5. Signature Verification | Validates Ed25519 signatures | | 6. Reading Status | Accepts, rejects or quarantines readings | | 7. Sequence Ordering | Maintains reading sequence information | | 8. Storage | Saves accepted readings in PostgreSQL |
| Feature | Description | |---|---| | Authentication | Landlords can register or log in | | Overview Dashboard | Displays property and electricity information | | Live Usage Monitoring | Displays live electricity readings | | LiveUsageChart | Visualizes power consumption | | Live Status | Shows a Live badge after fresh data loads | | Room Management | Creates and manages rooms | | Meter Management | Associates meters with rooms | | Tenant Assignment | Assigns renters to rooms | | Occupancy Tracking | Displays occupied and available rooms | | Bill Creation | Generates electricity bills | | Tariff Configuration | Sets electricity rates in NPR/kWh | | Dispute Management | Reviews and resolves renter issues | | Historical Data | Displays previous readings and billing information |
| Step | Action | |---|---| | 1 | Open http://localhost:5174 | | 2 | Register or log in as a landlord | | 3 | Press Ctrl+F5 to force a fresh browser reload | | 4 | Open the Overview tab | | 5 | Wait approximately 5–10 seconds | | 6 | Check the LiveUsageChart for the Live status | | 7 | Explore rooms, meters, bills and other dashboard features |
| Metric | Example | |---|---| | Total Rooms | 3 | | Occupied Rooms | 2 | | Available Rooms | 1 | | Occupancy Percentage | 67% |
| Feature | Description | |---|---| | Authentication | Renter registration and login | | Room Information | Displays assigned room details | | Bill Management | Displays issued and previous bills | | Consumption | Shows billed electricity consumption | | Payment | Supports HashPack wallet payment workflows | | Transaction Reference | Allows submission of Hedera transaction IDs | | Issue Reporting | Allows renters to report billing problems | | Resolution Tracking | Displays dispute and issue outcomes | | Billing History | Shows previous bills and payments |
| Functionality | Landlord | Renter | |---|---|---| | View Assigned Room | Yes | Yes | | View All Property Rooms | Yes | No | | Monitor Live Meter Readings | Yes | No | | Create Electricity Bills | Yes | No | | Configure Electricity Tariffs | Yes | No | | Assign Renters | Yes | No | | View Personal Bills | Yes | Yes | | Submit Payments | No | Yes | | Report Billing Issues | Manage | Submit | | Resolve Disputes | Yes | View Status | | View Billing History | Yes | Yes |
ChargeMesh calculates electricity charges using cumulative energy readings.
| Variable | Meaning | |---|---| | startingCumulativeKwh | Starting cumulative electricity reading | | endingCumulativeKwh | Ending cumulative electricity reading | | consumptionKwh | Electricity consumed during the billing period | | rateNprPerKWh | Electricity tariff in NPR per kWh | | electricityChargeNpr | Final electricity charge |
consumptionKwh =
endingCumulativeKwh - startingCumulativeKwh
electricityChargeNpr =
consumptionKwh × rateNprPerKWh
electricityChargeNpr =
round to nearest NPR cent
| Parameter | Example Value | |---|---:| | Starting Reading | 10.000 kWh | | Ending Reading | 15.000 kWh | | Consumption | 5.000 kWh | | Electricity Rate | NPR 12.50/kWh | | Electricity Charge | NPR 62.50 |
| Component | Details | |---|---| | Blockchain | Hedera Hashgraph | | Network | Hedera Testnet | | Service | Hedera Consensus Service | | HCS Topic ID | 0.0.11169785 | | Wallet | HashPack | | Default Testnet Account | 0.0.11206800 | | Audit Storage | HCS | | Application Storage | PostgreSQL |
| Step | Operation | Result | |---|---|---| | 1 | Renter initiates payment | Payment request submitted | | 2 | Backend receives transaction information | Transaction ID received | | 3 | Backend submits payment event | HCS submission initiated | | 4 | Hedera processes the event | Consensus record created | | 5 | Application verifies HCS event | Payment verification | | 6 | Bill status updated | Pending verification → Verifying → Paid | | 7 | Dashboards synchronize | Updated payment status displayed |
| Information | Purpose | |---|---| | Bill ID | Identifies the bill | | Transaction ID | Identifies the payment transaction | | HCS Topic ID | Identifies the audit topic | | Consensus Timestamp | Records consensus time | | Payment Status | Tracks payment verification | | Verified Timestamp | Records successful verification |
| No. | Feature | Description | |---|---|---| | 1 | Live Electricity Monitoring | Monitors power consumption | | 2 | Room Management | Manages property rooms | | 3 | Meter Management | Associates ESP32 meters with rooms | | 4 | Bill Generation | Creates electricity bills | | 5 | Tariff Management | Configures NPR/kWh rates | | 6 | Tenant Assignment | Assigns renters to rooms | | 7 | Occupancy Tracking | Monitors property occupancy | | 8 | Dispute Management | Reviews and resolves billing issues | | 9 | Historical Monitoring | Views previous readings | | 10 | Payment Tracking | Monitors payment statuses |
| No. | Feature | Description | |---|---|---| | 1 | Room Information | Views assigned room | | 2 | Bill Management | Reviews electricity bills | | 3 | Consumption Details | Views billed electricity usage | | 4 | Wallet Integration | Connects HashPack | | 5 | Payment Submission | Submits payment references | | 6 | Transaction Tracking | Tracks payment records | | 7 | Issue Reporting | Reports billing disputes | | 8 | Billing History | Reviews past bills and payments |
| No. | Feature | Technology / Implementation | |---|---|---| | 1 | Blockchain Audit Trail | Hedera HCS | | 2 | Wallet Connectivity | HashPack | | 3 | Live Data Updates | 5-second API polling | | 4 | Property Access Control | Property-based permissions | | 5 | Signature Verification | Ed25519 | | 6 | Invalid Reading Protection | Rejection and quarantine | | 7 | Flexible Sensor Storage | PostgreSQL JSONB | | 8 | Responsive Interface | React and Tailwind CSS | | 9 | Role-Based Permissions | Backend authorization | | 10 | Meter-to-Room Association | Backend validation |
| Schema | Tables | Purpose | |---|---|---| | identity | users, sessions | User accounts and authentication | | property | properties, rooms, tenancies | Property ownership and room assignments | | metering | meters, meter_keys, readings | Meter configuration and sensor data | | billing | tariffs, bills, disputes | Electricity billing and issue resolution | | audit | events, cre_reports | Audit records and CRE evidence | | system | integration_state | HCS topic configuration and system integration state |
{
"nonce": "test001",
"powerW": 7.7,
"roomId": "room_<id>_<uuid>",
"current": 0.034,
"meterId": "esp32-pzem001",
"voltage": 232.0,
"sequence": 1793967400,
"simulated": false,
"timestamp": "2026-11-06T07:01:00Z",
"deviceType": "physical",
"cumulativeEnergyKwh": 0.074
}
| Requirement | Specification | |---|---| | Node.js | Version 18 or newer | | Package Manager | npm | | Database | PostgreSQL | | Frontend | Modern browser | | Hardware | ESP32 with ChargeMesh firmware | | Electricity Meter | PZEM-004T | | Network | Wi-Fi internet connection | | Wallet | HashPack browser extension | | Blockchain Network | Hedera Testnet | | Environment | Configured .env files |
| Command | Purpose |
|---|---|
| npm install | Installs root dependencies |
| npm run dev | Starts API and frontend development servers |
| npm run dev:server | Starts backend only |
| npm run dev:web | Starts frontend only |
| Role | Access | |---|---| | Landlord | Register through the application | | Renter | Register through the application | | Wallet | Connect HashPack testnet account |
| Component | Current Status | |---|---| | ESP32 Data Reception | Implemented | | Meter Reading Validation | Implemented | | Property-Based Access Control | Implemented | | Live Dashboard | Implemented | | Bill Creation | Implemented | | Tariff Configuration | Implemented | | Hedera HCS Integration | Implemented | | HashPack Testnet Integration | Implemented | | Landlord/Renter Permissions | Implemented | | Ed25519 Signature Verification | Implemented | | Rejection and Quarantine Rules | Implemented | | Hard Refresh Workaround | Documented |
| Metric | Current Value | |---|---:| | HCS Topic | 0.0.11169785 | | HCS Messages | 44,802+ | | Typical Power Consumption | 7.6–7.8 W | | Typical Voltage | 238–239 V | | Frequency | 50.0 Hz | | Power Factor | 0.98–1.00 | | Electricity Tariff Example | NPR 12.50/kWh | | Configured HashPack Accounts | 3 | | Managed Rooms | 4 | | Managed Properties | 2 | | Dashboard Polling Interval | 5 seconds |
| HTTP Method | Endpoint | Purpose |
|---|---|---|
| GET | /api/health | Checks API health |
| GET | /api/readings?roomId=<id>&limit=<n> | Retrieves meter readings |
| GET | /api/rooms | Retrieves room information |
| GET | /api/auth/me | Checks authenticated user |
| Resource | Link |
|---|---|
| HCS Topic Overview | https://mirrornode.testnet.hedera.com/topics/0.0.11169785 |
| Latest HCS Messages | https://mirrornode.testnet.hedera.com/api/v1/topics/0.0.11169785/messages?limit=5 |
| Specific HCS Message | https://mirrornode.testnet.hedera.com/message/0.0.11169785,<SEQUENCE> |
| HashPack Testnet Account | https://mirrornode.testnet.hedera.com/account/0.0.11206800 |
ChargeMesh aims to bridge the gap between physical electricity meters and digital blockchain verification.
By combining ESP32-based electricity monitoring, a full-stack billing application, PostgreSQL data management and Hedera Consensus Service, ChargeMesh provides a transparent electricity management platform for small-scale rental properties.
Its primary goals are:
| Layer | Technology | Purpose | |---|---|---| | Frontend | React 19, TypeScript | Interactive landlord and renter dashboards | | Build Tool | Vite 8 | Fast development and frontend bundling | | Styling | Tailwind CSS 4 | Responsive user interface | | Navigation | React Router | Navigation between landlord and renter dashboards | | Icons | Lucide React | UI icons | | Backend | Node.js + Express | REST API and business logic | | Language | TypeScript | Type safety across the application | | Database | PostgreSQL | Stores users, properties, meter readings, bills and audit records | | Validation | Zod | Runtime validation and shared data schemas | | Blockchain | Hedera Hashgraph | Decentralized consensus and immutable audit records | | Blockchain Service | Hedera Consensus Service (HCS) | Records payment events and audit information | | Wallet | HashPack | Hedera wallet integration | | SDK | @hiero-ledger/sdk | Hedera network operations | | Web3 Library | viem | Wallet and blockchain interaction | | Hardware | ESP32 | Collects electricity meter readings | | Communication | Wi-Fi + HTTP | Sends hardware readings to the backend | | Infrastructure | Docker, Environment Variables | Development and configuration |
| Step | Component | What Happens | |---|---|---| | 1 | ESP32 Hardware | Collects electricity measurements such as voltage, current and power. | | 2 | Wi-Fi | Transmits meter readings to the backend. | | 3 | Node.js + Express API | Receives and validates incoming sensor data. | | 4 | PostgreSQL | Stores meter readings, property information and billing records. | | 5 | React Dashboard | Displays electricity usage, bills and room information. | | 6 | Hedera HCS | Records payment events and important audit information. | | 7 | HashPack Wallet | Enables wallet connectivity and Hedera-based payment workflows. |
Overall Architecture:
ESP32 → Wi-Fi → Node.js API → PostgreSQL → React Dashboard
Payment and audit workflow:
Payment → Backend API → Hedera HCS → Immutable Audit Record → Dashboard Verification
We implemented a PostgreSQL architecture with six separate schemas to organize different parts of the application.
| Database Schema | Responsibility | Stored Information | |---|---|---| | identity | User management | Users and sessions | | property | Property management | Properties, rooms and tenancies | | metering | Electricity monitoring | Meters and sensor readings | | billing | Billing management | Tariffs, bills and disputes | | audit | Audit and compliance | Events and CRE reports | | system | System configuration | Integration states and configurations |
We also use PostgreSQL JSONB fields for flexible storage of sensor metadata, allowing us to accommodate changing ESP32 payload structures without repeatedly modifying database schemas.
We use Hedera Consensus Service as an immutable audit layer rather than using blockchain as our primary database.
| Component | Implementation | |---|---| | Network | Hedera Testnet | | Service | Hedera Consensus Service | | HCS Topic | 0.0.11169785 | | Main Purpose | Payment verification and audit records | | Primary Storage | PostgreSQL | | Blockchain Storage | Payment events and system audit information | | Wallet | HashPack |
Payment Workflow:
| Step | Action | |---|---| | 1 | A renter initiates a bill payment. | | 2 | The backend receives the payment information and transaction ID. | | 3 | The backend submits the relevant payment event to the Hedera HCS topic. | | 4 | Hedera Consensus Service records the event with consensus ordering. | | 5 | The application checks the HCS event for verification. | | 6 | The bill status transitions through pending, verifying and paid. | | 7 | Landlord and renter dashboards synchronize the updated information. |
This separation allows PostgreSQL to handle fast application queries while Hedera provides an independently verifiable audit trail.
| Challenge | Our Solution | Why We Did It |
|---|---|---|
| Stale frontend data | Used cache: 'no-store' and documented hard-refresh requirements. | Prevented outdated cached readings from being displayed during development. |
| Incorrect property associations | Used PostgreSQL JSONB manipulation and runtime room-access checks. | Avoided a time-consuming migration of existing development records. |
| Two storage systems | Used PostgreSQL for primary data and HCS for immutable audit events. | Allowed us to combine application performance with blockchain verification. |
| Different user permissions | Implemented reusable role-based API filtering for landlords and renters. | Avoided duplicating API endpoints while restricting access to relevant information. |
| Changing sensor payloads | Used JSONB for flexible meter metadata. | Made it easier to add or modify sensor fields during hardware development. |
| Live dashboard updates | Implemented five-second API polling. | Avoided the complexity of WebSocket connection management during the hackathon. |
| Technology / Partner | How We Used It | Benefit to ChargeMesh | |---|---|---| | Hedera Hashgraph | Consensus and audit infrastructure | Provides an immutable and independently verifiable record of payment events. | | Hedera Consensus Service | Payment and audit event recording | Provides consensus ordering and a permanent audit trail. | | HashPack | Wallet connectivity | Enables users to interact with the Hedera ecosystem. | | viem | Blockchain and wallet interaction | Provides a structured interface for blockchain operations. | | PostgreSQL | Application database | Provides reliable relational storage and flexible JSONB support. | | ESP32 | Electricity monitoring hardware | Connects physical electricity consumption with the digital application. |
| Feature | Implementation | |---|---| | Data Validation | Zod schemas validate incoming data. | | User Authentication | JWT-based sessions. | | Role-Based Access | Separate landlord and renter permissions. | | Room Access Control | Checks whether users can access particular rooms. | | Meter Validation | Verifies meter-room associations. | | Reading Status | Supports accepted, rejected and quarantined readings. | | API Protection | Express rate limiting. | | Database Organization | Six separate PostgreSQL schemas. |
| Area | Current Implementation | Future Improvement | |---|---|---| | Dashboard Updates | Five-second polling | WebSockets for lower-latency updates | | HCS Integration | Event submission and verification | Retry mechanisms, exponential backoff and transactional outbox | | Hardware Firmware | Manual ESP32 flashing | OTA firmware updates | | Authentication | JWT sessions | Refresh tokens, password recovery and email verification | | Frontend Caching | Manual cache-bypass workaround | Proper cache invalidation | | Data Types | Shared Zod schemas | Automated type generation across application boundaries |
| Innovation | Explanation | |---|---| | Physical-to-Digital Integration | Connects electricity monitoring hardware with a full-stack web application. | | Hybrid Architecture | Uses PostgreSQL for application data and Hedera for immutable audit records. | | Transparent Billing | Links electricity consumption with billing and payment workflows. | | Role-Based System | Provides separate experiences and permissions for landlords and renters. | | Flexible Meter Data | Uses JSONB to accommodate changing hardware payloads. | | Blockchain Auditability | Makes payment events independently verifiable through Hedera Consensus Service. |
ChargeMesh combines IoT hardware, full-stack web development and blockchain technology into a shared electricity monitoring and billing platform.
The most important architectural decision was not putting everything on the blockchain. We deliberately kept frequently accessed application data in PostgreSQL and used Hedera Consensus Service for payment events and auditability.
This hybrid approach allowed us to build a practical application while introducing blockchain only where decentralization and independent verification provide meaningful value.
Our development prioritized getting the complete physical-to-digital workflow working, from ESP32 electricity readings to dashboards, billing and blockchain-based payment auditing, while documenting the engineering trade-offs that remain for future production improvements.

