Fabric with Corda
We will demonstrate asset exchange of a bond in Fabric network1 with tokens on Corda_Network.
For Fabric commands, run from weaver/samples/fabric/fabric-cli folder, and for Corda commands, run from weaver/samples/corda/corda-simple-application folder, in your clone of the Cacti repository. Here Alice and Bob in Fabric network1 correspond to PartyA (CORDA_PORT=10006) and PartyB (CORDA_PORT=10009) in Corda_Network respectively. Following are the step-by-step asset exchange process:
| Notes |
|---|
The hash used in following steps can be replaced by any valid SHA256 hash. |
- Run the following to verify the status of the bond assets owned by
aliceandbobin the Fabric networknetwork1fromweaver/samples/fabric/fabric-clifolder: - Run the following to verify the status of the assets owned by
PartyAandPartyBin theCorda_Networkfromweaver/samples/corda/corda-simple-applicationfolder: - Generate Secret-Hash Pair using following command (prints hash in base64):
- Run the following to trigger
alicelockingbond01:a03forbobinnetwork1for 60 mins: - Run the following to verify
alice's lock: - Run the following to trigger
PartyBlocking50units of token typet1forPartyAinCorda_Networkfor 30 mins:Note theCORDA_PORT=10009 ./clients/build/install/clients/bin/clients lock-asset --fungible --hashBase64=ivHErp1x4bJDKuRo6L5bApO/DdoyD/dG0mAZrzLZEIs= --timeout=1800 --recipient="O=PartyA,L=London,C=GB" --param=t1:50contract-iddisplayed after successful execution of the command, will be used in next steps. The output containingcontract-idwould like this:contract-idis the alphanumeric text (with underscore and hyphens) afterb=within parenthesis. - Run the following to verify
PartyB's lock (can be verified by both parties): - Run the following to trigger
PartyA's claim for50units of token typet1locked byPartyBinCorda_Network:CORDA_PORT=10006 ./clients/build/install/clients/bin/clients claim-asset --secret=secrettext --contract-id=<contract-id>PartyBcan see its node's logs to get the revealed hash preimage, and use it to claim the bond in the Fabric network. - Run the following to trigger
bob's claim forbond01:a03locked byaliceinnetwork1: - Run the following to verify the status of the bond assets owned by
aliceandbobin the Fabric networknetwork1fromweaver/samples/fabric/fabric-clifolder: - Run the following to verify the status of the assets owned by
PartyAandPartyBin theCorda_Networkfromweaver/samples/corda/corda-simple-applicationfolder:
The above steps complete a successful asset exchange between Fabric and Corda networks. In addition to the above commands, following commands can be run if specified timeout has expired and the locked asset remains unclaimed.
- If
alicewants to unlock the bond asset, run the following to triggeralice's re-claim forbond01:a03locked innetwork1: - If
PartyBwants to unlock the token asset, run the following to trigger unlock fort1:50locked inCorda_Network: