Fabric with Besu
We will demonstrate asset exchange of a bond in Fabric network1
with 10 BobERC20
tokens on Besu network2
.
For Fabric commands, run from weaver/samples/fabric/fabric-cli
folder, and for Besu commands, run from weaver/samples/besu/besu-cli
folder, in your clone of the Cacti repository. Here Alice
and Bob
in Fabric network1
correspond to account 1
and account 2
in Besu network2
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. |
- From
fabric-cli
, generate secret-hash pair using following command (prints hash in base64): - Run the following to verify the status of the bond assets owned by
alice
andbob
in the Fabric networknetwork1
fromweaver/samples/fabric/fabric-cli
folder: - Run the following in
besu-cli
, to verify the status of the assets owned byAlice
andBob
in the Besu networknetwork2
: - Run the following to trigger
alice
lockingbond01:a03
forbob
innetwork1
for 60 mins: - Run the following to verify
alice
's lock: -
Run the following to trigger
bob
locking10
units ofBobERC20
tokens foralice
innetwork2
for 30 mins:Note the./bin/besu-cli asset lock --network=network2 --sender_account=2 --recipient_account=1 --amount=10 --timeout=1800 --hash_base64=ivHErp1x4bJDKuRo6L5bApO/DdoyD/dG0mAZrzLZEIs=
contract-id
printed as output in above command. The output line containingcontract-id
(text in base64 afterLock contract ID:
) would like this: Let's refer it<contract-id-2>
for this demonstration. -
Run the following to verify
bob
's lock: - Run the following to trigger
alice
's claim for10
units ofBobERC20
tokens locked bybob
innetwork2
: - Run the following to trigger
bob
's claim forbond01:a03
locked byalice
innetwork1
: - Run the following to verify the status of the bond assets owned by
alice
andbob
in the Fabric networknetwork1
fromweaver/samples/fabric/fabric-cli
folder: - Run the following in
besu-cli
, to verify the status of the assets owned byAlice
andBob
in the Besu networknetwork2
:
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
alice
wants to unlock the bond asset, run the following to triggeralice
's re-claim forbond01:a03
locked innetwork1
: - If
bob
wants to unlock the token asset, run the following to triggerbob
's re-claim for50 BobERC20
tokens locked innetwork2
: