Module 7
Module 7
“
Hyperledger Blockchain.
The project aims to create an open-standard, public, decentralized public ledger based on the Blockchain technology
to advance world-wide business transactions processing in terms of cost-effectiveness, speed and traceability
On Feb 2, 2016, IBM committed the first 44K lines of code on GitHub.
• None
• Ether
Currency • Currency and tokens via • None
• Tokens via smart contracts
chaincode
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Goals of the Hyperledger
Where open-source teams build diverse approaches for business blockchain technology systems
</>
Creating enterprise- Providing neutral, Building technical Educating the public Promoting our
grade, open-source open and community- communities community of
distributed ledger driven infrastructures about the market communities
frameworks and code to develop blockchain opportunity for the
bases supported by and shared ledger blockchain technology taking a toolkit
technical and POCs, use cases, field approach with many
to support business business governance trials and platforms and
transactions deployments frameworks
Blockchain Network
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Hyperledger Frameworks & Tools
Infrastructure
Technical, legal, marketing and
organizational ecosystems that
accelerate open development and Cloud Foundry Node.js Hyperledger Open Container
commercial adoption Initiative
Frameworks
Meaningfully differentiated approaches
to business blockchain frameworks Hyperledger Hyperledger
Hyperledger Hyperledger
developed by a growing community of Sawtooth Burrow
Indy Iroha
communities
Tools
Typically built for one framework and,
through common license and community Hyperledger Hyperledger Hyperledger
of communities approach, ported to other Composer Explorer Cello
frameworks
“
algorithms for Hyperledger.
End User
End User
End User
• Enroll
ECert • Request ECert
Enrollment certificate
(ECert) is the long-term
identity of a participant on
the blockchain network. Invokes chaincode txn
(signed with ECert)
For example, a PaaS application using Node.js might have a web frontend user
Blockchain Logic
interface or a native mobile app with a backend model provided by a data
management service. The control logic may interact with one or more
chaincodes to process transactions on the blockchain. Chaincode Transactions
Frameworks
Meaningfully differentiated
Hyperledger Hyperledger Hyperledger Hyperledger Hyperledger
approaches to business blockchain
Indy Fabric Iroha Sawtooth Burrow
frameworks developed by a growing
community of communities
Tools
Typically built for one framework and, through common Hyperledger Hyperledger Hyperledger
license and community of communities approach, ported Composer Explorer Cello
to other frameworks
“
Hyperledger Iroha.
“
• Iroha is a distributed ledger project that was designed to be simple and easy to
incorporate into infrastructural projects requiring the distributed ledger
technology.
Sawtooth is written in Python and designed for use cases in many fields from IoT to Financials.
In Sawtooth, the data model and transaction language are implemented in a transaction family.
Sawtooth users are able to define their own custom “transaction family” with data models and
transaction languages tailored to their use cases.
Hyperledger Sawtooth supports creating and broadcasting events and allows applications to:
• Subscribe to events that occur in relation to the blockchain, such as a new block being
committed or switching to a new fork
• Subscribe to application specific events defined by a transaction family.
• Relay information about the execution of a transaction back to clients without storing that
data in state.
“
manage blockchain networks.
Designed to create a user-friendly web application, Hyperledger Blockchain Explorer can view, invoke,
deploy or query blocks, transactions and associated data, network information (name, status, list of
nodes, etc.), chain codes and transaction families, as well as any other relevant information stored in
the ledger.
“
permissions.
• It is a platform for distributed ledger solutions underpinned by a
modular architecture delivering high degrees of confidentiality,
resiliency, flexibility and scalability.
Key Features
• Channels for sharing confidential information
• Ordering Service delivers transactions consistently to peers in the network
• Endorsement policies for transactions
• CouchDB world state supports wide range of queries
Efficient processing
Chaincode functionality
Modular design
Ensures that only the intended participants can see the content, by
encrypting the content of each transaction
“
Components.
A Peer is a node on the network maintaining the state of the ledger and
managing chaincodes.
• A chaincode may be deployed on multiple channels; each instance is isolated within its channel.
• A chaincode may query another chaincode in other channels (ACL applied).
Member Services
• Default implementation of the Membership Provider
TCert
Root Certificate
Authority HSM
LDAP
Cluster DB Authenticate
Enroll ID, secretly
“
see how many more channels are required?
“
specifying members of the channel, ACL policies and anchor peers.
– The configuration becomes part of the genesis block of the channel.
– Then, notify members to join the channel (a peer may join multiple channels).
Endorsement Policy:
• “E0, E1 and E2 must sign”
• P3 and P4 are not part of the policy
Key:
Endorser
Ledger
Committer
Ordering Service
Application
Orderer
Fabric Endorsement
Smart Contract
(Chaincode) Policy
Key:
Endorser Ledger
Orderer Endorsement
Fabric Policy
Smart Contract
(Chaincode)
Key:
Endorser Ledger
Orderer Endorsement
Fabric Policy
Smart Contract
(Chaincode)
Key:
Endorser Ledger
Committer
Orderer
(Other applications)
Ordering Service
Fabric
Ordering Service
Fabric
Ordering Service
Fabric
“
Components.
• Hyperledger Composer allows us model our business network and integrate existing systems and
data with our blockchain applications.
• Applications use business centric APIs to invoke transactions that create, delete and update assets
and transfer them between participants.
• Assets, participants and transactions are recorded in the worlds state in registries.
• Model files describe the assets, participants, transactions and events that exist in a business
network.
• An expressive modeling language includes relationships, arrays and validation rules.
• Data is serialized as JSON and is fully validated by the Hyperledger Composer runtime.
• A business network definition is the set of the above for a given business network.
“
what purpose it serves.
“
applications with the existing business systems. You can use it to rapidly
develop use cases and deploy a blockchain solution in weeks rather than in
months. It allows you to model your business network and integrate existing
systems and data with your blockchain applications.
“
• Participants: buyers and homeowners
• Transactions: buying or selling houses and creating and closing listings
• Participants can have their access to transactions restricted based on their role as
either a buyer, seller or realtor.
• The realtor can then create an application to present buyers and sellers with a
simple user interface for viewing open listings and making offers.
• This business network could also be integrated with the existing inventory system,
adding new houses as assets and removing sold properties.
• Relevant other parties can be registered as participants; for example, a land
registry might interact with a buyer to transfer ownership of the land.
“
description. (You can also choose to base a new business network on an existing
template or import your own template.)
1. Click on “Deploy a New Business Network” under the “Web Profile” title to get
started.
2. The new business network needs a name; let's call it “new-network”.
3. Optionally, you can add a network description.
4. Next, we need to select a business network to base ours on, because we want to
build the network from scratch. Click on “empty-business-network”.
Next, let’s choose a Business Network Definition from the given options.
Choose empty-
business-network
“
we have selected an empty business network template, we need to
define our business network files.
The first step is to add a model file. Model files define assets, participants, transactions
and events in our business network.
This domain model defines a single asset type Commodity and single participant type Trader and a
single transaction type Trade that is used to modify the owner of a commodity.
/**
* Track the trade of a commodity from
Since the domain model has been defined now, one trader to another
we can define the transaction logic for the @param {org.acme.mynetwork.Trade} trade
business network. - the trade to be processed
@transaction */
• These functions are automatically function tradeCommodity(trade) {
executed when a transaction is submitted trade.commodity.owner =
for processing. trade.newOwner; return
getAssetRegistry('org.acme.mynetwork.C
• Click on the “Add a file” button om modity') .then(function
(assetRegistry)
• Choose “Script file” and click on “Add” { return
• Delete the lines of code in the script file and assetRegistry.update(trade.commodity)
replace it with the following code: ;
}); }
Access control files define access control rules for /** * Access control rules for
mynetwork */ rule Default {
business networks. (While you can have multiple
description: "Allow all
model or script files, you can only have one access
participants access to all
control file in any business network.) resources" participant: "ANY"
operation: ALL resource:
• Click on the “Add a file” button "org.acme.mynetwork.*" action:
• Choose “Access Control file” and click on “Add” ALLOW } rule SystemACL {
• Delete the lines of code in the access control file description: "System ACL to permit
and replace it with the code given on your right: all access" participant:
"org.hyperledger.composer.system.Pa
rticipant" operation: ALL resource:
"org.hyperledger.composer.system.**
Access control rules allow all participants to access all " action: ALLOW }
business network resources and all users to have system
access control privileges.
As we've created our model, script and access control files, we need to deploy and test our business
network.
• Click on “Update” to deploy our new model, script and access control files
Note: Before moving on, make sure that both participants exist in the Trader view!
Now that we have two Trader participants, we need something for them to trade. Creating an asset is very similar
to creating a participant. The Commodity we're creating will have an owner property indicating that it belongs to
the Trader with the trade ID, TRADER1.
• Choose the “Commodity” tab under “Assets” and click on “Create New Asset”
• Delete the asset data and replace it with the following:
{
"$class": "org.acme.mynetwork.Commodity", "tradingSymbol": "ABC",
"description": "Test commodity", "mainExchange": "Euronext",
"quantity": 72.297,
"owner": "resource:org.acme.mynetwork.Trader#TRADER1 "
}
{
"$class": "org.acme.mynetwork.Trade", "commodity":
"resource:org.acme.mynetwork.Commodity#ABC", "newOwner":
"resource:org.acme.mynetwork.Trader#TRADER2"
}
resource:org.acme.mynetwork.Trader#TRADER2
You can see that certain actions that we performed using the UI, like creating the Trader participants and the
Commodity asset, are recorded as transactions, even though they're not defined as transactions in our business
network model. These transactions are known as 'System Transactions’. They are common to all business
networks and are defined in the Hyperledger Composer Runtime.
A. Hyperledger Cello
B. Hyperledger Composer
C. Hyperledger Explorer
A. Hyperledger Cello
B. Hyperledger Composer
C. Hyperledger Explorer
A. Peer
B. Ledger
C. Channel
A. Peer
B. Ledger
C. Channel