How to write a Model File (.cto) for Hyperledger Composer
One of the first steps to building your blockchain is writing your model files. This is a fairly simple process. Luckily, Composer gives us a nice, easy-to-learn markup for creating such models. No fancy programming knowledge needed.. yet! I recommend using Visual Studio Code with the Hyperledger Composer extension for syntax highlighting (not required). 

Click here for the video tutorial

Step 1: Write a Namespace
In this example, I will be building a model file for a motel chain. This model will help the motel chain not double-book rooms and find vacant ones quickly for customers. Defining a namespace is easy. You can name it whatever you want, just don't do it twice!

Make sure to keep the filename and namespace the exact same (minus the ".cto"), as shown below:
[Image: attachment.php?aid=32]

Step 2: Defining our assets
Now it's time to define our assets. In this example, it will be for motel rooms.
[Image: attachment.php?aid=33]

Step 3: Save our model (.cto) file
Now save your model file as:

We're done!
You have now created your first Hyperledger Fabric model file. This model file can be found here.

Attached Files Thumbnail(s)