The following steps show how to setup Firefly MTLS Data Exchange for two organizations named org-a and org-b running on localhost.
org-a will use port 3000 for API and port 3001 for P2P. org-b will use port 4000 for API and port 4001 for P2P. Each organization will have its own private key and self-signed certificate.
Setup org-a
Environment variables
Open a command line window and set the following environment variables, assigning an appropriate location to DATA_DIRECTORY. This is where configuration and certificate files will reside:
The API key will be set to xxxxx (this is optional)
There is one peer named org-b whose P2P endpoint is https://localhost:4001
Note: the property p2p.endpoint can optionally be used to specify a front facing endpoint.
If this property is not provided, the p2p endpoint will be calculated as p2p.hostname:p2p.port
This will generate files key.pem and cert.pem. Notice that the common name is localhost while the organization name is org-a.
Setup org-b
Environment variables
Open a second command line window and set the following environment variables, assigning an appropriate location to DATA_DIRECTORY. This is where configuration and certificate files will reside:
The API key will be set to xxxxx (this is optional)
There is one peer named org-a whose P2P endpoint is https://localhost:3001
Note: the property p2p.endpoint can optionally be used to specify a front facing endpoint.
If this property is not provided, the p2p endpoint will be calculated as p2p.hostname:p2p.port
Firefly MTLS Data Exchange
The following steps show how to setup Firefly MTLS Data Exchange for two organizations named
org-aandorg-brunning onlocalhost.org-awill use port3000for API and port3001for P2P.org-bwill use port4000for API and port4001for P2P. Each organization will have its own private key and self-signed certificate.Setup org-a
Environment variables
Open a command line window and set the following environment variables, assigning an appropriate location to
DATA_DIRECTORY. This is where configuration and certificate files will reside:Configuration file
Create
config.jsonin the data directory and set its content to:Based on this configuration:
xxxxx(this is optional)org-bwhose P2P endpoint ishttps://localhost:4001Note: the property
p2p.endpointcan optionally be used to specify a front facing endpoint. If this property is not provided, the p2p endpoint will be calculated asp2p.hostname:p2p.portGenerate certificate
In the data directory, run the following command:
This will generate files
key.pemandcert.pem. Notice that the common name islocalhostwhile the organization name isorg-a.Setup org-b
Environment variables
Open a second command line window and set the following environment variables, assigning an appropriate location to
DATA_DIRECTORY. This is where configuration and certificate files will reside:Configuration file
Based on this configuration:
xxxxx(this is optional)org-awhose P2P endpoint ishttps://localhost:3001Note: the property
p2p.endpointcan optionally be used to specify a front facing endpoint. If this property is not provided, the p2p endpoint will be calculated asp2p.hostname:p2p.portGenerate certificate
This will generate files
key.pemandcert.pem. Notice that the common name islocalhostwhile the organization name isorg-b.Copy certificates
/org-a/cert.pemto/org-b/peer-certs/org-a.pem./org-b/cert.pemto/org-a/peer-certs/org-b.pem.This will make it possible for the organizations to establish MTLS communications with each other.
Build and run the processes
npm run build.org-arunnpm startorg-brunnpm startAccess the API Swagger
http://localhost:3000http://localhost:4000WebSocket Events
Alternative setup using CA
Generate CA key and cert:
Generate
org-akey:Generate
org-aCSR:Create signed certificate using CSR, CA
Generate
org-bkey:Generate
org-bCSR:Create signed certificate using CSR, CA