chapter4.pptxwgdyjshcbnbhvegwydvquhcjdvqigufwk

NiveditaSingh839848 17 views 69 slides May 10, 2024
Slide 1
Slide 1 of 69
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18
Slide 19
19
Slide 20
20
Slide 21
21
Slide 22
22
Slide 23
23
Slide 24
24
Slide 25
25
Slide 26
26
Slide 27
27
Slide 28
28
Slide 29
29
Slide 30
30
Slide 31
31
Slide 32
32
Slide 33
33
Slide 34
34
Slide 35
35
Slide 36
36
Slide 37
37
Slide 38
38
Slide 39
39
Slide 40
40
Slide 41
41
Slide 42
42
Slide 43
43
Slide 44
44
Slide 45
45
Slide 46
46
Slide 47
47
Slide 48
48
Slide 49
49
Slide 50
50
Slide 51
51
Slide 52
52
Slide 53
53
Slide 54
54
Slide 55
55
Slide 56
56
Slide 57
57
Slide 58
58
Slide 59
59
Slide 60
60
Slide 61
61
Slide 62
62
Slide 63
63
Slide 64
64
Slide 65
65
Slide 66
66
Slide 67
67
Slide 68
68
Slide 69
69

About This Presentation

gvdjshcA>:FI VBhvjvbfskjffweojjjjjjjjjjjjjj


Slide Content

BLOCKCHAIN Chapter 4

Why do we need blockchain ?

Issues that may arise High Transaction Fees : Banks may charge high transaction fees for any transaction. Double Spending Problem : An error which allows you to spend the amount twice. Frauds : Hackers may attack and gain unauthorised access to secret information leading to fraudulent transactions. Poor Data Recovery : Retrieving lost data is difficult in centralized system (single copy).

What is Blockchain? Blockchain is a distributed database of immutable records called blocks, which are cryptographically secure.

Block A block is a record book which contains all the transaction details. Consists of 4 major elements:- Transaction data Hash: alphanumeric value used to identify the block Hash of Previous Block Nonce: random value used to vary hash value

Blockchain 45AF Prevents data tampering

example

Features of blockchain

Blockchain Overview

What is Bitcoin? Bitcoin is a digital currency which is used to send and receive money across the world in a decentralized manner with minimum transaction fees. Bitcoin is software-based online payment system described by Satoshi Nakamoto in 2008 and introduced as open-source software in 2009. Payments are recorded in a public ledger using its own unit of account (Bitcoin) . It is a form of digita l currency (physical form is absent), created and held electronically. It can be used to buy things electronically and in that sense it is no different than conventional dollars . Bitcoin is commonly referred to as cryptocurrency .

Bitcoin is based on It is based on mathematics unlike conventional currencies that had been based on fixed quantity of metal (gold, silver…) or fiat currencies . Bitcoin has several features that set it apart from fiat currencie s : It is decentralized It is easy to set up and it is fas t It is anonymou s It is completel y transparent Transaction fees are very less Transactions are irreversibl e Cryptographically secure

Bitcoin is Decentralized Bitcoin is a peer-to-peer system which means that there is no need for a third party. B itcoin network is not controled by central authority (fully decentralized monetar y system). Bitcoins are being created by a community of people that anyone can join . T here is no authority (financial institution) which can tinker with monetary policy and in that sense devalue or revalue Bitcoin currency .

Bitcoin is Anonymous & Transparent Bitcoins are stored in wallet with digital credentials W allet uses public-key cryptography Public key can be thought of as an account number or name and the private key, ownership credentials. B itcoin is transferred to the next owner when the next owner gives a public key and previous owner uses his private key to publish a record into system announcing that the ownership has changed to the new public key. Bitcoin protocol stores details of every single transaction that occurred in the network in huge version of general ledger (Block chain ) .

Private Keys in Bitcoin Possession and transfer of value in bitcoin network via transactions are reliant upon private keys, public keys and addresses. Elliptic Curve Cryptography(ECC) is used to generate public and private key pairs Private keys are kept only on the owners side. They are used to digitally sign transactions proving ownership of bitcoins. They are fundamentally 256-bit numbers randomly chosen in the range specified by the SECP256K1 ECDSA curve recommendation. They are usually encoded using Wallet Import Format(WIF). It is a way to represent the full-size private key in a different format. Consider the following private key: AEDTEC8A03667180D01FB4251A546C2B9F2FE33507C68B7D9D41FA5714195201 When converted into WIR format , it looks as shown here: L2iN7umV7kbr6LuCmgM27rBnptGbDVc8g4ZBm6EbgTPQXnj1RCZP

Private Keys in Bitcoin Interested readers can do some experimentation using the online tool available at http:// gobittest.appspot.com/ PrivateKey .

Public Key in Bitcoin All network participant can see public key on the blockchain They are derived from private keys They are used to verify that the transaction has been signed with corresponding private key Verification proves the ownership of bitcoin.

CIA CIA stand for  Confidentiality, Integrity,  and  Availability . They are the three pillars of a security architecture. Confidentiality Confidentiality refers to the steps made by an organization to keep its data private or hidden. In practice, this involves limiting data access to prevent unauthorized disclosure. This requires ensuring that only authorized people have access to specified assets and that unauthorized individuals are actively discouraged from gaining access. Confidentiality might be breached accidentally as a result of human mistakes or negligence too. For example, failure to adequately protect passwords (by users or IT security), failure to encrypt data (in process, transit, and storage); physical eavesdropping (also known as  shoulder surfing ), weak authentication methods, etc.

CIA Integrity Integrity refers to the assurance that data has not been tampered with and can thus be trusted. Integrity contributes to the dependability of data by ensuring that it is in the correct condition and free of any unauthorized changes. Example  − Customers who shop online demand precise product and price information, as well as the assurance that quantity, pricing, availability, and other details will not change after they make an order. Financial consumers must have confidence in the security of their banking information and account balances

CIA Availability Networks, systems, and available applications are functioning. It ensures that authorized users get consistent and timely access to resources when they are needed. Systems, programs, and data are of little utility to a business and its customers if they are not available when authorized users require them. While hardware or software failure, power outages, natural catastrophes, and human mistake are all potential threats to availability. T he 'denial-of-service' attack, in which the performance of a system, website, or web-based application is purposely and maliciously degraded, or the system becomes unavailable, is perhaps the most well-known assault that threatens availability

Denial-of-service

Digital Signature using Public Key Cryptography

Reduce Signature Size using Hash

Cryptographically Secured Hash Functions Is a hash function which takes an input (or 'message') and returns a fixed-size string of bytes. The string is called the 'hash value', 'message digest', 'digital fingerprint', 'digest' or 'checksum' Hash Functions : Map any sized data to a fixed size.

Cryptographically Secured Hash Functions Cryptographically Secured: One way , given a x , we can compute H(x) , but given a H(x) , no deterministic algorithm can compute x For two different x 1 and x 2 , H(x 1 ) and H(x 2 ) should be different Hashing is a mathematical operation that is easy to perform, but extremely difficult to reverse. Most widely used hashing functions are MD5, SHA1 and SHA-256.

Cryptographic Hash Functions: Example MD5  is a cryptographic hash function algorithm that takes the message as input of any length and changes it into a fixed-length message of 16 bytes. MD5 algorithm stands for the  Message-Digest Algorithm . MD5 was developed as an improvement of MD4, with advanced security purposes. The output of MD5 (Digest size) is always  128 bits. MD5  was   developed in 1991 by  Ronald Rivest. Use Of MD5 Algorithm: It is used for file authentication. In a web application, it is used for security purposes. e.g. Secure password of users etc. Using this algorithm, We can store our password in 128 bits format. 

Example: MD5

Cryptographic Hash Functions: Example MD5 : 128-bit (16-byte) hash value, typically expressed in text format as a 32 digit hexadecimal number. SHA1 (Secure Hash Algorithm) : 160-bit (20-byte) hash value, typically rendered as a hexadecimal number, 40 digits long. SHA256: 256-bit (32-byte) hash value, typically rendered as a hexadecimal number, 64 digits long.

Cryptographic Hash Functions X is called the message and H(X) is called the message digest A small change in the data results in a significant change in the output – called the avalanche effect

Hashes are "digests", not "encryption" Encryption transforms data from a clear text to ciphertext and back (given the right keys), The two texts should roughly correspond to each other in size Long clear text yields long ciphertext , and so on. "Encryption" is a two-way operation.

Hashes are "digests", not "encryption" Hashes compile a stream of data into a small digest A one way operation . All hashes of the same type have the same size no matter how big the inputs are

How are hashes used? Hashing passwords store a hash of the password rather than the password itself. hashes are not reversible , there is no way to find out for sure “PASSWORD”

How are hashes used? Digitally Signed Documents "signing" a document electronically is the digital equivalent of placing an autograph on paper sign (encrypts with one's private key) the hash of the document, the result of which is a digital signature .

Digital Signature in Blockchain

Example

Mining Miner’s Role Join the network, listen for transactions, and Validate the transactions Collect transactions for a predefined time and start the mining process:- find the nonce value Construct a new block Add the new block to the existing blockchain Broadcast the new blockchain Earn a reward for successfully mining the block.

Mining Reward The miner who computes the new hash gets a reward. According to the rules of Bitcoin, the node that creates a block gets to include a special transaction in that block the node can also choose the recipient address of this transaction Initially the block reward was set to 50 bitcoins The total number of bitcoins is 21 million. The block reward halves every 210,000 blocks created i.e rate drops roughly every four years .

Mining Reward

Mining Reward When is the next Bitcoin Halving? Block #315,000 (estimated around 2024) Current mining reward is 3.125 BTC When was the last Bitcoin Halving? Block #630,000 (May 24th, 2020) Current mining reward is 6.25 BTC It is important to note that this is the only way in which new bitcoins are allowed to be created.

Mining Reward With 21 million being the maximum bitcoin, New block creation reward is actually going to run out in 2140 The second incentive mechanism is called the transaction fee

Mining Difficulty Hash Value is 256 bits out of which atleast 64 bits are fixed to have zero value. The difficulty changes for every 2016 blocks Desired rate : one block each 10 minutes Two weeks to generate 2016 blocks (24[hours]*60[mins])10=144*14[days]=2016 The change in difficulty is in proportion to the amount of time over or under two weeks the previous 2016 blocks took to find.

Setting Difficulty Level The difficulty is computed every two weeks using the below formula  

Fork A byproduct of distributed consensus, forks happen anytime two miners find a block at nearly the same time. The ambiguity is resolved when subsequent blocks are added to one, making it the longest chain, while the other block gets “orphaned” (or abandoned) by the network. But forks also can be willingly introduced to the network. This occurs when developers seek to change the rules the software uses to decide whether a transaction is valid or not.

Fork

Fork Forks represent changes to the bitcoin protocol that make previous rules valid or invalid. Soft Fork is a rule change that is backward compatible which means the new rules can still be interoperable with the legacy protocol . Hard Fork enables a rule change to the software, but it does not have backward compatibility. Causes a permanent split from the legacy rule-set, or version, of the blockchain before the fork occurred .

Soft Fork

Soft Fork

Hard Fork

Hard Fork

Block Chain Demo Open the web link given below:- Blockchain Demo (andersbrownworth.com) Reference: https://andersbrownworth.com/blockchain/

Block Chain Demo

Block Chain Demo

Block Chain Demo

PROOF OF WORK

Proof of Work

Proof of Stake

Proof of Stake

The 51% Attack A 51% attack is a type of attack on a blockchain network where an attacker gains control of more than 50% of the network's computing power, also known as hash rate. This would allow the attacker to rewrite the blockchain history and potentially double-spend or reverse transactions, leading to serious problems for the network's integrity and security. In a blockchain network, transactions are validated and recorded by a decentralized network of nodes that compete to solve complex mathematical problems, and the longest valid chain of blocks is considered the true ledger of the network. However, if an attacker controls more than 50% of the network's computing power, they can create a longer chain of blocks faster than the rest of the network, effectively invalidating previous transactions and rewriting the blockchain history.

The 51% Attack To execute a 51% attack, the attacker needs to have a significant amount of computing power and resources, which is not feasible for most individual attackers. However, it is possible for a group of miners to collude and create a large enough mining pool to control more than 50% of the network's hash rate. To prevent a 51% attack, blockchain networks implement various security measures, including proof-of-work algorithms, which make it computationally expensive to execute such an attack. Additionally, some blockchain networks, such as proof-of-stake networks, rely on a different mechanism to secure the network and prevent such attacks.

The 51% Attack Private and public blockchains are two types of blockchain networks that differ in terms of their accessibility, permission, and transparency. Public blockchains are open and permissionless networks that allow anyone to participate in the network and access the data stored on the blockchain. Examples of public blockchains include Bitcoin, Ethereum, and Litecoin. Private blockchains , on the other hand, are closed and permissioned networks that restrict access to the data stored on the blockchain. They are typically used by organizations or groups of organizations to facilitate private transactions or exchange of information. Examples of private blockchains include Hyperledger Fabric and Corda. In summary, public blockchains are open and transparent, accessible to anyone, and maintained by a decentralized network of nodes, while private blockchains are closed and permissioned, accessible only to authorized participants, and managed by a centralized entity or a group of entities.

Ethereum Virtual Machine & Feature The Ethereum Virtual Machine (EVM) is the runtime environment for executing smart contracts in the Ethereum blockchain network. It serves as the decentralized computer that processes and executes code written in Ethereum's native programming language, Solidity. Decentralised : operates on a decentralized network of nodes, meaning no single entity has control over the network Cryptocurrency (Ether) : Ethereum has its native cryptocurrency called Ether (ETH), which is used as both a digital currency and a fuel to pay for transaction fees and computational services on the network Immutable Ledger : Transactions on the Ethereum blockchain are recorded on an immutable ledger, meaning they cannot be altered or tampered with once they are confirmed and added to the blockchain.

Advantages of Smart Contracts: Trustless Transactions : Smart contracts enable trustless transactions by automating the execution of agreements without the need for intermediaries. Participants can engage in transactions directly with each other, knowing that the terms of the contract will be enforced automatically by the blockchain. Cost Efficiency : Smart contracts eliminate the need for intermediaries such as lawyers, brokers, or escrow services, reducing transaction costs associated with traditional contracts. This cost efficiency is particularly beneficial for cross-border transactions and microtransactions. Transparency and Security : Smart contracts operate on a transparent and immutable blockchain, providing full visibility into the terms and execution of the contract. This transparency enhances security and reduces the risk of fraud or manipulation. Automated Execution : Smart contracts execute automatically when predefined conditions are met, removing the need for manual intervention and reducing the potential for errors or delays in contract execution.

Bitcoin scripting Ethereum smart contracts Bitcoin scripting is primarily designed for transaction verification and defining conditions for spending bitcoins. It allows users to create custom transaction outputs with specific spending conditions. Ethereum smart contracts are designed to execute arbitrary code and automate complex logic on the blockchain. They enable the creation of decentralized applications ( DApps ) with programmable functionality. Bitcoin scripting language is a stack-based, Forth-like language that is intentionally limited to ensure security and prevent certain types of attacks. Ethereum smart contracts are written in high-level languages like Solidity, which is specifically designed for writing smart contracts. Solidity resembles JavaScript and is more expressive and flexible compared to Bitcoin scripting. Bitcoin scripting allows for basic conditional spending conditions, such as multisignature wallets, time-locked transactions (e.g., CheckLockTimeVerify ), and hash-locked transactions (e.g., HashTimeLock ). Ethereum smart contracts support a wide range of functionalities, including conditional statements, loops, data storage, interaction with other contracts, and even interaction with external data sources (via oracles). This enables the development of complex decentralized applications and protocols.

Plug and Play (PnP) platform In permissioned blockchains, Plug and Play (PnP) platform mechanisms are designed to enable easy integration of various components or modules into the blockchain network. These mechanisms facilitate interoperability, customization, and scalability of the blockchain infrastructure. Here's how PnP platform mechanisms are typically distinguished: Modular Architecture : Permissioned blockchains are built with a modular architecture, allowing different components such as consensus algorithms, smart contract languages, data storage mechanisms, and identity management systems to be plugged in or replaced easily. This modular approach ensures flexibility and adaptability to evolving business requirements. Standardized APIs : PnP platforms often provide standardized Application Programming Interfaces (APIs) that define how external applications or modules can interact with the blockchain network. These APIs abstract the complexity of the underlying blockchain technology, making it easier for developers to integrate new features or functionalities. Component Marketplaces : Some permissioned blockchain platforms offer component marketplaces or repositories where developers can discover, download, and deploy pre-built modules or smart contracts. These marketplaces foster collaboration and innovation within the blockchain ecosystem by allowing developers to leverage existing solutions and focus on building specific features or applications. Dynamic Configuration : PnP platforms allow for dynamic configuration of blockchain networks by enabling the addition or removal of components on-the-fly. This dynamic configuration capability facilitates seamless upgrades, maintenance, and optimization of the blockchain infrastructure without disrupting ongoing operations. Interoperability Standards : PnP mechanisms in permissioned blockchains adhere to interoperability standards that ensure compatibility between different modules or components. These standards enable seamless integration with external systems, such as legacy databases or enterprise applications, and promote interoperability across heterogeneous blockchain networks.

Hyperledger Fabric is a Permissioned Blockchain Here's a detailed classification of its key features: Permissioned Network : Hyperledger Fabric supports permissioned networks, where participants must be authenticated and authorized to access the blockchain network. It provides fine-grained access control mechanisms, allowing administrators to define roles and permissions for network participants. Modular Architecture : Fabric's modular architecture enables pluggable components, allowing organizations to customize and configure the blockchain network according to their specific needs. Components such as consensus algorithms, membership services, and smart contract engines can be swapped in and out to tailor the network's functionality. Private Data Channels : Fabric allows the creation of private data channels, enabling confidential transactions between a subset of network participants. Participants within a private data channel have access to a shared ledger containing only the transactions relevant to them, enhancing privacy and confidentiality.

Turing completeness of a smart contract R efers to the ability of a programming language or computational system to simulate any algorithmic process Turing completeness means that the programming language used to write the smart contracts is capable of expressing any computable function or algorithm. A smart contract platform that is Turing complete allows developers to create complex and arbitrarily intricate programs within the constraints of the platform Ethereum, for example, is often cited as an example of a Turing complete blockchain platform. Its programming language, Solidity, allows developers to create sophisticated smart contracts that can execute a wide range of tasks, from simple token transfers to complex decentralized applications ( DApps ).
Tags