b4H DApp - Donation Application for supporting causes without losing ownership
Welcome to the code for b4H DApp. This is an open source effort started at Giveth.io to realize the potential of ethereum smart contracts. More specifically, the Giveth DApp provides an alternative to traditional donation. That genesis effort is now complemented for the whole #blockchain4goood community by adopting bitcoin as a store of value.
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.
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
npm install
cd C:\some\directory\for\repositories
npm install npm@latest -g
npm install -g windows-build-tools
npm install
npm rebuild node-sass
npm install web3
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 DACs contract address. |
REACT_APP_CAMPAIGN_FACTORY_ADDRESS | Differs per REACT_APP_ENVIRONMENT | Overwrites the Campaign Factory contract address. |
REACT_APP_CAPPED_MILESTONE_FACTORY_ADDRESS | Differs per REACT_APP_ENVIRONMENT | Overwrites the Milestone 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\> |
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
Google analytics and Hotjar can be enabled per environment:
analytics: {
ga_UA: 'UA-12345678-1', // Your Google Analytics tracking code
useGoogleAnalytics: true, // Whether to enable GA
useHotjar: false // Whether to enable Hotjar
}
The following events are tracked with Google Analytics:
DO NO USE ANY OTHER THAN DEVELOP ENVIRONMENT FOR DEVELOPING AND TESTING.
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 b4H Dapp, 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 Riot. You can read more about the release planning on our wiki.
Reach out to us on Riot for any help or to share ideas.