********************************************************************| Hyperledger Composer Playground - Testing the business network - Video Transcript (English) ### BEGIN ### Hyperledger Composer Playground Or Playground for short Is an environment that lets you quickly model, and test your Blockchain business networks. In this video I'll show you how to test your business network using Composer Playground. Here's what you'll see: * Create a business network using the perishable-network template in Playground * Tour the business network model * Instantiate the model * And test the business network in Playground This video accompanies Part 1 of my Hyperledger Composer Basics tutorial series, which you can find only at IBM Developer. You'll find a link to the series in the video description. Let's get started. Make sure playground is running. Now open a web browser, and navigate to localhost, port 8080. From the Playground Welcome screen, click the Let's Blockchain button to get started. Select Deploy a new business network. The wizard comes up. Scroll down until you see the perishable-network template, and select it. Call the new netork perishable-network and then click Deploy. When the admin ID card displays, click Connect now. To open any model file, select it and it opens in the editor window. Click on the model file: perishable.cto At the top of the model file there are two enumerated types that define product types and shipment status. This is followed by an abstract transaction called ShipmentTransaction that contains a reference to an asset called Shipment. This is followed by a concrete transaction called TemperatureReading that extends ShipmentTransaction. And ShipmentReceived, which also extends ShipmentTransaction. Next is the Shipment asset that has a number of properties defined on it. Followed by the Contract asset. And the Address concept. Next up are the Participants, starting with an abstract Participant called Business. And it has three participant subtypes: * Grower * Shipper, and * Importer Finally there is the SetupDemo transaction, which you'll use to instantiate the model and populate the asset and participant registries. Next up is the JavaScript code, which resides in logic.js When you model a transaction like ShipmentReceived, you must provide its chaincode, or business logic. That goes in this file. Here is the business logic for when a shipment is received. And here is the business logic for recording a temperature sensor reading. And finally, the JavaScript code for setting up the demo. Click on the Test tab. Notice you see the constituents of the model on the left-hand side. The setupDemo function is used to populate the registries. To execute it click on Submit Transaction. Make sure SetupDemo appears in the Transaction Type drop-down. And click Submit, and the transaction runs. Click on Grower and you see the Grower instance. Same for Importer, Shipper. As well as for the Contract and Shipment assets. Let's submit four temperature reading transactions: 5, 7, 1, and 4 degrees Celcius. Then submit the ShipmentReceived transaction. Click Submit Transaction. Make sure TemperatureReading is in the Transaction Type drop-down. Enter the temperature reading to record in the Blockchain. And the Shipment ID (SHIP_001). Click Submit and the transaction runs, and records the temperature reading as a transaction in the Blockchain. Repeat that for the remaining readings. To test receipt of the shipment, invoke the ShipmentReceived transaction. Enter the Shipment ID (SHIP_001) Every transaction that you execute in Playground is recorded in the blockchain. There are the four temperature reading transactions. And the ShipmentReceived transaction. That was a look at how to test a Blockchain business network using Playground. Be sure to check out the Hyperledger Composer Tutorial series, available only at IBM Developer. You'll find a link in the video description. I hope you enjoyed the video. I'm Steve Perry. Thanks for watching! I'll see you next time. ### END ###