Skip to content
This repository has been archived by the owner on Jul 27, 2023. It is now read-only.
/ ELX-front-end Public archive

Front end for application developed as part of my engineering thesis. A web application for posting classifieds supported by smart contracts.

Notifications You must be signed in to change notification settings

kplich/ELX-front-end

Repository files navigation

ELX - front end

Front end for ELX application. Written using Angular and Angular Material 10. Supported by smart contracts in Solidity and Firebase.

Installing and running the application

Requirements: npm 6+ (more or less), an Ethereum client and a Firebase project (optional).

Compiling the contracts

To compile contracts, Truffle is required. Install it globally using npm:

npm install -g truffle

Move to the blockchain directory and compile them:

cd blockchain
truffle compile

As a result, you should see the following output:

Compiling your contracts...
===========================
> Compiling .\contracts\AbstractEscrow.sol
> Artifacts written to C:\Users\kplich\Documents\prywatne\ELX\ELX-front-end\blockchain\build\contracts
> Compiled successfully using:
   - solc: 0.7.1+commit.f4a555be.Emscripten.clang

The compiler does not deploy the contracts on the blockchain; this will happen when users agree to a transaction.

Setting up the Firebase project

To connect the application to your own Firebase project, change the firebaseConfig object in files within the environments folder. If you don't have a Firebase project, create it. There's no guarantee if the configuration provided will work.

Running a blockchain network

For a development blockchain network, it's best to use Ganache. For a one-time run, it should be enough to run a 'quickstart' network.

To connect to the blockchain in the browser, MetaMask can be used - it's available for Chrome, Firefox, Brave and Edge. Change the network by choosing 'Custom RPC' from the dropdown menu at the top of the extension. Give your network a name in the 'Network Name' field.

MetaMask

In the 'New RPC URL' enter the 'RPC server' from Ganache.

Ganache

You can also use a CLI version, installable using npm install ganache-cli -g.

Install and run the application locally

This application uses Node to manage its dependencies. To install it, run npm install within the top-level directory. Then, to run the application, run:

npm run local

Build and deploy the application

For a production build, run:

npm run build
npm run start

Running tests

To test the application once, run:

npm run test

To keep the tests running and watching for changes, run:

npm run test:watch

To test the contracts, you also need a blockchain network available at the address 127.0.0.1:8080. The tests might require a lot of gas to execute, therefore it is recommended to use the blockchain from Ganache CLI for tests with accounts preloaded with lots of Ethers:

truffle-cli -e 10000000000000000000

Once this or other blockchain is running, in another session of the terminal run

cd blockchain
truffle test

About

Front end for application developed as part of my engineering thesis. A web application for posting classifieds supported by smart contracts.

Topics

Resources

Stars

Watchers

Forks