top of page
s3-news-tmp-980-blockchain-2x1-940-1.png

Hyperledger

Implementation of Tuna Fishing Supplychain 

context
My Mentor : Anubhav Chaturvedi
  • LinkedIn
  • LinkedIn
Dlithe

What is Hyperledger?

Hyperledger is the umbrella open source project that the Linux Foundation has created and hosted since 2015. It aims at advancing and promoting cross-industry blockchain technologies to ensure accountability, transparency, and trust among business partners. As a result, Hyperledger makes business network and transactions more efficient.

Difference between Distributed Ledger & Blockchain

The most important difference to remember is that blockchain is just one type of distributed ledger. Although blockchain is a sequence of blocks distributed ledgers do not require such a chain. Furthermore, distributed ledgers do not need proof of work and offer theoretically – better scaling options

distributed-ledger-technology.png

Components of Hyperledger Frameworks

Hyperledger business blockchain frameworks are used to build enterprise blockchains for a consortium of organizations. They are different than public ledgers like the Bitcoin blockchain and Ethereum. The Hyperledger frameworks include:

  • An append-only distributed ledger

  • A consensus algorithm for agreeing to changes in the ledger

  • Privacy of transactions through permissioned access

  • Smart contracts to process transaction requests.

crypto_is_easy.jpeg

Technical Dependencies

Install cURL

$ sudo apt install curl

cURL is a tool to transfer data from or to a server, using one of the supported protocols. The name is a play on ‘Client for URLs’, originally with URL spelled in uppercase to make it obvious it deals with URLs.

Docker

docker --version && docker-compose --version

Docker is a tool designed to make it easier to create, deploy, and run applications by using containers. Containers allow a developer to package up an application with all of the parts it needs, such as libraries and other dependencies, and ship it all out as one package. The isolation and security allow you to run many containers simultaneously on a given host. You can even run Docker containers within host machines that are actually virtual machines!

Picture1.png
478yoo.jpg

Node.js & npm

node — version && npm — version

What is Node.js?

  • Node.js is an open source server environment

  • Node.js is free

  • Node.js runs on various platforms (Windows, Linux, Unix, Mac OS X, etc.)

  • Node.js uses JavaScript on the server

​

What is npm?

  • NPM is a package manager for Node.js packages, or modules if you like.

  • www.npmjs.com hosts thousands of free packages to download and use.

  • The NPM program is installed on your computer when you install Node.js

  • NPM is already ready to run on your computer!

GO

Go is an open source programming language that makes it easy to build simple, reliable, and efficient software. Go is created at Google in 2009 by Robert Griesemer, Rob Pike, and Ken Thompson.

47904f.jpg

Tuna Fishing Supplychain

Problem Context:

our goal is to eliminate illegal, unreported, and unregulated fishing. We will use Hyperledger Fabric to bring transparency and clarity to a real-world example: the supply chain of tuna fishing.

We will be describing how tuna fishing can be improved, starting from the source, fisherman Sarah, and the process by which her tuna ends up at Miriam’s restaurant. In between, we’ll have other parties involved, such as the regulator who verify the validity of the data and the sustainability of the tuna catches.

478rci.jpg

What is Hyperledger Fabric Chaincode ?

In Hyperledger Fabric, chaincode is the ‘smart contract’ that runs on the peers and creates transactions. More broadly, it enables users to create transactions in the Hyperledger 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-manage 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.

Applications interact with the blockchain ledger through the chaincode. Therefore, the chaincode needs to be installed on every peer that will endorse a transaction and instantiated on the channel.

1_0HyKsOag1W68z5aJOahcBA.gif

Quick High Level Overview:

​

Peer can be part of one or more channel

 

Every channel has a separate ledger

 

Every Channel has one or more chain codes

 

Every Chain code has a different endorsement policy

 

Chaincode must be part of a channel. As the ledger is part of a channel. One channel can have as many chaincodes as possible.

 

Chaincode must be installed in each peer that is part of the channel and instantiated.

 

When a Chaincode gets instantiated a policy (endorsing) has to be defined. [consensus: before a transaction can be recorded in the ledger only if a rule is met]

Stakeholders

  • Sarah is the fisherman who sustainably and legally catches tuna.

  • Regulators verify that the tuna has been legally and sustainably caught.

  • Miriam is a restaurant owner who will serve as the end user, in this situation.

  • Carl is another restaurant owner fisherman Sarah can sell tuna to.

0_1SZ3MPzINqzfg1p6.png
0_1SZ3MPzINqzfg1p6.png
0_EG1YQtXr1nGCzIFJ.png

Here are the four example attributes of tuna fish that we will be recording on the ledger:

  • Vessel (string)

  • Location (string)

  • Date and Time (datetime)

  • Holder (string)

We create a Tuna Structure that has four properties. Structure tags are used by the encoding/json library

type Tuna struct {
Vessel string ‘json:”vessel”’
Datetime string ‘json:”datetime”’
Location string ‘json:”location”’
Holder string ‘json:”holder”’
}

Chain Code: Invoke Method

As described earlier, the Invoke method is the one which gets called when a transaction is proposed by a client application. Within this method, we have three different types of transactions — recordTuna, queryTuna, and changeTunaHolder, which we will look at a little later.

As a reminder, Sarah, the fisherman, will invoke the recordTuna when she catches each tuna.

0_U6RQ-BEGc8KabOAY.png

Change TunaHolder can be invoked by Miriam, the restaurateur, when she confirms receiving and passing on a particular tuna fish as it passes through the supply chain. queryTuna can be invoked by Miriam, the restaurateur, to view the state of a particular tuna.

0_OHJBvHlTr4ZeySPx.png

Regulators will invoke queryTuna and queryAllTuna based on their need to verify and check for sustainability of the supply chain

0_gt3DGXyDQYV0Nh00.png
0_k87neICmJt3Ft4sk.jpg

Congrats~you have gone through all the theoretical concepts of the Hyper Ledger model. Feel bored?! Here’s a real case to get your hands dirty!

CONTACT ME

Joyston Menezes

computer science engineer

​

Phone:

+91 9480966920

​

Email:

joystonmj7@gmail.com

​

  • Black LinkedIn Icon
  • Black Facebook Icon
  • Black Twitter Icon
  • Black Instagram Icon

Thanks for submitting!

© 2020 All Right reserved developed by Joyston Menezes

bottom of page