github.com/muhammedhassanm/blockchain@v0.0.0-20200120143007-697261defd4d/blockapps-ba-master/README.md (about)

     1  Blockapps BA
     2  ------------
     3  [![BlockApps logo](http://blockapps.net/img/logo_cropped.png)](http://blockapps.net)
     4  
     5  ### Supply Chain Demo App
     6  This demo app uses STRATO blockchain platform and Smart Contracts to demonstrate a solution for a basic 2-party Supply Chain Workflow.
     7  
     8  ![Alt text](SupplyChain-Workflow.png?raw=true "Supply Chain Workflow")
     9  
    10  ![Alt text](sequence-diagram-05.png?raw=true "Supply Chain Sequence Diagram")
    11  
    12  ![Alt text](Demo_Application_Stack.png?raw=true "Demo Application Stack")
    13  
    14  ![Alt text](Production_Architecture.png?raw=true "Production Architecture")
    15  
    16  ### Pre Requisites
    17  
    18  Node v7.2 or more recent.
    19  
    20  This application requires a [BlockApps STRATO](http://blockapps.net/blockapps-strato-blockchain-application-development/) node. Follow the instruction in the [STRATO getting started guide](https://github.com/blockapps/strato-getting-started) to install a local instance.
    21  
    22  Please make sure that ports 80, 3030, and 3031 are publicly accessible. If you are using AWS or Azure, you may need to allow traffic on these ports by changing the firewall settings.
    23  
    24  Once you have a functional STRATO node, you can clone this project and deploy it to the STRATO instance using the instructions below.
    25  
    26  
    27  ### Dependencies
    28  
    29  Install the dependencies
    30  
    31  ```
    32  npm i
    33  ```
    34  
    35  Install the UI dependencies
    36  
    37  ```
    38  cd ui
    39  npm i
    40  ```
    41  
    42  ### Deploying on Localhost
    43  
    44  #### Uploading the smart contracts required by the demo app
    45   
    46  If you are deploying using STRATO on `localhost` (Linux and Mac users only):
    47  Run the following from the **project root**:
    48  
    49  ```
    50  npm run deploy
    51  ```
    52  
    53  Windows users should run
    54  
    55  ```
    56  set "SERVER=localhost" & npm run deploy-windows
    57  ```
    58  
    59  #### Launching the API
    60  
    61  From the project root (Linux, Mac and Windows):
    62  
    63  ```
    64  npm run start
    65  ```
    66  
    67  #### Launching the UI
    68  
    69  If you are deploying using STRATO on localhost (Linux and Mac users only):
    70  
    71  ```
    72  cd ui
    73  npm run start
    74  ```
    75  
    76  On Windows:
    77  
    78  ```
    79  cd ui
    80  set "REACT_APP_API_URL=http://localhost:3031" & set "PORT=3030" & npm run start-windows
    81  ```
    82  
    83  ### Deploying on a remote server (AWS, azure etc)
    84  
    85  Create a config file under `./server/config` with the naming convention `<server-name>.config.yaml`. You are free to chose the `server-name`. 
    86  
    87  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`. 
    88  
    89  Configfure `<server-name>.config.yaml` as follows:
    90  
    91  ```
    92  apiDebug: true
    93  password: '1234'
    94  timeout: 600000
    95  libPath: ./server/lib
    96  contractsPath: ./contracts/
    97  dataFilename: ./server/dapp/dapp.presets.yaml
    98  deployFilename: ./server/config/<server-name>.deploy.yaml
    99  
   100  # WARNING - extra strict syntax
   101  # DO NOT change the nodes order
   102  # node 0 is the default url for all single node api calls
   103  nodes:
   104    - id: 0
   105      explorerUrl: 'http://<your-ip-or-dns>:9000'
   106      stratoUrl: 'http://<your-ip-or-dns>/strato-api'
   107      blocUrl: 'http://<your-ip-or-dns>/bloc/v2.2'
   108      searchUrl: 'http://<your-ip-or-dns>/cirrus'
   109  ```
   110  
   111  Replace <server-name> 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**:
   112  
   113  ```
   114  SERVER=<server-name> npm run deploy
   115  ```
   116  
   117  On Windows:
   118  
   119  ```
   120  set "SERVER=<local-ip>" & npm run deploy-windows
   121  ```
   122  
   123  Here <local-ip> can be 127.0.0.1 or the local network ip.
   124  
   125  #### Launching the API
   126  
   127  From the project root (Linux, Mac and Windows):
   128  
   129  ```
   130  npm run start
   131  ```
   132  
   133  #### Launching the UI
   134  
   135  ```
   136  cd ui
   137  API_URL="http://<your-ip-or-dns>:3031" npm run start
   138  ```
   139  
   140  On Windows:
   141  
   142  ```
   143  cd ui
   144  set "REACT_APP_API_URL=http://<your-ip-or-dns>:3031" & set "PORT=3030" & npm run start-windows
   145  ```
   146  
   147  where `<your-ip-or-dns>` is the IP or DNS name of the remote machine. Eg: 
   148  
   149  ```
   150  set "REACT_APP_API_URL=http://some.remote.cloudapp.provider.com:3031" & set "PORT=3030" & npm run start-windows
   151  ```
   152  
   153  ### Testing
   154  
   155  ```
   156  npm run test
   157  ```
   158  
   159  On Windows:
   160  
   161  ```
   162  set "SERVER=<server-name>" & npm run test-windows
   163  ```
   164  
   165  <!--MKDOCS_DOC_DIVIDER_USAGE-->
   166  ## Using the BlockApps Supply Chain Demo App
   167  
   168  Open the app in the browser.
   169  
   170  By default, application is running at http://localhost:3030/
   171  
   172  ### Logins for the app
   173  The app comes pre loaded with four different users: `Buyer1`, `Buyer2`, `Supplier1`, `Supplier2`. All these users have the same password: `1234`.
   174  
   175  ### Bidding Flow Guide
   176  
   177  - Buyer Logs in
   178  ![Bidding1](http://i.imgur.com/kKVZkZO.gif)
   179  
   180  - Buyer creates a project for suppliers to bid on
   181  ![Bidding2](http://i.imgur.com/xADXnrX.gif)
   182  
   183  - Supplier logs in
   184  ![Bidding3](http://i.imgur.com/jNke2we.gif)
   185  
   186  - Supplier makes a bid on the earlier project
   187  ![Bidding4](http://i.imgur.com/4msxzoR.gif)
   188  
   189  - Buyer accepts early supplier bid
   190  ![Bidding5](http://i.imgur.com/WmK3lO4.gif)
   191  
   192  Note: After the buyer accepts the bid, 20 dollars from the buyer's account is taken and held by the smart contract but is still not disbursed until the product is accepted
   193  
   194  - Supplier marks that the product is shipped
   195  ![Bidding6](http://i.imgur.com/qYSeMAk.gif)
   196  
   197  - Buyer confirms that they recieved the product
   198  ![Bidding7](http://i.imgur.com/xD5g7dE.gif)
   199  
   200  
   201  <!--![Bidding](http://i.imgur.com/3GdKBMj.gif)
   202  
   203  
   204  ![Bidding2](http://i.imgur.com/rQF6oK6.gif)
   205  
   206  
   207  ![Bidding3](http://i.imgur.com/RnCXrSO.gif)
   208  
   209  
   210  ![Bidding4](http://i.imgur.com/54TVkKh.gif)-->