DApp - Donation Application for charitable giving without losing ownership
Welcome to the code for Giveth's DApp. This is an open source effort to realize the potential of ethereum smart contracts. More specifically, the Giveth DApp provides an alternative to traditional donation.
In the following sections you will learn all you need to know to run the DApp locally and to start contributing. All the steps are also described in this amazing Video Tutorial Walkthrough by Oz.
If your operative system is any distribution of linux you can use an All-in-One installation scripts special thanks to Dapp contributor Jurek Brisbane, available here along with a youtube video, otherwise try the following:
git clone {paste your own repo link here}
NOTE: Please use develop
branch for contributing.
git clone -b develop {paste your own repo link here}
cd giveth-dapp
yarn install
npm config set msvs_version 2017
cd C:\some\directory\for\repositories
node -v
yarn install
The Giveth dapp will need to connect to a feathers-giveth server. Follow the feathers-giveth readme instructions to install and run server before proceeding further. Alternatively, you could change the configuration to connect to the develop
environment, see the Configuration section.
Start the dapp.
npm start
Once the dapp is up in your browser, click "Sign In" from the main menu.
For testing locally, choose any of the wallet files found in the giveth-dapp/keystores/
folder using the wallet password: password
. DO NOT USE THESE ON ANY MAINNET EVMs.
Using the test token
To use the test token you need to import the keystore.json you use for your account to MetaMask.
After importing, click on 'Add token' > 'Custom token' and enter the MiniMe Token address that can be found when deploying the contracts
(should be 0xe78A0F7E598Cc8b0Bb87894B0F60dD2a88d6a8Ab
by default but make sure to check)
The token balance should show up automatically, and the token symbol is MMT.
However, in the dApp the token symbol is referred to as ANT, b/c the dapp needs to be able to fetch a conversion rate.
NOTE: When resetting feathers or redeploying the contracts, you need to remove the keystore from metamask and follow this procedure again.
npm run build
NOTE: due to some web3 libraries that are not transpiled from es6, we have to use our giveth-react-scripts fork of react-scripts .
The DApp has several node environment variables which can be used to alter the DApp behaviour without changing the code. You can set them through .env
or .env.local
files in the DApp folder.
Variable name | Default Value | Description |
---|---|---|
PORT | 3010 | Port on which the DApp runs |
REACT_APP_ENVIRONMENT | 'localhost' | To which feathers environment should the DApp connect. By default it connects to localhost feathers. Allowed values are: localhost , develop , release , alpha , mainnet . See Deployment Environments. |
REACT_APP_DECIMALS | 8 | How many decimal should be shown for cryptocurrency values. Note that the calculations are still done with 18 decimals. |
REACT_APP_FEATHERJS_CONNECTION_URL | Differs per REACT_APP_ENVIRONMENT | Overwrites the environment injected feathers connection URL. |
REACT_APP_NODE_CONNECTION_URL | Differs per REACT_APP_ENVIRONMENT | Overwrites the EVM node connection URL for making EVM transactions. |
REACT_APP_LIQUIDPLEDGING_ADDRESS | Differs per REACT_APP_ENVIRONMENT | Overwrites the Liquid Pledging contract address. |
REACT_APP_DAC_FACTORY_ADDRESS | Differs per REACT_APP_ENVIRONMENT | Overwrites the Communities contract address. |
REACT_APP_CAMPAIGN_FACTORY_ADDRESS | Differs per REACT_APP_ENVIRONMENT | Overwrites the Campaign Factory contract address. |
REACT_APP_MILESTONE_FACTORY_ADDRESS | Differs per REACT_APP_ENVIRONMENT | Overwrites the MilestoneFactory contract address. |
REACT_APP_TOKEN_ADDRESSES | Differs per REACT_APP_ENVIRONMENT | Overwrites the bridged token addresses. This is a JSON object string w/ token name : token address. |
REACT_APP_BLOCKEXPLORER | Differs per REACT_APP_ENVIRONMENT | Overwrites the block explorer base URL. The DApp assumes such blockexplorer api is \<BLOCKEXPLORER\>/tx/\<TRANSACTION_HASH\> |
REACT_APP_DEFAULT_GASPRICE | 10 | Overwrites the default gasPrice that is used if ethgasstation service is down. The value is in gwei. |
REACT_APP_ANALYTICS_KEY | "" | Overwrites Segment analytics key |
Example of .env.local
file that makes the DApp run on port 8080, connects to the develop environment and uses custom blockexplorer:
PORT=8080
REACT_APP_ENVIRONMENT='develop'
REACT_APP_BLOCKEXPLORER='www.awesomeopensourceexplorer.io'
The rest of the configuration can be found in configuration.js
Segment Analytics can be enabled by setting REACT_APP_ANALYTICS_KEY
The milestone creation/proposal view now supports query string arguments! The following arguments are available:
Argument | Expected Values | Type |
---|---|---|
title | The title of the milestone | string |
description | The description of the milestone | string |
recipientAddress | The address of the recipient | string |
reviewerAddress | The address of the reviewer | string |
selectedFiatType | A valid fiat type (i.e. USD) | string |
date | A valid milestone date string | string |
token | A valid token symbol (i.e. DAI) | string |
tokenAddress | A valid token address | string |
maxAmount | A valid max amount of ETH or token | number |
fiatAmount | A valid max amount of fiat (dependant on selectedFiatType) | number |
isCapped | Determines whether the milestone should be capped | 0 or 1 (boolean) |
requireReviewer | Determines whether the milestone should require a reviewer | 0 or 1 (boolean) |
The DApp is fully open-source software, and we would love to have your helping hand! See CONTRIBUTING.md for more information on what we're looking for and how to get started. You can then look for issues labeled good first issue or help wanted. We regularly reward contributions with ether using the Reward DAO.
If you are not a developer, you can still help us by testing new releases periodically. See the Release Process section.
If you want to better understand how does the development process works, please refer to our wiki pages, especially to the Product Definition, Product Roadmap and Development Process & Quality Assurance.
At first you would like to run the DApp locally. When running testrpc
locally in deterministic
mode, you can use any of the keystores in the giveth-dapp/keystores
as your wallet.
This will provide you access to the testrpc accounts for local development. Each keystore uses the same password: password
. DO NOT USE THESE ON ANY MAINNET EVMs
The keystores are seeded with 10.000 ANT tokens for testing donations. To get started with testing donations, make sure to add your account's keystore to MetaMask and swith MetaMask to Ganache. The donation modal should then show the appropriate balance when donating in ANT tokens.
NOTE: If you get a nonce error in MetaMask or if the dapp fails to load with your metamask unlocked, it could be b/c metamask is confused. You should go to "settings" -> "Reset Account" in MetaMask in order to reset the nonce & cached account data.
At Giveth, we are using the gitflow branching model to deploy to 4 different environments.
Name | Blockchain | Branch Deployed | Auto Deploy | Use |
---|---|---|---|---|
mainnet | Ethereum Main Network | master | no | Main network deployment for now abandoned due to high transaction costs until sustainable solution is found. |
alpha | Rinkeby Test Network | master | no | Environment used as a production version until scalability is resolved. |
release | Rinkeby Test Network | release | yes | Environment for release candidate quality control testing by non-devs. |
develop | Rinkeby Test Network | develop | yes | Development environment for integrating new features. Feature and pull request branches are also automatically deployed to this environment. |
You can change the environment to which the DApp connects through the node environment variables. See the Configuration section for more details.
The development uses the Gitflow process with 2 weeks long sprints. This means there is new release to be tested every fortnight. We invite contributors to help us test the DApp in the release environment before we merge it to the master branch and deploy to production environments. If you are interested, write to the DApp Development channel on Element . You can read more about the release planning on our wiki.
Reach out to us on Element or Discord for any help or to share ideas.