The project is available on GitHub as an Open Source Project for you to take an inspiration from here Chain Agreement Repository
A smart contract and a web project which enables users to create and store agreements online.
The first part of this project is the smart contract and is defined in the below description
It has a simple Solidity contract which defines two functions like
The create agreement function would write the transaction on chain and save it with index of contentId. You can retrieve the agreement with the use of contentId and get all the details.
The Frontend Application is hosted at here and is built with ParcelJs and React with TailwindCSS used for styling it.
The frontend application is a simple application containing of two pages namely
view which both do exactly as their name suggests.
On the create page you can create an agreement using addresses of initiator and acceptor and putting the actual agreement text as a markdown file.
The process after this is rather simple. Firstly the markdown file with appropriate details attached is sent to IPFS and uploaded using
web3.storage API's. This helps us make sure that the agreements will remain alive and accessible as long as IPFS is available and all this is possible due to how Filecoin is built.
I have attached some screenshots of how this all works in below and you can see a proper example with the help of it.
After the uploading of agreement on IPFS it is time to write the agreement transaction data on chain with the help of the smart contract that we developed earlier.
We use React-Moralis to accomplish this task and it takes the
content-id that we have received from the IPFS upload task.
Remember storing things on-chain is costly so try to minimize whatever you store on-chain.
I plan to built a newer version of this application with a lot of other things built into it and have called in some of my friends to help me build it better. I will constantly write about the progress we have made in other projects or in my blogs.
Thanks for giving this a read