To use the network properly, we will create one participant for each class (Factory, Warehouse, Transporter, Store, and Consumer), generate their respective business cards, and import them into a Composer CLI Wallet:
- First, we will create the participants:
$ composer participant add -c admin@food-safety-b10407 -d '{"$class":"com.packtpublishing.businessnetwork.foodsafety.Consumer","identifier":"5","name":"Consumer"}'
Participant was added to participant registry.
Command succeeded
$ composer participant add -c admin@food-safety-b10407 -d '{"$class":"com.packtpublishing.businessnetwork.foodsafety.Store","identifier":"4","name":"Store"}'
Participant was added to participant registry.
Command succeeded
$ composer participant add -c admin@food-safety-b10407 -d '{"$class":"com.packtpublishing.businessnetwork.foodsafety.Transporter","identifier":"2","name":"Transporter"}'
Participant was added to participant registry.
Command succeeded
$ composer participant add -c admin@food-safety-b10407 -d '{"$class":"com.packtpublishing.businessnetwork.foodsafety.Warehouse","identifier":"3","name":"Warehouse"}'
Participant was added to participant registry.
Command succeeded
$ composer participant add -c admin@food-safety-b10407 -d '{"$class":"com.packtpublishing.businessnetwork.foodsafety.FoodFactory","identifier":"1","name":"Factory"}'
Participant was added to participant registry.
Command succeeded
- Then, we will issue an identity and import their respective business cards with the following command:
composer identity issue -c admin@food-safety-b10407 -f <name of the output file for the card> -u <participant name> -a <participant class# Participant id>
- Repeat this command for each participant: Transporter 1, Store 1, Warehouse 1, and Factory 1.
$ composer identity issue -c admin@food-safety-b10407 -f consumer.card -u "Consumer" -a "resource:com.packtpublishing.businessnetwork.foodsafety.Consumer#1"
Issue identity and create Network Card for: Consumer
√ Issuing identity. This may take a few seconds...
Successfully created business network card file to
Output file: consumer.card
Command succeeded
- Import each card into the Composer CLI wallet for each participant/card generated and check that all cards have been imported successfully:
$ composer card import -f consumer.card
Successfully imported business network card
Card file: consumer.card
Card name: Consumer 1@food-safety-b10407
Command succeeded
$ composer card list
The following Business Network Cards are available:
Connection Profile: hlfv1
┌──────────────────────────────────┬───────────────┬────────────────────┐
│ Card Name │ UserId │ Business Network │
├──────────────────────────────────┼───────────────┼────────────────────┤
│ Factory 1@food-safety-b10407 │ Factory │ food-safety-b10407 │
├──────────────────────────────────┼───────────────┼────────────────────┤
│ Warehouse 1@food-safety-b10407 │ Warehouse │ food-safety-b10407 │
├──────────────────────────────────┼───────────────┼────────────────────┤
│ Store 1@food-safety-b10407 │ Store │ food-safety-b10407 │
├──────────────────────────────────┼───────────────┼────────────────────┤
│ Consumer 1@food-safety-b10407 │ Consumer │ food-safety-b10407 │
├──────────────────────────────────┼───────────────┼────────────────────┤
│ Transporter 1@food-safety-b10407 │ Transporter │ food-safety-b10407 │
├──────────────────────────────────┼───────────────┼────────────────────┤
│ admin@food-safety-b10407 │ admin │ food-safety-b10407 │
├──────────────────────────────────┼───────────────┼────────────────────┤
│ PeerAdmin@hlfv1 │ PeerAdmin │ │
└──────────────────────────────────┴───────────────┴────────────────────┘
Issue composer card list --card <Card Name> to get details a specific card
Command succeeded