Skip to content

Installation

Supply Chain Demo App

BlockApps STRATO makes it easy to build blockchain applications to improve the tracability and auditability of logistics systems. In this example, we showcase a supply chain web application built using the BlockApps STRATO REST APIs.

At a high level, blockchain technology can be used to accelerate cost savings in multi-party logistics applications:

  • Syncronized State of Information - Sophisticated logistics programs involve multiple parties who often are in different time zones. Blockchains allow multiple parties to access a syncronized state of information at a moment in time.

  • Automated Business Agreements - Ethereum Smart Contracts allow users to create business agreements with contingency plans that can be automatically executed based on pre-determined conditions in the outside world. For example, purchase orders can be executed if inventory reaches a pre-determined threshold.

  • Tamper-Proof Record Keeping - Blockchain applications can cryptographically prove that supply chain materials (1) originate from an advertised source, (2) contain the advertised contents, (3) in the advertised quantities.

Application Architecture

Demo App Installation

The demo app consists of a Node JS server which calls the REST APIs on your STRATO node, and a ReactJS front end.

System Requirements

  • Node v7.2 or above
  • BlockApps STRATO node.
  • Ports 80, 3030, and 3031 must be publicly accessible. If you are using AWS, Azure, or Google Cloud Platform, you may need to allow traffic on these ports by changing the firewall settings.

Installation - Localhost

Use this guide if your STRATO node is running on localhost. Otherwise, scroll down to the Remote Server Instructions

1. Download the source code

git clone https://github.com/blockapps/blockapps-ba/
cd blockapps-ba

2. Install the dependencies

npm i

3. Install the UI dependencies

cd ui
npm i

4. Deploy the Server

Mac/Linux Users

Run the following from the project root

npm run deploy

Windows Users

Run the following from the project root

set "SERVER=localhost" & npm run deploy-windows

5. Launch the API

From the project root (Linux, Mac and Windows)

npm run start

6. Launch the UI

Mac/Linux Users

cd ui
npm run start

Windows Users

cd ui
set "REACT_APP_API_URL=http://localhost:3031" & set "PORT=3030" & npm run start-windows

Success! The app should be running on localhost:3031

Installation - Remote Server

Use this guide if your STRATO node is running on AWS, Azure, or Google Cloud Platform.

1. Download the source code

git clone https://github.com/blockapps/blockapps-ba/
cd blockapps-ba

2. Install the dependencies

npm i

3. Install the UI dependencies

cd ui
npm i

Mac/Linux Users

4. Set the Configuration

  • Create a config file under ./server/config with the naming convention <server-name>.config.yaml. You are free to chose the server-name.

  • Copy the content of localhost.config.yaml to a new file <server-name>.config.yaml, located at ./server/config. ou are free to chose the server-name.

  • Configure <server-name>.config.yaml as follows:

apiDebug: true
password: '1234'
timeout: 600000
libPath: ./server/lib
contractsPath: ./contracts/
dataFilename: ./server/dapp/dapp.presets.yaml
deployFilename: ./server/config/<server-name>.deploy.yaml

#WARNING - extra strict syntax
#DO NOT change the nodes order
#node 0 is the default url for all single node api calls
nodes:
  - id: 0
    explorerUrl: 'http://<your-ip-or-dns>:9000'
    stratoUrl: 'http://<your-ip-or-dns>/strato-api'
    blocUrl: 'http://<your-ip-or-dns>/bloc/v2.2'
    searchUrl: 'http://<your-ip-or-dns>/cirrus'
  • Replace with the name of your config file (excluding config.yaml) and <your-ip-or-dns> with the IP or the DNS name of your remote server and then run the following from the project root:
SERVER=<server-name> npm run deploy

Windows Users

set "SERVER=<local-ip>" & npm run deploy-windows

local-ip can be 127.0.0.1 or the local network IP.

5. Launch the API

From the project root (all users)

npm run start

6. Launch the UI

Mac/Linux Users

cd ui
API_URL="http://<your-ip-or-dns>:3031" npm run start

Windows Users

cd ui
set "REACT_APP_API_URL=http://<your-ip-or-dns>:3031" 
& set "PORT=3030" & npm run start-windows

where <your-ip-or-dns> is the IP or DNS name of the remote machine

set "REACT_APP_API_URL=http://some.remote.cloudapp.provider.com:3031" 
& set "PORT=3030" & npm run start-windows

Success! The app should be running on <server_name>:3031

Testing (Optional)

Mac/Linux Users

npm run test

Windows Users

set "SERVER=<server-name>" & npm run test-windows

Appendix