Skip to content

ashgkwd/wechain

Repository files navigation

WeChain

Simple react and node based app to send money from owner's wallet to desired destination wallet.

Installation

git clone https://github.com/ashgkwd/wechain.git
cd wechain/front && yarn
cd ../server && yarn

Start

Ensure that front/.env file has REACT_APP_BLOCKCHAIN, REACT_APP_NODE_SERVER and REACT_APP_PRIVATE_KEY To start front cd front and npm start.

Ensure that server/.env file has PORT, BLOCKCHAIN and PRIVATE_KEY To start node based back end cd server and node index.js.

How to obtain private key?

You will need to export keystore file. You can do that using popular Sync app. Then using keystore file's info, you can obtain private key.

Ref:

Do I need local thor node running?

If you are not using public thor node, you will need to run a local node. Here are steps to do that:

Server thor node setup

sudo apt update
sudo apt install build-essential
wget https://dl.google.com/go/go1.14.linux-amd64.tar.gz
sudo tar -C /usr/local -xzf go1.14.linux-amd64.tar.gz
echo "export PATH=\$PATH:/usr/local/go/bin" >> .profile
source .profile
git clone https://github.com/vechain/thor.git
cd thor
make dep
make all

Run thor using bin/thor --network test --api-cors "*" --api-addr 0.0.0.0:8669

Ref: https://www.reddit.com/r/Vechain/comments/99jgs3/how_to_build_a_dapp_on_vechain_initial_steps/ Ref: https://medium.com/@muhammadtriwibowo/set-permanently-ulimit-n-open-files-in-ubuntu-4d61064429a

Server web3-gear setup

pip3 install web3-gear

Ref: https://github.com/vechain/web3-gear

Server react app setup

You will need node and npm. Ref: https://tecadmin.net/install-latest-nodejs-npm-on-ubuntu/

git clone https://github.com/ashgkwd/wechain.git
cd wechain/front && npm install
npm run build
cd /var/www/http && sudo ln -s /home/ubuntu/wechain/front/build/ wechain

Create apache2 conf file in /etc/apache2/sites-available/wechain.conf and paste contents of wechain-apache2.conf file from this repo. Modify according to your needs.

Then enable site and reload apache2 sudo a2ensite wechain.conf and sudo service apache2 reload

Server node app setup

cd server && npm install

Server supervisord setup

Install supervisor sudo apt install supervisor

Then create a file /etc/supervisor/conf.d/wechain.conf and copy paste contents from wechain-supervisord.conf. Modify content according to your needs.

Supervisor takes care of auto restarting node server and thor instance.

Ref: http://supervisord.org/running.html

Debug

To see logs of thor node and node app: tail -f /var/log/we*

To see log of react app, in browser F12 or right click and inspect element > console

Mounting EBS volume in ubuntu instance: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-using-volumes.html

To run test cases for react cd front && npm run test

Production Links

The app is deployed at http://13.58.163.28/

When you setup a new server, ensure ~/wechain/front/.env, ~/wechain/server/.env, ~/wegear/passcode and ~/wegear/owneraccountkeystore.txt are manually placed with correct content.

About

Blockchain 📦⛓️ and Daap 🛡️

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published