Data Sharing
This document lists sample ways in which you can exercise the data-sharing interoperation protocol on the test network launched earlier.
Once the networks, relays, and drivers have been launched, and the ledgers bootstrapped, you can trigger four different interoperation flows corresponding to distinct data-sharing combinations as follows:
- Corda to Corda: Either Corda network requests state and proof from another Corda network
- Corda to Fabric: The Corda network requests state and proof from either Fabric network
- Fabric to Corda: Either Fabric network requests state and proof from the Corda network
- Fabric to Fabric: One Fabric network requests state and proof from another Fabric network
We assume that one of the following chaincodes have been deployed in either Fabric network you are testing with:
simplestatesimplestatewithacl
Corda to Corda¶
To test the scenario where Corda_Network requests the value of the state (key) H from Corda_Network2 and writes the value to a key H in its local state, do the following:
- (Make sure the following are running:
Corda_Network, relay, and driver;Corda_Network2, relay, and driver) - Navigate to the
weaver/samples/corda/corda-simple-applicationfolder in your clone of the Cacti repository. -
Run the following:
- If Relays and Drivers are deployed in the host machine:
- Without TLS:
- With TLS:
RELAY_TLS=true RELAY_TLSCA_CERT_PATHS=../../../core/relay/credentials/fabric_ca_cert.pem NETWORK_NAME=Corda_Network CORDA_PORT=10006 ./clients/build/install/clients/bin/clients request-state --wkey=H localhost:9081 localhost:9082/Corda_Network2/localhost:30006#com.cordaSimpleApplication.flow.GetStateByKey:H
- If Relays and Drivers are deployed in Docker containers:
- Without TLS:
- With TLS:
RELAY_TLS=true RELAY_TLSCA_CERT_PATHS=../../../core/relay/credentials/docker/ca-cert.pem NETWORK_NAME=Corda_Network CORDA_PORT=10006 ./clients/build/install/clients/bin/clients request-state --wkey=H localhost:9081 relay-corda2:9082/Corda_Network2/corda_network2_partya_1:10003#com.cordaSimpleApplication.flow.GetStateByKey:H
- If Relays and Drivers are deployed in the host machine:
-
Query the value of the requested state using key
HinCorda_Networkby running the following command:
To test the scenario where Corda_Network2 requests the value of the state (key) C from Corda_Network and writes the value to a key C in its local state, do the following:
- (Make sure the following are running:
Corda_Network, relay, and driver;Corda_Network2, relay, and driver) - Navigate to the
weaver/samples/corda/corda-simple-applicationfolder in your clone of the Cacti repository. -
Run the following:
- If Relays and Drivers are deployed in the host machine:
- Without TLS:
- With TLS:
RELAY_TLS=true RELAY_TLSCA_CERT_PATHS=../../../core/relay/credentials/fabric_ca_cert.pem NETWORK_NAME=Corda_Network2 CORDA_PORT=30006 ./clients/build/install/clients/bin/clients request-state --wkey=C localhost:9082 localhost:9081/Corda_Network/localhost:10006#com.cordaSimpleApplication.flow.GetStateByKey:C
- If Relays and Drivers are deployed in Docker containers:
- Without TLS:
- With TLS:
RELAY_TLS=true RELAY_TLSCA_CERT_PATHS=../../../core/relay/credentials/docker/ca-cert.pem NETWORK_NAME=Corda_Network2 CORDA_PORT=30006 ./clients/build/install/clients/bin/clients request-state --wkey=C localhost:9082 relay-corda:9081/Corda_Network/corda_partya_1:10003#com.cordaSimpleApplication.flow.GetStateByKey:C
- If Relays and Drivers are deployed in the host machine:
-
Query the value of the requested state, using the key
CinCorda_Networkby running the following command:
Corda to Fabric¶
To test the scenario where Corda_Network requests the value of the state (key) a from network1 and writes the value to a key a in its local state, do the following:
- (Make sure the following are running: Corda network, relay, and driver; Fabric
network1, relay, and driver) - Navigate to the
weaver/samples/corda/corda-simple-applicationfolder in your clone of the Cacti repository. -
Run the following:
- If Relays and Drivers are deployed in the host machine:
- Without TLS:
- With TLS:
- If Relays and Drivers are deployed in Docker containers:
- Without TLS:
- With TLS:
- If Relays and Drivers are deployed in the host machine:
-
Query the value of the requested state (key)
ainCorda_Networkusing the following:
To test the scenario where Corda_Network requests the value of the state (key) Arcturus from network2 and writes the value to a key Arcturus in its local state, do the following:
- (Make sure the following are running: Corda network, relay, and driver; Fabric
network2, relay, and driver) - Navigate to the
weaver/samples/corda/corda-simple-applicationfolder in your clone of the Cacti repository. -
Run the following:
- If Relays and Drivers are deployed in the host machine:
- Without TLS:
- With TLS:
- If Relays and Drivers are deployed in Docker containers:
- Without TLS:
- With TLS:
- If Relays and Drivers are deployed in the host machine:
-
Query the value of the requested state (key)
ArcturusinCorda_Networkusing the following:
| Notes |
|---|
You can test the above data transfer scenario with Corda_Network2 instead of Corda_Network by changing the following in the request-state or get-state command:
|
Fabric to Corda¶
To test the scenario where network1 requests the value of the state (key) H from Corda_Network and writes the value to a key H in its local state, do the following:
- (Make sure the following are running: Corda network, relay, and driver; Fabric
network1, relay, and driver) - Navigate to the
weaver/samples/fabric/fabric-cli(for the Node.js version) or theweaver/samples/fabric/go-cli(for the Golang version) folder in your clone of the Cacti repository. - (Make sure you have configured
fabric-clias per earlier instructions) - Edit
chaincode.json: in thesimplestate:Create:argsattribute, replace the argument"a"with"H"(this specifies the key to which the data from the remote view is to be written into); i.e.,: with -
Run the following:
- If Relays and Drivers are deployed in the host machine:
- Without TLS:
- With TLS:
- If Relays and Drivers are deployed in Docker containers:
- Without TLS:
- With TLS:
- If Relays and Drivers are deployed in the host machine:
-
Query the value of the requested state (key)
Hinnetwork1using the following:
To test the scenario where network2 requests the value of the state (key) H from Corda_Network and writes the value to a key H in its local state, do the following:
- (Make sure the following are running: Corda network, relay, and driver; Fabric
network2, relay, and driver) - Navigate to the
weaver/samples/fabric/fabric-cli(for the Node.js version) or theweaver/samples/fabric/go-cli(for the Golang version) folder in your clone of the Cacti repository. - (Make sure you have configured
fabric-clias per earlier instructions) - Edit
chaincode.json: in thesimplestate:Create:argsattribute, replace the argument"a"with"H"(this specifies the key to which the data from the remote view is to be written into); i.e.,: with -
Run the following:
- If Relays and Drivers are deployed in the host machine:
- Without TLS:
- With TLS:
- If Relays and Drivers are deployed in Docker containers:
- Without TLS:
- With TLS:
- If Relays and Drivers are deployed in the host machine:
-
Query the value of the requested state (key)
Hinnetwork2using the following:
| Notes |
|---|
You can test the above data transfer scenario with Corda_Network2 instead of Corda_Network by changing the following in the view address (last parameter in the interop command):
|
Fabric to Fabric¶
To test the scenario where network1 requests the value of the state (key) Arcturus from network2 and writes the value to a key Arcturus in its local state, do the following:
- (Make sure the following are running: Fabric
network1, relay, and driver; Fabricnetwork2, relay, and driver) - Navigate to the
weaver/samples/fabric/fabric-cli(for the Node.js version) or theweaver/samples/fabric/go-cli(for the Golang version) folder in your clone of the Cacti repository. - (Make sure you have configured
fabric-clias per earlier instructions) - Edit
chaincode.json: in thesimplestate:Create:argsattribute, replace the argument"a"with"Arcturus"(this specifies the key to which the data from the remote view is to be written into); i.e.,: with - Run the following:
- If Relays and Drivers are deployed in the host machine:
- Without TLS:
- With TLS:
- If Relays and Drivers are deployed in Docker containers:
- Without TLS:
- With TLS:
- If Relays and Drivers are deployed in the host machine:
| Notes |
|---|
If you wish to enable end-to-end confidentiality for this data sharing session, add the --e2e-confidentiality=true switch to any of the above commands. For example: ./bin/fabric-cli interop --local-network=network1 --requesting-org=Org1MSP --e2e-confidentiality=true localhost:9083/network2/mychannel:simplestate:Read:Arcturus |
- Query the value of the requested state (key)
Arcturusinnetwork1using the following:
To test the scenario where network2 requests the value of the state (key) a from network1 and writes the value to a key a in its local state, do the following:
- (Make sure the following are running: Fabric
network1, relay, and driver; Fabricnetwork2, relay, and driver) - Navigate to the
weaver/samples/fabric/fabric-cli(for the Node.js version) or theweaver/samples/fabric/go-cli(for the Golang version) folder in your clone of the Cacti repository. - (Make sure you have configured
fabric-clias per earlier instructions) - (There is no need to edit
chaincode.jsonto change the key as the default argument"a"is what we intend to use in this data sharing use scenario.) - Run the following:
- If Relays and Drivers are deployed in the host machine:
- Without TLS:
- With TLS:
- If Relays and Drivers are deployed in Docker containers:
- Without TLS:
- With TLS:
- If Relays and Drivers are deployed in the host machine:
| Notes |
|---|
If you wish to enable end-to-end confidentiality for this data sharing session, add the --e2e-confidentiality=true switch to any of the above commands. For example: ./bin/fabric-cli interop --local-network=network2 --requesting-org=Org1MSP --e2e-confidentiality=true localhost:9080/network1/mychannel:simplestate:Read:a |
- Query the value of the requested state (key)
ainnetwork2using the following: