/express-box

To Be Used as Truffle Box Creating API Endpoints for Ethereum Blockchain

Primary LanguageJavaScript

Express-Box

To Be Used as Truffle Box Creating API Endpoints for Ethereum Blockchain.

We use personalised blockchain for Ethereum BlockChain Development. This personalised blockchain is made in the GanacheCLI.

The Smart Contract Written in solidity language is deployed on this Ethereum Blockchain. Smart Contract is Immutable hence, once deployed it can't be changed.

A truffle box to serve as the foundation of any Truffle and Express.js dApp.

This Box Uses NodeJS(Express JS) to provide API endpoints to the Ethereum Blockchain smart contract so that this smart contract can be used in Android Apps as well.

Pre-Requisites

  1. NodeJS
  2. Yarn
  3. GanacheCLI
  4. Truffle

Installation

  1. In one terminal window run the Launch GanacheCLI ganache-cli -i 666
  • To prevent creating a new network id everytime, we have set a default network key in the truffle config file.
  • To change that, simply go to the 'truffle.js' file and change the network_id from '666' to " * " and to Launch GanacheCLI ganache-cli.
  1. Run npm install or yarn install to install all the node modules
  2. In another terminal window go the to project repositary, now, You need to compile the smart contracts written in the /contracts folder. For this, truffle compile
  3. You can see that a new /build folder has been created in the root directory which contains the compiled contracts.
  4. Now these contracts need to be deployed on the Blockchain. For this, truffle migrate --network development.
  • If you changed the network_id to " * " in Step 1, you can run truffle migrate
  1. To run the Express server yarn start or npm server.js, if you have nodemon installed.
  2. In the browser window open http://localhost:3000/.

Collaborators

  1. ARVIND KALRA
  2. PRANAV SINGHAL