This project provides a blockchain-based solution for managing and rewarding participation in Community Involvement Projects (CIP). It serves two main stakeholders:
- Participants: Individuals who engage in volunteering activities can collect tokens representing their participation and have their volunteering hours recorded on the blockchain.
- Charities/Non-profit Organizations: These organizations can issue participation tokens and record the volunteering hours of participants on the blockchain.
To set up and test the smart contracts, follow these steps:
-
Install Node.js and npm: Ensure that Node.js and npm are installed on your computer. If not, download and install them from nodejs.org.
-
Install Truffle: Truffle is a development framework for Ethereum. Install it globally using npm:
npm install -g truffle
-
Install Ganache: Ganache provides a personal Ethereum blockchain for testing purposes. Download and install it from the Ganache website, or use the CLI version:
npm install -g ganache-cli
-
Clone the Repository: Clone this repository to your local machine:
git clone https://github.com/jefflcy/4302-group-project.git
-
Install Dependencies: Navigate into the project directory and install the required npm packages:
cd 4302-group-project npm install
-
Start Ganache: Make sure you have the latest version of Ganache, though deprecated.
npm install -g ganache
Once done, launch Ganache CLI and run:
ganache-cli
Now ganache will be listening out for transactions on
127.0.0.1:8545
. -
Deploy the Contracts: Compile and deploy the smart contracts to your local blockchain using Truffle:
truffle compile truffle migrate
-
Testing the Contracts: Write unit tests to
test_volunteer.js
and test them using Truffle:truffle test
- Charities/Non-profits:
- Obtain the
uri
for the your json files. - Deploy the
Volunteer.sol
contract with thaturi
as parameter. - Call
createProject
withstartDateTime
,endDateTime
&uriHash
as parameters. - Call
endProject
withprojId
to finalize the project, which also handles volunteers who did not check out before the project's end.
- Obtain the
- Participants:
- Call
checkIn
with theprojId
at the start ( >= project.startDateTime). - Call
checkOut
with theprojId
at the end ( <= project.endDateTime).
- Call
- Calling of
createProject
:- Ensure that the Wallet Address that deployed the
Volunteer.sol
contract is the address that calls thecreateProject
function - Ensure that the inputted
uriHash
is valid, starting with 'Qm' and have a length of 46 characters. - Ensure that the
startDateTime
is earlier than theendDateTime
and theendDateTime
is in the future
- Ensure that the Wallet Address that deployed the
- Calling of
checkIn
:- Ensure that you are checking in within the Project Duration
- Ensure that you are checking in to a Project that the Project organiser has not ended.
- Ensure that you are checking in to an existing Project with a Valid Project ID
- Calling of
checkOut
:- Ensure that you are checking out of a Project that you had previously checked into
- Ensure that you are checking out within the duration of the Project.
- Ensure that the Project organiser has not ended the Project you are checking out of.
- Calling of
endProject
:- Ensure that the Wallet Address that deployed the
Volunteer.sol
contract is the address that calls theendProject
function - Ensure that there are Volunteers in the Project that you want to end
- Ensure that the Wallet Address that deployed the
- Time Tracking: Utilizes
block.timestamp
for tracking the check-in and check-out times of volunteers. - Token Issuance: A token representing participation is minted for volunteers who check out properly by the end of the project.
- Soulbound Tokens: Participants are not allowed to transfer tokens of project participation to other participants.
- Single Day Events Only contract support events with defined start and end times but doesn't explicitly cater to events spanning multiple days. This could limit the flexibility of the platform, especially for events or volunteer activities that naturally extend beyond a single day.
- Whole Numbers for Time Tracking The contract uses whole numbers (integers) for time tracking, which means it can't easily handle time measurements that require more precise calculations (like partial hours or minutes), potentially leading to rounding errors or imprecise tracking of volunteer hours.
- Lack of Event Modification Features Contract lacks methods for editing or updating details of an existing project once it has been created. This could pose challenges if there are changes to the event details, such as a change in timing or extending the duration of the project. Users would need to rely on external mechanisms to handle these changes, which could lead to discrepancies or the need to cancel and recreate projects.
- No Deletion of Projects Current implementation provides basic error handling through require statements but does not implement more sophisticated error management strategies that could give users more detailed feedback about the nature of errors or how to correct them.
- Permission and Access Control Limitations: The contract uses a simple ownership model with some functions restricted to the owner only. This may not be sufficient for organizations that require a more nuanced access control system with multiple levels of permissions for different types of administrative tasks.
- Dependence on Accurate Timekeeping: The contract's logic heavily relies on the block.timestamp for checking in and checking out volunteers, which is known to be manipulable by miners to a certain degree. This reliance could potentially be exploited under certain conditions, leading to inaccurate tracking of project start or end times.
- Lack of Support for Fractional Token Minting The system does not support issuing fractional tokens, which might be needed for more granular reward systems. For example, if volunteers earn tokens based on the exact number of minutes worked, the inability to handle fractions could limit the system's fairness or accuracy.
This project is open-sourced under the MIT License.