********************************************************************| Hyperledger Composer Playground - Video Transcript ### BEGIN ### Hyperledger Composer Playground Or Playground for short Is an environment that lets you quickly model, and test your Blockchain business networks. Blockchain is a complex technology, and Playground makes it easier for you to quickly get up and running. In this video I'll show you how to run Playground. Here's what you'll see: * Docker installation instructions from docs.docker.com * Start Playground in Docker * And run Playground in a web browser 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. From docs.docker.com, click on Get Docker. Find the installation link specific to your platform. And follow the instructions. From a Terminal window on Mac, or command prompt on Linux, start the Hyperledger Composer Playground Docker image. COMMAND: docker run --name composer-playground --publish 8080:8080 hyperledger/composer-playground This command tells Docker to run the image and assign the name composer-playground to the container. Publish port 8080 in the container as port 8080 on the host machine so you can access the Playground UI through a browser. The last parameter is the name of the image to download: hyperledger/composer-playground If this is the first time you're running playground the images are downloaded to your local Docker repository. Once the download is finished, the Playground container will start. Press Ctrl+C to stop the container. If you try to start the container again, Docker complains because the name is already used. You can pick a different name each time, or run COMMAND: docker rm --force composer-playground To remove the name. By default composer-playground runs in the foreground. But if you don't care about seeing the output on the console, you can run the composer-playground container in detached mode. SCREEN CAP: SHOW THE DETACH OPTION Just specify the --detach option when you start the container. To stop a detached container, use this command: COMMAND: docker stop composer-playground Open your web browser and go to: http://localhost:8080 And you'll see the Playground Welcome Screen. Click on the Let's Blockchain button to get started. Click on Deploy a new business network. A wizard opens and shows several templates to choose from. Choose the empty-business-network template, and call it "test-network" Scroll down and click the Deploy button to deploy the network to the Blockchain. An ID card for an admin user is created. Click on the Connect now link to connect to your new network. Once connected to the business network model definition, you are in the Define tab, where you'll define and work with the model for your business network. To add a file to the model, click the Add a file link Then choose the type of file you want to add, of which there are four: * Model files, where you model the assets, participants, transactions, and so forth, in your business model. * JavaScript files, which contain chain code * Query files * And Access Control files Choose Model File and click Add. The new model file opens in the editor window. Change the namespace to org.acme.myfirstmodel Add an asset, and call it Test. Give it an ID property of testId, of type String. And a String property called message. Next add a transaction called Hello, and give it a relationship to type Test. Then add a new JavaScript file, where the chaincode for the Hello transaction will reside. The @param annotation is required and tells Composer that this function expects a parameter of type org.acme.myfirstmodel.Hello. The @transaction annotation is also required and tells Composer that this JavaScript function is a chaincode transaction. The function itself is very simple: it prints the message property of the Test asset that's passed in to the console. Click Deploy changes to update the model. Now, click the Test tab to test the model. Before you can use the Test asset you have to instantiate it and store it in the Asset registry. Click Create New Asset, give it a testId of "TEST" and a message of "Playground". The instance is saved and stored in the asset registry. Now open the JavaScript console window so you can see the output. To invoke the Hello transaction, click Submit Transaction. Specify the ID of the Test asset to pass to it, which is TEST. And click Submit. And there's the message in the JavaScript console. Obviously, a real application would be far more complicated than this. But hopefully this gives you a taste of how to Test your model in Playground. That was a brief tour of Hyperledger Composer Playground. Hopefully you have a sense of just how easy it is to use. Be sure to check out my Hyperledger Composer Basics 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 ###