NOTE: Since the site is hosted on Render with free pricing, consequently the various layers of the project (front-end, back-end, ai) will be cut if not used within a certain time limit.
Water credit is a project uses blockchain technology to promote water saving among companies and individuals.
The following demo of the project proposes users to test the following features:
- Loading of bills;
- Extraction of relevant data from the documents through AI;
- Calculating the amount of tokens based on the comparison and relative savings between the two bills;
- Minting the amount of tokens calculated in the user's wallet.
| Symbol | Decimals | Network | Address | Active |
|---|---|---|---|---|
| WCT | 6 | Solana Devnet | D6PQusi8y83BqMoYWMvFNM1CXhuMtz8MrJdRHYNdBFHX | 🟢 |
The application architecture includes four interdependent layers:
- Front-end: structured with multiple frameworks, the layer interfaces directly with the user;
- Backend: managed with Express.js, the layer implements business logic and data processing;
- Database: The layer in question is essential for storing data. To improve the scalability and availability of data in the first phase, we chose to use and implement MongoDB;
- Integration: In this layer the artificial intelligence model used is called "CohereForAI/c4ai-command-r-plus" and is used for data extraction;
- Integration: The second level of integration involves direct connection to the Solana blockchain to be able to carry out on-chain operations such as token minting, liquidity pools and staking.
WaterCredit uses different projects for implement the functionalities that described in the first section of this file.
For configure and use correctly them you must follow the following steps:
- Solana.py;
- Pymongo;
- FastAPI.
For configure this project, you must following these commands for running it correctly:
Move into ai folder project and run this command for install dependencies using requirements.txt file:
pip install -r requirements.txtThen you must create 'seed.txt' file inside project root which it must contain the private key converted into UInt8Array about your Solana wallet. E.g.:
[43, 102, 231, 20, 48, 210, ...]After made previous steps, the next one is to create '.env' file for set the following settings:
HF_CHAT=[your_HuggingChat_cookie]
MINT_TOKEN_ADDRESS=[token_address_Solana_Testnet]
MOCK_AI=OFF
MOCK_NUMBER_ITEM='1'
MONGODB_URL=[Your MongoDB url]
The parameters MOCK_AI and MOCK_NUMBER_ITEM work together when the first parameter set to "ON" value. That means that it will mock the response from AI. The value of MOCK_NUMBER_ITEM must be initialized to '1'. For HuggingChat, you must sign up on HuggingChat website and into browser do a right click, click on "Inspect" and go to "Application" tab. At this point you can see the key like that "hf-chat" and related value. You must copy that value and put inside '.env' file into HF_CHAT key.
The last step is to launch the FastApi server and for do it you must run this command into terminal of the folder project:
fastapi run main.py- ExpressJS;
- MongoDB.
In the first time that you're configuring this project, you must following these commands for running it correctly:
Move into back-end folder project and run this command for install the dependencies:
npm installAt this point you must create '.env' file for set some settings for launch correctly the server. This configuration file must contain the following keys with related values:
ENDPOINT=http://localhost
APPLICATION_PORT=[Replace with your port]
ENDPOINT_PY=http://localhost
FRONT_END_ENDPOINT=[Replace with front end endpoint + port]
PY_PORT=[Replace with the port that currently running the water-credit-ai project]
MONGODB_URL=[Your MongoDB url]
Then for running ExpressJS server, not in reloading mode, you can run the following command:
npm run serverIf you want running ExpressJS server, in reloading mode, you can the following command:
npm run server-reloading- Vue.js
- Bootstrap
In the first time that you're configuring this project, you must following these commands for running it correctly:
Move into front-end folder project and run this command for install the dependencies:
npm installAt this point you must create '.env' file for set some settings for launch correctly the server. This configuration file must contain the following keys with related values:
VUE_APP_BACK_END_ENDPOINT=[Your back end endpoint]
For running Vue.js server, you can run the following command:
npm run dev👤 @Kerry1207 👤 @SamuelePassiatore
This project is MIT licensed.
