project screenshot 1
project screenshot 2
project screenshot 3
project screenshot 4

GridSync

Automated electricity top-up using 1inch limit orders for cost-efficient Web3 energy trading

GridSync

Created At

Unite Defi

Project Description

GridSync is a decentralized, automated electricity top-up system designed for prepaid energy markets like those in Kenya and other developing regions. It eliminates the outdated, manual process of entering long tokens into physical meters and replaces it with a smart, Web3-powered solution that leverages real-time electricity pricing and decentralized trading strategies.

What Problem Does GridSync Solve? In many parts of the world, consumers are required to prepay for electricity. After paying, they receive a 20-digit token, which must be manually entered into a meter to activate the credit. This system is:

Time-consuming

Prone to user error

Blind to market fluctuations in electricity prices

Our Solution: Automation + Smart Trading via Web3 GridSync automates this process and adds financial intelligence by:

Linking payments directly to meter IDs, automatically crediting electricity without manual input.

Integrating Web3 and 1inch’s Limit Order Protocol to allow users to trade for electricity when prices are favorable.

How GridSync Works Payment: The user pays using fiat or crypto via a simple interface.

Limit Order Setup: The system creates a limit order using the 1inch Limit Order Protocol. It waits to buy electricity credits until the price drops to a user-defined or algorithmically calculated threshold.

Execution: When the order conditions are met (e.g., lower electricity rates at night), the smart contract automatically executes the trade.

Credit Delivery: The electricity token is instantly credited to the user’s meter using a backend integration, with no manual input required.

Why 1inch Limit Order Protocol? Asynchronous execution — Users don’t need to monitor prices in real-time.

Gas-efficient design — Orders only execute under favorable conditions.

Custom strategies — Support for TWAP, DCA, and conditional orders.

Secure and decentralized — Reduces reliance on centralized energy brokers.

Use Cases & Benefits Consumers save money by buying electricity at off-peak hours.

Utility companies benefit from smoother demand management.

Energy traders or NGOs can optimize energy allocation in real-time.

Scalable across any country with prepaid meter systems.

How it's Made

How We Built GridSync GridSync was built as a full-stack decentralized energy access platform that fuses traditional energy top-up workflows with modern Web3 and DeFi design patterns. Our development focused on three core pillars: automation, real-time data, and decentralized affordability.

Frontend (React + Vite + Ethers.js) Built with React 19 and Vite for fast development and hot reloads.

Integrated MetaMask using ethers.js v6 to enable wallet-based user identity and transactions.

Designed an intuitive onboarding flow where users enter their meter ID and link it to their wallet.

Developed a Dashboard component showing real-time meter balances, energy consumption, and simulated top-up states.

Created a diagram-based energy flow simulation using SVG and simple state transitions to visualize how GridSync handles payments, trading, and token delivery.

Backend (Node.js + Express + SQLite3) Developed RESTful APIs for:

Wallet-based user authentication.

Onboarding new users with a unique meter ID.

Fetching meter balances and kWh data.

Used SQLite for lightweight, file-based local storage of users and meters.

Created a service layer to abstract database logic and keep route handlers clean.

Built health checks, user lookup, and dynamic response messaging.

Web3 & Protocol Integration (1inch Limit Order Protocol) Although the current build is primarily centralized and educational, we prototyped a DeFi-based trading layer that can:

Simulate limit orders via a pseudo-price oracle to reflect dynamic electricity rates.

Use wallet-connected inputs to set user-defined price thresholds for buying energy (e.g., only purchase electricity when price < $0.12/kWh).

Prepare the architecture to later interact with 1inch’s Limit Order smart contracts by storing signed orders and triggering fulfillment based on backend price tracking scripts.

Hacky Note: For testing this dynamic behavior without a live smart meter or chain data feed, we mocked energy prices using a simple local function that changes the "price" every few seconds.

Database Design Two tables: users and meters — normalized and connected via meter_id.

Stored balances both in USD and Watts for dual-unit logic.

Used created_at and updated_at fields for every row to simulate audit logs and transaction histories.

API Design & Dev Workflow Separated routes and services to keep the backend modular and scalable.

All APIs follow a standard JSON response with { success, message, data }.

Simulated energy pricing and balance top-up flows via mock endpoints, allowing full testing without deploying contracts.

Testing & Local Simulation Frontend was tested with MetaMask wallet injection and multiple onboarding cases.

Backend runs at localhost:3001, frontend at localhost:5174.

SQLite database auto-initializes with two sample users and meters for easy testing.

Used Postman and VS Code REST Client to validate backend endpoints.

What’s Next (DeFi Integration Pipeline) We’re preparing to extend GridSync into a true decentralized application by:

Deploying a smart contract that mints electricity tokens and integrates with real meters.

Using the 1inch Limit Order Protocol directly on-chain to execute cost-efficient top-ups.

Integrating Chainlink oracles to track actual energy prices and fulfill limit orders automatically.

Enabling fiat-to-crypto onboarding through providers like Transak or Ramp.

Building a mobile-first UI for field usage in energy-limited regions.

background image mobile

Join the mailing list

Get the latest news and updates