Initial Setup Instructions:
- Download MongoDB locally
-If homebrew is not yet installed, in terminal:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
-Once homebrew is installed:
brew tap mongodb/brew
brew install mongodb-community
- Create a local folder to use mongodb and give necessary permissions
-For MacOS pre Catalina
sudo mkdir -p /data/db
sudo chown -R `id -un` /data/db
-For MacOS Catalina onwards
sudo mkdir -p /System/Volumes/Data/data/db
sudo chown -R `id -un` /System/Volumes/Data/data/db
- Check to see if MongoDB is installed correctly and RUN
mongo --version
-You should see something similar to:
MongoDB shell version v4.4.1
Build Info: {
"version": "4.4.1",
"gitVersion": "ad91a93a5a31e175f5cbf8c69561e788bbc55ce1",
"modules": [],
"allocator": "system",
"environment": {
"distarch": "x86_64",
"target_arch": "x86_64"
}
}
-Now run mongodb (leaving it open and running in the background)
brew services run mongodb-community
If needing assistance on locally downloading mongodb, more information can be found here: https://zellwk.com/blog/install-mongodb/font%20awesome
- Get App Dependencies Setup
-Cd into 'Decent' folder (terminal 1) -This will run a local instance of truffle and provide a console we can use later to interact with our deployed contract and provided accounts
npm i
npx truffle develop
truffle migrate
-Truffle migrate will compile and deploy an instance of the smart contract, copy that address and paste in the src/next.config.js file under CONTRACT_ADDRESS
-Paste in the server.js file on line 37 as well
In another terminal (terminal 2), start the server:
npm run server
Open another terminal (terminal 3) to start client:
-cd src
npm i
npm run build
npm run start
- Setup Metamask, if not already installed
-Download metamask chrome extension
-From the truffle console, copy the local network being used e.g. http://localhost:9545
-Open metamask networks (Ethereum Mainnet, Ropsten, etc), and click 'Custom RPC'
-Fill out the network name (truffle)
-Paste the network you copied from the truffle console into the New RPC URL input
-If metamask requires a Chain Id, go into the truffle console and enter in 'web3.eth.chainId()'