taikoxyz / grants

Community grants program
38 stars 3 forks source link

[Grant Application]: zkPET: Peer-to-Peer Energy Trading through Zero Knowledge Machine Learning #96

Open tsubasakong opened 1 year ago

tsubasakong commented 1 year ago

Project Description

The combination of machine learning(ML) with zero-knowledge proofs(ZKP) is bringing artificial intelligence (AI) into web3 to make decentralized applications smarter and more powerful. The research question proposed in this study is to investigate the applications of zero-knowledge machine learning (ZKML) technology in the energy field. We aim to build a novel privacy-preserving, smart, and decentralized peer-to-peer renewable energy trading (P2P-ET) system on the Taiko blockchain. This research is motivated by several primary ideas that are connected to existing research in this field. First, the concept of bringing real-world assets (RWA) onto the blockchain has gained significant attention. The integration of energy trading into Taiko presents a promising opportunity for innovation and efficiency in the energy market. Second, in traditional energy markets, the merit order effect (MOE) has been widely used to determine pool prices. However, in blockchain-based decentralized energy markets, it is challenging to implement an efficient MOE in smart contracts because this algorithm has a time complexity of O(n^2) and requires a lot of on-chain storage spaces to store submitted offer data, which is not scalable or cost efficient. So, it is worth investigating the combination of this mechanism with ZKP to design a P2P-ET market, enabling efficient price discovery, seamless matching of energy supply and demand, and scalable and secure energy transaction. Third, ZKP has enabled blockchain with enhanced scalability through an off-chain computation mechanism called zk-rollups. It also enables privacy-preserving transactions via submitting commitments instead of the orignal sensastive energy data, which could be leaked because of blockchain’s transparency. In this project, ZKML will be used to train machine learning models to forecast electricity demand and solar electricity production without revealing the sensitive data used to train the models. This can be useful for grid operators who need to forecast demand and production in order to ensure that there is enough electricity to meet demand, but who do not want to reveal private information about their customers' electricity usage and supply patterns. Having both demand and supply information, the proposed system will play a role of prover to execute MOE off-chain and generate a verifiable proof using the Halo2 proof system, which then will be verified on-chain.

zkml

Category

Zero-Knowledge Proofs (ZKP)

Timeline

Timeline Key Milestones Deliverables
0 - 2nd month System design and preliminary results Prediction model with EZKL; MOE circuits; Smart contracts
2- 4th month System implementation and test with simulated electricity data System prototype; Backend and frontend integration
4th - 6th month Prototype in small scale and technical report IoT and Oracle setup; System on-chain and off-chain interaction; Technical report

Project Plan

System Design and Development

System design includes user authentication, KYC, market rules, price models, and interactions between on-chain (e.g., mint and burn tokens) and off-chain (e.g., deliver and consume energy) operations. Smart contracts will be implemented and deployed on Taiko to facilitate secure and automated energy transactions, ensuring trust and integrity. In addition, a trading system with user-friendly frontend and backend REST APIs will be designed and developed to interact with smart contracts and demonstrate the end-to-end energy trading process.

Merit Order Effect Integration

In the energy industry, the most widely adopted trading model in a pool market is the merit order effect. It dispatches electricity generation sources based on their variable costs, prioritizing the cheapest and most efficient generators. The research will explore existing MOE algorithms and convert them to circuits using Halo2 to meet the specific requirements of the energy trading domain. The MOE and ZKP integration process will involve algorithm design, circuits and smart contracts development, and MOE algorithm optimization for efficient energy price determination.

Zero Knowledge Machine Learning Integration

It would be a critical issue for the grid if there is not enough power supplier. Demand and supply matching becomes an indispensable component in designing a decentralized energy trading system. A traditional energy market relies on a centralized electricity operator assuming a level of trust in generators to achieve energy balance. In an open and decentralized energy market, this requires a machine learning model to accurately forecast the demand and production without revealing the sensitive information of market participants. Therefore, zero-knowledge machine learning technology, i.e., a tool EZKL, will be used to train machine learning models, export the ONNX files, and converts them into verifiable proofs, which will be then verified on-chain easily by a generated verifier Solidity smart contract.

Simulation and Performance Evaluation

A comprehensive simulation framework will be developed to assess the performance and effectiveness of the proposed blockchain-based P2P-ET system with the integrated MOE and ZKML demand/supply prediction mechanism. Synthetic data will be used to train ML models, provide prove inputs, and verify the ZKML proofs. IoT devices (e.g., ESP32) will be used to simulate the demand and supply data, which then be sent to the Oracle data service (e.g., AWS and Switchboard) and consumed off-chain or on-chain by smart contracts. In addition, real-world energy market data (e.g., AESO and DIMO) could be utilized to evaluate the system's scalability, liquidity provision, and overall efficiency.

Project Impact

Powered by Taiko, our project aims to facilitate the mass adoption of renewable energy within the realm of blockchain technology. By promoting permissionless transactions for individual renewable energy sources, the system relies solely on market forces. This approach not only democratizes access to renewable energy but also accelerates its global benefits, thus contributing to a sustainable future for the entire world. With ZKP and ZKML, our project aims to investigate this bleeding-edge technology applications in the energy sector to facilitate innovations of decentralized renewable energy. In particular, we try to address the privacy issues in energy demand and production prediction ML model training using ZKP technologies.

Team Information

Stephen Fan linkedin profile Google Scholar profile Github Stephen(Caixiang) is a postdoctoral fellow at the University of Alberta, Canada. He received his Ph.D. and MSc degrees in software engineering and intelligent systems from the University of Alberta in 2023 and 2019, respectively. His current research interests include blockchain, zero-knowledge proofs, transactive renewable energy, performance evaluation and modelling. Stephen has 6+ years of research and practical experience in blockchain and distributed ledger technologies and rich experience in blockchain performance evaluation and web3 development. His was finalisted in the ETHGlobal Waterloo hackathon via the ZKML project SmileDAO, which used ZK+ML to verify smiles and build a DAO community of positivity.

Tao He linkedin profile Google Scholar profile Github Tao is a seasoned software developer with 7 years of experience, holding a Ph.D. in Engineering with a focus on energy recovery. He previously worked at Amazon as a software engineer. Tao's solid background extends across various domains including blockchain development, Computer Science, Applied Mathematics, Statistics, and Engineering.

Point of Contact

Discord: StephenFan#4976 | caixiang@ualberta.ca

Previous Work

We took part in the Scaling Ethereum 2023 Hackathon, presenting our project, zkDELX. This initiative represents a decentralized electricity exchange market, utilizing zkEVM to support both the electric vehicle and renewable energy industries (see our showcase at ETHGlobal). During the hackathon, our contracts were successfully deployed and executed on the Taiko testnet. As of now, our preliminary project has been integrated into the Taiko Ecosystem, and more information can be found here.

Additional Information

No response

Agreement