This project is about the creation of an Ether wallet platform where users can create accounts, send and receive ether, and view wallet balance.
It is a low level implementation of platforms like coinbase, luno etc.
- Solidity (Writing Smart Contract)
- Javascript (React & Node.js)
- Web3 (Blockchain Interaction)
- Ganache (Local blockchain)
- Remix (Web based solidity compiler)
- MySql Workbench (Local database management tool for MySQL database)
- Install NodeJS,
- MySql Workbench
Below is the data flow pattern used in this project:
Frontend(React) <-> Fetch Api <-> Backend(Node.js) <-> Web3 <-> Ganache(Local blockchain)
Apart from the above data flow or architectural pattern, the below architectural pattern can also be used with a couple of tweaks:
Frontend(React) <-> Web3 <-> MetaMask(Web3 connector) <-> Ganache(Local blockchain)
Kindly fork and clone the repo
Download Ganache which is a local blockchain that you can run the smart contract or
Install Ganache-cli using the following command
npm install ganache-cli
After install of the Ganache-cli, run the following command to get access to your local blockchain
ganache-cli
You can copy the code in 'wallet.sol' and paste in Remix, then compile and deploy to local blockchain.
cd or navigate to the backend folder from the root folder in your terminal and install backend dependencies
#Goto backend
cd frontend
#Install dependencies
npm install
Create a .env file in the root directory of the backend folder and add the following properties
DB_USER = ?
DB_HOST = ?
DB_DATABASE = ?
DB_PASSWORD = ?
#Set timezone, put 1 if it's GMT+1 or -1 if it's GMT-1
TIME_ZONE = ?
SECRET_KEY=?
#Local blockchain url
WEB3_URL =?
#Smart contract address
CONTRACT_ADDRESS=?
cd or navigate to the frontend folder from the root folder in your terminal and install backend dependencies
#Goto frontend
cd frontend
#Install dependencies
npm install
The backend test include database connect and table creation test, web3 test and account creation test.
NB: Please some test cases are commented out and the reasons for the comment are at the top of each comment. Please check the test cases in the test folder for details
It's advisable to run the test files one after the order in the following order
- errorLogger.test.js
- db.test.js
- accountController.test.js
- web3Controller.test.js
cd to the backend folder in your terminal and enter the following command
npm run test
cd to the backend folder in your terminal and enter the following command
npm start
Backend opens at port 8000
cd to the frontend folder in your terminal and enter the following command
npm start
You can access the project in your browser by entering - localhost:3000
;
If your backend test is successful, then you should have the following login details
- email: [email protected]
- password: password
- IJONI VICTOR
Don't forget to star the project :) :) . Thanks