There are couple ways to go about creating decentralized application that runs on the Hyperledger Fabric blockchain network. Either creating application natively using the Golang chaincode or using the highly recommended Hyperledger Composer framework.
Before proceeding, be sure to check out How to setup Hyperledger Fabric and Composer to prepare your environment.
Hyperledger Composer essentially speeds up app development time significantly, by exposing a RESTful API that interacts with the Fabric blockchain, however it does abstract out most of the interesting stuff that is awesome about the underlying Fabric blockchain technology, for instance, the installation and instantiation of channels and joining of peers to channels, building and deploying the chaincode and how applications interacts with the network natively by querying and updating the shared ledger.
This post uses the Hyperledger Composer framework to help accelerate the development of the TNN demo application.
Here is a simple description of the TNN demo application. It represents a network of users (Participants) that either produces or consumes video news clips (Assets). Rewards and reputation points are transacted between producers and consumers of published clips.
Now, lets dive (and delve) into the steps in creating the TNN decentralized application. Sample source code is provided in the resource section (clone or fork as you wish). I pretty much followed the the developer tutorial for creating the Hyperledger Composer solution.
Open and inspect the content of the file, models/sample.cto, this is the schema that defines the participants, the assets and transaction in the network. This file is written with the Composer modeling language that defines the relationships between defined assets and participants and the Transaction mechanism in which participants interacts with assets.
Open the access control file, permissions.acl. This file list out the different permissions between participants and assets. This is where the rules and privacy configurations are defined.
That is it in terms of code base. Though you may choose to wire up a unit test, that is outside the scope of this post.
Follow and answer the onscreen input request. Here is how mine looked after entering all requested info. By default, the connection profile name is hlfv1, and the network identifier is news-network, the Fabric username and password is admin and adminpw respectively.
If all goes well, you should see the Web Server URL and the REST API. The API uses the LoopBack API explorer.
Web server listening at: http://localhost:3000
Browse your REST API at http://localhost:3000/explorer
Browse around and explore the REST API. From the onset, you should notice the different endpoints, especially that of the NewsClip and the User endpoints. You can test out a simple query within the explorer.
Congratulations! Check the resource section for additional information and links to get you started.