By utilizing blockchain, DeFi has fundamentally changed the structure of lending and borrowing, which now enables such transactions without the need for conventional financial intermediaries. In effect, this allows for direct transactions between participants through smart contracts on blockchains, which in this case have been designed to execute by themselves under certain conditions on blockchains such as Ethereum. The very nature of these contracts means that all terms of the transaction are clear and cannot be changed, leading to a lesser incidence of fraud and greater efficiency. However, the complex dynamics, as well as market volatilities in the sphere of crypto, make predictive analytics a tool of paramount importance for the participants. Interest rates can be predicted accurately to support proper investment risk management and high-yield optimization in such a market that doesn't come with the traditional safety nets of conventional banking systems.
The project is proposing to develop a solution based on the integration of AI into the interest rate forecast within the DeFi lending-space. The developed solution will be deployed directly onto the blockchain based on the GizaTech ZKML framework. This framework does not only deploy the AI models but also ensures that every output of a predictive model has a cryptographic proof, thus verifying the integrity and accuracy of the prediction. In fact, it enables trust in an ecosystem where traditional audit mechanisms are absent.
The core value of the project lies in the ability to provide checked and transparent predictive insight over DeFi interest rates—something crucial for sound risk management and investment planning in decentralized finance. The element of transparency and reliability redefined by means of on-chain AI predictions and cryptographic proofs in one of the basic concerns in dealing with DeFi is the danger of opaque and incorrect data. By assuring that every single forecast is verifiable and correct, the project supports the individual investor in decision-making and supports one of the key DeFi market problems—the general instability of the DeFi lending market. It may help in the further use of DeFi as a people-oriented alternative to classical financial services and result in more significant financial inclusion and innovation.
The core of the technology stack behind this project is a combination of AI, blockchain, and real-time communication technologies. The system uses machine learning algorithms to study historical data for the prediction of future interest rates—central to the sphere of DeFi. These models are deployed in the blockchain through the ZKML framework provided by GizaTech, which also hosts the models and generates cryptographic proofs for each inference, proving that no one tampered with the predictions. This integration of cutting-edge technologies makes sure the project is innovative but practical, responsive to the needs of the tech-savvy audience, and grinds at the frontiers of what decentralized applications can do.
Here are the summary of the primary tech stack used for this project:
- Pytorch (for Model Training and Development)
- GizaTech's ZKML Framework (for generating proof of inference of the model and on-chain solutions) See more
Training of Supply Rate Prediction ModelLogs:
The trained supply rate model (Pytorch) will then be converted to ONNX. This will enable the easy transpilation of the model into its Cairo language equivalent one which is the language used to create proof of computation of the inferences of the model. The model needs to be transpiled and deployed to an endpoint before making inferences using the Giza CLI. The following picture shows a sample prediction and its generated proof id on the supply rate model.
Sample Supply Rate Prediction:
On the logs and both on the jupyter notebook shows that the predicted value is: -0.01408386 with a generated proof id of 2fef481397e2427bb5c0b7f5334ba056.
The proof can then be downloaded using the following command on the Giza CLI.
giza endpoints download-proof --endpoint-id [endpoint_id] --proof-id [proof-id] --output-path supply_rate_model.proof
or run the following code on a python environment:
import os #The proof of inference will be downloaded on the current working directory. Check after running the following command os.system(f"giza endpoints download-proof --endpoint-id {endpoint_id} --proof-id {proof_id} --output-path supply_rate_model.proof")
Sample proof download using Giza CLI from the borrow rates model:
The proof can then be verified on the Giza CLI. This can be done using the following command:
giza verify --proof PATH_OF_THE_PROOF
or
giza verify --proof-id PROOF_ID
The following is a sample proof verification with the following result and verification time given:
The steps above are also done for the borrow rate model.
Github Repository Link: https://github.com/John-Embate/TransparentAI-DeFi-Lending-Protocol-Rates-Forecaster-with-ZKML
"I am into Robotics, Electronics, Programming, Data Science, Data Analysis, Business Intelligence, Machine Learning, Deep Learning, and ZKML Solutions & Applications"
Recent Awards:
- Connext AI Solutions Hackathon 1st Place (2024) (Developed an AI chatbot using finance and payroll documents of the company.) See More
- Gizathon Top AI Action 2nd Place (2024) See More
- Starknet Infra Hackathon Overall Best Project (2023) See More
- FWD Regional Insurtech Data Hackathon Top 10 Finalist (2022) (Developed an ML model for Insurance Products Preferences of Customers) See More
- Build the Future Hackathon First Placer (2022) See More
- Fishackathon (Wild Fisheries) Finalist (2022) See More
- Galileo Hackathon Philippines First Placer (2021) See More
- Planetary Health Hackathon First Placer (2021) See More
- Taikai Top 100 Builders (Rank 97) See More