0% found this document useful (0 votes)
9 views58 pages

Unit 2-1

The document provides an introduction to blockchain technology, focusing on Bitcoin as a decentralized digital currency and its underlying protocols. It explains key concepts such as public and private keys, transaction types, and the structure of blocks in the blockchain. Additionally, it discusses various blockchain types and platforms for decentralization, highlighting the importance of consensus and security in the blockchain ecosystem.

Uploaded by

anushkarokade21
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views58 pages

Unit 2-1

The document provides an introduction to blockchain technology, focusing on Bitcoin as a decentralized digital currency and its underlying protocols. It explains key concepts such as public and private keys, transaction types, and the structure of blocks in the blockchain. Additionally, it discusses various blockchain types and platforms for decentralization, highlighting the importance of consensus and security in the blockchain ecosystem.

Uploaded by

anushkarokade21
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 58

INTRODUCTION TO

BLOCKCHAIN
TECHNOLOGY
BITCOIN
 Bitcoin, it's a protocol, a digital currency, and a platform.
 It is a combination of peer-to-peer network, protocols, and
software that facilitate the creation and usage of the digital
currency named bitcoin.
 Bitcoin with a capital B is used to refer to the Bitcoin protocol,
whereas bitcoin with a lowercase b is used to refer to bitcoin,
the currency.
 Nodes in peer-to-peer network talk to each other using the
Bitcoin protocol.
 Decentralization of currency was made possible for the first
time with the invention of bitcoin.
 The double spending problem was solved in an elegant and
ingenious way in bitcoin
BITCOIN
 Keys and addresses :
 Elliptic curve cryptography is used to generate public and
private key pairs in the Bitcoin network.
 The bitcoin address is created by taking the corresponding
public key of a private key and hashing it twice.
 First with the SHA256 algorithm and then with RIPEMD160.
 The resultant 160-bit hash is then prefixed with a version
number and finally encoded with a Base58Check encoding
scheme.
 The bitcoin addresses are 26-35 characters long and begin with
digit 1 or 3.
 A typical bitcoin address looks like a string shown here:
 1ANAguGG8bikEv2fYsTBnRUmx7QUcK58wt
BITCOIN

QR code of a bitcoin address 1ANAguGG8bikEv2fYsTBnRUmx7QUcK58wt

 Currently, there are two types of addresses, the commonly used


P2PKH and another P2SH type, starting with 1 and 3, respectively.
 In the early days, bitcoin used direct Pay-to-Pubkey, which is now
superseded by P2PKH.
 However, direct Pay-to-Pubkey is still used in bitcoin for coinbase
addresses.
PUBLIC KEYS IN BITCOIN
 In public key cryptography, public keys are generated from
private keys.
 Bitcoin uses ECC based on the SECP256K1 standard.
 A private key is randomly selected and is 256-bit in length.
 Public keys can be presented in an uncompressed or
compressed format.
 Public keys are basically x and y coordinates on an elliptic
curve and in an uncompressed format and are presented with
a prefix of 04 in a hexadecimal format.
PUBLIC KEYS IN BITCOIN
 Compressed public key is 33 bytes long as compared to 65
bytes in the uncompressed format.
 Keys are identified by various prefixes as follows:
 Uncompressed public keys used 0x04 as the prefix.
 Compressed public key starts with 0x03 if the y 32-bit part of
the public key is odd.
 Compressed public key starts with 0x02 if the y 32-bit part of
the public key is even.
PRIVATE KEYS IN
BITCOIN
 Private keys are basically 256-bit numbers chosen in the range
specified by the SECP256K1 ECDSA recommendation.
 Any randomly chosen 256-bit number from 0x1 to 0xFFFF FFFF
FFFF FFFF FFFF FFFF FFFF FFFE BAAE DCE6 AF48 A03B BFD2
5E8C D036 4140 is a valid private key.
 Private keys are usually encoded using Wallet Import
Format (WIF) in order to make them easier to copy and use.
 Mini Private Key Format is sometimes used to encode the
key in under 30 characters.
BITCOIN CURRENCY
UNITS
BASE58CHECK
ENCODING
 Encoding is used to limit the confusion between various characters,
such as 0OIl as they can look the same in different fonts.
 The encoding basically takes the binary byte arrays and converts
them into human readable strings.
 String is composed by utilizing a set of 58 alphanumeric symbols.
 More explanation and logic can be found in the base58.h source file
in the bitcoin source code.
 Vanity addresses :
 As bitcoin addresses are based on base 58 encoding, it is possible
to generate addresses that contain human-readable messages.
 Vanity addresses are generated using a purely brute-force method.
VANITY ADDRESSES
TRANSACTIONS
 Transactions can be as simple as just sending some bitcoins to
a bitcoin address, or it can be quite complex depending on the
requirements.
 Inputs can be thought of as coins being spent that have been
created in a previous transaction and outputs as coins being
created.
 If a transaction is minting new coins, then there is no input and
therefore no signature is needed.
 If a transaction is to sends coins to some other user (a bitcoin
address), then it needs to be signed by the sender with their
private key and a reference to the previous transaction in
order to show the origin of the coins.
 Transactions are not encrypted and are publicly visible in the
THE TRANSACTION LIFE
1.
CYCLE
A user/sender sends a transaction using wallet software or
some other interface.
2. The wallet software signs the transaction using the sender's
private key.
3. The transaction is broadcasted to the Bitcoin network using a
flooding algorithm.
4. Mining nodes include this transaction in the next block to be
mined.
5. Mining starts once a miner who solves the Proof of Work
problem broadcasts the newly mined block to the network.
6. The nodes verify the block and propagate the block further,
and confirmation starts to generate.
7. Finally, the confirmations start to appear in the receiver's
wallet and after approximately six confirmations, the
THE TRANSACTION STRUCTURE
 A transaction at a high level contains metadata, inputs, and outputs.
 Transactions are combined to create a block.
TYPES OF TRANSACTION
 Various scripts available in bitcoin to handle the value transfer
from the source to the destination.
 Scripts range from very simple to quite complex depending
upon the requirements of the transaction.
 Standard transactions are evaluated using IsStandard() and
IsStandardTx() tests and only standard transactions that pass
the test are generally allowed to be mined or broadcasted on
the bitcoin network.
 Nonstandard transactions are valid and allowed on the
network.
TYPES OF TRANSACTION
 Pay to Public Key Hash (P2PKH):
 P2PKH is the most commonly used transaction type and is
used to send transactions to the bitcoin addresses.
 The format of the transaction is shown as follows:
 ScriptPubKey: OP_DUP OP_HASH160 <pubKeyHash>
OP_EQUALVERIFY OP_CHECKSIG
 ScriptSig: <sig> <pubKey>
 The ScriptPubKey and ScriptSig parameters are concatenated
together and executed.
TYPES OF TRANSACTION
 Pay to Script Hash (P2SH):
 P2SH is used in order to send transactions to a script hash
(that is, the addresses starting with 3) and was standardized in
BIP16.
 In addition to passing the script, the redeem script is also
evaluated and must be valid.
 A script that defines the conditions under which funds locked
in a Pay-to-Script-Hash (P2SH) address.
 The template is shown as follows:
 ScriptPubKey: OP_HASH160 <redeemScriptHash> OP_EQUAL
 ScriptSig: [<sig>...<sign>] <redeemScript>
TYPES OF TRANSACTION
 MultiSig (Pay to MultiSig):
 M of n multisignature transaction script is a complex type of
script where it is possible to construct a script that required
multiple signatures to be valid in order to redeem a transaction.
 Various complex transactions such as escrow and deposits can
be built using this script.
 The template is shown here:
 ScriptPubKey: <m> <pubKey> [<pubKey> . . . ] <n>
OP_CHECKMULTISIG
 ScriptSig: 0 [<sig > . . . <sign>]
 Raw multisig is obsolete, and multisig is usually part of the P2SH
redeem script.
 Pay to Pubkey:
 This script is a very simple script that is commonly used in
coinbase transactions.
 It is now obsolete and was used in an old version of bitcoin.
 The public key is stored within the script in this case and the
unlocking script is required to sign the transaction with the
private key.
 The template is shown as follows:
 <PubKey> OP_CHECKSIG
 Null data/OP_RETURN: This script is used to store arbitrary
data on the blockchain for a fee.
 The limit of the message is 40 bytes.
 The output of this script is unredeemable because OP_RETURN
will fail the validation in any case. ScriptSig is not required in
this case.
 The template is very simple and is shown as follows:
 OP_RETURN <data>
COINBASE TRANSACTIONS
 A coinbase transaction or generation transaction is always
created by a miner and is the first transaction in a block.
 It is used to create new coins. It includes a special field, called
coinbase, which acts as an input to the coinbase transaction.
 Transaction also allows up to 100 bytes of arbitrary data that
can be used to store arbitrary data.
BLOCKCHAIN
 Blockchain is a public ledger of a timestamped, ordered, and
immutable list of all transactions on the bitcoin network.
 Each block is identified by a hash in the chain and is linked to
its previous block by referencing the previous block's hash.
 The structure of a block
THE STRUCTURE OF A BLOCK HEADER
 The Merkle tree is a binary tree of cryptographic hashes, and the Merkle
root is the hash at the top of this tree.
BLOCKCHAIN STRUCTURE
BLOCKCHAIN TECHNOLOGY DEFINITION
 Blockchain at its core is a peer-to-peer distributed ledger that
is cryptographically secure, append-only, immutable
(extremely hard to change), and updateable only via
consensus or agreement among peers.
 Blockchain is a decentralized consensus mechanism. In a
blockchain, all peers eventually come to an agreement
regarding the state of a transaction.
 Blockchain is a data structure; it is basically a linked list that
uses hash pointers instead of normal pointers. Hash pointers
are used to point to the previous block.
BLOCKCHAIN
 Blockchain can be thought of as a layer of a distributed peer-
to-peer network running on top of the Internet.
GENERIC ELEMENTS OF A BLOCKCHAIN
 Addresses
 Addresses are unique identifiers that are used in a transaction
on the blockchain to denote senders and recipients.
 An address is usually a public key or derived from a public key.
 While addresses can be reused by the same user, addresses
themselves are unique.
 In practice, however, a single user may not use the same
address again and generate a new one for each transaction.
 Transaction
 A transaction is the fundamental unit of a blockchain.
 A transaction represents a transfer of value from one address
to another.
GENERIC ELEMENTS OF A BLOCKCHAIN
 Block
 A block is composed of multiple transactions and some other
elements such as the previous block hash (hash pointer),
timestamp, and nonce.
 Peer-to-peer network
 Network topology where all peers can communicate with each
other and send and receive messages.
 Scripting or programming language
 This element performs various operations on a transaction.
GENERIC ELEMENTS OF A BLOCKCHAIN
 Virtual machine
 This is an extension of a transaction script.
 A virtual machine allows Turing complete code to be run on a
blockchain (as smart contracts) whereas a transaction script
can be limited in its operation.
 Virtual machines are not available on all blockchains; however,
various blockchains use virtual machines to run programs.
 Example :
 Ethereum Virtual Machine (EVM) and Chain Virtual
Machine (CVM).
GENERIC ELEMENTS OF A BLOCKCHAIN
 State machine
 A blockchain can be viewed as a state transition mechanism.
 A state is modified from its initial form to the next and eventually
to a final form as a result of a transaction execution and
validation process by nodes.
 Nodes
 A node in a blockchain network performs various functions
depending on the role it takes.
 A node can propose and validate transactions and perform
mining to facilitate consensus and secure the blockchain.
 Nodes can also perform , functions such as simple payment
verification (lightweight nodes), validators, and many others
functions depending on the type of the blockchain used.
GENERIC ELEMENTS OF A BLOCKCHAIN
 Smart contracts
 Programs run on top of the blockchain and encapsulate the
business logic to be executed when certain conditions are met.
 It provides flexibility and power to the blockchain applications.
HOW BLOCKCHAINS ACCUMULATE BLOCKS
 1. A node starts a transaction by signing it with its private key.

 2. The transaction is propagated (flooded) by using much desirable


Gossip protocol to peers, which validates the transaction based on
preset criteria. Usually, more than one node is required to validate
the transactions.
 3. Once the transaction is validated, it is included in a block, which is
then propagated on to the network. At this point, the transaction is
considered confirmed.
 4. The newly created block now becomes part of the ledger and the
next block links itself cryptographically back to this block. This link
is a hash pointer. At this stage, the transaction gets its second
confirmation and the block gets its first.
 5. Transactions are then reconfirmed every time a new block is
created. Usually, six confirmations in the bitcoin network are
required to consider the transaction final.
TYPES OF BLOCKCHAIN
 Public blockchains
 These blockchains are open to the public and anyone can
participate as a node in the decision-making process.
 Users may or may not be rewarded for their participation.
 These ledgers are not owned by anyone and are publicly open
for anyone to participate in.
 All users of the permission-less ledger maintain a copy of the
ledger on their local nodes and use a distributed consensus
mechanism in order to reach a decision about the eventual
state of the ledger.
 These blockchains are also known as permission-less ledgers.
TYPES OF BLOCKCHAIN
 Private blockchains

 Private blockchains as the name implies are private and are open
only to a consortium or group of individuals or organizations that
has decided to share the ledger among themselves.
 Semi-private blockchains

 Here part of the blockchain is private and part of it is public.

 The private part is controlled by a group of individuals whereas


the public part is open for participation by anyone.
 Sidechains

 More precisely known as pegged sidechains, this is a concept


where coins can be moved from one blockchain to another and
moved back.
TYPES OF BLOCKCHAIN
 Common uses include the creation of new altcoins (alternative
cryptocurrencies) where coins are burnt as a proof of adequate
stake.
 There are two types of sidechain.
 First type - Burning coins is applicable to a one-way pegged
sidechain.
 Second type is called a two-way pegged sidechain, which
allows the movement of coins from the main chain to the
sidechain and back to the main chain when required.
 Permissioned ledger
 A permissioned ledger is a blockchain where the participants
of the network are known and already trusted.
TYPES OF BLOCKCHAIN
 Permissioned ledger

 Permissioned ledgers do not need to use a distributed


consensus mechanism, instead an agreement protocol can be
used to maintain a shared version of truth about the state of the
records on the blockchain.
 Distributed ledger

 Ledger is distributed among its participants and spread across


multiple sites or organizations.
 This type can either be private or public.

 The key idea is that, unlike many other blockchains, the records
are stored contiguously instead of sorted into blocks.
 This concept is used in Ripple.
TYPES OF BLOCKCHAIN
 Tokenized blockchains
 Blockchains are standard blockchains that generate
cryptocurrency as a result of a consensus process via mining
or via initial distribution.
 Tokenless blockchains
 Probably not real blockchains because they lack the basic unit
of transfer of value but are still valuable in situations where
there is no need to transfer value between nodes and only
sharing some data among various already trusted parties is
required.
PLATFORMS FOR DECENTRALIZATION
 Ethereum
 Ethereum the first blockchain that introduced a Turing
complete language and the concept of a virtual machine.
 This is in contrast to the limited scripting language in bitcoin
and many other cryptocurrencies.
 Availability of Turing-complete language called Solidity,
endless possibilities have opened for the development of
decentralized applications.
 Proposed in 2013 by Vitalik Buterin and provides a public
blockchain to develop smart contracts and decentralized
applications.
 Currency tokens on Ethereum are called Ethers.
PLATFORMS FOR DECENTRALIZATION
 Maidsafe
 Maidsafe provides a SAFE (Secure Access for Everyone)
network that is made up of unused computing resources, such
as storage, processing power, and the data connections of its
users.
 The files on the network are divided into small chunks of data
that are encrypted and distributed throughout the network
randomly.
 Data can only be retrieved by its respective owner.
 One key innovation is that duplicate files are automatically
rejected on the network, which helps reduce the need for
additional computing resources to manage the load.
 It uses Safecoin as a token to incentivize its contributors.
PLATFORMS FOR DECENTRALIZATION
 Lisk
 Lisk is a blockchain application development and
cryptocurrency platform.
 It allows developers to use JavaScript to build decentralized
applications and host them in their own respective sidechains.
 Lisk uses the Delegated Proof of Stake (DPOS) mechanism
for consensus where 101 nodes can be elected to secure the
network and propose blocks.
 It uses the Node.js and JavaScript backend whereas the
frontend, such as CSS3, HTML5, and JavaScript.
 Lisk uses LSK coin as a currency on the blockchain.
 Another derivative of Lisk is Rise, which is a Lisk-based
decentralized application and digital currency platform.
 It has more focus on the security of the system.
CONSENSUS IN BLOCKCHAIN
 Distributed computing concept to provide a means of agreeing
to a single version of truth by all peers on the blockchain
network.
 Two categories of consensus :
 1. Proof-based, leader-based, or the Nakamoto consensus
where a leader is elected and proposes a final value.
 2. Byzantine fault tolerance-based, which is a more traditional
approach based on rounds of votes.
 Proof of Work
 Proof that enough computational resources have been spent
before proposing a value for acceptance by the network.
 Used in bitcoin and other cryptocurrencies.
 Only one mechanism successful against Sybil attacks. (A
single node to operate many active fake identities)
 Proof of Stake
 Works on the idea that a node or user has enough stake in the
system.
 Idea was first introduced by Peercoin and is going to be used
in the Ethereum blockchain.
 Second important concept is coin age, which is a derived
from the amount of time and the number of coins that have
not been spent.
 In this model, the chances of proposing and signing the next
block increase with the coin age.
 Delegated Proof of Stake
 Used in the bitshares blockchain.
 An innovation over standard PoS where each node that has
stake in the system can delegate the validation of a
transaction to other nodes by voting.
 Proof of Elapsed Time
 Introduced by Intel, it uses Trusted Execution Environment
(TEE) to provide randomness and safety in the leader election
process via a guaranteed wait time.
 Requires the Intel SGX (Software Guard Extensions)
processor in order to provide the security guarantee.
 Deposit-based consensus
 Nodes that wish to participate on the network have to put in a
security deposit before they can propose a block.
 Proof of importance
 Relies on how much stake a user has in the system but it also
monitors the usage and movement of tokens by the user to
establish a level of trust and importance.
 This is used in Nemcoin.
 Federated consensus or federated Byzantine consensus
 Used in the stellar consensus protocol, nodes in this protocol
keep a group of publicly trusted peers and propagates only
those transactions that have been validated by the majority of
trusted nodes.
 Reputation-based mechanisms
 Leader is elected on the basis of the reputation it has built
over time on the network.
 This can be based on the voting from other members.
 Practical Byzantine Fault Tolerance
 Byzantine Generals’ Problem
 Byzantine Generals’ problem was acknowledged in 1982 as
a logical decision puzzle.
 Its basis on how generals of the same side with different
troops might have a communication problem in making
decisions about the next move against the enemy.
 The problem states like a group of generals with their army
are about to attack their enemy. They surrounded the enemy’s
castle from 4 different directions. Now how would they
communicate the decision of attacking or retreating at the
same time?
 Blockchain seems to resolve this problem with the Byzantine
fault tolerance (BFT) consensus mechanism.
 To ensure the success of the generals’ team, they need
an algorithm that could adhere to the following
conditions:
• All the troop generals need to agree on the next action of the
plan.
• The generals should be trustworthy and loyal to the system.
• Generals must not get influenced to become network traitors.
• They need to follow the algorithm of the system.
• The group of generals needs to reach a consensus or decision,
irrespective of the traitors’ actions.
• The system or network should not lead to a 51% attack at any
point of action.
 Byzantine Fault Tolerance (BFT) is a consensus approach ,the
system should stay intact even if one of the nodes (or general)
fails.
 In addition, BFT aims to reduce the effect of malicious byzantine
 Practical Byzantine Fault Tolerance (PBFT)
 An attempt to overcome the Byzantine problems, Barbara
Liskov and Miguel Castro introduced a Practical Byzantine Fault
Tolerance (pBFT) consensus algorithm in 1999.
 They aim to ensure a practical byzantine state machine
replication for tolerating malicious or byzantine nodes.
 Essential aspects of the pBFT consensus algorithm:
• All nodes are assembled in a sequence.
• One network node serves as a leader node, and the rest of
them are backup nodes.
• The primary or leader node serves the client’s request. It
works as a moderator between client and backup nodes.
• All nodes are capable of communicating with other nodes to
check the honest nodes.
• Honest nodes should be able to reach a consensus for the next
global change in the network based on majority rule.
• It identifies the source of the message to make sure it’s sent
by the correct sender.
• Ensures the message has not been modified or corrupted in
between.
ADVANTAGES AND DISADVANTAGES OF
BLOCKCHAIN
 Advantages
 Open:
 Accessible to all means anyone can become a participant in
the contribution to blockchain technology.
 One does not require any permission from anybody to join the
distributed network.
 Verifiable:
 Store information in a decentralized manner so everyone can
verify the correctness of the information by using zero-
knowledge proof .
 Permanent:
 Records or information , permanent means one needs not
worry about losing the data because duplicate copies are
stored at each local node as it is a decentralized network.
 Free from Censorship:
 As it does not have control of any single party rather it has the
concept of trustworthy nodes for validation and consensus
protocols that approve transactions by using smart contracts.
 Tighter Security:
 Uses hashing techniques to store each transaction on a block
that is connected to each other so it has tighter security.
 SHA 256 hashing technique for storing transactions.
 Immutability:
 Data cannot be tampered ,due to its decentralized structure.
 Any change will be reflected in all the nodes.
• Transparency:
• Histories of transactions transparent everywhere all the nodes
in the network have a copy of the transaction in the network.
• Any changes occur in the transaction it is visible to the other
nodes.
• Efficiency:
• Removes any third-party intervention between transactions
and removes the mistake making the system efficient and
faster.
• Settlement is made easier and smooth.
• Cost Reduction:
• Needs no third man it reduces the cost for the businesses and
gives trust to the other partner.
• Disadvantages
• Scalability:
• Cannot be scaled due to the fixed size of the block for storing
information.
• The block size is 1 MB due to which it can hold only a couple of
transactions on a single block.
• Immaturity:
• Only a couple-year-old technology so people do not have much
confidence in it.
• Energy Consuming:
• For verifying any transaction a lot of energy is used.
• 0.3 percent of the world’s electricity had been used by 2018 in
the verification of transactions done using blockchain technology.
 Time-Consuming:
 To add the next block in the chain miners need to compute nonce
values many times .
 Legal Formalities:
 In some countries, the use of blockchain technology applications
is banned like cryptocurrency due to some environmental issues.
 Not promoting to use blockchain technology in the commercial
sector.
 Storage:
 Blockchain databases are stored on all the nodes of the network
creates an issue with the storage, increasing number of
transactions will require more storage.
 Regulations:
 Blockchain faces challenges with some financial institution.

You might also like