This is a comprehensive guide that will walk through new contributors on how to run Giveth TRACE locally. We'll be dealing with 2 repos found in the Giveth Github the
giveth-dapp for the front-end and
feathers-giveth for smart contract interfacing and the back-end database.
- NodeJS v10.24.0
- Click Star on this repo near the top-right corner of this web page (if you want to).
- Join our Contributors Discord if you haven't already.
- Fork this repo by clicking Fork button in top-right corner of this web page. Continue to follow instruction steps from your own feathers-giveth repo.
- The rest of these steps must be done from your machine's command line. Clone your own "feathers-giveth" repo. Copy the link from the "Clone or download" button near the top right of this repo's home page.git clone email@example.com:Giveth/feathers-giveth.git
- Change directories to feathers-giveth:cd feathers-giveth/
- Make sure you have NodeJS (v10.24.0), yarn (v0.27.5 or higher), and npm (5.4.1 or higher) installed.
- Install dependencies from within feathers-giveth directory:yarn install
- Install Mongo (we recommend installing via Brew)
- Run Mongo in a terminal window
mongodor in the background
mongod --fork --syslog
- Install Redis (we recommend install via Brew
brew install redis)
- Run Redis in terminal window
redis-serveror in the background
redis-server --daemonize yes
- (optionally) Install IPFS (we recommend installing via Brew)
*If you don't install ipfs, image uploading will be affected. You can update the config
ipfsGatewayvalue to use a public ipfs gateway ex. https://ipfs.io/ipfs/, however your uploads will be removed at some point
The feathers server will need to connect to an ethereum node via websockets. Typically this will be a local TestRPC instance.
The configuration param
blockchain.nodeUrl is used to establish a connection. The default nodeUrl is
We need to deploy any contract to that we intend to call. NOTE: The following cmd will clear the
datadir, thus starting off in a clean state.yarn deploy-local
After deploying local, make sure to copy-paste the MiniMeToken address in default.json
We provide an easy way to start the bridge & 2 ganache-cli instances. VERY IMPORTANT: this command enables Home Ganache and Foreign Ganache networks, if you are using MetaMask you will need to add a Custom RPC to your networks config,
http://localhost:8546will be Foreign Ganache, and Home Ganache is normally added by default which is
http://localhost:8545if needed.yarn start:networks
Since the bridge & ganache-cli is now running, open a new terminal window and navigate to the same feathers-giveth directory.
Optionally open a new terminal window and start the ipfs daemonipfs daemon
Run db migration files ( if this the first time you want to start application, it's not needed to run migrations)./node_modules/.bin/migrate-mongo up
Start your appyarn start
If you run into errors like wallet balance not loading, it is very likely that Ganache is stuck
netstat -vanp tcp | grep 8545
Find the process that is listening on
127.0.0.1.8545 and kill it with
kill -9 PID (which is in the last colomn)
ipfsApi is a valid ipfs node that we can connect to, we will pin every ipfs hash that is stored in feathers. We currently do not remove any orphaned (hashes with no references in feathers) ipfs hashs. In the future we will provide a script that you can run as a cronjob to unpin any orphaned hashes.
Video tutorial walkthrough here: https://tinyurl.com/y9lx6jrl
feathers-giveth/scripts directory contains a few scripts to help development.
deploy.js- deploys a new vault & liquidPledging contract
getState.js- prints the current state of the deployed vault & liquidPledging contracts.
confirm.js- confirms any payments that are pending in the vault
makeUserAdmin.js- make a user admin
yarn test and all your tests in the
/src directory will be run.
It's included some integration tests so for running tests, you need to run a mongodb in your local system (on port 27017)
You can control the logging level with the
LOG_LEVEL env variable. Available levels can be found at: https://github.com/winstonjs/winston/tree/2.x#logging-levels
To enable debug logging simply start the server with
LOG_LEVEL=debug yarn start
We use docker-compose for orchestration of our docker containers in our production servers.
- make Make sure you have a file named
production.jsonin config folder
- Install docker and docker-compose on your server
- run this command:
docker-compose -f docker-compose-production.yml up -d
PS: It's good to see Github Actions config(
./.github/workflows/CI-CD.yml) to better understand the deployment structure
You will need to download the rsk node. After installing, you will run the node w/ the
regtestnetwork for local development.java -jar rskj-core-0.5.2-ORCHID-all.jar co.rsk.Start --regtest
orjava -Drsk.conf.file=rsk.conf -jar rskj-core-0.5.2-ORCHID-all.jar co.rsk.Start
We need to deploy any contracts that we intend to call. NOTE: You will also need to ensure that your rsk node is in a clean state (reset) for the configured addresses to be correct.npm run deploy-local:rsk
Optionally open a new terminal window and start the ipfs daemonipfs daemon
Start your appyarn start:rsk
The Audit log system logs every Create, Update, Patch and
Remove on Campaigns, Traces, Events, Users,
PledgeAdmins, Communities, Donations
For enabling audit log locally you should change
in config to
- cd elk
- docker-compose up
And then after logging in
localhost:5601 with user:
you can see the logs
Each of these services are available via rest or websockets:
If the server is using default configurations, you can see data for any of these services through your web browser at
PS: For accessing all features like creating
campaigns it's suggested to
isAdmin field true, for your user in you local MongoDb
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.
- NodeJS v10 LTS.
- yarn (v1.22.10 or higher)
- Click Star on the
giveth-dapprepo near the top-right corner of this web page (if you want to).
- Join us on Element or Discord if you haven't already.
- Fork this repo by clicking Fork button in top-right corner of this web page. Continue to follow instruction steps from your own giveth-dapp repo.
- Clone your own "giveth-dapp" repo. Copy the link from the "Clone or download" button near the top right of this repo's home page.
- The rest of these steps must be done from your machine's command line. See the OSX and Linux or Windows section to continue.
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:
- From the desired directory you wish to copy the "giveth-dapp" folder with source files to.NOTE: Please usegit clone firstname.lastname@example.org:Giveth/giveth-dapp.git
developbranch for contributing.git clone -b develop email@example.com:Giveth/giveth-dapp.git
- Change directories to giveth-dapp:cd giveth-dapp
- Make sure you have NodeJS (v10) and yarn (v1.22.10 or higher) installed.
- Install dependencies from within giveth-dapp directory:yarn install
- That is it, you are now ready to run the giveth-dapp! Head to the Run DApp section for further instructions.
- Install the latest version of Python from this Link. (make sure python is added to $PATH)
- Install Microsoft Visual Studio 2017 (double-check the version) from this link. Giveth-Dapp needs the node-gyp module and node-gyp needs VS C++ 2017 Build Tools to be installed.
- After downloading, install the packages marked from this image.
- Then run command below in command promptnpm config set msvs_version 2017
- After installing the above, you should install NodeJS version 10 LTS (it is better to be v10.24.1 LTS).
- Download and run the node-v10.24.1-x64.msi installer and then continue through the installation as normal. Be sure to have the "Enable in PATH" option enabled before installing.
- Open the command line in administrator mode by right-clicking on the cmd.exe application and selecting "Run as administrator"
- In the administrator command prompt, change to the directory where you want to store this repository.cd C:\some\directory\for\repositories
- Double-check the node version with CMD command:node -v
- After that, install the latest version of Yarn. Be careful not to install packages with NPM. If you have already tried "npm install", you should first delete "node modules" folder.yarn install
- That is it, you are now ready to run the giveth-dapp!
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
developenvironment, see the Configuration section.
Start the dapp.yarn 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
0xe78A0F7E598Cc8b0Bb87894B0F60dD2a88d6a8Abby 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.
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.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: |
|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 |
|REACT_APP_DEFAULT_GASPRICE||10||Overwrites the default gasPrice that is used if ethgasstation service is down. The value is in gwei.|
.env.local file that makes the DApp run on port 8080, connects to the develop environment and uses custom blockexplorer:
The rest of the configuration can be found in
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:
|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)|
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.
- The Giveth Dapp is auto deployed from the develop branch and is live on Rinkeby develop.giveth.io. All pull requests are autodeployed and the PR preview will be generated upon submission. To learn how to access PR previews see Development Process & Quality Assurance on our wiki.
- In order to use the dapp you will need to create account. If this is your first time, click "sign up" to create an account. If you already have a valid keychain file, use it to sign in.
- You will need test ether on the Rinkeby network. Go to the "wallet" page to see your new address (0x..). Copy that address and use the faucet to get some: https://faucet.rinkeby.io/
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.