Hyperledger Fabric: The most complete

Kruk Matias
Coinmonks
Published in
4 min readDec 8, 2017

--

In this first of series about hyperledger projects, I want to start it up with the most complete, in my opinion. Fabric is a

“platform for distributed ledger solutions, underpinned by a modular architecture delivering high degrees of confidentiality, resiliency, flexibility and scalability. It is designed to support pluggable implementations of different components, and accommodate the complexity and intricacies that exist across the economic ecosystem.”

It was initially contributed by Digital Asset and IBM, as a result of the first hackathon. The code is available and there is a rich community and complete documentation.

I’m going to skip all the theoretical concepts based on the platform and give it a concept how to think a solution based on this technology. In this post I’m not going to show how to build a chaincode. It shows only how to build the logic in the webapp.

Basic structure for a fabric app

Technologies

This is the stack needed: cURL, Node.js, npm package manager, Go language, Docker, and Docker Compose.

Steps

$ git clone https://github.com/hyperledger/education.git

$ cd education/LFS171x/fabric-material/tuna-app

$ ./startFabric.sh

$ npm install

$ node registerAdmin.js

$ node registerUser.js

$ node server.js

Finally, browse localhost:8000

Structure of Application

Comments and suggestions

In web app: If you want to change the logic just add it in routes.js and controller.js. And the logic in src folder.

Glossary

MSP

The membership service provider, or MSP, is a component that defines the rules in which identities are validated, authenticated, and allowed access to a network. The MSP manages user IDs and authenticates clients who want to join the network. This includes providing credentials for these clients to propose transactions. The MSP makes use of a Certificate Authority, which is a pluggable interface that verifies and revokes user certificates upon confirmed identity.

Chaincode

It’s the ‘smart contract’ that runs on the peers and creates transactions. More broadly, it enables users to create transactions in the Fabric network’s shared ledger and update the world state of the assets.

Chaincode is programmable code, written in Go, and instantiated on a channel. Developers use chaincode to develop business contracts, asset definitions, and collectively-managed decentralized applications. The chaincode manages the ledger state through transactions invoked by applications. Assets are created and updated by a specific chaincode, and cannot be accessed by another chaincode…

In this case you can find the chaincode in ./education/LFS171x/fabric-material/chaincode/tuna-app/tuna-chaincode.go.

Ordering service

Transactions within a timeframe are sorted into a block and are committed in sequential order. In a blockchain network, transactions have to be written to the shared ledger in a consistent order. The order of transactions has to be established to ensure that the updates to the world state are valid when they are committed to the network. Unlike the Bitcoin blockchain, where ordering occurs through the solving of a cryptographic puzzle, or mining, Fabric allows the organizations running the network to choose the ordering mechanism that best suits that network.

Channels

Channels allow organizations to utilize the same network, while maintaining separation between multiple blockchains. Only the members of the channel on which the transaction was performed can see the specifics of the transaction. In other words, channels partition the network in order to allow transaction visibility for stakeholders only. This mechanism works by delegating transactions to different ledgers. Only the members of the channel are involved in consensus, while other members of the network do not see the transactions on the channel.

Get Best Software Deals Directly In Your Inbox

--

--