Currently, charitable foundations spend about 30% of donations in administrative expenses. Such event depletes the amount of resources delivered to people in need. Reducing the involvement of intermediary institutions will inevitably translate into more help for the intended recipients.
Traditional charity systems have an intrinsic lack of transparency. Donors have no way to track or ensure assistance is getting to the right place. This has generated a high degree of mistrust towards charitable foundations. This could be improved by providing users with efficient ways to track donations and moreover, make each transaction distinguishable from the others. Such improvement would help restoring donor confidence and consequently, increase overall donations.
Saving the world solves both mentioned problems in traditional charity systems (admin costs and transparency). It provides an efficient blockchain system which processes and records transactions directly from donor to supplier. This last delivers resources directly to the end recipient without the need of intermediaries. In addition, each donation is completely trackable and stored as a non-fungible token.
This MVP is a proof-of-concept to explore the viability of Blockchains to store immutable data for tokenized assets in the Relief Aid domain. A Smart Contract using ERC721 is used to collect parameters from our application and write to blockchain.
To improve and ecconomize gas usage, we've integrated a free IPFS service to store tokenized information for each asset 'donated' through our app. This could be greatly improved by hosting an IPFS node and it's infrastructure. This is most often done using cloud services like AWS GPC or Azure to host an ethereum node.
For this app, we've used Ganache to simulate the Smart Contract deployment, the mining, and the transaction storage. We've used the Pinata public IPFS cloud to store some donated asset metadata and the tokenized image. To modify the allowed amount of storage would have been out of scope for this project, so we store most metadata in Ganache. In a production scenario, all metadata is tokenized and stored on a public IPFS chain.
- Streamlit - User interface
- Python - We use Anaconda to manage Python environment.
- Ganache - Local blochain for dev/testing
- Web3.py - Smart Contract interaction
- Remix - remix.ethereum.org
- Pinata or other IPFS host provider (API Key and Secret API Key)
- MetaMask - Installed into your chrome or edge browser. We will create dummy accounts to run the app.
1.1 Create a conda environment and activate it
conda create -n stw python=3.7 anaconda -y
conda activate stw
1.2 Install the required packages (make sure stw
is activated first)
python -m ipykernel install --user --name stw
conda install -c conda-forge nodejs -y
pip install python-dotenv
pip install web3
pip install streamlit
pip install SQLAlchemy
1.3 Clone this repository.
git clone git@github.com:Saving-the-world-org/save_the_world.git
cd save_the_world/
Copy the PROJECT23.env to .env then replace required values:
(.env file)
NETWORK="development"
WEB3_PROVIDER_URI="http://127.0.0.1:7545"
SMART_CONTRACT_ADDRESS="YOUR_SMART_CONTRACT_ADDRESS"
ABI_PATH="contracts/compiled/save_the_world_abi.json"
IPFS_URI="https://gateway.pinata.cloud/ipfs/"
PINATA_API_KEY="YOUR_PINATA_API_KEY"
PINATA_SECRET_API_KEY="YOUR_PINATA_SECRET_API_KEY"
PUBLIC_KEY="YOUR_MINTER_ACCOUNT_PUBLIC_ADDRESS"
PRIVATE_KEY="YOUR_MINTER_ACCOUNT_PRIVATE_KEY"
INFURA_KEY=""
Create Ganache local network and import accounts into MetaMask
5.1 In remix, copy the contents of /contracts/save_the_world_ERC721.sol
into a new .sol file in remix. The name doesn't matter. Just the version of Solidity (^0.8.7) and the account addresses from your local ganache blockchain you would like to assign specific ERC721 Roles in our deployment:
(import your accounts into MetaMask as shown in this screenshot - Account 2, Account 3, etc...)
5.2 Switch to the Deploy and Run Transactions
tab and change to:
Injected Provider - MetaMask
You might be prompted for your MetaMask password.
5.3 Click the Deploy Contract
button and fetch your new contract address for the .env file.
...
SMART_CONTRACT_ADDRESS="<paste here>
"
...
From within the project directory, run the Streamlit app. The first time it's run, plase got tpo teh Settings page and click the RESET ALL db tables
.
streamlit run Home.py
This page can be built out into a management solution for onboarding new organizations or managign existing ones.
This page uses inheritance to conveniently populate dropdowns selections based on category, type of donation. etc.
This would be built our as well into a MVC-type solution to manage a catalog of resources (to be donated/minted).
This is where the local db is prepopulated with data from CSV files to provide list or resources, organizations, and ethereum addresses associated with said organizations.
The minted tokens are stored in the pinata.cloud ipfs platform. Example IPFS Tokenized Relief Asset (STW Token):
NOTE: This MVP only stores variables allow within the Pinata free tier.