0% found this document useful (0 votes)
9 views

Chapter 4

Uploaded by

aditsinghonline
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views

Chapter 4

Uploaded by

aditsinghonline
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 58

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 digital 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 currencies:
1. It is decentralized
2. It is easy to set up and it is fast
3. It is anonymous
4. It is completely transparent
5. Transaction fees are very less
6. Transactions are irreversible
7. Cryptographically secure
Bitcoin is Decentralized

• Bitcoin is a peer-to-peer system which means that there is no


need for a third party.
• Bitcoin network is not controled by central authority (fully
decentralized monetary system).
• Bitcoins are being created by a community of people that
anyone can join.
• There 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


• Wallet uses public-key cryptography
• Public key can be thought of as an account number or name and the
private key, ownership credentials.
• Bitcoin 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.
• The '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
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 x1 and x2, H(x1) and H(x2) 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

You might also like