This project contains an Express Node.js application which does request transformation for API requests from the front end react application for supplychain to the appropriate format for the Rest servers for corda.
The deployment has been made easy for Docker. The provided docker file will create the image that can be run.
The following will create the image called express_corda_app and then run the service on port 3000 for the manufacturer
docker build -t express_corda_app .
docker run -p 3000:3000 -e "API_URL=https://partyaapi.blockchaincloudpoc.com/api/v1 PORT=3000" express_corda_app
The list of all supplychain api requests are listed below:
[
{
party: "O=PartyA,OU=Manufacturer,L=47.38/8.54/Zurich,C=CH",
time: 1549565435354
},
{...}
]
This maps the custodian changes on the ledger to a list of objects with the timestamp of custodian change and new custodian.
Tracking ID is a passed in string and must be a valid UUID (java.util.uuid).
{
status:"owned"
}
This checks trackable states and sees whether the any state associate to that tracking ID exists and if so returned if you currently own it.
Tracking ID is a passed in string and must be a valid UUID (java.util.uuid).
The different states are owned, unowned, and new.
{
organization:"PartyA"
}
This checks the nodes organization name
N/A
{
organizationUnit:"Manufacturer"
}
This checks the nodes organization unit name. In the front end this allows the user to access a few different APIS
N/A
[{
"productName": "Insulin",
"health": null,
"sold": false,
"recalled": false,
"misc": {
"name": "Expensive Insulin"
},
"custodian": "OU=Store, O=PartyD, L=40.73/-74/New York, C=US",
"trackingID": "53116d75-e884-4d21-bbd8-057a144a30c5",
"timestamp": 1552583510960,
"containerID": "17219ad9-3e8b-4c79-ab55-79f6ada4a2d6",
"linearId": {
"externalId": null,
"id": "af9efb7f-d13b-4b68-a10b-e680b5d2b2b0"
},
"participants": [
"OU=Carrier, O=PartyB, L=51.50/-0.13/London, C=US",
"OU=Warehouse, O=PartyC, L=42.36/-71.06/Boston, C=US",
"OU=Store, O=PartyD, L=40.73/-74/New York, C=US",
"OU=Manufacturer, O=PartyA, L=47.38/8.54/Zurich, C=CH"
]
}]
This gets back a list of all products available to node
N/A
{
"productName": "Insulin",
"health": null,
"sold": false,
"recalled": false,
"misc": {
"name": "Expensive Insulin"
},
"custodian": "OU=Store, O=PartyD, L=40.73/-74/New York, C=US",
"trackingID": "53116d75-e884-4d21-bbd8-057a144a30c5",
"timestamp": 1552583510960,
"containerID": "17219ad9-3e8b-4c79-ab55-79f6ada4a2d6",
"linearId": {
"externalId": null,
"id": "af9efb7f-d13b-4b68-a10b-e680b5d2b2b0"
},
"participants": [
"OU=Carrier, O=PartyB, L=51.50/-0.13/London, C=US",
"OU=Warehouse, O=PartyC, L=42.36/-71.06/Boston, C=US",
"OU=Store, O=PartyD, L=40.73/-74/New York, C=US",
"OU=Manufacturer, O=PartyA, L=47.38/8.54/Zurich, C=CH"
]
}
This gets back the single product with tracking id from url param
N/A
{
"productName":"Dextrose",
"misc": {"name":"Expensive Dextrose"},
"trackingID": "0d15d7b8-caaa-468d-8b83-aae049b40f46",
"counterparties": ["PartyB","PartyC","PartyD"]
}
{
"generatedID": "0d15d7b8-caaa-468d-8b83-aae049b40f46"
}
This gets adds the product to the ledger and returns the trackingID back. It also send the copy to all other counterparties allowed to view the product and handle it
This data is parse from a QR code on the front end. The misc field is customizable and doesnt need anything or can be a mapping of any key to any value. Used to store other metadata.
"0d15d7b8-caaa-468d-8b83-aae049b40f46"
This is used to update custodian to node hitting the endpoint
N/A
[{
"productName": "Insulin",
"health": null,
"sold": false,
"recalled": false,
"misc": {
"name": "Expensive Insulin"
},
"custodian": "OU=Store, O=PartyD, L=40.73/-74/New York, C=US",
"trackingID": "53116d75-e884-4d21-bbd8-057a144a30c5",
"timestamp": 1552583510960,
"containerID": "",
"linearId": {
"externalId": null,
"id": "af9efb7f-d13b-4b68-a10b-e680b5d2b2b0"
},
"participants": [
"OU=Carrier, O=PartyB, L=51.50/-0.13/London, C=US",
"OU=Warehouse, O=PartyC, L=42.36/-71.06/Boston, C=US",
"OU=Store, O=PartyD, L=40.73/-74/New York, C=US",
"OU=Manufacturer, O=PartyA, L=47.38/8.54/Zurich, C=CH"
]
}]
This gets back a list of all products available to node which are containerless
N/A
[{
"health": null,
"sold": false,
"recalled": false,
"misc": {
"name": "Pharma Insulin container"
},
"custodian": "OU=Store, O=PartyD, L=40.73/-74/New York, C=US",
"trackingID": "17219ad9-3e8b-4c79-ab55-79f6ada4a2d6",
"timestamp": 1552583510960,
"containerID": null,
"contents": [
"53116d75-e884-4d21-bbd8-057a144a30c5",
"0d15d7b8-caaa-468d-8b83-aae049b40f46"
],
"linearId": {
"externalId": null,
"id": "2059484c-0c3b-43a7-9604-4a61d3039639"
},
"participants": [
"OU=Carrier, O=PartyB, L=51.50/-0.13/London, C=US",
"OU=Warehouse, O=PartyC, L=42.36/-71.06/Boston, C=US",
"OU=Store, O=PartyD, L=40.73/-74/New York, C=US",
"OU=Manufacturer, O=PartyA, L=47.38/8.54/Zurich, C=CH"
]
}]
This gets back a list of all containers available to node
N/A
{
"misc": {"name": "Pharma Insulin container"},
"trackingID": "17219ad9-3e8b-4c79-ab55-79f6ada4a2d6",
"counterparties": ["PartyB","PartyC","PartyD"]
}
{
"generatedID": "17219ad9-3e8b-4c79-ab55-79f6ada4a2d6"
}
This gets adds the container to the ledger and returns the trackingID back. It also send the copy to all other counterparties allowed to view the container and handle it.
This data is parse from a QR code on the front end. misc field is customizable and doesnt need anything or can be a mapping of any key to any value. Used to store other metadata.
{
"health": null,
"sold": false,
"recalled": false,
"misc": {
"name": "Pharma Insulin container"
},
"custodian": "OU=Store, O=PartyD, L=40.73/-74/New York, C=US",
"trackingID": "17219ad9-3e8b-4c79-ab55-79f6ada4a2d6",
"timestamp": 1552583510960,
"containerID": null,
"contents": [
"53116d75-e884-4d21-bbd8-057a144a30c5",
"0d15d7b8-caaa-468d-8b83-aae049b40f46"
],
"linearId": {
"externalId": null,
"id": "2059484c-0c3b-43a7-9604-4a61d3039639"
},
"participants": [
"OU=Carrier, O=PartyB, L=51.50/-0.13/London, C=US",
"OU=Warehouse, O=PartyC, L=42.36/-71.06/Boston, C=US",
"OU=Store, O=PartyD, L=40.73/-74/New York, C=US",
"OU=Manufacturer, O=PartyA, L=47.38/8.54/Zurich, C=CH"
]
}
This gets back the container with the id passed in the url param
N/A
"17219ad9-3e8b-4c79-ab55-79f6ada4a2d6"
This is used to update custodian to node hitting the endpoint
N/A
{
"contents":"{productTrackingID}"
}
"{containerTrackingID}"
This is used to add a product to a container
Currently only works one at a time but can be modified (should be) to allow multiple
{
"contents":"{productTrackingID}"
}
"{containerTrackingID}"
This is used to remove a product from a container
Currently only works one at a time but can be modified (should be) to allow multiple
Content type
Image
Digest
Size
28.4 MB
Last updated
over 5 years ago
docker pull hyperledgerlabs/supplychain_corda:express_app_0.9.0.0