0% found this document useful (0 votes)
84 views17 pages

Introduction To BC

Blockchain allows multiple companies to track supply chain data without a central authority by using a distributed ledger that is replicated across all participating nodes. Transactions that change data such as responsible parties or temperature readings are sent to nodes and validated using a consensus mechanism. This ensures all nodes have a consistent view of the ordered transaction history, even without a single point of control. The dairy company scenario could use blockchain to track shipments and identify accountability for any issues by recording supply chain transactions on an immutable shared ledger.

Uploaded by

Kovela Hema Sri
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
84 views17 pages

Introduction To BC

Blockchain allows multiple companies to track supply chain data without a central authority by using a distributed ledger that is replicated across all participating nodes. Transactions that change data such as responsible parties or temperature readings are sent to nodes and validated using a consensus mechanism. This ensures all nodes have a consistent view of the ordered transaction history, even without a single point of control. The dairy company scenario could use blockchain to track shipments and identify accountability for any issues by recording supply chain transactions on an immutable shared ledger.

Uploaded by

Kovela Hema Sri
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 17

Introduction

 2 minutes

Implementing a solution across multiple companies can be challenging because you


need to trust data from partners. In most cases, you use a central database. Data is
stored in one location as the source of truth. The company who maintains the
database must be trusted as the central authority of the data.

Blockchain lets you implement a business process when you need to trust data and
participants without using a central database.

Suppose you are a solutions architect at a dairy processing company that produces
ice cream. You use a supply chain to receive raw dairy goods from multiple dairies.
Your company ships packaged ice cream to various retailers. There has been food
quality and safety issues caused by improper temperature storage during shipment.
Because multiple companies are responsible to ship and store the product, it has
been difficult to identify the supply chain party at fault. You want to create a system
that identifies issues in the supply chain quickly. Each supply chain company wants to
integrate their existing systems with the solution and independently audit shipments
if there is a food safety recall.

In this module, you'll see how blockchain allows business partners to trust each
other's data without a central authority. You'll also learn a bit about how blockchain
works. The goal is to help you decide if blockchain is a good choice for your scenario.

Learning objectives
In this module, you will learn to:

 Explain how blockchain enables trust and business processes between


participants
 Evaluate when to use blockchain for a solution
 Classify available Azure blockchain options for a solution
Prerequisites
 Basic knowledge of programming concepts such as variables and conditional
logic

What is blockchain?
 5 minutes

Blockchain is a record-keeping and contract-enforcement technology that uses


cryptography to make it extremely difficult to change previous history. It allows
participants to share workstreams by tracking changes on a shared ledger.

In the ice cream scenario, how do we discover there is a food quality or safety issue
caused by improper temperature storage during shipment? We need to track the
responsible party and the temperature and keep a log of changes.

Why not use a centralized database?


We could use a centralized database that all participants use to track shipments. In
many scenarios, a centralized database is the right solution. Suppose we have a
centralized database that stores details about the shipment and who's currently
responsible. In our scenario, we could have the farmer, shipper, factory, and retailer
use the same centralized database.

The advantage of the centralized database is that it's easy to control access and
consistency. Everyone is using the same database and there's a trusted authority
controlling access. Because there is only one database, all participants are using the
same set of data. All participants need to trust the database is correct, and by
extension they need to trust the owner of the database not to modify historical data
for any reason.

What if our scenario doesn't allow for a trusted central authority? What if no one
company wants to be responsible for hosting a centralized database? Perhaps the
requirements for system integration with each participant system can't be met.

Distributed database
What if each participant could have their own copy of the database? A distributed
database uses multiple copies of a database and changes are synchronized. In our
scenario, we could have the farmer, shipper, factory, and retailer use their own
distributed database.

The advantage of the distributed database is that each participant has a copy of the
database. In most cases, it's easier to control access and integrate your systems and
process in your own copy of a database. However, synchronization of changes to
each database is required. Handling failures and conflicts can add complexity and
data integrity issues.

Distributed ledger
Blockchain technology is referred to as a distributed ledger. Just like an accounting
ledger, the distributed ledger is a history of transactions. Each transaction in the
ledger affects the final state.

Blockchain networks that are distributed among participants are called a consortium
network. The consortium network gives each partner visibility into every transaction
that occurs on the network.
Blockchain uses consensus rules to ensure data is consistent across nodes. It also
uses cryptography to enable participants to trust the data. Specifically, it prevents
any individual participant or minority of participants from modifying history. Since
blockchain is decentralized, solutions that can use a decentralized database work
best. For example, you have a requirement to support multiple companies with no
central authority due to cost, control, or being a single point of failure.

How blockchain works


 10 minutes

Now that we know the basics of blockchain, let's see how it works behind the scenes.
This information should help you decide whether blockchain will work for your
scenario.

How is data distributed?


In our scenario, there are multiple companies. We could have a centralized database
at the dairy processing company. However, no one participant wants to be the
central authority. We could use a blockchain distributed ledger. Using blockchain
removes the need for a central authority. Also, each participant with a blockchain
node has a copy of the ledger so that they can do their own auditing and integration
with their systems. But, there isn't a requirement for each company to have their own
node. Nodes may be shared between partners.

Each node is connected to other nodes using a blockchain network. For example,
Dalia Pelayo farms, the ice cream factory, and the ice cream shops each have a node
they manage. Contoso West and Contoso East are separate partners that share the
same parent company. Contoso has one node. There doesn't need to be a one to
one relationship of nodes to companies.
Changing state
Data in a blockchain represents state. That's why digital tokens like cryptocurrency
are a good fit for blockchain. If we think about the ownership of physical currency, a
coin can only be in one person's pocket at a time. If the coin is in your pocket, the
state of ownership is yours. If you give the coin to your friend, the state changes to
your friend owning the coin. In our scenario, shipments move through the supply
chain. Responsibility for the product must be transferred. The data we're interested in
is the responsible party, temperature, and if the product is in compliance.

Blockchain uses transactions change the state of the data from one value to another.
For example, we need to know if the ice cream is stored below freezing. In a
shipment of ice cream, a temperature sensor reports the temperature periodically.
The reported temperature is a transaction that is sent to a blockchain transaction
node.

In the ice cream scenario, when a shipment is sent through the supply chain, a
transaction is sent each time the status changes. For example, the illustration shows
transactions for a typical shipment to the ice cream factory. Each transaction changes
either the responsible party or the temperature. The current state of the ledger is the
transactions applied in order.
When sending a transaction, you send it to a blockchain transaction node. Let's
suppose Dalia Pelayo Farms sends a shipment of milk using Contoso West Shipping.
Dalia Pelayo Farms shipment system sends a transaction to their blockchain node.
The transaction updates the shipment responsibility from the farmer to Contoso
West Shipping.

Blockchain sends the transaction throughout the blockchain network. Each node gets
a copy of the transaction.

Each node processes the transaction but it still requires validation using a consensus
mechanism. Consensus enables consistency and trust for the distributed ledger.

How can you trust ledger data is consistent?


In a distributed network, it's difficult to determine what is true because data changes
must occur across all nodes. What happens if the ice cream factory node doesn't get
a shipping transaction? How would they know if milk has been shipped from the
farm? What if the shipping company's refrigerated truck fails and the milk spoils?
Could the shipping company modify their ledger to avoid responsibility?

Blockchain uses a consensus mechanism to validate and agree on the data across all
blockchain nodes. Consensus provides a way for all decentralized nodes to come to
the same state. When transferring value or responsibility, order matters. For example,
if you transfer ownership of a car to your friend, you can't also transfer ownership to
a colleague at work. This issue is known as the double spend problem which
consensus solves. Consensus ensures the correct order of transactions and the
integrity of the blockchain. As part of consensus, a group of transactions is validated
as a block and the network must agree if the block should be included in the
blockchain.

There are several blockchain consensus algorithms including proof of work, proof of
stake, and proof of authority. Each algorithm solves consistency in a different way. In
simple terms, consensus provides a way for the distributed ledger to come to a
common state.

What is a block?
A block is a cluster of data within the blockchain that stores transaction information.
The number of transactions in a block is usually time-based. For example, the
illustration shows a block containing transactions that occurred in the past 10
minutes.
Through consensus, validated blocks are added to the blockchain at each node.
Because all nodes have the same blocks in the chain, the ledger is consistent across
the network. As a result, all the nodes contain the same validated data in an agreed
upon order.

How can you trust the ledger is immutable?


You would think that if you have control of the ledger in your node, you could just
change the data in your copy. How can it be immutable?

Blockchain uses a cryptographic hash to create link between blocks. By linking blocks,
the order of transactions can be agreed upon through the consensus algorithm.
A cryptographic hash is an algorithm that maps data of an arbitrary size to a bit
representation of fixed size. You can think of it as a digital fingerprint. Bitcoin uses
the SHA-256 hash algorithm. If you used a SHA-256 hash function on a 100 page
document, the function output is a 256-bit hash value. If you changed just one
character in the document and regenerated the hash, the output is a different 256-
bit hash value. Now, imagine if we use a block as the input to the hash function. The
output is a unique hash value for the data in the block.
Blockchain uses hashes to detect if any changes have been made to the blocks. By
including the previous block's hash value when generating the next block's hash,
blocks are chained together through hashes.

Blockchain provides trust by using hashes to prove data history hasn't changed. By
including the hash of the previous block when creating a new block, an immutable
chain of transactions is created in order.

If any block is modified in the chain, the hash of later blocks is different. As a result,
validation discovers the discrepancy.
Trusted logic
Blockchain allows us to store data that is consistent and can be trusted. How do we
add logic that executes the same at each node?

In our scenario, we need logic to transfer responsibility of the product from one
participant to another. We also need to use data from IoT temperature sensor to
know if the temperature is too high.

A decentralized application (DApp) is an application on a distributed computing


system. In this module, we'll focus on using the Ethereum blockchain protocol.
Ethereum DApps are called smart contracts. A smart contract contains logic that is
executed as part of a transaction. On Ethereum, you program the logic using a
programming language called Solidity.

Smart contracts are deployed to the blockchain and are referenced by an address. To
use a smart contract, you create an instance. A smart contract instance contains state
data and program logic. In our scenario, a smart contract instance contains data such
as, the responsible participant, location, and if the product temperature is out of
compliance. We can execute functions to transfer responsibility or receive
temperature telemetry for the instance.

When the responsibility of a product transfers to another party, a transaction is


executed. Smart contract logic updates the state data. In our ice cream scenario, the
ice cream factory shipping system creates a smart contract instance for a new ice
cream shipment. The factory shipping system sends a transaction that calls
the TransferResponsibility function to transfer the responsibility of the shipment to
Contoso East shipping. The blockchain network sends the transaction to all nodes.
The smart contract logic executes at each node.
What if during shipment the refrigeration unit fails and the temperature of the ice
cream goes above freezing? An IoT temperature sensor monitors the ice cream
temperature and sends transactions periodically. If the temperature is above freezing,
the smart contract logic marks the shipment as non-compliant.
Because the transaction is included in a chain of blocks, there is an immutable record
of when the shipment became non-compliant. The ice cream shop can refuse
delivery and can avoid food safety issues.

Just like data in the blockchain, a smart contract is immutable. Once deployed, the
logic cannot be changed. Therefore, you can trust that smart contract logic always
executes the same on all nodes. Any code changes require a new smart contract be
deployed at a new address.

Blockchain types
 5 minutes

A blockchain can be public or private. The distinction determines who can participate
in the blockchain network.

Public
What if you wanted a network where you trusted no one? Anyone with Internet
access can join your blockchain network. No onboarding is required and you don't
have to ask an authority for permission.

A public blockchain is decentralized with no single authority on the network. All


transactions in the blockchain are visible by any node on the network.

The first blockchain network was created for Bitcoin. The Bitcoin blockchain network
is public. All transactions can be viewed by anyone. For example, you can view the
latest Bitcoin blocks and transactions using a block explorer.

The consensus algorithms for public blockchains use cryptocurrency as a reward to


validate blocks. Public blockchains may also charge a cryptocurrency fee for
validating transactions. Public blockchain privacy is limited. If you wanted to keep
your transaction private, you should only share your public key with the other
participant in the transaction.

Private
What if we had some trust of the participants in the blockchain network? The
information stored in the blockchain would only be accessible to participants invited
to the blockchain network. Private networks are semi-trusted networks. In a private
network, there is an agreement between all participants about how they will leverage
the blockchain.
A consortium blockchain is a private blockchain but authority is distributed and acts
in the best interests of the network.

In our scenario, we want transaction privacy from the public. Consortium blockchains
can restrict who has authority to participate in consensus. Trust is enforced by
restricting only the participants be involved in validation. The group of participants is
called a consortium. Consensus algorithms for consortium blockchains can use
authority rather than cryptocurrency.

We may also want privacy of some data. For example, all parties would know a
product was transported but details about the shipment could be kept private. Since
we use multiple shipping companies, the details about the shipments could be kept
private between two of the parties. Competing shipment companies would only
know that the transaction happened and could not see the details about the
shipment.

Blockchain protocols
There are several blockchain protocols. The most well known is Bitcoin. The Bitcoin
blockchain network was created for Bitcoin cryptocurrency. The primary function of
the Bitcoin blockchain network is to store Bitcoin value. Value can be transferred
from one to another in a trustless way.

Ethereum is a general use protocol. Ethereum extends what Bitcoin had created to
provide a protocol that would allow small programs to be written, as well as simple
value transfers. The net effect is the ability to add logic and code instead of simple
fixed value transfers.

If you are going to use blockchain for your own solution, consider a general use
protocol like Ethereum and Hyperledger Fabric. They are programmable blockchains
that can be used for several scenarios. General use protocols use smart contracts to
encode business logic and state. In this module, we focus on the Ethereum protocol.

When to use blockchain


 5 minutes

Blockchain technology works best for certain scenarios. You shouldn't use it as a
general purpose solution. In many cases, a centralized database is a better option.
When considering using blockchain, ask yourself these questions about your
scenario.
Participants
 Do you need to support multiple partners or companies?
 Do you want to avoid a central authority? Perhaps there is not trust in any one
participant. Participants may not want to be reliant on a third party.
 Do the participants share data or use a workflow that involves several or all
the participants? Blockchain technology guarantees each node is consistent.
Most other business to business (B2B) solutions rely on synchronization.
Synchronizing data introduces breakage and expense to B2B systems. The
consistency of the distributed data is a key advantage of blockchain technology.

Performance
 Is your transaction throughput low? Depending on the blockchain protocol
and consensus mechanism, transaction rates can be low.
 Is there defined business logic when interacting with other business partners?
Executing business logic in a transaction can affect performance.

Business logic
 Is your business logic simple? Executing a complex smart contract function on
a public blockchain requires more cryptocurrency than a simple one.
 Is your business logic static and doesn't change? Since blockchain data is
immutable, smart contract logic changes require you to deploy a new contract
to a new address. Consider how you will version your business logic.

Trust
 Is trust and integrity required between participants?
 Does the order of transactions matter?
 Do you need transaction privacy?

Blockchain options on Azure


If you want to host your solution on Azure, there are several options you can
consider.

Templates
Solution templates provide Infrastructure as a Service (IaaS) packaged virtual
machines (VMs) for many major protocols and blockchain network configurations.
For example, there are solution templates provided by Microsoft to deploy
blockchain consortium networks for Ethereum and Hyperledger Fabric. There are also
several third-party solution templates for other popular blockchain protocols
including Corda and Quorum, BlockApps, and GoChain.

Solution templates for blockchain can be found in the Azure Marketplace.

Azure Blockchain Workbench

Use Azure Blockchain Workbench for rapid prototyping and integration with other
Azure services. With Azure Blockchain Workbench, you can configure and deploy a
consortium network quickly. It's ideal for development prototyping or test
exploration. The goal of Azure Blockchain Workbench is to reduce development time
and cost with prebuilt integrations to the cloud services needed for application
development such as Azure Active Directory, Azure Key Vault, Azure Service Bus, and
Azure Event Hubs.

For more information on Azure Blockchain Workbench, see the Azure Blockchain


Workbench documentation.

Azure Blockchain Service

Azure Blockchain Service provides permissioned blockchain as a service. Use Azure


Blockchain Service to build and govern a consortium network. You can create
blockchain nodes easily using the Azure portal.

For more information on Azure Blockchain Service, see the Azure Blockchain


Service documentation.

Knowledge check
 5 minutes

Check your knowledge


1. 

Suppose a refrigeration truck freezer fails during shipment to the ice cream shop. The
ice cream in the shipment melts. The freezer is repaired and the ice cream refreezes
before delivery. How would the ice cream shop know if the shipment is out of
compliance?
The shipment is out of compliance temporarily. However, when the freezer is
repaired, the temperature returns to freezing. The last transaction from the IoT
temperature sensor updates the temperature in the ledger. Therefore, the shipment
appears to be in compliance.

Smart contract logic sets the shipment non-compliant when the temperature is too
high. The ice cream shop can check if the shipment is out of compliance before
accepting delivery.

You need to audit the blockchain history to determine compliance. Once you
investigate the blockchain history, you can mark the shipment as being out of
compliance.
2. 

Why is blockchain immutable?

Blockchain uses hashes to tamper-proof the data in the blockchain. Validation would
detect the invalid blocks. Bad blocks would be thrown out during consensus.
Therefore, blockchain cannot be changed in a healthy blockchain network.

Blockchain ledgers are read only for participants by default. Only processes with the
granted permission can write data. Since ledgers are read only to participants, they
are immutable.

Immutability depends on how you configure the blockchain network. It can be


configured to be read only or immutable. However, blockchain is fully configurable.
You can configure nodes to allow administrators to make changes to transaction
history. The changes are synchronized automatically.
3. 

How do smart contracts enable business workflows?

Smart contracts use pre-defined business workflow logic for common business
scenarios.

Smart contracts are client applications you write that call the blockchain to execute
transactions and change ledger state.

Smart contracts contain state and programmable logic. Transactions instantiate


smart contracts and execute functions that change state. Therefore, smart contracts
enable you to create a business workflow.
Summary
 2 minutes

Our goal was to show you how to evaluate whether you should consider blockchain
technology when developing a solution. We developed some criteria you can use to
guide your decision:

 How blockchain establishes trust between participants


 Performance considerations
 Business logic
 Azure options

Analyze your business process against each of these criteria. The results should give
you an idea of how close a match blockchain is to your needs.

You might also like