Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Blocchain Fundamentals Module1

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 90

Blockchain Technology for IOT Applications:

From Theory to Implementation

Prof. Neeraj Kumar, SMIEEE, Thapar University, Patiala, Punjab, India.


Profile of the Instructors
Prof. Neeraj Kumar
• Prof. Neeraj Kumar has more than 20 years of experience with expertise in Blockchain, Machine learning, deep learning and network programming
• He has more that 20,000 citations with current h-index of 79.
• Has published more than 400 SCI/SCIE research articles in top tiered journals and conferences
• Has executed projects of more than 6 crores from government of India
• Has published more than 10 authored and edited books from Springer, Elsevier, IET, CRC etc.
• Has supervised 15 Ph.D. students and 35 M.E./M.Tech. thesis
• Conducted more than 100 FDP, STC, and training programs in ML, Deep learning, and Blockchain
• Trained thousands of students in emerging technologies for real-time projects and training
• Editor of ACM Computing Survey, IEEE Transactions on Networks and Service Management, IEEE Transactions on Sustainable Computing, IEEE Network,
IEEE Communication Magazine, Elsevier. JNCA, Elsevier Comcom
Resources

• Books

https://www.elsevier.com/books/the-blockchain- https://www.routledge.com/Probabilistic-Data-
technology-for-secure-and-smart-applications-across- Structures-for-Blockchain-Based-Internet-of-Things-
industry-verticals/kumar/978-0-12-821991-1 Applications/Kumar-Miglani/p/book/9780367529901
Table of Contents
● Introduction
1. Blockchain terminologies
2. Distinction between databases and blockchain ledgers
● Cryptographic component
1. Cryptography, hash functions and digital signatures
● Consensus components
1. Principles and paradigms of distributed systems
2. Blockchain consensus algorithms
● Blockchain structures
1. Blockchain structure
2. Types of blockchain
Table of Contents K1
● Introduction
1. Blockchain terminologies
2. Distinction between databases and blockchain ledgers
● Cryptographic component
1. Cryptography, hash functions and digital signatures
● Consensus components
1. Principles and paradigms of distributed systems
2. Blockchain consensus algorithms
● Blockchain structures
1. Blockchain structure
2. Types of blockchain
Introduction

“To understand the power of blockchain systems, and the


things they can do, it is important to distinguish between
three things that are commonly muddled up, namely the
bitcoin currency, the specific blockchain that underpins it
and the idea of blockchains in general.”

The Trust Machine, THE ECONOMIST, Oct. 31, 2015

Source: https://www.economist.com/leaders/2015/10/31/the-trust-m
Table of Contents K1
● Introduction
1. Blockchain terminologies
2. Distinction between databases and blockchain ledgers
● Cryptographic component
1. Cryptography, hash functions and digital signatures
● Consensus components
1. Principles and paradigms of distributed systems
2. Blockchain consensus algorithms
● Blockchain structures
1. Blockchain structure
2. Types of blockchain
Tracing Blockchain’s Origin
• The shortcomings of current transaction systems
• During 2000’s financial crisis
Bitcoin Whitepaper: 10/31/2008
https://bitcoin.org/bitcoin.pdf
Digital Currency
• The most successful among lot of efforts: Bitcoin
• Replace cash with numbers and codes
• Advantages
• Fast
• International
• Easy accounting
• Weighs nothing
• Cheap
• Problems to be solved
Problems of Digital Currency
• Perfect Copy
• Just like downloading attachment from email
• How to distinguish counterfeits
• Ownership Problem
• Double Spending
• Networks are noisy and transmission across networks is far from instantaneous:
delay
• A hacker can capitalize
• Fraudster Detection Problem
The Long Road to Bitcoin
• Centralized Banking: not robust
• Satoshi determined to find the centralized part of banks
• The ledger
• “What if I could turn a bank inside out? Instead of one central party controlling
the ledger, what if every user were recruited to maintain a constantly updated
copy?”
• The strength of the digital was perfect copies, so copy the ledger,
everywhere, instantly.
• Any ledgers with even one common not agreeing with the masses would be
discarded, leaving fraudsters powerless
• Replace cash with Ledger!
Decentralization
• Replace cash with Ledger
Blockchain terminologies

● Blockchain – What is it?


In fact, the blockchain is more than a technology, it
o Usually contains financial transactions
o Is replicated across a number of systems in almost real-time
o Uses cryptography and digital signatures to prove identity,
authenticity and enforce read/write access rights
o Can be written by everyone in a public blockchain (but only certain
participants in a private blockchain)
o Can be read by participants, often a wider audience
o Has mechanisms to make it hard to change historical records, or at
least make it easy to detect when someone is trying to do so
hash hash hash hash
Block 1 Block 2 Block 3 Block 4

Source: https://miethereum.com/wp-content/uploads/2017/11/A.-A-Gentle-Introduction-To-
What is Blockchain Technology
• Bitcoin stores all its transactions onto a public database called
as Blockchain
Highlights
Blockchain Structure

Source: https://www.edureka.co/blog/blockchain-tutorial/
4 Key Concepts of Blockchain

Source: IBM, A new disruption in financial services


Blockchain terminologies

● Distributed ledger – What is it?

Source: https://tradeix.com/distributed-ledger-technology/
Blockchain terminologies

● Blockchain – What is it?


o Aka DLT (Distributed Ledger Technology) - rudimentary shared
accounting system

o Technologically, it is :
• Distributed database – public ledger (you can insert,
select data, but can’t update or delete data.
• Distributed computer – execute digital contracts
• Based on p2p (peer-to-peer) technology, cryptology and
API

Image source:
Blockchain Architecture
• Revolutionary Technology
• Protocol
• TCP/IP, HTTP, Cloud Computation, Big Data, IoT, FinTech…
• Melanie Swan: Blockchain: Blueprint for A New Economy, Jan 2015
• Blockchain 1.0
• Bitcoin
• Programmable Money
• Blockchain 2.0
• Ethereum
• Smart Contract
• Blockchain 3.0…
• Non-Financial Uses
• Applications
Bitcoin System vs. Current Banking System
• Decentralized System
• The Blockchain system follows a decentralized approach when compared to banks and financial organizations which are
controlled and governed by Central or Federal Authorities.
• Here, everyone who is involved with the system holds some power.
• Public Ledgers
• The ledger which holds the details of all transactions which happen on the Blockchain, is open and completely accessible to
everyone who is associated with the system.
• Even though the complete ledger is publicly accessible, the details of the people involved in the transactions remains
completely anonymous.
• Verification of Every Individual Transaction
• Every single transaction is verified by cross-checking the ledger and the validation signal of the transaction is sent after a few
minutes.
• Through the usage of several complex encryption and hashing algorithm, the issue of double spending is eliminated.
• Low or No Transaction Fees
• These transaction fees are however relatively quite less when compared to the fees implied by banks and other financial
organizations.
• If a transaction needs to be completed on priority then an additional transaction fees can be added by the user so as to have
the transaction verified on priority.
the key business benefits
• Time savings:
• Cost savings:
• Tighter security:
• Enhanced privacy:
• Improved auditability:
• Increased operational efficiency:
Building trust with blockchain
• Distributed and sustainable:
• Secure, private, and indelible:
• Transparent and auditable:
• Consensus-based and transactional:
• Orchestrated and flexible:
Why It’s Called “Blockchain”
Different Players in Implementation
• Blockchain user
• Regulator
• Blockchain developer
• Blockchain network operator
• Traditional processing platforms
• Traditional data sources
• Certificate authority
Blockchain terminologies

● Distributed ledger – How it works?

Users initiate
Users Broadcast One or more Nodes aggregate
transactions
their Nodes begin validated
using their
transactions to validating each transactions into
Digital
Nodes transaction Blocks
Signatures

Block reflecting
Nodes Broadcast
Consensus “true state” is
Blocks to each
protocol used chained to prior
other
Block

Source: https://ccl.yale.edu/sites/default/files/files/A%20Brief%20Introduction%20to%20Blockchain
Ledger
The decentralized ledger (Blockchain)
• Decentralization: get rid of the Third Party
• Satoshi paired two main technologies
• Proof of Work: to solve the double spending problem
• Elliptic Curves: to solve unique access to the ledger
• Nothing was newer than 2001
1. 2001: SHA-256 finalized
2. 1999-present: Byzantine fault tolerance
3. 1999-present: P2P networks
4. 1998: Wei Dai, B-money
5. 1998: Nick Szabo, Bit Gold
6. 1997: HashCash
7. 1992-1993: Proof-of-work for spam
8. 1991: cryptographic timestamp
9. 1980: public key crypto algorithm
Blockchain: Distributed Ledger Technology
What does a block look like?
Blockchain terminologies
● Transaction & blocks
o A transaction is a value transfer; a block is a collection of
transactions on the bitcoin network, gathered into a block that are
hashed and added to the blockchain.

Image source: https://pplware.sapo.pt/informacao/monero-xmr-uma-moeda-


Blockchain terminologies

● Mining
o This process of solving cryptographic problems using computing
hardware also triggers the release of cryptocurrencies

Source: https://marmelab.com/blog/2016/05/12/blockchain-expliquee-aux-
Blockchain terminologies

● Mining
o The process by which transactions are verified and added to a
blockchain.

Source:
Blockchain terminologies

● Mining
o Miners on the network select transactions from pools and form
them into a ‘block’.
Blockchain terminologies

● Forks
o A fork is the creation of an ongoing alternative version of the
blockchain, by creating two blocks simultaneously on different
parts of the network. This creates two parallel blockchains, where
one of the two is the winning blockchain.

o When does it happens?


• Block found at the same time
• Software incompatibility
• “We don’t agree” split
Blockchain terminologies

● Forks
Blockchain terminologies

● Bitcoin
o Crypto currency, first asset based on Blockchain
o Used for drug/weapons e-commerce, ransom ware
o Used for remittance, speculation, store of value

“What is needed is an electronic payment system based on


cryptographic proof instead of trust, allowing any two willing parties
to transact directly with each other without the need for a trusted
third party.”
Satoshi Nakamoto – October 31st, 2008

Source: https://medium.com/@flatoutcrypto/what-is-the-point-of-
Blockchain terminologies

● Bitcoin
o Monetary creation

Image source:
Blockchain terminologies

● Bitcoin
o Inside Bitcoin’s Blockchain
BLOCK
(Units of the blockchain, like pages of transactions in a ledger)

Header
(It is hashed twice to create the fingerprint which
is referred to in the next block)

Transaction count
(How many transactions are in the block,
including the coinbase transaction)

Block content
Coinbase transaction Bitcoin transactions
Blockchain terminologies

● Bitcoin
o Inside Bitcoin’s Blockchain
- Block Header : includes Technical
data, Previous block hash, Merkle Root,
Timestamp, Difficulty target, Nonce.
Here is an example:

Source:
Blockchain terminologies

● Bitcoin
o Inside Bitcoin’s Blockchain
- Block content : Transaction Flow
Mining Coinbase Regular Address to Address Transaction

Image source: Scorechain


Blockchain terminologies

● Bitcoin
o Inside Bitcoin’s Blockchain
- Block Transaction example:

Image source: www.blockchain.c


Blockchain terminologies

● Bitcoin
o How the
money transfer works

Image source: https://www.weusecoins.com/images/bitcoin-transaction-life-cycle-


Blockchain terminologies

● Ethereum
o Proposed in late 2013 by Vitalik Buterin (cryptocurrency researcher
and programmer)
o Online crowdsale during summer 2014
o Bitcoin on steroids!

“A blockchain is a magic computer that anyone can upload programs to


and leave the programs to self-execute, where the current and all
previous states of every program are always publicly visible, and which
carries a very strong cryptoeconomically secured guarantee that
programs running on the chain will continue to execute in exactly the
way that the blockchain protocol specifies.”
VitalVitalik Buterin
Source: https://medium.com/blockchain-review/how-does-the-blockchain-work-for-dummies-
Blockchain terminologies

● Ethereum
o Decentralised app platform (dapps)
o Transaction & smart-contracts ledger
o Based on the Ethereum Virtual Machine
(EVM)
o Cryptocurrency called ether (ETH)

Image source:
Blockchain terminologies

● Ethereum
o Smart Contract

How a “Traditional”
contract works:

Source: https://www.investopedia.com/terms/s/smart-contracts.asp
Blockchain terminologies

● Ethereum
o Smart Contract

How a “Smart Contract”


contract works:

Source:
Table of Contents K2
● Introduction
1. Blockchain terminologies
2. Distinction between databases and blockchain ledgers
● Cryptographic component
1. Cryptography, hash functions and digital signatures
● Consensus components
1. Principles and paradigms of distributed systems
2. Blockchain consensus algorithms
● Blockchain structures
1. Blockchain structure
2. Types of blockchain
Distinction between databases and blockchain ledgers

● Distinction between databases and blockchain ledgers


o It begins with architecture

● Databases

Source:
● Blockchain ledgers https://www.coindesk.com/inf
Distinction between databases and blockchain ledgers

Databases Blockchains
VS

Databases have admins & centralized No on is the admin or in-charge


control
Only entities with rights can access Anyone can access (public) blockchain
database
Only entities entitled to read or write Anyone with right proof of work can
can do so write on the blockchain
Databases are fast Blockchains are slow
No history of records & ownership of History of records & ownership of
digital records digital records

Source: https://coinsutra.com/blockchain-vs-data
Table of Contents K1
● Introduction
1. Blockchain terminologies
2. Distinction between databases and blockchain ledgers
● Cryptographic component
1. Cryptography, hash functions and digital signatures
● Consensus components
1. Principles and paradigms of distributed systems
2. Blockchain consensus algorithms
● Blockchain structures
1. Blockchain structure
2. Types of blockchain
Table of Contents K1
● Introduction
1. Blockchain terminologies
2. Distinction between databases and blockchain ledgers
● Cryptographic component
1. Cryptography, hash functions and digital signatures
● Consensus components
1. Principles and paradigms of distributed systems
2. Blockchain consensus algorithms
● Blockchain structures
1. Blockchain structure
2. Types of blockchain
Cryptography, hash functions and digital
signatures
● Cryptography: the encryption and decryption of data
o 2 main cryptographic concepts used in Blockchain:
- Hashing
- Digital Signatures

o 3 forms of encryption that are widely used:


Symmetric cryptography Asymmetric Hashing
cryptography
Same password to one password to encrypt, Maps to fixed size
encrypt & decrypt the other to decrypt

2 ways function Passwords come by pair 1 way function


Source: https://lisk.io/academy/blockchain-basics/how-does-blockchain-
Cryptography, hash functions and digital
signatures

Image source: Scorechain


Cryptography, hash functions and digital
signatures

Image source: Scorechain


Cryptography, hash functions and digital
signatures

Image source: Scorechain


Cryptography, hash functions and digital
signatures

Image source: Scorechain


Cryptography, hash functions and digital
signatures

Image source: https://pascalpares.gitbook.io/an-introduction-to-the-bitcoin-system/the-


Table of Contents K1
● Introduction
1. Blockchain terminologies
2. Distinction between databases and blockchain ledgers
● Cryptographic component
1. Cryptography, hash functions and digital signatures
● Consensus components
1. Principles and paradigms of distributed systems
2. Blockchain consensus algorithms
● Blockchain structures
1. Blockchain structure
2. Types of blockchain
Table of Contents K1
● Introduction
1. Blockchain terminologies
2. Distinction between databases and blockchain ledgers
● Cryptographic component
1. Cryptography, hash functions and digital signatures
● Consensus components
1. Principles and paradigms of distributed systems
2. Blockchain consensus algorithms
● Blockchain structures
1. Blockchain structure
2. Types of blockchain
Consensus components

● Principles and paradigms of distributed systems


o Byzantine fault tolerance (BFT): the dependability of a fault-
tolerant computer system, particularly distributed computing
systems, where components may fail and there is imperfect
information on whether a component has failed.
o The objective of BFT is to defend against failures of system
components with or without symptoms that prevent other
components of the system from reaching an agreement among
themselves, where such an agreement is needed for the correct
operation of the system.
o One example of BFT in use is bitcoin. The bitcoin network works in
parallel to generate a blockchain with proof-of-work allowing the
system to overcome Byzantine failures and reach a coherent global
view of the system’s state.

Source:
Table of Contents K1
● Introduction
1. Blockchain terminologies
2. Distinction between databases and blockchain ledgers
● Cryptographic component
1. Cryptography, hash functions and digital signatures
● Consensus components
1. Principles and paradigms of distributed systems
2. Blockchain consensus algorithms
● Blockchain structures
1. Blockchain structure
2. Types of blockchain
Consensus components

● Blockchain consensus algorithms


o Behind every cryptocurrency, there’s a consensus algorithm. No
consensus algorithm is perfect, but they each have their strengths.
In the world of crypto, consensus algorithms exist to prevent double
spending.

o Proof of Work (PoW)


o Proof of Stake (PoS)
o Delegated Proof of Stake (DPOS)
o Proof of Burn (PoB)
o Practical Byzantine fault tolerant Mechanism (PBFT)
o …

Source: https://www.newgenapps.com/blog/8-blockchain-consensus-
Consensus components

Image source:
Table of Contents K1
● Introduction
1. Blockchain terminologies
2. Distinction between databases and blockchain ledgers
● Cryptographic component
1. Cryptography, hash functions and digital signatures
● Consensus components
1. Principles and paradigms of distributed systems
2. Blockchain consensus algorithms
● Blockchain structures
1. Blockchain structure
2. Types of blockchain
Table of Contents K1
● Introduction
1. Blockchain terminologies
2. Distinction between databases and blockchain ledgers
● Cryptographic component
1. Cryptography, hash functions and digital signatures
● Consensus components
1. Principles and paradigms of distributed systems
2. Blockchain consensus algorithms
● Blockchain structures
1. Blockchain structure
2. Types of blockchain
Consensus components

● Blockchain structure
o No more client/server architecture with name roles

Image source: Scorechain


Consensus components

● Blockchain structure
o Peer-to-peer Architecture with pseudonymous client bearing key
pairs. Each node as a database copy.

Image source: Scorechain


Consensus components

● Blockchain structure
o Data structure:

Image source: Scorechain


Consensus components

● Blockchain structure
o Blocks of data:

Image source: Scorechain


Table of Contents K1
● Introduction
1. Blockchain terminologies
2. Distinction between databases and blockchain ledgers
● Cryptographic component
1. Cryptography, hash functions and digital signatures
● Consensus components
1. Principles and paradigms of distributed systems
2. Blockchain consensus algorithms
● Blockchain structures
1. Blockchain structure
2. Types of blockchain
Consensus components

● Types of blockchain
o There mainly three types of Blockchains that have emerged after
Bitcoin introduced Blockchain to the world.
 Public Blockchain:
no one in charge, anyone can participate in reading/writing/auditing the
blockchain (i.e. Bitcoin, Litecoin, etc.)
 Private Blockchain:
a private property of an individual or an organization, there is one in charge of
important things such as read/write or whom to selectively give access to read
or vice versa (i.e. Bankchain)
 Consortium or Federated Blockchain:
More than one in charge. A group of companies or representative individuals
come together and make decisions for the best benefit of the whole network
(i.e. r3, EWF)
Table of Contents K2
● Smart contract theory
1. Smart Contract Theory and architecture
2. Architectures and decentralized autonomous systems
● Smart contract application
1. Existing blockchain applications, related structures and
architectures
Table of Contents K2
● Smart contract theory
1. Smart Contract Theory and architecture
2. Architectures and decentralized autonomous systems
● Smart contract application
1. Existing blockchain applications, related structures and
architectures
Table of Contents K2
● Smart contract theory
1. Smart Contract Theory and architecture
2. Architectures and decentralized autonomous systems
● Smart contract application
1. Existing blockchain applications, related structures and
architectures
Smart Contract Theory and architecture

● Smart Contract Theory

o A computer protocol designed digitally facilitate, verify, or enforce


the negotiation or performance of a contract.
o It allows the performance of credible transactions without the third
parties.
o The transactions are traceable and irreversible.

Source: https://en.wikipedia.org/wiki/Smart_con
Smart Contract Theory and architecture

● Smart Contract architecture

* Transaction without smart contract


If
yes
Check if it Check if Message
is signed by there are will be
the enough added to Date: Price of Condi- Condi- Condi-
message coins for the before gasoline tion 3 tion 4 tion X
sender. the blockchain 31 Dec. >50$/ liter … … …
payment 2019…
If yes If yes

* Transaction with smart contract


Image source: Scorechain
Table of Contents K2
● Smart contract theory
1. Smart Contract Theory and architecture
2. Architectures and decentralized autonomous systems
● Smart contract application
1. Existing blockchain applications, related structures and
architectures
Architectures and decentralized autonomous systems

● DAO (Decentralized Autonomous Organization)


o An organization represented by rules encoded as a computer
program, which is transparent, controlled by shareholders and not
influenced by a central government.
o It's notionally like the example for getting funds for a small
conference, except that it includes much more. Members buy
shares in the DAO and can vote on things according to the number
of shares they have. The dreamers have the idea they'll replace
Democracy and run entire countries this way.
o The DAO was the largest crowdfunding in history, having raised over
$150m from more than 11,000 enthusiastic members. (ICO)
o A DAO’s financial transaction record and program rules are
maintained on a blockchain.
Source:
https://blog.erratasec.com/2016/06/etheriumdao-hack-
Table of Contents K2
● Smart contract theory
1. Smart Contract Theory and architecture
2. Architectures and decentralized autonomous systems
● Smart contract application
1. Existing blockchain applications, related structures and
architectures
Table of Contents K2
● Smart contract theory
1. Smart Contract Theory and architecture
2. Architectures and decentralized autonomous systems
● Smart contract application
1. Existing blockchain applications, related structures and
architectures
Smart contract application

● Example 1: Lottery
o Lottery without smart contract
Company
Organizer
Statuses

Payments Winner pick


Terms & Escrow account
conditions

Payment provider
Lottery
Terms &
conditions

participants
Smart contract application

● Example 1: Lottery
o Lottery with smart contract

Organizer

Smart
contract

participants
Smart contract application

● Example 2-1: Group wallets


o Enforcing at least 2 out of 3 people of a group to agree to create a
valid transaction

Andre Beth
2 <pubKeyAndrew> Carl
<pubKeyBeth> w
<pubKeyCarl> 3
CHECKMULTISIG Bitcoin
transaction

Blockchain
Smart contract application

● Example 2-2: Heritage wallets


o Enforcing that a transaction must be signed either by Camille OR by
Beth after 5 years

IF
<pubKeyCamille> Camill
CHECKSIG Beth
e
ELSE
<5 y> CLTV DROP
<pubKeyBeth> Bitcoin
CHECKSIG transaction
ENDIF

Blockchain
Smart contract application

● Example 2-3: Secure storage


o Enforcing that a transaction must be signed by either 3 devices in
different locations OR a recovery key deposited in the bank after 8
months
IF
3 <pubKeyHome>
<pubKeyMobile> Home Mobile Office Bank
<pubKeyOffice> OP_3
CHECKMULTISIG
ELSE
<8 m> CLTV DROP Bitcoin
<pubKeyBank> transaction
CHECKSIG
ENDIF

Blockchain
Existing blockchain applications, related
structures and architectures
● ERC-20
o Proposed on November 19, 2015 by Fabian Vogelsteller.
o A technical standard used for smart contracts on the Ethereum
blockchain for implementing tokens. (ERC: Ethereum Request for
Comment, 20: the number that was assigned to this request.)
o It defines a common list of rules that an Ethereum token has to
implement, allowing developers to program how new tokens will
function within the Ethereum ecosystem. These rules include how
the tokens are transferred between addresses and how data within
each token is accessed.
o + 142,200 ERC-20 token contracts (as of November 19, 2018): EOS,
Bancor, Qash, etc…

Source: https://en.wikipedia.org/wiki/ERC
Existing blockchain applications, related
structures and architectures
● ERC-721: a class of unique tokens
o A free, open standard that describes how to build non-fungible or unique
tokens on the Ethereum blockchain. While most tokens are fungible (every
token is the same as every other token, i.e.ERC-20), ERC-721 tokens are all
unique.
o It defines a minimum interface a smart contract must implement to allow
unique tokens to be managed, owned and traded.
● ERC-725: Ethereum Identity Standard
o A proposed standard for blockchain-based identity which lives on the
Ethereum blockchain.
o It describes proxy smart contracts that can be controlled by multiple keys
and other smart contracts, it can describe humans, groups, objects and
machines.
o Users should be able to own and manage their identity instead of ceding
ownership of identity to centralized organizations. Source:
http://erc721.org/
Block Chain usecase (dubai)

You might also like