Upgrade to Pro — share decks privately, control downloads, hide ads and more …

2022 - Blockchain - Lesson 01

2022 - Blockchain - Lesson 01

Introduction to Blockchain technologies, glossary, trusted and untrusted transactions,



May 05, 2022

More Decks by Aletheia

Other Decks in Technology


  1. www.neosperience.com | blog.neosperience.com | info@neosperience.com Neosperience Empathy in Technology Introduction

    to Blockchain technologies May, 5th 2022
  2. Luca Bianchi Who am I? github.com/aletheia https://it.linkedin.com/in/lucabianchipavia https://speakerdeck.com/aletheia Chief Technology

    Of fi cer @ Neosperience Chief Technology Of fi cer @ WizKey Serverless Meetup and ServerlessDays Italy co-organizer www.bianchiluca.com @bianchiluca
  3. What is a Blockchain?

  4. of course! Blockchain is…

  5. ✓ Something fancy to earn money ✓ A Buzzword ✓

    A technology to ensure trusted transactions between untrusted actors without intermediaries
  6. What is the Bitcoin? Keep it simple, the way you

    would explain it to my mother
  7. First, it’s not a currency What is Bitcoin (BTC)? It’s

    an exchange medium, subject to high volatility, perfectly de fi ned by demand/o ff er mechanism Second, it’s not a FIAT money It has some important di ff erences: •decentralized - no Federal Reserve or BCE to control BTC value •no in fl action - the overall number of BTC is fi xed (21M) •no reversal - transactions cannot be reversed because become part of the trust • no real economy - BTC value is not constrained to any state economics Third, it does not require a bank Money transfers can be achieved between two peers
  8. You can buy them — trade $ for BTC How

    to obtain Bitcoins (BTC)? Cryptocurrencies can be traded on markets: websites that handle conversions, deposits and retrieval of cryptocurrencies. To be purchased a crypto currency needs to be listed on a given markets. 
 Remember blockchain has never been hacked, but markets can be hacked (and have been).
  9. A BTC account What do you need to trade BTCs?

    Every transaction has a source and a destination which are numeric equivalents to traditional bank account numbers. An user can have one or more addresses (since their creation is as easy as clicking a button) A private/public key pair Each account is paired to a couple of keys. The BTC account is the hash of a public key. To recover and claim ownership of an account, you need the private key counterpart. Remember your keys are the only way an account can be recovered. There is no bank in the middle to guarantee your identity. A Wallet Many addresses can receive/send cryptocurrencies, to safely store key pairs, some tools, named “wallets” have been created. There are many wallets around, some of them are online but not reliable while others are physical and more safe top hold signi fi cant amounts of money (hardware wallets, paper wallets)
  10. BTC wallets

  11. None
  12. https://www.gdax.com/trade/BTC-EUR

  13. Will I be rich trading BTC?

  14. You can buy them — trade $ for BTC How

    to obtain Bitcoins (BTC)? Cryptocurrencies can be traded on markets: websites that handle conversions, deposits and retrieval of cryptocurrencies. To be purchased a crypto currency needs to be listed on a given markets. 
 Remember blockchain has never been hacked, but markets can be hacked (and have been). You can mine them… mining... WTF is Bitcoin mining? wait... we have to talk about the Blockchain!
  15. Introducing Blockchain

  16. Blockchain !== Bitcoin

  17. Blockchain IS NOT Bitcoin Liberating blockchain technology from its application

    to cryptocurrencies is important in understanding the broader implications and applications of blockchain technology. The Disintermediation of Everything The revolutionary idea behind Bitcoin was to form a digital alternative to fi at currency, but free from the need for a central bank. Blockchain technology enables a ledger of information to be distributed among an “ecosystem” of interested participants. In the dominant form of the technology, no single participant controls the ledger and everyone has an identical copy of it. The ledger’s integrity is maintained by consensus of the participants and a method for encoding information into the ledger is based on axiomatic mathematical relationships The ledger’s transactions cannot be re-written in any way, shape or form; Transactions cannot be repudiated, meaning that party X and party Y can never deny that the transaction took place. Transactions in the ledger are forever, for always and for all time: they can not be undone once entered, only reversed with another negating transaction. The Ledger
  18. Partial (wrong) de fi nition A de fi nition of

    Blockchain the blockchain is the technology running bitcoin A better de fi nition A blockchain is a distributed database that maintains a continuously-growing list of records called blocks secured from tampering and revision An even better de fi nition The blockchain is a secured protocol enabling peer-to-peer exchanges on a distributed network in a secured, public and non repudiable way.
  19. Which problem does the blockchain solve?

  20. An extension to Common Law Trust mechanism Trust Born as

    a fi duciary relation between two parties with a supervisor, it has been extended to almost every transaction that has to bee guaranteed by a third party. It borrows from Common Law the terminology: Settlor - is the part that wants to contribute something to a bene fi ciary 
 Bene fi ciary - is the part receiving something from a Settlor Protector - is an optional actor, that guarantees the trusted relation. If there is not a protector, the transaction is untrusted Transactions can be trusted or untrusted • Trusted transactions can be veri fi ed • Trusted transactions cannot be reversed once registered • Trusted transactions require a place where are stored, called general ledger • The Protector is a key actor in a trusted transaction (cannot occur without) Duty of a Protector A Protector maintains and guarantees the consistency of the ledger, that is the source of truth. The trust must be within the Protector: a malicious or faulty protector can break the trust. 

  21. Peer to peer transaction (untrusted) Untrusted transactions • A good

    is exchanged between two actors 
 • The good end of the transaction relies on both actor consensus about such transaction • Any actor can contest transaction 
 • Even more di ff i cult when extending to n participants
  22. Intermediated transactions (trusted) Trusted transactions • A good is sent

    to the Protector, that stores it, partial transaction recorded into the ledger 
 • The Protector sends the good to Bene fi ciary, transaction completion recorded into ledger 
 • At any time, ledger can be consulted 
 • Protector trustworthiness is given for granted need a hierarchy of Protectors to transfer trust)
  23. Trust problems examples

  24. Example - Bank Transactions

  25. Real Estate Example - Others Each ownership transaction between a

    seller and a buyer of a real estate is executed by a third party that acts on government behalf to record and execute transfers Democracy When a proposal or a candidate is voted, a third party (a teller at a pool) is required to count and validate votes, then crediting scores to the corresponding competitor. Quality Assurance When a certi fi cation is required to establish a statement of quality for a given product or service, an external organization (a certi fi cation company) is required to validate quality and provide trust information
  26. Example Bob is looking for a new suite Sally runs

    an online store and sells clothes
  27. Example

  28. Trustiness A protector must be certi fi ed itself as

    trustworthy, because it represents the source of truth of the transaction Issues with Protector Scalability A protector is required for each transaction that must occur, moreover some additional e ff ort is needed to guarantee ledger consistency across multiple Cost Since Protector is a key role within a transaction and brings a lot of responsibility (and often bureaucracy) its work has to be payed a considerable amount of money, often proportional to the value of exchanged good Censorship A protector can decide whether a transaction can occur or not
  29. Blockchain Architecture

  30. None
  31. 1. Node Application The four technologies of a blockchain the

    blockchain ecosystem constitutes a service overlay network (SON) and to be a node in the network your computer must be able to process application-speci fi c messages and a ff ect the shared state of the SON. Regardless of how one is quali fi ed, once one has a node application one can participate in the respective blockchain ecosystem. 2. Shared Ledger It is a logical component. The distributed ledger is a data structure managed inside the node application. Once you have the node application running, you can view the respective ledger (or blockchain) contents for that ecosystem. Regardless of how many ecosystems you are a participant in, there is only one shared ledger for each ecosystem.
  32. 3. Consensus Algorithm The four technologies of a blockchain The

    consensus algorithm is implemented as part of the node application, providing the ‘rules of the game’ for how the ecosystem will arrive at a single view of the ledger. Di ff erent ecosystems have di ff erent methods for attaining consensus depending on the desired features the ecosystem needs. There are di ff erent methods proof-of-work (PoW), proof-of-stake (PoS), etc. 4. Virtual Machine A virtual machine is a representation of a machine (real or imaginary) created by a computer program and operated with instructions embodied in a language. It is an abstraction of a machine, held inside a machine. The Virtual Machine o ff ers the abstraction layer of the blockchain instruction set in a distributed computing model.
  33. How does Blockchain work?

  34. A digital wallet Components of a simple transaction Originates or

    receives a transaction, in the form of a receipt, are expressed as digital number A Block within the blockchain Blocks hold batches of valid transactions that are hashed and encoded into a Merkle tree (an hashed tree). Each block includes the hash of the prior block in the blockchain, linking the two. The linked blocks form a chain. This iterative process con fi rms the integrity of the previous block, all the way back to the original genesis block. Consensus and proof of work Bitcoin’s blockchain achieves consensus through sequential cryptographic hashing of the transactions and the fi nal ‘proof- of-work’ validation. A cryptographic hash function takes a message (transaction value) and converts it into an alphanumeric value. Hash functions are nearly impossible to invert thus the input value of a hash function can never be determined from its output value. Also, a small change to the input dramatically changes the output. In a blockchain protocol, the header of the latest block is a combined hash value of the set of latest transactions. To this combined hash number is appended a random number called the nonce.
  35. Block structure A Block is a data structure that collects

    the veri fi ed transactions to be included in the blockchain. A block consists of a header which contains various other metadata and collection of transactions. The block header is 80 bytes, and the average transaction is at least 250 bytes. Generally, a block contains more than 500 transactions, leading to the block size on average of 1 MB. The collected transactions are recorded in the block in the form of a Merkle tree
  36. Merkle Tree It is a binary hash tree which uses

    SHA256 algorithm to encrypt the transactions and create a summary of all transactions in the block. It is possible to create a huge block of transactions using a Merkle tree, but it will eliminate participation of nodes with low computing resources. Let us assume there are transaction T1 and T2: 
 Then, Hash(T1) = SHA256(SHA256(T1)) Hash (T1 T2) = SHA256(SHA256 Hash(T1) + Hash(T2))
  37. None
  38. Other terms Block time: It takes a certain amount of

    time for the miners to fi nd a solution to include transactions in a block, which is called as Block time. Transaction pool: Miners consider a transaction pool which contains all the transactions for block generation and mining. Block size: Block size determines the space reserved for each block which may depend on the number of transactions included in the block. For bitcoin, the block size is designed at 1MB. Con fi rmation: A transaction is con fi rmed only after it is veri fi ed by the participants in the network and collected into the block. Then it is appended to the blockchain, after which reversing of the transaction is not possible Di ffi culty: Blockchain di ff i culty is de fi ned as the complexity to generate a block or successfully validate a set of transactions to collect into a block. Hashrate: Number of hashes a miner can generate per second to while mining a block is hashrate
  39. Double spending problem The transactions may be broadcasted to all

    the nodes in the distributed network, but the transactions may arrive at a di ff erent time. One party may be involved in a number of consecutive transactions in a short amount of time. Each transaction may be propagated as they were created, but they may not be received by the nodes in the order in which they are generated. As shown in fi gure 2.6, the 2nd transaction may be validated before the 1st transaction, thus creating a problem 11 of double spending
  40. Consensus problems

  41. The Sybil attack a reputation system is subverted by creating

    multiple identities.[4] A reputation system's vulnerability to a Sybil attack depends on how cheaply identities can be generated, the degree to which the reputation system accepts inputs from entities that do not have a chain of trust linking them to a trusted entity, and whether the reputation system treats all entities identically.
  42. A fault tolerance problem Each division has its own commander/general

    who is backed by one or more lieutenants. Generals sends messages to liutenants and to other divisions. A message can be either “attack” or “retire” Coordinated Attack Leading to Victory Uncoordinated Attack Leading to Defeat
  43. Mining and PoW

  44. Proof-of-Work (PoW) The prover proves to others (the veri fi

    ers) that a certain amount of a speci fi c computational e ff ort has been expended. Veri fi ers can subsequently con fi rm this expenditure with minimal e ff ort on their part. A key feature of proof-of-work schemes is their asymmetry: the work – the computation – must be moderately hard (yet feasible) on the prover or requester side but easy to check for the veri fi er or service provider. This idea is also known as a CPU cost function, client puzzle, computational puzzle, or CPU pricing function. Advantages of PoW Proof of work has some powerful advantages, especially for a relatively simple but hugely valuable cryptocurrency like Bitcoin. It’s a proven, robust way of maintaining a secure decentralized blockchain. As the value of a cryptocurrency grows, more miners are incentivized to join the network, increasing its power and security. Because of the amount of processing power involved, it becomes impractical for any individual or group to meddle with a valuable cryptocurrency’s blockchain.
  45. Trustiness Proof-of-work Introducing the hash function, which is a mathematical

    function f(x) —> y that: 1. for any length of x it produces always an y of a given length 
 2. function cannot be inverted (i.e. does not exist a g(y) —> x function) 
 3. a slightly change of x values produces a signi fi cant change of y 4. there is no an x’ ≠ x that has the same y value consider having an x made of a fi xed number (obtained to previous block) and a variable number (called nonce), so x = fi xed + nonce nonce is a random value, we de fi ne a valid POW when nonce value produces a given y that has a value smaller than a given number. Miners try di ff erent nonces ‘till they match the required output, once this is done, it represents the POW of the block. Once a POW has been found, the corresponding block is added to the chain. The blockchain adjust the required maximum value of the output y and this is called di ffi culty. Di ffi culty is needed to guarantee blockchain reliability and fi xed mining throughput.
  46. Proof-of-work (energy)

  47. Security through time

  48. Thank you.

  49. bit.ly/blockchain-2022-01

  50. Empathy in Technology

  51. www.neosperience.com | blog.neosperience.com | info@neosperience.com