Unit 5 - Blockchain Application Development
Unit 5 - Blockchain Application Development
sense of immutability.
So no one can change this in the future and it is also gives you
finality so once the transaction is performed it is there forever,
everyone can see that the transaction was performed.
So this is the overall system and this ensures that we can
significantly reduce some of the inefficiencies that exist in
multiple echo system today.
so what are some of the key concepts?
i.e 1) Shared ledger amongst all the participants in the network.
so this is an append only distributed system of record of all
transaction that are being performed on the network by any
participant.
Blockchain for Enterprise:
1) Shared ledger amongst all the participants in the network.
so this is an append only distributed system of record of all
transaction that are being performed on the network by any
participant. So this is the shared ledger. So this is the distributed
system concept. how this ledger is maintained in the consistent
manner across all the participants is through a notion of consensus.
Blockchain for Enterprise:
Blockchain for Enterprise:
1) Shared ledger:
so this is a protocol that all the participants will perform, it is an
exchange of messages and they all agree that this is a valid
transaction that can be added on to the network and apart from
these notions there is also a notion of security.
Some of this notions are not there in the bitcoin blockchain.
Where we want to ensure that only certain participants can see
certain piece of information or they can only perform certain
kind of transactions and all of this transactions can secure, they
are authenticated and verifiable.
There are many other notions of privacy.
This is auditable may be even a regulator can come in and see
that all of these transactions are performed by valid users, they
are all authenticated and proper transactions to be performed on
this business network.
Blockchain for Enterprise:
They can admit these transactions. This is very different
from what bitcoin taught about blockchain.
Another aspect is the 2) Notion of smart contracts:
apart from exchanging information amongst participants in
the network we are also executing business processes, that
is the smart contract, so it is the logic or the piece of
code written in traditional programming languages perhaps
that you can execute in a decentralized fashion so all of the
nodes in the network will actually execute this transaction,
they will compute the output state and the output state will
then get recorded to the ledger, if this is a valid transaction.
In the bitcoin world again just as a comparison, the bitcoin
executes a very static smart contract, this is exactly execute
one smart contract which does not have the ability
Blockchain for Enterprise:
2) Notion of smart contracts: for you to embed your own smart
contract and that smart contract in bitcoin is just being able to
determine who the owner of a particular bitcoin is and who
transferred how many bitcoin to another persons.
So that is the asset management in transfer is the only kind of
thing that you can do in bitcoin where we are looking for much
more richer set of transactions and business logic that we want
to embed into some of these transactions and shared ledger, smart
contracts, consensus and security all of these put together is what
as called a blockchain and putting these together is really a big
acknowledgeable advancement that we have come up with
blockchain together as a community.
It helps to reduce time for executing some of these transactions,
what was previously very manual process, it can now be
automated across organizations.
Blockchain for Enterprise:
It helps reduce cost, it helps reduce risk and it also enables new
business models.
When we talk about some of the solutions that have been
enabled by blockchain we will look at some of these new
business models.
Blockchain for Enterprise:
So now in perspective of bitcoin vs enterprise blockchain
application just think of right hand end of this spectrum which
is 100% centralized.
This is typical old distributed systems where it is just one
organization that is executing the entire application or your
system.
Blockchain for Enterprise:
And it is a centralized system of records. So that is one end of
these spectrum.
The other end of the spectrum where may be bitcoin or other
permission less system belongs to completely decentralized
anyone can join the network, anyone can execute the
transaction, anyone can see what is going on so that is on the
fully decentralized permission less side.
But for enterprise application we need something in slightly in
the middle where we want some of the Decentralized benefits
but with certain security privacy features with better scale and
so on.
Here is the distinction in the bitcoin world. It looking for
completely censorship-resistant.
Blockchain for Enterprise:
So one should be able to prevent transaction from being
executed.
So in a government or in regulatory authority should not be
able to say this transaction is not valid. So it were looking for
complete censorship-resistant.
It were looking to scale to large number of nodes.
So bitcoin today runs about 5000 or so and also looking for
one global blockchain i.e. one blockchain for entire world.
In contrast for enterprise application we are interested in
security and privacy policies instead of scaling this many
number of nodes.
And interested in the transaction throughput.
The distinction is like if we take enterprise today it probably
Blockchain for Enterprise:
Blockchain for Enterprise:
in doing business with may be tens of other companies or
sometimes may be hundreds of other companies.
It is very rarely that you are scaling even larger than that.
So we are looking to scale in the transaction throughput.
We are looking at many interacting blockchain.
Think of one blockchain entire world.
Application for one blockchain network for particular
application and there is a different blockchain network for
another application and these two need to interact with each
other.
So the requirements in some sense are very different so the
way we design these blockchain platforms going to be very
different from what bitcoin did but the overall underline
Blockchain for Enterprise:
properties remain same.
It still want immutability, finality, consensus among all the
parties and want to run this in decentralized manner where no
single entity is in charge of managing the entire network.
So the access is open in permission less setting to everyone in
the network.
Whereas in Permissioned setting only looking for Permissioned
read write access where we can specify who can write a
particular piece of data, who can read the data that flexibility
is there.
Permission-less VS Permissioned Blockchain :
Permission-less Permissioned
Access Open read/write access Permissioned
to database read/write access to database
Scale Scale to a large number Scale in terms of transaction
of nodes, but not in throughput, but to a large
transaction throughput number of nodes
Consen Proof of work/ proof of Closed membership consensus
sus stake algorithms
Identity Anonymous/pseudony Identities of nodes are known,
mous but transaction identities can
be private/
anonymous/pseudonymous
Asset Native assets Any asset/data/state
Hyperledger Fabric :
Hyperledger project is a new platform specially suited for
enterprise application.
It is one of the fastest growing open source project under
Linux foundation.
Hyperledger Fabric :
It involves 220 leading enterprise companies. The logos of all various
companies that are participate. Its includes large technological firms,
large financial companies, banks, healthcare companies and industries
specific companies who have joined these consortium to help promote
its mission in building enterprise grade blockchain platform.
Hyperledger Fabric :
Hyperledger fabrics production grade was released in July 2017.
It has large number of organization contribution to it.
IBM is one of the largest contributor to it both in terms of code as
well as IP. There are many other projects that are also the part of this
Hyperledger consortium.
Hyperledger Fabric :
One of them is Hyperledger composer. This is gives you the set of
higher level abstraction for business users to come and develop
application on top of blockchain.
So instead of being having to work with a details of blockchain
platform, work at higher level of abstraction where you can talk
about business concepts directly and encode that to run on
blockchain platform.
It has many interesting features that you can model your business
network.
You can talk about in terms of asset participants and transaction
rather than having to talk about low level variables & functions & so
on. And it is all exposed via APIs and can automatically generate
some of these APIs as well.
Hyperledger Fabric :
It also gives you the ability to integrate with the existing
systems of records.
So blockchain in many of this enterprise application be just one
part of large application.
So it might involve other database where you are storing data,
bring that on blockchain.
Whatever is going to record on blockchain might want to
extract that out, your own analytics and visualization.
So some of these capabilities are also pert of composer which is
fully open source, open governed.
To see Hyperledger fabrics in deep, understand first some
of the actors in blockchain.
Hyperledger Fabric :
Some of the key concepts such as how the transaction is get
committed by all the peers in the blockchain network in a
consistent manner and everyone to be committing same
transaction in same order.
Hyperledger Fabric :
Hyperledger Fabric Architecture :
The key components of the Hyperledger Fabric Architecture
channel
Hyperledger Fabric : Channels:
So a copy of the chain code is going to be running on each peer that
needs to run that chain code.
But a chain code is installed for a specific channel or each channel.
Each peer is going to be running a copy of chain code that it needs
to run.
Example: here there are two channels red and blue. E0 is the part
of both of these channels. E1 is the part of red channel. So this
chain code is running on E0 and E1. For E0 it needs the chain code
on both these channels whereas E1 needs this chain code only
on red channel because it does not know the existence of blue
channel
Hyperledger Fabric : Channels:
channel. So chain code has to be installed on each channel
specifically and the state maintained is the part of ledger and it
separate for each of the channel.
so the chain code state in one channel is different from chain code
state in another channel. So these are kept private and separate.
Peers can participate in multiple channels i.e. just one peer process
can be participating in multiple channels and this becomes very
useful when we are building application for easy segregation of
data and transactions across the nodes in the network itself.
channel
Hyperledger Fabric : Channels:
And this also alerts for concurrent execution for performance and
scalability. So say 20 nodes in a network, 5 of them can form a
private channels among themselves, 10 can form another private
channels among themselves and these two channels can execute
completely parallel with each other and that can help to improve
scalability of the entire network itself.
So they can all executes transaction themselves without
interfering with each other. So that is the notion of channels.
channel
Hyperledger Fabric : Channels:
Example: Here is a network with just a single channel. Client
application is going to submit transaction to the network.
E0,E1,E2 and E3 are the endorsing peers in this network, there is
exactly one channel in this system and all the peers connects to
that channel i.e. blue channel.
This channel is going to maintain sequence of blocks or sequence
of transactions. A and B are smart contract. So these are chain
codes that are deployed. So these chain codes are all installed on
Hyperledger Fabric : Channels:
Example: every node in the network and it are instantiated on that
channel so when transaction is submitted by certificate authority
on network i.e. invoking a particular function in smart contract A
then all the 4 peers E0,E1,E2 and E3 they are all going to be
executing same function across all the nodes and go through
ordering and the consensus and finally validation.
Hyperledger Fabric : Channels:
Example: so this is a single channel network where all the peers
are part of single channel. There could be multi channel network.
Now there could be 2 different application.
One application is transacting on red channel.
Another application is transacting on blue channel and these
application may not even know the existence of other channel.
Hyperledger Fabric : Channels:
In this example E0 and E3 are only part of red channel and they
are only aware of smart contracts or chain codes that are deployed
on that channel.
E1 and E2 are only part of blue channel and not known the
existence of red channel.
So this completely disjoined channels in this network and they
actually using same ordering service.
Hyperledger Fabric : Channels:
It is possible that even ordering service is separate across the
channels. So the transactions on one channel are only ordered for
that channel, the transactions for other channels are kept separate.
Endorsement policy also may be same or different on two
channels. For smart contract Y on red channel define particular
endorsement policy. For smart contract A on blue channel define
different endorsement policy.
Hyperledger Fabric :
Membership Service Provider (MSP):
Identities will be use to communicate with each other.
Administrators managing this network themselves.
Hyperledger Fabric : Membership Service Provider (MSP):
Users are authenticating themselves by signing the transaction and
this sign is verified by the peer. So peer is going to validate this
signature provided by the user.
Signing and insurance are possible because of security framework
of MSP.
Hyperledger Fabric : Membership Service Provider (MSP):
Supports different crypto standard with pluggable interface:
Different application might need different security properties that
might be provided by different certificate authorities or different
crypto standards.
It includes TLS i.e. Transport Layer Security is used for
encrypting all Communication across the network
Hyperledger Fabric : Membership Service Provider (MSP):
i.e. communication among peers themselves, peer to order
communication, user to peer communication, peers and chain codes,
all of these are secured through TLS.
Hyperledger Fabric : Identities :
User Identities : Every user in network is going to be issued identity,
an enrollment certificate. Enrollment certificate has 2 parts:
1) Keystore: Private key to digitally sign transaction by user while
submitting onto network.
2) Signcert : which is public x.509 certificate in fabric implementation
Hyperledger Fabric : Identities :
User Identities : 2) Signcert : which includes this public key to
validate whether it was indeed this user who signed that transaction
and includes some attributes that certificate authority might provide
to the user.
Optionally may also includes TLS credentials: peer needs TLS
credentials for communicating with other peers and orders in the
Hyperledger Fabric : Identities :
User Identities : network. All of this can be backed by Hardware
Security Module i.e. HSM where this keys are separately stored.
HSM is used to sign transactions without anyone else or any
component in the system getting access to private keys.
Hyperledger Fabric : Identities :
Admin Identities : The admin identities is very similar in
concept to user identities.
Hyperledger Fabric : Identities :
Peer and ordered Identities : For instance an organization who is
running the peer can designate one of its users as an administrator.
The specific function that administrator can do for instance joining
the peer to particular channel can only be performed by that
administrator user. If the regular user who is not an administrator
Hyperledger Fabric : Identities :
Peer and ordered Identities : tries to perform that transaction , it will
denied by the network. It also stores the public certificate of certificate
authority that it will recognize. So it need the public certificate of that
certificate authority to able to validate users who are connecting to this
peer. That is the part of cacerts.
Hyperledger Fabric : Identities :
Peer and ordered Identities : There are also certification revocation lists :
This is important over a period of time to manage which are legitimate
users which are not. So hold your certificate for certain length of time &
revoke that certificate and have a new certificate for security purpose.
Peers and orders receive channel MSP information to know which
channels they are connected to.
Hyperledger Fabric : Endorsement Policy :
Endorsement Policy :
A subset of the peers executing chain codes on each channel and that
is governed by endorsement policy.
So the endorsement policy states which peers have to execute or
endorse a certain transaction before it will be deemed as valid to be
added to the blockchain. So each chain codes defines an endorsement
policy and this can be different for each channel that chain code
belongs to.
Code as Law means the code that execute & fulfills some
terms of a contract and that code can not altered or
influenced by any outside 3rd party or system.
With Ethereum, blockchain can actually deploy code onto
blockchain and execute it.
And for ripple it is the XRP that is the cryptocurrency that use and
there are market makers that help convert one currency to another.
Ripple has a centralised governance model so ripple controls who
joins the network, how is this created and they also hold large
fraction of the cryptocurrencies still.
Overview of Ripple :
Overview of Corda :
What is Corda?
Very much similar to blockchain, Corda is a distributed
ledger platform designed to record, manage and
automate contract based legal agreements between two
or more parties.
Well known for its application in business deals.
Targeted towards the world's largest financial
institutions, but potential for application exceeds beyond
that.
It offers a unique approach to privacy, security, and takes
care of the scalability issues that Dapps face.
Overview of Corda : What is Corda?
Corda is an open-source enterprise-based blockchain designed
to offer interoperability.
It is a platform that is intended to record, manage, and
synchronize agreements and transfer anything valuable.
It allows enterprises to communicate and transact directly
while maintaining transparency and without worrying about
privacy and to integrate Blockchain across their operations
immediately and efficiently.
Moreover, Corda offers timestamping services to order
transactions temporally and ignore disputes.
It has a smart contract logic, which specifies constraints that
ensure state transitions are valid as outlined in contract code.
Overview of Corda :
How Corda works?
As in Blockchain which embodies the Distributed
Ledger Technology (DLT), the data are stored in all the
nodes in the blockchain making it highly secure.
This means that an individual or any entity outside the
block can never change the data for their own agenda.
This makes it highly secure but at the same time raises
the issue of the number of files and the space it takes up.
Overview of Corda :
Smart contracts play a vital role in blockchain, i.e. the
contract would be transparent and accessible by everyone in
the block.
But the main difference with Corda, is that the smart
contract can be permission based.
Only the two or more parties involved in the transaction
would have access to the smart contract.
Also with the consensus of the parties involved, a
regulatory or a legal body can be given access and brought
into the network as an observer to verify the contract.
Overview of Corda : Highlights
Smart contracts in Corda are executed taking into account
the following features :
Regulating and streamlining the workflow between
decentralized firms
Recording and managing the evolution of financial
agreements and other shared data between two or more
identifiable parties in a way that is grounded in existing
legal constructs and compatible with existing and emerging
regulation
Inclusion of supervisory and regulatory nodes just as
observers
Overview of Corda : Highlights
Smart contracts in Corda are executed taking into account
the following features:
Consensus algorithms and levels are between two firms
involved and not global
Access of the data within the agreement is only limited and
entitled or logically privileged to the Permissioned parties
involved
Acts as a bridging between the usual hard contract with
mart contracts by recording the links
Validation of the transaction solely between the two parties
involved
Overview of Corda :
Why choose Corda?
Due to following features:
Data privacy and security
Native tokenization and interoperability
Settlement finality
Sustainability
Multi-tenancy
Regulatory complaint
Writing smart contract using Hyperledger Fabric :