Presentation is loading. Please wait.

Presentation is loading. Please wait.

Modified from Bob Vachon

Similar presentations


Presentation on theme: "Modified from Bob Vachon"— Presentation transcript:

1 Modified from Bob Vachon
Blockchain Cisco Networking Academy Program Routing and Switching Essentials v6.0 Chapter 5: Switch Configuration Modified from Bob Vachon

2 Preliminaries 5 - Switch Configuration 5.3 – Summary

3 Public Key Crypto: Encryption
Key pair: public key and private key

4 Public Key Crypto: Digital Signature
First, create a message digest using a cryptographic hash Then, encrypt the message digest with your private key Authentication Integrity Non-repudiation

5 Cryptographic Hash Functions
Consistent: hash(X) always yields same result One-way: given Y, hard to find X s.t. hash(X) = Y Collision resistant: given hash(W) = Z, hard to find X such that hash(X) = Z Hash Fn Fixed Size Hash Message of arbitrary length

6 Digital Signature

7 Merkle tree Binary tree with hash pointers! Drawback:
More number of blocks H( ) H( ) H( ) H( ) H( ) H( ) H( ) H( ) H( ) H( ) H( ) H( ) H( ) H( ) (data) (data) (data) (data)

8 Merkle tree H( ) H( ) H( ) H( ) H( ) H( ) Advantage:
Proving membership of a data block in the tree is easy Only need to show O(log n) items In other words, membership verification in O(log n) time/space How to prove non-membership? Sorted Merkle trees: Order leafs of the tree in some fashion, say lexicographically, numerically, etc. Verify membership of data before and after the missing one! Non-membership verification also takes O(log n) time/space H( ) H( ) H( ) H( ) H( ) H( ) (data)

9 Trust (or lack of it) 5 - Switch Configuration 5.3 – Summary

10 What is Blockchain List of transactions List of transactions List of transactions Hash of previous block Hash of this block Hash of this block Hash of previous block Hash of this block Hash of previous block A blockchain is a digital and distributed ledger that uses a continuously growing list of records (transactions), called blocks The ordered blocks are linked and secured using a cryptographic hash The transactions cannot be added to, modified or deleted Blockchain is a potentially disruptive technology

11 Blockchain as a disruptive technology
TRUST VERIFY Traditional services: Using a third party (intermediary) to provide trust in financial, business, legal and other types of transactions. Current trust models involve: Third party intermediaries such as banks, governments, credit reporting agencies, title companies, retail, insurance companies Examples: Using credit card, trusting bank to record everything accurately, wire transfer, currency is real and country will back it Trust but verify (Russian proverb) – All transactions involve the need to trust the intermediary but… also verify Blockchain changes how we trust – a fundamental currency in commerce

12 Ledger Deposit Cash $1,000 $1,000 3/1/2018 Receipt Withdraw Chk 100
Deposit/Withdraw Amount Balance Date Verification Deposit Cash $1,000 $1,000 3/1/2018 Receipt Withdraw Chk 100 $100 $900 3/2/2018 Checkbook Withdraw ATM $50 $850 3/3/2018 Receipt Deposit Payroll $400 $1,250 3/4/2018 Receipt Withdraw AcctFee $25 $1,225 3/5/2018 Receipt Withdraw Chk 102 $25 $1,200 3/6/2018 Checkbook Third party intermediaries such as banks use ledgers to record transactions Centralized ledger under the control of the "trusted" intermediary Transactions are recorded in a ledger, which at any time the intermediary can Added, modified, or deleted

13 Ledger Deposit Cash $1,000 $1,000 3/1/2018 Receipt Withdraw Chk 100
Deposit/Withdraw Amount Balance Date Verification Deposit Cash $1,000 $1,000 3/1/2018 Receipt Withdraw Chk 100 $100 $900 3/2/2018 Checkbook Withdraw ATM $50 $850 3/3/2018 Receipt Deposit Payroll $400 $1,250 3/4/2018 Receipt Withdraw AcctFee $25 $825 3/5/2018 Receipt Withdraw Chk 102 $25 $800 3/6/2018 Checkbook If a deposit is not recorded or not recorded correctly, difference of $400 in your checking account Bank can add a transaction fee with out our knowledge We trust that the intermediary will not make any improper or incorrect additions, modifications or deletions

14 Blockchain: A high level look
5 - Switch Configuration 5.3 – Summary

15 Ledgers and Digital Signatures
A ledger is a collection of economic transactions Commonly used as a list of debits and credits to track the monetary balance associated with an individual or an account. Typically, we use a trusted intermediary, such as a bank, to maintain this ledger We will use crypto currency to understand how blockchain can be used to maintain a ledger instead of an intermediary such as bank Instead of us needing to trust an intermediary, blockchain will provide the trust

16 Ledgers and Digital Signatures
$100 We will use a digital ledger (blockchain) to record all transactions between Jose and Maria This is just a high level view, so don't worry about the details…. We will discuss those soon If a transaction is added to this digital ledger: "Jose pays Maria $100"… Problem: How do we trust that a transaction is with Jose's approval? Solution: Digital signatures Jose will add his digital signature to the transaction What is a digital signature? Ledger Jose pays Maria $100 Jose's digital signature

17 What is a digital signature
This is a message. The digital signature with this message creates a unique hash. This is a different message. A slight difference makes the digital signature completely different. This is a different message. A slight difference makes the digital signature completely different! DS: DS: DS: A digital signature is a mathematical scheme for demonstrating the authenticity of digital messages or documents A digital signature cannot be copied because it is always different because is uses the message to help derive the signature Changing the message even slightly makes the digital signature completely different A digital signature has three parts Public key Secret key (aka private key) Message

18 Digital signature involves a function consisting of:
Message Secret key (private key) Public key Secret key (private key): Must be kept private and used to create a digital signature Used with the message to create a unique digital signature (bits) Public key: Used by someone to verify that the message with the digital signature was really created by the sender (using the secret key) A digital signature is stronger than a written signature because it changes with different messages, which means it can't be copied Again, changing the message even slightly makes the digital signature completely different It is computationally infeasible to create a valid digital signature without the private key

19 Creating a message with a Digital Signature
This is a message. The digital signature with this message creates a unique hash. Only you produced this message Digital Signature: Secret key (sk) 256 bit Signature Computationally infeasible to guess Verifying a message with a Digital Signature This is a message. The digital signature with this message creates a unique hash. TRUE or FALSE Digital Signature: Public key (pk) You can feel very confided that the message was created by the person who has this public key The message is digitally signed using: Message Secret key The message is verified using: Message Public key

20 Create Send Verify True
Jose creates a message and using his secret key (that only he knows), signs it with a digital signature Jose can now send that message with its digital signature to anyone. Maria receives Jose's message with the digital signature Maria has Jose's public key and uses it to verify that this message really did come from Jose Jose wants people to have his public key so they know messages were created by him If the message was really created using Jose secret key (that only Jose knows), then the result will be True If the digital signature is a fraud, the result will be False Create Send Verify True

21 In this example, the digital signature authenticates that this transaction happened with Jose's approval This transaction can be verified by anyone with Jose's public key $100 Ledger Jose pays Maria $100 Jose's digital signature Jose pays Maria $100 Jose pays Maria $100 Jose pays Maria $100

22 Blockchain has two fundamental differences than a traditional ledger:
New Transaction Gerlinde pays Jose $25 Blockchain has two fundamental differences than a traditional ledger: Each transaction has a key (hash) that is dependent upon the hash of a previous transaction The ledger is decentralized – multiple copies – any interested parties will have a copy The trust is that everyone receives and believes any new transactions, in the correct order, and that everyone is working with the exact same ledger To do this (high level), which ever ledger has the most computational work (cryptographic hash function) put into it – to attempt to fraud would be computationally infeasible. (coming)

23 Continuing to using a cryptocurrency to understand blockchain…
New Transaction Gerlinde gets $100 New Transaction Maria gets $100 $100 $100 New Transaction Matteo gets $100 $100 $100 New Transaction Jose gets $100 Continuing to using a cryptocurrency to understand blockchain… Everyone pays $100 to purchase Digital Dollars (DD) which is added to the ledger Everyone has a copy of the ledger These new transactions are copied to all ledgers and is verified (digital signature) Ledger 1. Gerlinde gets $100 2. Maria gets $100 3. Matteo gets $100 4. Jose gets $100

24 New Transaction Gerlinde gets $100 New New Transaction Maria gets $100 New Transaction Gerlinde pays Jose $25 New Transaction Gerlinde pays Jose $25 New Transaction Matteo gets $100 New Transaction Jose gets $100 New Transaction Gerlinde pays Jose $25 New Transaction Gerlinde pays Jose $25 A new transaction updates all copies of ledger and is verified (digital signature) Ledger 1. Gerlinde gets $100 2. Maria gets $100 3. Matteo gets $100 4. Jose gets $100 5. Gerlinde pays Jose $25

25 Invalid Transaction Maria pays Matteo $500 New New Transaction Maria pays Matteo $500 Invalid Transaction Maria pays Matteo $500 Invalid Transaction Maria pays Matteo $500 A running balance ensures that no one spends more than their balance Doing so would be an invalid transaction as if it did not have a valid digital signature The history of transactions is the currency If everyone is using the ledger, there is not need for a physical currency Ledger 1. Gerlinde gets $100 2. Maria gets $100 3. Matteo gets $100 4. Jose gets $100 5. Gerlinde pays Jose $25 6. Maria pays Matteo $500 Running Balance Gerlinde = $100 > $75 Jose = $100 > $125 Matteo = $100 Maria = $100 - $500 = -$400 (Overdrawn)

26 ✔ ✔ ✔ Initial (valid) Transaction
New Transaction: 101 Gerlinde pays Jose $25 Initial (valid) Transaction New Transaction: 101 Gerlinde pays Jose $25 New Transaction: 101 Gerlinde pays Jose $25 New Transaction: 101 Gerlinde pays Jose $25 Each record in the ledger must be a unique transaction We need to ensure that someone doesn't just copy the same transaction multiple times, such as Jose copying "Gerlinde pays Jose $25" The digital signature would be the same for each copy of the same transaction and it would be considered "valid" because the digital signature is valid To ensure that Jose doesn't duplicate the transaction multiple times (with the valid digital signature), the initial transaction must contain a unique ID The unique ID is part of the message, therefore affects the digital signature Each new transaction on the ledger, with a unique transaction ID, requires a new digital signature and therefore can't be duplicated

27 ✖ ✖ ✖ ✖ ✖ ✖ Duplicate (invalid) Transactions
New Transaction: 101 Gerlinde pays Jose $25 New Transaction: 101 Gerlinde pays Jose $25 New Transaction: 101 Gerlinde pays Jose $25 New Transaction: 101 Gerlinde pays Jose $25 New Transaction: 101 Gerlinde pays Jose $25 New Transaction: 101 Gerlinde pays Jose $25 New Transaction: 101 Gerlinde pays Jose $25 New Transaction: 101 Gerlinde pays Jose $25 If Jose attempted to send a duplicate transaction, the consensus of the other ledgers would show this is a duplicate and therefore invalid

28 ✔ ✔ ✔ ✖ ✖ ✖ ✖ ✖ ✖ Initial (valid) Transaction
New Transaction: 101 Gerlinde pays Jose $25 Initial (valid) Transaction New Transaction: 101 Gerlinde pays Jose $25 New Transaction: 101 Gerlinde pays Jose $25 New Transaction: 101 Gerlinde pays Jose $25 Duplicate (invalid) Transactions New Transaction: 101 Gerlinde pays Jose $25 New Transaction: 101 Gerlinde pays Jose $25 New Transaction: 101 Gerlinde pays Jose $25 New Transaction: 101 Gerlinde pays Jose $25 New Transaction: 101 Gerlinde pays Jose $25 New Transaction: 101 Gerlinde pays Jose $25 New Transaction: 101 Gerlinde pays Jose $25 New Transaction: 101 Gerlinde pays Jose $25

29 Invalid! My ledger shows you balance is only $100
My balance is now $150 $50 $125 Invalid! My ledger shows you balance is only $100 The history of the transactions is the currency The history of transactions, that is agreed to by everyone (consensus), is what allows this ledger (these transactions) to be trusted The leger is not centralized like a bank, but is decentralized Every transaction is sent to everyone else with that ledger But how can we guarantee that when someone sends a transaction that everyone else received it? What if Gerlinde gave Maria $50, which updates Maria's balance to from $100 to $150 Then Maria tries to give Jose $125, however Jose never received the transaction that Gerlinde gave Maria $50, so he believes Maria doesn't have enough money and invalidates the transaction

30 When a change is made, the transaction is sent to everyone with that ledger
Important that everyone has a copy of the same, accurate ledger Important that we have a way to agree everyone on what the right ledger is How to ensure that everyone else is recording the same transactions and in the same order Everyone must be listening for and receiving all transactions Need a way to accept or reject transactions Need a way to know if you can trust a ledger Bitcoin uses Computational work – Trust which ever ledger has the most computational work This uses a cryptographic hash function

31 Blockchain: A deeper look
5 - Switch Configuration 5.3 – Summary

32 + Fraud computationally infeasible Computational work
Ledger + Computational work Fraud computationally infeasible Blockchain uses one of two methods to solve these problems: Proof of work Proof of stake Proof of work - Uses a hash function

33 Proof of work (PoW) - Uses a hash function
Hash or Digest File Hash function 256 bits Unpredictable Same input generates same output One change produces a completely different result Hello Luigi SHA256 File Hash or Digest Hash function hello Luigi SHA256 Proof of work (PoW) - Uses a hash function A hash function is a function that takes in input data, and from that input creates an output of a fixed length (such as 256 bits), known as the hash or the digest of the message Looks random but isn't - The same input will always generates the same output Changing a single character in the input will change the hash or digest completely, in an unpredictable manner

34 Given this Digest find the input that would generate it….
? Hash or Digest Hash function ? SHA256 A cryptogrpahic hash function means it is computationally infeasible to compute in the reverse direction If given the 256 bits (Digest), find the input that the SHA256 function would generate this exact string of 256 bits, is almost impossible The computation to go through 2256 is astounding!!! Proof of work = SHA256

35 The only way to do this is by guessing
Proof of Work (PoW) Ledger 1. Gerlinde gets $100 2. Maria gets $100 3. Matteo gets $100 4. Jose gets $100 5. Gerlinde pays Jose $25 Hash or Digest Hash function SHA256 Special number at the end of the ledger so when SHA256 is applied to the entire ledger the first 30 bits are all 0s. A special number is added to the end of the ledger so when SHA256 is applied to the ledger with this value, the first 30 bits are all 0s This is known as the proof of work (PoW) It takes a great deal of computation to find a number that when used with the input data creates digest with the first 30 bits of all 0s The probability that any 256 bit has starting with 30 successive 0s is 1 in 230 or approximately 1 in a billion The only way to do this is by guessing

36 The number of consecutive zeros requires more computational work
Proof of Work 1? 2? 3? … "This is taking too long!" "Not for the average computer but I did it!" The only way to do this is by guessing the special number until you get a digest starting with 30 consecutive 0s It takes a lot of computational work for a computer to finally arrive at this special number The number of consecutive zeros requires more computational work If you change the ledger, even slightly, you would have to go through another billion guesses to find the digest starting with 30 consecutive 0s

37 Difficult to compute But easy to verify
"I found the special number to create the digest starting with 30 zeros. I did all the hard work!" "I only had to use the number given and with the file apply SHA256. If the result is 30 consecutive zeros then it is verified. That was easy!" It takes a lot of computation work to find a special number to add to the end of the ledger, that when SHA256 is applied will create a digest with 30 consecutive zeros However, it is easy to verify because all the work has already been done To verify, you just add the number to the end of the ledger, apply SHA256 to the ledger and verify that the digest starts with 30 consecutive zeros

38 Getting back to our cryptocurrency…
This is an example of how a cyptocurrency might work We have a distributed ledger system, with all transactions broadcasted to everyone else It is important that they all agree on what the correct ledger is The core idea is that everyone will trust which ever ledger has the most computational work put into it

39 Block Block Block The ledger is organized as a collection of blocks
Prior Digest 1. Gerlinde gets $100 [Digital Signature] 2. Maria gets $100 PoW Prior Digest 3. Matteo gets $100 [Digital Signature] 4. Jose gets $100 PoW Prior Digest 5. Gerlinde pays Jose $25 [Digital Signature] PoW SHA256 SHA256 SHA256 The ledger is organized as a collection of blocks Every transaction in each block has been verified using its digital signature Each block also contains the hash of the previous block This to maintain the order of these blocks and to make it computationally infeasible to modify a block or change the order of the blocks

40 Block Block Block Each block contains:
Prior Digest 1. Gerlinde gets $100 [Digital Signature] 2. Maria gets $100 PoW Prior Digest 3. Matteo gets $100 [Digital Signature] 4. Jose gets $100 PoW Prior Digest Block Reward - $0.05 5. Gerlinde pays Jose $25 [Digital Signature] PoW SHA256 SHA256 SHA256 Each block contains: The hash (proof of work) of the prior block A maximum number of transactions and their digital signatures The hash (proof of work) computed for this block consists of the hash of the previous block along with all the transactions and their digital signatures

41 Block 4 Block 7 Block Prior Digest 1. Gerlinde gets $100 [Digital Signature] 2. Maria gets $500 PoW Prior Digest 3. Matteo gets $100 [Digital Signature] 4. Jose gets $100 PoW Prior Digest 5. Gerlinde pays Jose $25 [Digital Signature] PoW 1 3 6 9 SHA256 SHA256 SHA256 and so on 2 5 8 So a change to a block would change that block's hash, which changes the next block's hash, which changes the next block's hash, all the way to the last block That would require doing all the computational work for every block including finding a new special number for the modified block that starts with 30 consecutive 0s, changing the previous hash on the next block, finding a new special number for that block, and so on

42 Block Block Block Prior Digest 73781183740057
1. Gerlinde gets $100 [Digital Signature] 2. Maria gets $100 PoW Prior Digest 3. Matteo gets $100 [Digital Signature] 4. Jose gets $100 PoW Prior Digest 5. Gerlinde pays Jose $25 [Digital Signature] PoW SHA256 SHA256 SHA256 This is why it is called a "block chain" Each block is chained together with the hash of the previous block Any change to a block affects all the blocks after it Increasing the number of consecutive 0's, for example to 60 consecutive zeros, in the proof of work will increase the amount of computation needed This will make it even more infeasible for someone to make changes to the blockchain

43 Blockchain – Each block is a list of transactions, with a hash of the previous block and hash of this block. The hash is computed using the hash of the previous block, and all transactions with their digital signatures

44 1. A new transaction is created and broadcasted to everyone
4 4 New transaction 1 4 4 3 2 Process 1. A new transaction is created and broadcasted to everyone 2. A block creator, known as a miner, does the proof of work For cryptocurrencies like bitcoin, a block reward is added to the block Miner: Listen for transactions, performing the proof of work, broadcasting the block, and getting rewarded 3. The miner broadcasts that block to everyone 4. Others in the blockchain verify the proof of work and then add the block to the chain

45 I don't need to listen for transactions, only new blocks
New transaction I did it! I don't need to listen for transactions, only new blocks There are usually many miners They are all performing the (verifying of the digital signature and the transaction) computational proof of work Whoever finds right special number that results in the required number of zeroes first, broadcasts the block and receives the block reward Anyone who just wants to participate as a source/receiver of transactions does not have to worry about doing any of the computational proof of work They don't have to listen for transactions, only new blocks to update their blockchain

46 Trust is not given to a central authority,
Maria If two distinct blockchains are received with conflicting transactions, the longest blockchain is accepted this is the one with the most computational proof work Trust is not given to a central authority, but is given to the the blockchain with the most computational proof of work The receiver may not trust a new block immediately, but wait for several new blocks to be added to it

47 Trust Digital Signature Summary Trust Digital signatures
The ledger is the truth or the currency in a crypto currency Decentralize Proof of work Blockchain Decentralize Proof of Work Blockchain


Download ppt "Modified from Bob Vachon"

Similar presentations


Ads by Google