Front end for ELX application. Written using Angular and Angular Material 10. Supported by smart contracts in Solidity and Firebase.
Requirements: npm 6+ (more or less), an Ethereum client and a Firebase project (optional).
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.
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.
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.
In the 'New RPC URL' enter the 'RPC server' from Ganache.
You can also use a CLI version, installable using npm install ganache-cli -g
.
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
For a production build, run:
npm run build
npm run start
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