The DLT app consists of a **fabricConnect.ts** TypeScript file which contains the logic for Identification management (Certificates required for the MSP), connection management to the blockchain, and finally it exposes a contract object with all the required information for interacting with the chaincode. The compiled **fabricConnect.ts** logic can be imported into a **dltGateway.js** or other testing code inside the [/tests](./tests/) folder.
The DLT app consists of a **fabricConnect.ts** TypeScript file, which contains the logic for identification management (certificates required for the MSP), connection management to the blockchain, and finally, it exposes a contract object with all the required information for interacting with the chaincode. The **fabricConnect.ts** is coded following the Fabric Gateway API recommendations from Hyperledger Fabric 2.4+. The compiled **fabricConnect.ts** logic is imported into a **dltGateway.js** file, which contains the gRPC logic for interaction with the TFS controller. Testing code for various performance tests is included inside the [/dltApp/tests](./dltApp/tests/) folder.
The chaincode is written in Go, providing a reference for the operations that are recorded in the blockchain. This chaincode must already be deployed in a working Hyperledger Fabric blockchain.
## Requisites
NodeJS
* NodeJS
* Docker
* K8s
## Running the App
## Building the App
Install the dependencies and compile the sourcecode.
Install the dependencies and compile the sourcecode.
```bash
npm install
```
Run the Gateway application
## Packing the App
```bash
node .\src\dltGateway.js
The [automation](./automation/) folder contains the Dockerfiles and Kubernetes configuration files alongside deployment scripts.
```
### Build a Docker Image
In another terminal run the test client application.
Using the Dockerfile, create a Docker image of the Gateway.
```bash
node .\src\testGateway.js
docker build -t your-username/dltgateway:v1.0.0 .
```
If necessary, upload the Docker image to a Docker repository for convenience. (You can work with the local image if deploying the Kubernetes service on the same machine.)
```bash
docker push your-username/dltgateway:v1.0.0
```
The purpose of the dltGateway is to expose the chaincode operations to gRPC connections for integration with the ADRENALINE testbed modules.
### Run the Deployment Script
Make the necessary changes to the environment variables inside the **configmap.yaml** according to the specific Fabric deployment. Also, update the path in the **persistent-volume.yaml** with the correct information.
## Performance Test
```bash
./deploy_dlt_gateway.sh
```
Once the Kubernetes service is deployed, TFS can perform gRPC requests to as usual.