3.8 KiB
DGF Prototype
Decentralized Governance Framework
Local development setup
Clone this repository to a directory on your machine
git clone https://gitea.dgov.io/DGF/dgf-prototype
Nginx
-
Install nginx
brew install nginx
-
Install mkcert
brew install mkcert
-
Install root CA
mkcert -install
-
Create a certificate
mkcert dgfprototype.dev
-
Create certificates directory
sudo mkdir /etc/nginx/certs
-
Move the certificate to the certificates directory
sudo mv dgfprototype.*.pem /etc/nginx/certs/
-
Add the following to the
http
section of/etc/nginx/nginx.conf
map $http_upgrade $connection_upgrade { default upgrade; '' close; }
-
Add the following to a new file
/etc/nginx/sites-available/dgfprototype_dev
server { listen 443 ssl; server_name dgfprototype.dev; ssl_certificate /etc/nginx/certs/dgfprototype.dev.pem; ssl_certificate_key /etc/nginx/certs/dgfprototype.dev-key.pem; location /api/ { proxy_pass http://127.0.0.1:3003/; } location / { proxy_pass http://127.0.0.1:3002/; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $connection_upgrade; proxy_set_header Host $host; } }
-
Create a symbolic link in
sites-enabled/
sudo ln -s /etc/nginx/sites-available/dgfprototype_dev /etc/nginx/sites-enabled
-
Restart nginx
sudo systemctl restart nginx
or
sudo brew services restart nginx
-
Edit
/etc/hosts
to add the domain alias127.0.0.1 dgfprototype.dev
API
-
In a new terminal window, navigate to
dgf-prototype/backend
-
Install the project
npm install
-
Copy the example configuration file
cp .env.example .env
-
Edit
.env
and set the following valuesPORT=3003
-
Create the data directory
mkdir data
-
Run the daemon
node src/index.js
Hardhat
-
In a new terminal window, navigate to
dgf-prototype/ethereum
-
Install the project
npm install
-
Copy the example configuration file
cp .env.example .env
-
In
.env
, set a value forSEED_PHRASE
orLOCAL_PRIVATE_KEY
-
Run a hardhat node
npx hardhat node
-
In a separate terminal window, navigate again to
dgf-prototype/ethereum
-
Build and deploy the contracts
npm run deploy-local
Metamask
-
Install the Metamask extension in your browser
-
In the Metamask extension, click the list of networks in the top left, and click "Add Network"
-
At the bottom of the list of popular networks, click "Add a network manually"
- Network name: Hardhat local
- RPC URL: http://127.0.0.1:8545/
- Chain ID: 1337
- Currency symbol: ETH
Frontend
-
In a new terminal window, navigate to
dgf-prototype/frontend
-
Install the project
npm install
-
Install
vite
npm i -g vite
-
Run the development server
vite dev
-
Now you should be able to open the site at https://dgfprototype.dev
To run automatic staking
-
Clone this repository to a directory on your machine
git clone https://gitea.dgov.io/DGF/dgf-prototype
-
Change to the
ethereum
directorycd ethereum
-
Install the project using
npm
npm install
-
Copy the example configuration file
cp .env.example .env
-
Export your Sepolia private key from MetaMask and add it to your
.env
fileSEPOLIA_PRIVATE_KEY="YOURKEY"
-
Run the automatic staking script
npm run automatic-staking-sepolia