Project Story

  • About the project

    Inspiration

    The modern energy grid, despite its importance, is largely a relic of a centralized past. It's often inefficient, with energy lost in long-distance transmission, and it leaves consumers with little control or choice. We were inspired by the rise of distributed energy resources like home solar panels and the concurrent rise of decentralized finance. We asked: "What if we could apply the trustless, peer-to-peer principles of blockchain to the energy sector?" Our vision was to create a micro-economy for energy, empowering homeowners to sell their excess power directly to their neighbors, creating a more resilient, efficient, and community-driven grid. That vision is VoltSwap.

    What it does

    VoltSwap is a fully functional, full-stack web application that facilitates a peer-to-peer energy trading marketplace. Here's the user journey:

    1. Onboarding: Users sign up and securely link their real-world energy meter and a non-custodial Algorand wallet (like Lute).
    2. Funding: Users can deposit USDCa (a stablecoin on Algorand) into their personal, on-chain vault within our smart contract. This vault is non-custodial, meaning only the user can withdraw their funds.
    3. Trading: Users can place buy and sell orders for "energy credits" on a live, real-time order book. Producers can sell their surplus, and consumers can buy energy at market rates.
    4. Automated Settlement: A robust backend system, featuring a matching engine and a settlement engine, autonomously finds matching orders and executes the trade. The settlement is an on-chain transaction that atomically debits the buyer's deposited USDCa, pays the seller, and transfers the energy credit balance—all without either user needing to be online.
    5. Transparency: All settled trades are recorded on the Algorand blockchain, and users can view their complete trade history with direct links to the transaction on the block explorer.

    How we built it

    VoltSwap was built from the ground up on Bolt.new, leveraging its seamless full-stack development environment. The architecture is a sophisticated hybrid model designed for both performance and security:

    • Frontend: A responsive and modern UI built with Next.js, React, and Tailwind CSS. State management is handled by React Context, and we use the powerful @txnlab/use-wallet-react library for wallet interactions. can be found here link
    • Backend: A Node.js server using Express and TypeScript. It exposes a RESTful API for all frontend interactions. backend project can be found here link
    • Database & Auth: We used Supabase for its robust PostgreSQL database, Row Level Security (RLS) policies, and integrated authentication system. It serves as our off-chain "source of truth" for user data and the live order book.
    • Smart Contract: The core of our system is a secure smart contract written in Typescript and deployed on the Algorand TestNet. It utilizes Box storage to create personal, non-custodial vaults for each user's USDCa deposits and to track their energy credit balances.
    • Backend Engines: Two key background services power the marketplace: a Matching Engine that finds compatible trades and a Settlement Engine that calls our smart contract to execute them on-chain. A Monitor Service listens to the blockchain and updates our database in real-time.

    This entire stack, from the database to the blockchain to the frontend, was developed and integrated within the Bolt.new environment.

    Challenges we ran into

    Our biggest challenge was evolving the core architecture. Our initial design used a direct, P2P atomic swap model where the buyer had to be online to sign the final settlement transaction. While technically decentralized, we realized the user experience was clunky and not suitable for a real marketplace.

    This led to a major pivot mid-hackathon: redesigning the smart contract and backend to a custodial vault model. This was a significant undertaking, requiring us to rewrite the settleTrade logic, add deposit and withdraw functions, and build an entirely new settlementEngine on the backend. Debugging the interactions between the frontend, our off-chain database, and the on-chain contract—especially handling asynchronous state and potential race conditions—was a formidable but incredibly rewarding challenge.

    Accomplishments that we're proud of

    We are immensely proud of building a truly full-stack, end-to-end dApp that solves a real-world problem. Moving beyond a simple atomic swap to a more complex and realistic custodial exchange architecture was a major accomplishment. The system is robust: the matching engine, settlement engine, and blockchain monitor all work in harmony to create a seamless, automated loop. We are also proud of the polished, professional, and fully responsive UI we built, which provides a user experience on par with modern FinTech applications.

    What we learned

    This project was a deep dive into the complexities of hybrid on-chain/off-chain application design. We learned the critical importance of a "single source of truth" and the security patterns required for handling user funds in a smart contract. We mastered the use of Algorand's Box storage for scalable on-chain data and gained invaluable experience with the full development lifecycle on Bolt.new, from initial setup to final deployment on services like Render and Netlify. Most importantly, we learned how to strategically pivot our architecture when faced with a fundamental UX challenge.

    What's next for VoltSwap

    VoltSwap is more than just a hackathon project; it's a blueprint for a real-world solution. The next steps are clear:

    1. Partner with Utility Companies: Integrate with real smart meter APIs to automate the "production" and "consumption" of energy credits, removing the need for manual simulation.
    2. Expand to MainNet: After rigorous audits, we plan to deploy the smart contract to the Algorand MainNet.
    3. Mobile App: Develop a native mobile application for an even more accessible user experience.
    4. Advanced Trading Features: Introduce more complex order types, data visualizations, and price history charts.

    Test Wallet Address

    This are two funded wallet address with algo and usdca... download lute wallet provider here link Address 1:U3DNFF4VD7GWQ3UFG3DTMFMEDUKACMKYQ2U33UEU4UH3ALNXGVNSAEX5NQ Address 1 MNEMONIC: elican lesson dial exchange reject slight climb minute left path long cool cherry avoid shine flash brisk fury friend usage photo chaos snake absent under

Address 2:ZGMNGHHNMZBMVMD3DWGUEPLZ4JIW566WRPW7YJWW34PHRJTZ6PS3XIIDPE Address 2 MNEMONIC: hidden patch quality toilet clump note host april ball heavy defy leg mother upset trick excuse more bar grab gravity current prevent pink absent garlic

Built With

Share this project:

Updates