BLOCK CHAIN_INTRO.pptx
Document Details
Uploaded by HopefulPortland
Rajalakshmi Engineering College
Tags
Full Transcript
CS19721 BLOCK CHAIN FUNDAMENTALS Course Objectives To study about the structure of blockchain and create simple blockchain. To learn about the various types of blockchain. To study various consensus mechanisms used in blockchain. To get ins...
CS19721 BLOCK CHAIN FUNDAMENTALS Course Objectives To study about the structure of blockchain and create simple blockchain. To learn about the various types of blockchain. To study various consensus mechanisms used in blockchain. To get insight into the major cryptocurrencies that are based on blockchain. To know about industry use case for blockchain in Course Outcomes On completion of the course, the students will be able to Understand the blockchain concepts and create a simple application of blockchain. Analyze different types of blockchain. Compare and contrast the various consensus mechanism. Analyze and choose the best cryptocurrency for their use case. Understand and apply the various industry use cases of blockchain SYLLABUS UNIT – I : INTRODUCTION Structure of a Block – Block Header – The Genesis Block – Linking Blocks in the Blockchain – Merkle Trees – Simple Blockchain UNIT – II : BLOCK CHAIN TYPES Public Blockchain – Private Blockchain – Semi-private Blockchain – Sidechains – Permissioned ledger – Distributed ledger – Shared ledger – Fully private and proprietary Blockchains – Tokenized Blockchains – Tokenless Blockchain UNIT – III : CONSENSUS IN BLOCK CHAIN Proof of Work – Proof of Stake – Delegated Proof of Stake – Proof of Elapsed Time – Deposit-based consensus – Proof of importance – Federated consensus – Reputation-based mechanisms – Practical Byzantine Fault Tolerance UNIT – IV : CRYPTOCURRENCIES Bitcoin - Overview- Transactions- Mining – Ethereum - Overview -Transactions – Ethereum Virtual Machine UNIT – V : BLOCK CHAIN USE CASE Supply Chain Management – Healthcare Record Management – Digital Identity– Finance and Insurance BLOCK CHAIN TECHNOLOGY INTRODUCTION Blockchain, sometimes referred to as Distributed Ledger Technology (DLT), makes the history of any digital asset unalterable and transparent through the use of decentralization and cryptographic hashing. A simple analogy for understanding blockchain technology is a Google Doc. When we create a document and share it with a group of people, the document is distributed instead of copied or transferred. This creates a decentralized distribution chain that gives everyone access to the document at the same time. No one is locked out awaiting changes from another party, while all modifications to the doc are being recorded in real-time, making Structure of a Block Structure of a Block A block is composed of a header and a body, where a header contains the hash of previous block, a timestamp, Nonce and the Merkle root. The Merkle root is the root hash of a Merkle tree which is stored in the block body. A Block in a Blockchain BLOCK Blocks are data structures within the blockchain database, where transaction data in a cryptocurrency blockchain are permanently recorded. A block records some or all of the most recent transactions not yet validated by the network. Once the data are validated, the block is closed. BLOCK CHAIN TECHNOLOGY HOW IT WORKS Each block contains three main elements: some data, the cryptographic identifier of the block (called hash) as well as the hash of the previous block. BLOCK CHAIN TECHNOLOGY HOW IT WORKS Data that are stored inside the blocks depends upon types of blockchain. For eg, bitcoin blockchain stores the data about details of Sender, receiver and the amount of transacted coin. BLOCK CHAIN TECHNOLOGY HOW IT WORKS A block also consist of HASH. We can compare hash with the finger print. Hash is always unique like finger print. Changing something inside the block will change the hash inside it. So hash is very important and useful when we want to change the data inside the block. If the hash of the block changes it is no more the same block. A blockchain also contains the hash of previous block and these creates the chain of the block and this technology makes the blockchain so secured. BLOCK CHAIN TECHNOLOGY HOW IT WORKS Here are the chain of three blocks. Each block has hash and the hash of previous block. So block no 3 points the block no 2 and block no 2 points the block no 1. The first block is special block, it cannot point to previous block. This block is called genesis block. BLOCK HEADER A block header is used to identify a particular block on an entire blockchain and is hashed repeatedly to create proof of work for mining rewards. A blockchain consists of a series of various blocks that are used to store information related to transactions that occur on a blockchain network. THE GENESIS BLOCK THE GENESIS BLOCK The Genesis Block, also known as Block 0, is the very first block upon which additional blocks in a blockchain are added. It is effectively the ancestor that every other block can trace its lineage back to since every block references the one preceding it. MERKLE TREE What Is a Merkle Tree? A Merkle tree is a data structure that is used in computer science applications. In bitcoin and other cryptocurrencies, Merkle trees serve to encode blockchain data more efficiently and securely. They are also referred to as "binary hash trees." MERKLE TREE BLOCK CHAIN TECHNOLOGY HOW IT WORKS Now, let’s say you tamper with the second block. This causes the hash of that block to change. In turn, that will make block 3 and all following blocks invalid because block 3 will no longer store a valid hash of the previous block. So changing a single block will make all the following blocks invalid. BLOCK CHAIN TECHNOLOGY HOW IT WORKS But using hashes is not enough to prevent tampering. Modern computers can calculate hundreds of thousands of hashes per second. This means you can effectively tamper with a block and recalculate all the hashes of other blocks to make your blockchain valid again. Solution: Blockchain has something called Proof-Of-Work. It is a mechanism that slows down the creation of new blocks, in the case of bitcoin it takes about 10-15 minutes to calculate the required proof of work and add a new block to the chain. This mechanism makes it very hard to tamper with the block because if you tamper with one block you need to recalculate the proof of work for all the following blocks. So the security of blockchain comes from its creative use of hashing and the proof of work mechanism. BLOCK CHAIN TECHNOLOGY DECENTRALIZATION There’s one more way blockchains secure themselves, and that’s by being distributed. Instead of having a central entity manage the chain, a blockchain uses a P2P network that anyone is allowed to join (assuming the blockchain is public). When someone joins this blockchain network, they become a node and get a full copy of the blockchain. This node can then use the copy of the blockchain to verify that everything is in order. BLOCK CHAIN TECHNOLOGY DECENTRALIZATION Now let’s see what happens when a blockchain participant creates a new block. That new block is sent to all nodes on the network. Each node then verifies the block to make sure it hasn’t been tampered with. If everything checks out, each node adds this block to its own blockchain. The nodes in the network eventually arrive at a consensus: they agree on which blocks are valid and which aren’t. Blocks that have been tampered with will be rejected by other nodes in the network. So to successfully tamper with a blockchain, you need to tamper with all blocks on the chain, redo the proof of work for each block following the block tampered with, and take control of more than 50% of the P2P network. Only then will your tampered block be accepted by everyone else. But this is almost impossible to do. BLOCK CHAIN TECHNOLOGY EXAMPLE TO ILLUSTRATE WORKING Blockchain Applications The basic application of the blockchain is to perform transactions in a secure network. One can set up multichain to prevent unauthorized access to sensitive data. It is not available to the public, and can only be available to authorized entities in the organization. Real life applications of blockchain In a secure and full-proof voting management system. To supply chain management. In healthcare management. Real estate project. NFT marketplace. Avoid copyright and original content creation. In the personal identity system To make an immutable data backup. Internet of Things QUIZ 1.What is a blockchain? A.A distributed ledger on a peer-to-peer network B.A type of cryptocurrency C.An exchange D.A centralized ledger 2. What does P2P stand for? A.Password to Password B.Peer to Peer C.Product to Product D.Private Key to Public Key 3. Who created Bitcoin? A.Satoshi Nakamoto B.Samsung C.John Mcafee D.China 4. Where do you store your cryptocurrency? A.Bank account B.Floppy Disk C.Wallet D.In your pocket 5. What is a genesis block? A.The 2nd transaction of a Blockchain B.The first block of a Blockchain C.A famous block that hardcoded a hash of the Book of Genesis onto the blockchain D.The first block after each block halving Blockchain Creation https://onlinegdb.com/4YdFE1L7Z Permissionless Blockchain It is also known as trustless or public blockchains, are available to everyone to participate in the blockchains process that use to validate transactions and data. Characteristics: Permissionless blockchain has no central authority. The platform is completely open-source. Full transparency of the transaction. Heavy use of tokens. Advantages Everyone can participate only requirement is good hardware and internet. Bring trust among users or entities. It has a high level of transparency as it’s a larger network. Broader decentralization of access to more participants. Disadvantages Poor energy efficiency due to large network. Lower performance scalability. Less privacy as many of the things is visible. Permissioned Blockchain These are the closed network only a set of groups are allowed to validate transactions or data in a given blockchain network. These are used in the network where high privacy and security are required. Characteristics A major feature is a transparency based on the objective of the organization. Another feature is the lack of anatomy as only a limited number of users are allowed. It does not have a central authority. Developed by private authority. Advantages This blockchain tends to be faster as it has some nodes for validations. They can offer customizability. Strong Privacy as permission is needed for accessing transaction information. As few nodes are involved performance and scalability are increased. Disadvantages Not truly decentralized as it requires permission. Risk of corruption as only a few participants are involved. Anytime owner and operator can change the rules as per their need. Blockchain Types There are 4 types of blockchain: Public Blockchain. Private Blockchain. Hybrid Blockchain. Consortium Blockchain. Public Blockchain These blockchains are completely open to following the idea of decentralization. They don’t have any restrictions, anyone having a computer and internet can participate in the network. As the name is public this blockchain is open to the public, which means it is not owned by anyone. Anyone having internet and a computer with good hardware can participate in this public blockchain. All the computer in the network hold the copy of other nodes or block present in the network. In this public blockchain, we can also perform verification of transactions or records. Advantages Trustable: There are algorithms to detect no fraud. Participants need not worry about the other nodes in the network. Secure: This blockchain is large in size as it is open to the public. In a large size, there is greater distribution of records. Anonymous Nature: It is a secure platform to make your transaction properly at the same time, you are not required to reveal your name and identity in order to participate. Decentralized: There is no single platform that maintains Disadvantages Processing: The rate of the transaction process is very slow, due to its large size. Verification of each node is a very time-consuming process. Energy Consumption: Proof of work is high energy- consuming. It requires good computer hardware to participate in the network. Acceptance: No central authority is there so governments are facing the issue to implement the technology faster. Examples Examples of public blockchains include Bitcoin Ethereum Bitcoin Cash Litecoin Monero IOTA Private Blockchain These blockchains are not as decentralized as the public blockchain only selected nodes can participate in the process, making it more secure than the others. These are not as open as a public blockchain. They are open to some authorized users only. These blockchains are operated in a closed network. In this few people are allowed to participate in a network within a company/organization. Advantages Speed: The rate of the transaction is high, due to its small size. Verification of each node is less time- consuming. Scalability: We can modify the scalability. The size of the network can be decided manually. Privacy: It has increased the level of privacy for confidentiality reasons as the businesses required. Balanced: It is more balanced as only some user has the access to the transaction which improves the performance of the network. Disadvantages Security- The number of nodes in this type is limited so chances of manipulation are there. These blockchains are more vulnerable. Centralized- Trust building is one of the main disadvantages due to its central nature. Organizations can use this for malpractices. Count- Since there are few nodes if nodes go offline the entire system of blockchain can be endangered. Usecases With proper security and maintenance, this blockchain is a great asset to secure information without exposing it to the public eye. Therefore companies use them for internal auditing, voting, and asset management. An example of private blockchains is Hyperledger, Corda. Hybrid Blockchain It is the mixed content of the private and public blockchain, where some part is controlled by some organization and other makes are made visible as a public blockchain. It is a combination of both public and private blockchain. Permission-based and permissionless systems are used. User access information via smart contracts Even a primary entity owns a hybrid blockchain it cannot alter the transaction Advantages Ecosystem: Most advantageous thing about this blockchain is its hybrid nature. It cannot be hacked as 51% of users don’t have access to the network. Cost: Transactions are cheap as only a few nodes verify the transaction. All the nodes don’t carry the verification hence less computational cost. Architecture: It is highly customizable and still maintains integrity, security, and transparency. Operations: It can choose the participants in the blockchain and decide which transaction can be made public. Disadvantages Efficiency: Not everyone is in the position to implement a hybrid Blockchain. The organization also faces some difficulty in terms of efficiency in maintenance. Transparency: There is a possibility that someone can hide information from the user. If someone wants to get access through a hybrid blockchain it depends on the organization whether they will give or not. Ecosystem: Due to its closed ecosystem this blockchain lacks the incentives for network participation. Use cases It provides a greater solution to the health care industry, government, real estate, and financial companies. It provides a remedy where data is to be accessed publicly but needs to be shielded privately. Examples of Hybrid Blockchain are Ripple network and XRP token. Consortium Blockchain It is a creative approach that solves the needs of the organization. This blockchain validates the transaction and also initiates or receives transactions. Also known as Federated Blockchain. This is an innovative method to solve the organization’s needs. Some part is public and some part is private. In this type, more than one organization manages the blockchain. Advantages Speed: A limited number of users make verification fast. The high speed makes this more usable for organizations. Authority: Multiple organizations can take part and make it decentralized at every level. Decentralized authority, makes it more secure. Privacy: The information of the checked blocks is unknown to the public view. but any member belonging to the blockchain can access it. Flexible: There is much divergence in the flexibility of the blockchain. Since it is not a very large decision can Disadvantages Approval: All the members approve the protocol making it less flexible. Since one or more organizations are involved there can be differences in the vision of interest. Transparency: It can be hacked if the organization becomes corrupt. Organizations may hide information from the users. Vulnerability: If few nodes are getting compromised there is a greater chance of vulnerability in this blockchain. Use cases It has high potential in businesses, banks, and other payment processors. Food tracking of the organizations frequently collaborates with their sectors making it a federated solution ideal for their use. Examples of consortium Blockchain are Tendermint and Multichain. Semi-Private Blockchain With a semi-private blockchain, the private part is controlled by a group of individuals, while the public part is open for participation by anyone. Sidechain A sidechain is a separate blockchain that runs independent of Ethereum and is connected to Ethereum Mainnet by a two-way bridge. Sidechains can have separate block parameters and consensus algorithms, which are often designed for efficient processing of transactions. Distributed Ledger Distributed ledger technology (DLT) is a digital system for recording the transaction of assets in which the transactions and their details are recorded in multiple places at the same time. Unlike traditional databases, distributed ledgers have no central data store or administration functionality. BLOCK CHAIN TECHNOLOGY CRYPTOCURRENCY Cryptocurrency, sometimes called crypto-currency or crypto, is any form of currency that exists digitally or virtually and uses cryptography to secure transactions. Cryptocurrencies don't have a central issuing or regulating authority, instead using a decentralized system to record transactions and issue new units. Cryptocurrency is a digital payment system that doesn't rely on banks to verify transactions. It’s a peer-to-peer system that can enable anyone anywhere to send and rec eive payments. Instead of being physical money carried around and exchanged in the real world, cryptocurrency payments exist purely as digital entries to an online database describing specific transactions. When you transfer cryptocurrency funds, the transactions are recorded in a public ledger. Cryptocurrency is stored in digital wallets. BLOCK CHAIN TECHNOLOGY CRYPTOCURRENCY - BITCOIN Bitcoin is the first decentralized digital currency. All Bitcoin transactions are documented on a virtual ledger called the blockchain, which is accessible for everyone to see. Bitcoin gives you complete control over your money, unlike other assets you own which are regulated by banks and governments. As bitcoin gains more popularity, more and more places accept it as a payment method. In a nutshell, Bitcoin works through updating a ledger of transactions ( the Blockchain). Each computer that participates in the Bitcoin network holds a copy of this ledger and verifies every transaction going through it. BLOCK CHAIN TECHNOLOGY BITCOIN WALLET Bitcoin wallets are programs that allow you to send and receive Bitcoin The wallet does this by interacting with Bitcoin’s ledger, known as the blockchain. Bitcoin wallets are a bit similar to how email works. BLOCK CHAIN TECHNOLOGY BITCOIN MINING BLOCK CHAIN TECHNOLOGY BITCOIN MINING PROOF OF WORK BLOCK CHAIN TECHNOLOGY BITCOIN MINING PROOF OF WORK It is called “Proof of Work” because it requires some type of work - usually computer processing - from participating nodes (miners) in the Bitcoin network. users (nodes) in the Bitcoin network are called “miners” because they check and prove the accuracy of a transaction in a process called mining In order to reach consensus on a valid block in the blockchain, the Bitcoin algorithm provides a difficulty as a parameter that needs to be met for a block to be valid. This “difficulty” is regularly modified by the Bitcoin network depending on the computational power of the miners. Difficulty may be decreased or increased to maintain a constant speed at which new blocks are added. BLOCK CHAIN TECHNOLOGY BITCOIN MINING PROOF OF WORK An arbitrary number called a nonce (“number only used once”) is added to the block for purposes of cryptography. Miners alter the nonce until a value is found that gives the block's hash the required difficulty level. Once this requirement is met the block cannot be changed without redoing the work. The node then “hashes” the selected set of data. A hash function cannot be reverse-engineered, meaning that the hash value cannot be used to find out the original data. The newly generated hash is checked against the current difficulty. A hash value always has to contain a specific number of zero-bits. If the hash meets the criteria of difficulty, it is broadcast to the other miners in the network. If it does not, another nonce is selected and hashed. Miners generate many hashes with different nonces until they find one that meets the needed criteria. This repetitive process is known as “mining” BLOCK CHAIN TECHNOLOGY BITCOIN MINING PROOF OF WORK Therefore, the first miner who finds a valid hash validates the block into a new block and gets a block reward in Bitcoin. Presently, the Bitcoin block reward is 6.25 BTC and a new block is mined approximately every ten minutes. Each time a new block comes up, there is a new chance for a different miner to be rewarded. For this reason, the verification of transactions on the Bitcoin blockchain is like a never-ending gold rush with thousands of miners around the world simultaneously mining to be the first to discover a block. BLOCK CHAIN TECHNOLOGY PROOF OF WORK - DISADVANTAGES Proof of Work has been historically slow in terms of the rate at which transactions are processed. Furthermore, vast amounts of energy are required for the mining process in the Bitcoin blockchain. In Germany, for example, mining just 1 (one) bitcoin carried an average cost of more than 12,000 euros in 2018. For this reason, miners try to improve their chances by joining mining pools. Another disadvantage of the Proof of Work process is that larger mining pools have more computational power at their access and thus greater chances of mining valid blocks, putting individual miners at disadvantage. BLOCK CHAIN TECHNOLOGY HOW ETHEREUM WORKS Ethereum is a platform powered by blockchain technology that is best known for its native cryptocurrency, called ether, or ETH, or simply ethereum. It is not managed or controlled by one entity. Instead they are governed by code. Ethereum borrows heavily from Bitcoin’s protocol and its underlying blockchain technology, but it adapts the tech to support applications beyond money. The Ethereum platform supports ether in addition to a network of decentralized apps, otherwise known as dApps. Smart contracts, which originated on the Ethereum platform, are a central component of how the platform operates. BLOCK CHAIN TECHNOLOGY Ethereum Smart Contracts Smart contracts are digital transaction protocols that verify, control, and self-execute an agreement, embedded in computerized codes on a blockchain, if parties meet predefined rules. They are a part of any cryptocurrency. Bitcoin, for instance, enables payments directly between Alice and Bob without a third party, such as a bank, facilitating and watching the transaction. Ethereum aims to expand smart contracts by abstracting away Bitcoin’s design so developers can use the technology for more than simple transactions, expanding its use to agreements with additional steps and new rules of ownership. BLOCK CHAIN TECHNOLOGY Ethereum Smart Contracts BLOCK CHAIN TECHNOLOGY BLOCK CHAIN TECHNOLOGY Ethereum Blockchain The history of all the smart contracts is stored in the Ethereum blockchain. Hundreds of volunteers from around the world store a copy of the complete Ethereum blockchain, which is quite long. This is one feature that makes Ethereum decentralized. Each of these is called a "node" in Ethereum's network. Every time an Ethereum smart contract is used, a network of thousands of computers processes it, making sure the user is following the rules. All of these nodes are connected. In addition to storing this data, each Ethereum node follows the same set of rules for accepting transactions and running smart contracts. In contrast to Bitcoin, Ethereum nodes store more than just transaction details. The network needs to keep track of the "state” – or the current information – of all of these applications, including each user’s balance, all the smart contract code, where it’s all stored, and any changes that are made. BLOCK CHAIN TECHNOLOGY Bitcoin Vs Ethereum BLOCK CHAIN TECHNOLOGY Ethereum Virtual Machine The smart contracts developers write in a human- readable programming language cannot be read by a computer. They must be converted into bytecode, a language a computer can understand, which is done by EVM. BLOCK CHAIN TECHNOLOGY CARDANO Cardano is a third-generation, decentralized proof-of-stake (PoS) blockchain platform designed to be a more efficient alternative to proof-of-work (PoW) networks. Scalability, interoperability, and sustainability on PoW networks like Ethereum are limited by the infrastructure burden of growing costs, energy use, and slow transaction times. BLOCK CHAIN TECHNOLOGY CARDANO The Cardano platform runs on the Ouroboros consensus protocol. In 2017, Hoskinson launched Cardano as a public, open-source, decentralised blockchain with a proof of stake consensus (PoS) system. Due to the disadvantages of PoW, many new blockchains start with a Proof of Stake system, which is fairly more energy- efficient and secure. While both PoW and PoS share the goal of reaching consensus in a blockchain, the process of reaching the goal is different. In PoS, users or nodes who want to participate in the network must lock a certain amount of the network’s native token, or cryptocurrency, as their stake. The size of the stake generally determines the chances for a particular node to be selected as the next validator to create the next block. BLOCK CHAIN TECHNOLOGY CARDANO While both PoW and PoS share the goal of reaching consensus in a blockchain, the process of reaching the goal is different. BLOCK CHAIN TECHNOLOGY CARDANO In PoS, users or nodes who want to participate in the network must lock a certain amount of the network’s native token, or cryptocurrency, as their stake. The size of the stake generally determines the chances for a particular node to be selected as the next validator to create the next block. BLOCK CHAIN TECHNOLOGY CARDANO In PoS, users or nodes who want to participate in the network must lock a certain amount of the network’s native token, or cryptocurrency, as their stake. The size of the stake generally determines the chances for a particular node to be selected as the next validator to create the next block. However, in order for the network not to favour only the nodes with the highest stakes, unique and randomised methods of an election are implemented. Some of these include ‘Coin Age Selection’ and ‘Randomised Block Selection.’ BLOCK CHAIN TECHNOLOGY CARDANO The Coin Age Selection method allows the network to pick nodes based on how long their tokens have been staked for. Coin Age = the number of coins staked * number of days they have been staked for. When a node is selected to validate and create the next block, its Coin Age is reset to zero, and must wait before it can be elected to forge another block. This prevents wealthy and large nodes from dominating the blockchain. The Randomised Block Selection method is a more pseudo-random approach that selects nodes based on low hash values and high stakes, allowing other nodes to predict which node is likely to be the next forger. BLOCK CHAIN TECHNOLOGY CARDANO BLOCK CHAIN TECHNOLOGY CARDANO In PoS, nodes usually receive transaction fees in the form of pre- mined crypto in exchange. This is unlike PoW, where miners receive block rewards in the form of freshly-minted crypto. In PoS, If the network detects a fraudulent transaction, the node responsible will lose part of its stake and its right to participate as a forger. As long as the stake involved is higher than the potential reward, nodes stand to lose more than they gain if they attempt fraud. Thank You