19ITEN1007 - Block Chain Technologies Unit 1 - Block Chain Characteristics DEPARTMENT OF INFORMATION TECHNOLOGY Ms.K.Saranya AP/IT
UNIT I - Introduction to Block Chain Concepts Block Chain Characteristics – Chaining of Blocks - Hashing - Merkle Tree - Consensus - Mining and Finalizing Blocks - Currency Aka Tokens - Security on Block chain - Data Storage on Block chain - Wallets - Coding on Block chain: Smart Contracts - Peer-to-Peer Network - Types of Block chain Nodes - Risk Associated with Block chain Solutions - Life Cycle of Block chain Transaction. 2 19ITEN1007 - Block Chain Technologies
Block Chain Formal Definitions Harvard Business Review: blockchain is an open, distributed ledger that can record transactions between two parties efficiently and in a verifiable and permanent way. Merriam Webster : A digital database containing information (such as records of financial transactions) that can be simultaneously used and shared within a large decentralized, publicly accessible network or the technology used to create such a database. A system in which participants of a peer-to-peer network maintain distributed ledger that is secure, practically immutable and auditable. 3 19ITEN1007 - Block Chain Technologies
Block Chain Characteristics 5 Distributed: Blockchain processes and stores data at multiple participants and so, by nature, blockchain is a distributed system. Decentralized: There is no single decision-making authority that exists in blockchain network; the decision to store or reject certain data is taken collectively by participants based on preset rules . Highly available: Distributed and decentralized nature of blockchain network helps ensure consumers that the network always has a node available to serve the requests. 19ITEN1007 - Block Chain Technologies
Block Chain Characteristics 6 Immutable: Transactions permanent on blockchain ledger and makes it immutable. Transparent: All the participants have a copy of ledger entries. Sharing of data and logic encourages transparency in blockchain . Auditable: Blockchain does not only share current state, but the entire journey or journal or log of how the state has been arrived. The log is available for each node to inquire. This makes activities happening on blockchain auditable . 19ITEN1007 - Block Chain Technologies
Block Chain Characteristics 7 Secure: Blockchain extensively utilizes encoding and encryption mechanisms for transaction creation, broadcast, and storage. Blockchain , at design, does not encourage or force participant nodes or users of participant nodes to store any information that can help identify a user or participant in the real world. Supporting Privacy: Blockchain does not identify individuals with identifiers that store personal information. Also, for transactions initiated by party A with party B, with cryptographic technologies used with blockchain , transactions can be initiated by party A without knowing any private information about party B . 19ITEN1007 - Block Chain Technologies
Block Chain Characteristics 8 Democratization of trust: It allows participants to decide and execute rules or choose a decision-maker transparently for each transaction. This makes “trust” more democratic in the sense that a trustworthy peer is chosen each time from peers; the chosen node is not “appointed”. 19ITEN1007 - Block Chain Technologies
Chaining of Blocks 9 Sample Block Structure Blocks will get a unique identifier based on the contents of the data. These identifiers are created using called hashing. 19ITEN1007 - Block Chain Technologies
Chaining of Blocks 10 Chaining of Blocks 19ITEN1007 - Block Chain Technologies
Chaining of Blocks 12 Each block shall have four sections: identifier, data, timestamp, and identifier of the previous block. The first block in the chain is usually called genesis block. This block does not get confirmed till it gets enough data (1 KB) that it can hold. Whenever 1 KB of data is confirmed, update “data” of BLOCK-01 to received data. The identifier for BLOCK-01 will be created using contents of the block including “data”, “timestamp”, and “previous block identifier” of BLOCK-01. 19ITEN1007 - Block Chain Technologies
Hashing 13 Hash Function: Used to connect the “blocks” in a blockchain in a tamper-proof way. Takes any string as an input. Input M: The message. Fixed size output. Output H(M): This as the message digest. 19ITEN1007 - Block Chain Technologies
Hashing Cryptographic hash functions are one of the key components of blockchain . These functions are part of some of the building block functions that help implementation of features such as security, privacy, and consensus on blockchain platforms. There are different types of cryptographic hash algorithms are available they are Message digest algorithm or MD5, secure hash algorithm (SHA ). 14 19ITEN1007 - Block Chain Technologies
Hashing 15 19ITEN1007 - Block Chain Technologies
Hashing Fixed Output Size Deterministic Compute Easy Pre Image Resistance Second Pre Image Resistance Collision Resistance 16 19ITEN1007 - Block Chain Technologies
Fixed Output size 17 C ryptographic hash functions, output string size remains same irrespective of input string size. 19ITEN1007 - Block Chain Technologies
Deterministic 18 If the input is same, the output will also always be same. If the function is applied on the same input any number of times, the resultant answer will always be same. Any number of times SHA-1 function is executed on string “BLOCKCHAIN HOLDS A GREAT PROMISE”, the hash generated will always be same, x‘82FF9EBDDEF5D1299B0B5C61DE0E245ACB2603160 ’. 19ITEN1007 - Block Chain Technologies
Compute Easy 19 Creating hash value is not compute intensive; it does not need special hardware and can be completed reasonably fast and not hold up the end user. This has made these functions popular for signature validation, consensus scenarios for the blockchain . 19ITEN1007 - Block Chain Technologies
Pre Image Resistance 20 It is not computationally easy to derive input for a given output, H1 = hash(string1). 19ITEN1007 - Block Chain Technologies
Second Pre Image Resistance 21 This property means given an input and its hash, it should be hard to find a different input with the same hash. H1=hash(s1), it is not easy to find s2, such that s1<>s2 and H1 =hash(s2). 19ITEN1007 - Block Chain Technologies
Collision Resistance 22 If the input is same, the output will also always be same. If the function is applied on the same input any number of times, the resultant answer will always be same. Any number of times SHA-1 function is executed on string “BLOCKCHAIN HOLDS A GREAT PROMISE”, the hash generated will always be same, x‘82FF9EBDDEF5D1299B0B5C61DE0E245ACB2603160 ’. 19ITEN1007 - Block Chain Technologies
Merkle Trees A Merkle Tree, also known as a Binary Hash Tree is a data structure used for efficiently summarizing and verifying the integrity of large sets of data . Each block in the bitcoin blockchain contains a summary of all the transactions in the block, using a Merkle Tree. 24 19ITEN1007 - Block Chain Technologies
Merkle Tree Split the source data into smaller chunks ( Data 1, Data 2, Data 3, Data 4). Hash Value for each chunk is calculated Pair the hash value of adjacent chunk are concatenate and keep repeating this process till a single hash value left. This single hash value is called Merkle root. 25 19ITEN1007 - Block Chain Technologies
Merkle Trees Merkle Trees are binary trees containing cryptographic hashes. The term “tree” is used in computer science to describe a branching data structure, but these trees are usually displayed upside down with the “root” at the top and the “leaves” at the bottom . The merkle tree is constructed bottom-up. 26 19ITEN1007 - Block Chain Technologies
Duplicating One Data Element An even number of data elements, by duplicating one data element. T he merkle tree is a binary tree, it needs an even number of leaf nodes. If there is an odd number of transactions to summarize, the last transaction hash will be duplicated to create an even number of leaf nodes, also known as a balanced tree . 27 19ITEN1007 - Block Chain Technologies
A Merkle Tree Summarizing Many Data Elements 28 19ITEN1007 - Block Chain Technologies
Consensus Blockchain is to agree on data to be inserted and create a block of data. Decision-making process where participants agree on decisions of creating a block is called consensus. In the context of blockchains and cryptocurrencies , proof-of-work ( PoW ) and proof-of-stake ( PoS ) are two of the most prevalent consensus mechanisms. 29 19ITEN1007 - Block Chain Technologies
Byzantine General’s Problem 30 19ITEN1007 - Block Chain Technologies
Proof-of-Work 31 Proof-of-work ( PoW ) is one of the consensus mechanisms in early cryptocurrency blockchain networks such as Bitcoin . The idea here is participants should do certain activity and show a proof that it is done. All other participants shall be able to verify easily that the activity has happened based on some evidence. 19ITEN1007 - Block Chain Technologies
Proof-of-Work 32 PoW gives equal opportunity for all participants; every participant gets equal chance to prove that they have done the work. Blockchain networks that use PoW try to incentivize by rewarding those who put more efforts and are able to solve the puzzle . 19ITEN1007 - Block Chain Technologies
Proof-of-Stake 33 PoW where participants would invest in computing resources, in PoS participants need to invest through cryptocurrency . PoS is planned to be used in Ethereum . All participants have the same base data. The creator of the block does not get any incentive. Block creators publish the block to all participants. Participants, who are also called validators, would bet on next block that is proposed to be added . 19ITEN1007 - Block Chain Technologies
Mining and Finalizing Blocks Blockchain networks, Consensus decision is about composing the block . Participant nodes try to compose the block, they also communicate the transactions to each other . E ach of the participants have their own block composition that they want to all participants to agree on. 34 19ITEN1007 - Block Chain Technologies
Mining and Finalizing Blocks Public blockchain network that supports cryptocurrencies , transactions that perform exchange of currencies form data that is to be put in the block. The currencies also called tokens . O ne token as a unit of currency, say a dollar, a pound, or a rupee. 35 19ITEN1007 - Block Chain Technologies
Mining and Finalizing Blocks A participant that is investing efforts in creation of the blocks is helping the network sustain itself and so this participant will be incentivized. Part of this incentive comes in the form of fees that the participant charges to individuals who are performing transactions . Creating “new money” in the network and giving it to the participant whose block is added to the network. The process of creation of the new token and allocating it to the participant whose block is accepted by all participants is called mining. 36 19ITEN1007 - Block Chain Technologies
Mining and Finalizing Blocks Participant nodes that participate in mining are called miners. Mining helps the network sustain itself by rewarding participants that put efforts, defines a consistent way in which new tokens are added to the pool, and establishes immutability of the transactions . All the participant nodes are getting transactions in parallel; each wants transactions they have received to be included in the next block, each one is sharing transactions they have received with everyone and at the same time, each participant is also trying to create a block . 37 19ITEN1007 - Block Chain Technologies
Mining and Finalizing Blocks Transactions are first placed in something called mempool . When a transaction is received by the network but is not accepted in a block that is agreed by participants, it is called unconfirmed transactions or pending transactions . Once a transaction is placed in a block that is accepted on the ledger, it is called confirmed transaction. 38 19ITEN1007 - Block Chain Technologies
Mining and Finalizing Blocks The confirmation about transaction submitted by participant to be accepted on immutable ledger chain is called finality . Probabilistic finality, there is a chance or probability associated with the transaction being added to the ledger post as it is received by the minor . Absolute finality or immediate finality, if the miner (participant node) receives the transaction, it will definitely be added to the network. 39 19ITEN1007 - Block Chain Technologies
Mining Process 40 19ITEN1007 - Block Chain Technologies
Currency Aka Tokens When assets get transacted on blockchain networks, they are given digital identities called tokens . A token that is interchangeable (i.e., any one token can be replaced by another) is called fungible token. Usually, currency tokens are fungible. For instance, to claim that I have 100 dollars, it is immaterial if I have five 20 dollar bills, twenty 5 dollar bills, or 100 dollar coins . A token that is not interchangeable (i.e., in this case we need to individually identify assets and one asset cannot be replaced by another even if it is of same value) is called non-fungible token . Most physical entities that are tracked through transactions become non-fungible . The presence of cryptocurrency makes different use cases realizable as well as makes sure that sustainability of those on the network is through reward mechanism. Rewards can be given to participants in the form of currencies that are managed and exchanged based on the mechanism that is either agreed upon or known to participants. 41 19ITEN1007 - Block Chain Technologies
Security on Block chain Blockchain is a distributed ledger technology (DLT) designed to engender trust and confidence in an environment. Blockchain is a decentralized ledger system that’s duplicated and distributed across a whole network of computer systems. It allows information access to all designated nodes or members who can record, share, and view encrypted transactional data on their blockchain . 42 19ITEN1007 - Block Chain Technologies
Asymmetric Cryptography 45 An organization wants to receive secrets from multiple parties. In such cases, the organization shares their public key to all parties that they wish to receive messages from. These parties would encrypt the message they want to send using the public key . Share something secure with multiple individuals and the receivers want to verify that the message they have received has been from a valid source and has not been compromised. In such cases, the sender signs the message using a private key . 19ITEN1007 - Block Chain Technologies
Data Storage on block chain Blockchain storage is a way of saving data in a decentralized network, which utilizes the unused hard disk space of users across the world to store files. The decentralized infrastructure is an alternative to centralized cloud storage and can solve many problems found in a centralized system . The DLT acts as a decentralized database of information about transactions between various parties. Operations fill the DLT in chronological order and are stored in the ledger as a series of blocks. An interconnected chain is formed between blocks with each one referring to the block before it, thus creating a blockchain. 19ITEN1007 - Block Chain Technologies 47
Data Storage on block chain In blockchain storage, files are first broken apart in a process called sharding. Each shard is copied to prevent loss of data should an error occur during transmission. The files are also encrypted with a private key that makes it impossible for it to be viewed by other nodes in the network. The replicated shards are distributed among decentralized nodes all over the world. The interactions are recorded in the blockchain ledger, allowing the system to confirm and synchronize the transactions across the nodes in the blockchain. Blockchain storage is designed to save these interactions forever and the data can never be changed. 19ITEN1007 - Block Chain Technologies 48
UTXO Models UTXO stands for Unspent Transaction Output. The idea of this model is to store all transactions on the blocks. In this method, the account balance is not stored explicitly on the chain. Each time a transaction is to be created, all the UTXOs from all addresses need to be consolidated to feed as input to subsequent transactions. This is done by off chain utilities called wallets. The biggest advantage of the UTXO model is that transactions cannot be replayed on chain as each transaction needs output from a previous transaction as input. 19ITEN1007 - Block Chain Technologies 49
UTXO Model 19ITEN1007 - Block Chain Technologies 50
Global State Models The global state model records transactions and stores the impact of the same outside the transaction. Each transaction is recorded between accounts and the result is aggregated. For platforms that support currency at platform level such as Ethereum , aggregation is done at user accounts. In the global state model, both transactions and state of accounts need to be stored at each node. 19ITEN1007 - Block Chain Technologies 51
Wallets Way to establish an end user’s identity with the block chain without compromising individual privacy. Wallets help establish this by storing three data items – public key, private key, and wallet address . 19ITEN1007 - Block Chain Technologies 52
Types of Wallets Based on the type of key’s Non-deterministic wallets: Randomly generated private keys are used and managed. When there are multiple private keys to be managed, it becomes very challenging to do so. Non-deterministic wallets were introduced in the first version of blockchain . 19ITEN1007 - Block Chain Technologies 54
Types of Wallets Deterministic wallets: private keys are created based on seed words. Generating keys based on seed words, first a key is generated and then that key is incremented to identify base numbers that are utilized to generate the private keys. When keys are generated based on the master key, which is in turn based on seed word and other keys are based on sequence of keys, which is in turn are based on master key, such wallets are called sequential deterministic wallets . 19ITEN1007 - Block Chain Technologies 55
Types of Wallets Hierarchical deterministic wallets, or HD wallets, help organize keys into parent–child relationships of keys. At first, a master public–private key pair is generated using a mnemonic that the end user needs to remember. By applying a counter or similar mathematical mechanism on master private key, child key pairs are generated. Public keys generated for these child private keys are again organized in similar parent–child relationships. All child private keys can be regenerated using mathematical mechanism. 19ITEN1007 - Block Chain Technologies 56
Wallets Based on how wallets are used by end users Hardware Wallets Paper Wallets Desktop Wallets Software Wallets 19ITEN1007 - Block Chain Technologies 57
Coding on Block chain: Smart Contracts Smart contracts provide a way to store certain data and/or execute certain code on blockchain platforms, which can be initiated based on certain conditions. Smart contracts execute on all nodes of a blockchain network. When a node is down for a while and it comes back online, the ledger syncs up and all the smart contracts would run in sequence. Smart contracts once deployed can run or fail, they cannot be killed or cancelled. They do not have a standard output such as sysout or stdout . 19ITEN1007 - Block Chain Technologies 58
Risk Associated with Block Chain Solutions 19ITEN1007 - Block Chain Technologies 59 Business Impact Related Risks Project Management Related Risks Technology usage Related Risks Regulatory and Compliance Risk
Life Cycle of Block chain Transaction. 19ITEN1007 - Block Chain Technologies 60
Resources Choudhari Ambadas Tulajadas ; Ariff Arshad Sarfarz , Sham M R, Blockchain for Enterprise Application Developers, Wiley Indi Pvt. Ltd., 2020 . 61 19ITEN1007 - Block Chain Technologies
Thank You 62 19ITEN1007 - Block Chain Technologies