BRApp is the BlockRabies application used for managing event data around the movement of Rabies vaccines from the manufacturer all the way to the patient. The core objective of BlockRabies is to write this data to the blockchain in order to enable incorruptible audits of the entire supply chain.
At present, the BlockRabies application is written in PHP and installed directly on the servers at the various clinics and supply chain facilities. On the other hand, the dHealth blockchain libraries (the “dHealth SDK”) are implemented using TypeScript and run using node.js. Thus, any transaction that is generated by the BRApp must use the TypeScript libraries in order to generate digital signatures for the blockchain transactions.
This document describes a proxy server, written in node.js, that enables the PHP BRApp instance to send data to the blockchain. This is a temporary solution until the PHP app can be upgraded to interface directly with locally installed dhealth client libraries written in node.js.
-
The
BlockRabiesapp is configured to set labels for each role for which it needs to submit transactions. Example:“Bouake Clinic”or“Abidjan Pharmacy”. -
The
dHealth Transaction Proxy Server (DTPS)is configured with: the allow-list of IP addresses from which requests should be accepted. a map of eachBlockRabieslabel and its correspondingdHealthwallet keys. -
During operation, the
BlockRabiesapp sends an API request to theDTPS, specifying the source and destination labels and the data to be announced. The data should be plain text and limited to 1000 characters. -
The
DTPScreates a transaction using the private key and public key corresponding to the specified source and destination labels, and including the specified data as the transaction payload. -
The success code from the transaction request is returned to the caller as the result of the API call.
There will be a single HTTPS API endpoint named /announce.
Each request will include an authorization code.
The post data will be a JSON format plain text, with two fields:
sender: this uniquely identifies the entity on whose behalf the announcement will be made.data: this is an application-specific json formatted string that will be included in the blockchain transaction. It is NOT interpreted by theDTPS, but instead directly attached to the transaction.
The HTTPS result code will indicate the success or failure of the blockchain transaction creation operation.
POST https://dtps.dhealth.cloud/announce
post-data:
{
“sender”: “ML-bouake-clinic”,
“data”: {
“event”: “RECEIVED”,
“entity”: “mali-supplier1”,
“serial_numbers”: “abc123,def456,geh789,ijk012”
}
}
result: http response code corresponding to transaction creation status.
Ideally, the DTPS should be hosted on a cloud service to avoid service interruptions. Given its stateless nature, it can most easily be implemented as a firebase cloud function (equivalent to an AWS lambda function), that is able to communicate with any one of several available blockchain nodes.
Following functions are defined and exported with this library:
| Function | Description |
|---|---|
dtps |
This function acts as the dHealth Transaction Proxy Service, which allow BlockRabies clients to send transactions to the dHealth blockchain network with given data. |
Serving the cloud functions locally works by executing the following command from the root directory of the project:
npm run serveThis will serve the cloud functions locally at http://localhost:8083/blockrabies-dtps/us-central1/dtps.
To run the cloud function locally with an emulator of Firestore and Firebase Hosting, execute the command:
firebase emulators:startThis command will serve:
- The cloud function at http://localhost:8083/blockrabies-dtps/us-central1/dtps
- The cloud firestore at: http://localhost:8084
- The emulator UI (where you can add data or read logs) at: http://localhost:8085
- The cloud hosting at: http://localhost:8086
Cloud functions can be deployed to Firebase using the following command:
npm run deployHosting site can be deployed to Firebase using the following command:
firebase deploy --only hosting:dtpsUnchangable domain names of Firebase functions will be similar to https://dtps-abcd12345-uc.a.run.app which is hard to enter and remember.
The hosting site acts as a proxy server that allows the function to have simpler, more friendly domain names (e.g. https://dtps.com).
Custom domain can be configured following this guide.
Copyright 2023-present dHealth Network, All rights reserved.
Licensed under the LGPL v3.0

