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

PDF Unit II

Uploaded by

sgg866425
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)
43 views58 pages

PDF Unit II

Uploaded by

sgg866425
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

Unit II

Introduction to Crypto Currency


CONTENT
S
• Bitcoin
• Digital Keys and Addresses
• Transactions
• Mining
• Bitcoin Networks
• Payments
• Wallets
Bitco
in
• Released in 2008 by Satoshi
Nakamoto.
• Focus on crypto-currencies and
micro-payments
• Proof of Work Consensus
Bitcoin vs. bitcoins
• Bitcoin is the system
• bitcoins are the units

What is Bitcoin?
A peer-to-peer internet currency that allows decentralized transfers of
value
between individuals and businesses.
Before Bitcoin
• DigiCash (1989): The 1st Electronic Cash System
• David Chaum’s company, featuring ecash (1983)
• Ecash notes backed by fiat from bank
• Relied on blind signatures

• The idea was published in 2009 by an pseudonymous person/group of people,


named Satoshi Nakamoto.
Goal with Bitcoin was:

• To create a trust less system, using cryptography


• Solve double-spending problem of previous digital currencies
• Create digital assets that can be owned, with proof of ownership
Distrust of financial institutions
• Any noncash transaction requires a trusted third-party administrator commonly a bank or
financial
service provider.
• The system forces participants to trust financial institutions that are not always trustworthy.

Transaction security

Two levels of verification


• Source is legitimate
• Coins are legitimate
Bitcoin

• Bitcoin is the official first cryptocurrency that had been released in 2009. It
is basically a digital currency and only exists electronically.
• Bitcoin is the first successful electronic cash system and coincidentally, the first
instance of a successful Blockchain.
• Secure, trustless, borderless
• No bank needed to authorize/process transactions
• Transactions are stored on a distributed ledger
• Bitcoin introduced the concept of cryptocurrency;
• decentralized digital money secured by cryptography, used to create
valuable digital assets that cannot be counterfeited.
Bitcoin transactions are authorized in a
peer- to-peer network.
• Each node stores the history of the chain of blocks, containing
validated transactions
• Counterfeiting is impossible because if one node’s history is corrupted the others
stay the same, and no central authority (i.e. bank) needs to confirm; this is
called decentralization
• Unlike previous P2P network models, members of the Bitcoin network
are incentivized to participate through cryptocurrency
• Specifically, the incentive is for the people who mint (create) Bitcoin,
called
miners.
Before and After
bitcoin
Bitcoin Properties

• Bitcoins can be possessed.


• Bitcoins can be transferred.
• Bitcoins are impossible to copy.
Mining bitcoins

• Miners solve complicated algorithms to find a solution called a hash.


• Finding a hash creates a block that is used to process transactions.
• Each new block is added to the block chain.
• Until there are 21 million bitcoins, miners are paid for finding a hash in new
coin.
• After 21 million, miners will charge transaction fees for creating a new block.
• The amount paid per hash goes down by half about every 4 years.
Owning bitcoins

• Users create accounts called wallets.


• Wallets are secured using passwords
and contain the private keys used
for transferring bitcoins.
Spending
bitcoins

• Figure:- bitcoin transaction


Wallets
• A wallet is a combination of public address and private
key.

Figure :- bitcoin wallets


Hardware
wallets
• Hardware wallets are hardware
devices that individually handle
public addresses and keys.
• It looks like a USB with OLED screen
and side buttons.
• when you open a wallet you are
provided with 2 pair of keys
(sometimes more). Public key and the • The private key is used to sign the
private key. transactions confirming your ownership
• public key is used to generate the over it.
public cryptocurrency address you • This is a reason why private key must be
can use to receive the cryptocurrency, kept secret
Paper Wallets

•It is a physically printed QR


coded form wallet.
•Some wallets allow
downloading the code to
generate new addresses offline.
Desktop Wallet

Desktop wallets are programs that


store and manage the private key for
your Bitcoins on your computer’s
hard drive.
Mobile
wallets

• A mobile wallet is a virtual wallet that


stores payment card information on a
mobile device.
• They are quite convenient as it uses
QR codes for transactions
• Some mobile wallets are Coinomi and
Mycelium
Web
Wallets
•These wallets are accessed
by internet browsers.
•They are the least secure
wallets.
•They are not the same as hot
wallets.
•They are ideal for small
investments and allow quick
transactions.
•Some of these are MetaMask
and Coinbase.
Bitcoin Transactions
Bitcoin Transactions

• A full node is basically an


electronic bookkeeper, and
anybody in the world can
set up and run one.

• Each node has a complete


copy of the public
ledger
– that’s a record of every
Bitcoin transaction
Sample Transaction

Transactions with Hash values


Transactions with Hash values

• Every transaction has a set of inputs and a set of outputs.


• The inputs identify which bitcoins are being spent, and the outputs assign those bitcoins
to their new owners.
• Each input is just a digitally signed reference to some output from a previous transaction.
• Once an output is spent by a subsequent input, no other transaction can spend that output
again.
• Each unspent output represents some amount of bitcoin that is currently in someone’s
possession.
• Note that nobody’s real name appears anywhere within a transaction. That’s why Bitcoin
is often said to be pseudonymous
• Instead of real names, bitcoins are assigned to addresses such
as
1PreshX6QrHmsWbSs8pHpz6kLRcj9kdPy6.
Where Do Addresses Come From?

• Obviously, if you want to receive bitcoins, you need to have a Bitcoin


address. Your wallet can generate addresses for you.
• In order to generate an address, your wallet first generates a private
key.
• A private key is nothing but a large number roughly between 1 and
256.
• To make such numbers shorter to write, it’s customary to encode them
as sequence of numbers and letters.
Bitcoin Address

• Your wallet converts that private key to a Bitcoin address using a well-
known function.
• This function is very straightforward for a computer to perform.
• It uses elliptic curve cryptography to generate Bitcoin addresses
• Ifanyone knows your private key, they could easily convert it to
a Bitcoin address, too.
• If someone knows only your Bitcoin address, it’s virtually impossible
to figure out what the private key was.
How Are Transactions Authorized
• InBitcoin, a valid
digital
signature serves as proof that
the transaction
was
authorized by the
address’s
owner.
• Just as a private key
was
required to generate
that
address, the same private key
is required, once again,
to
generate a valid
digital
signature.

• A digital signature is
only
valid if a specific equation is
The Bitcoin lifecycle
• Sender wants to send 1 Bitcoin to Receiver. This is what is going to happen:

Figure:- Bitcoin Life cycle


The Bitcoin lifecycle

• Sender creates a transaction.


• Sender's bitcoin wallet validates the transaction.
• The transaction is sent to Mempool.
• Miners get the transaction from Mempool and start mining the block using a
consensus algorithm.
• After the block is fully mined, it is added to the network.
• The chain validates the new block and every peer in the network will get the
blockchain with the new block added.
• Finally, the Receiver get your BTCs
Mempool

• The Mempool (Shortcut for Memory Pool) is where the transactions


stay until the miner is ready to get them.
• In the bitcoin's blockchain, the miner prioritize the biggest transactions
over the smallest ones.
• This happens because here is where the miner makes money.
• Miner "mine" the block through the consensus algorithm.
Bitcoin Flow of Transaction
Bitcoin Flow of Transaction• Let us say that there are two parties
Alice and Bob who want to
communicate with each other for funds
transfer over an insecure channel,
Internet. Then following sequence of
activities are performed between two
parties.
• If Alice wants to send some coins
from her walletX to Bob’s wallet Y, then
a request of transactional data “t” is sent
to Bob. This request is broadcasted in
the entire network.
• The distributed nodes accept the
request and update their ledgers with
the transactional information of Alice–
Bob.
• After updating ledgers, Alice computes
Bitcoin Flow of Transaction • A miner node is selected to verify and
validate the transaction.
• It computes proof-of-work (PoW) to
match the DS received.
• If PoW is successfully matched with DS,
then the result is broadcast to all the
nodes for verification and validation.
• The other miner nodes also verify the
PoW with DS.
• If the verification is successful, then the
miner node is (financially) rewarded for
computing the PoW.
• The validated block is added in the
validated chain and the transaction is
broadcasted to the entire blockchain.
Bitcoin Flow of Transaction
• Using the validated transaction “t,”
the bitcoins are added to walletY of
Bob.

• Bob decrypts the content using the


paired public key (PUK) of Alice
and sends the acknowledgment
(ACK) to Alice.

• The transaction is finished


Alice oncethe
receives
transaction
acknowledgment.
Mining
process
Mining Process
• Mining is a process by which new blocks are added to the blockchain.
• Blocks contain transactions that are validated via the mining process by
mining nodes on the Bitcoin network.
• Blocks, once mined and verified are added to the blockchain which keeps
the blockchain growing.
• This difficulty in finding the correct value (also called sometimes the
mathematical puzzle) is there to ensure that the required resources have been
spent by miners before a new proposed block can be accepted.
• New coins are minted by the miners by solving the PoW problem, also known
as partial hash inversion problem.
• This process consumes a high amount of resources including computing power
and electricity.
• This process also secures the system against frauds and double spending
attacks while adding more virtual currency to the Bitcoin ecosystem.
Mining Process
• Roughly one new block is created (mined) every 10 minutes to
control the frequency of generation of bitcoins.
• This frequency needs to be maintained by the Bitcoin
network and is encoded in the bitcoin core clients in order
to control the money supply.
• Miners are rewarded with new coins if and when they
discover new blocks by solving PoW.
• Miners are paid transaction fees in return for including
transactions in their proposed blocks.
• New blocks are created at an approximate fixed rate of every
10 minutes. The rate of creation of new bitcoins decreases by
50%, every 210,000 blocks, roughly every 4 years.
• When bitcoin was initially introduced, the block reward was
50 bitcoins; then in 2012, this was reduced to 25 bitcoins.
• In July 2016, this was further reduced to 12.5 coins (12 coins)
• This will reduce the coin reward further down to
Mining Process
• Approximately 144 blocks, that is, 1,728 bitcoins are generated
per day.
• The number of actual coins can vary per day; however, the
number of blocks remains at 144 per day.
• Bitcoin supply is also limited and in 2140, almost 21 million
bitcoins will be finally created and no new bitcoins can be
created after that.
• Bitcoin miners, however, will still be able to profit from the
ecosystem by
charging transaction fees.
Types of Mining

• The process of mining can get really complex and a regular desktop or
PC can’t cut it.
• It requires a unique set of hardware and software that works well for
the user.
• It helps to have a custom set specific to mining certain blocks.
• The mining process undertaking can be divided into three
categories:
1. Individual Mining
2. Pool Mining
3. Cloud Mining
Individual Mining
• In Individual Mining, the user has to register itself as a miner.
• As soon as a transaction occurs, all the single users in the blockchain
network will receive a mathematical problem.
• The first one to solve the complex mathematical problem gets
rewarded.
• The solution comes after rigorously using the hardware and software
properties of the computer, which is being used by the miner.
• With the solution onboard, all the other network miners will validate
the decrypted value and then add the same to the blockchain.
• Thus, verifying the transaction that just occurred.
Pool Mining
• Another type of mining is Pool Mining, where several users operate
together to approve the transaction
• Numerous transactions occur every second.
• Sometimes, due to the complexity of the data encrypted in the blocks,
a single user can’t decrypt the data encoded.
• Then the entire team of miners in the network operate together to solve
the complex numerical and computational problem.
• After the result is validated, the reward is then also split between all
users.
Cloud Mining
• Eliminating the use of multiple computer hardware and software, another way in
which you can mine blockchain is through cloud mining.
• Without juggling with the hardware and software parameters, electricity, or power
usage and the connectivity or bandwidth issues, you can extract the blocks
hassle- free with this method.
• Cloud mining allows the users to operate in peace, not having to worry about
the heating of the equipment or ventilation issues in managing the hardware.
• The constant worry to deal with handling all the machinery and worrying about
its order timings or selling profits is eliminated altogether.
• It seems profitable, according to the mining hardware parameters, but has its
own set of disadvantages.
• These include limiting operational functionality with the limitations on bitcoin
hashing.
• Lowering the reward profits results in the operational expenses to increase
with cloud mining.
• The software up-gradation gets restricted with this type of mining, and so does
the
verification process involved.
Tasks of the
miners
• Synching up with the network:
• Once a new node joins the bitcoin network, it downloads the blockchain
by requesting historical blocks from other nodes.
• This is not necessarily a task only for a miner.

• Transaction validation:
• Transactions broadcasted on the network are validated by full nodes
by verifying and validating signatures and outputs.
• Block validation:
• Miners and full nodes can start validating blocks received by them
by evaluating them against certain rules.
• This includes the verification of each transaction in the block along
with verification of the nonce value.
Tasks of the
• Create a new block:
miners
• Miners propose a new block by combining transactions broadcasted on the network
after validating them.
• Perform Proof of Work:
• This task is the core of the mining process
• This is where miners find a valid block by solving a computational puzzle.
• The block header contains a 32-bit nonce field
• Miners are required to repeatedly vary the nonce until the resultant hash is less than
a predetermined target.
• Fetch reward:
• Once a node solves the hash puzzle, it immediately broadcasts the results, and other
nodes verify it and accept the block.
• There is a slight chance that the newly minted block will not be accepted by other miners
on the network due to a clash with another block found at roughly the same time,
• but once accepted, the miner is rewarded with 12.5 bitcoins and any associated transaction
fees.
The mining algorithm
The mining algorithm consists of the following steps.
• The previous block's header is retrieved from the bitcoin
network.
• Assemble a set of transactions broadcasted on the network
into a block to be proposed.
• with a noncethe
Compute anddouble
the newly proposed
hash of block using the SHA-
the previousblock'sheader
algorithm.
256
combined
• Check if the resultant hash is lower than
the current difficulty level (target) then PoW is
solved.
• As a result of successful PoW the discovered block is
broadcasted to the network and miners fetch the reward.
• If the resultant hash is not less than the current difficulty
level (target), then repeat the process after incrementing the
nonce.
Bitcoin Address
Example
• Bitcoin addresses are 26-35 characters long, consist of alphabetic and
numeric characters, and either begin with “1”, “3”, or “bc1”.
• Currently, there are three Bitcoin address formats in use:

1. P2PKH (address starts with the number “1”)

2. P2SH (address starts with the number “3”)

3. Bech32 (address starts with “bc1”)


P2PKH (address starts with the number “1”)

• The P2PKH concept stands for “Pay to Public Key Hash”.

• P2PKH means “pay to this Bitcoin address”. It serves as an instruction on


the blockchain for users wanting to transfer Bitcoin to one another.

• Behind every transaction, there are underlying codes working behind the scene.
This scripting language is known as the Bitcoin Scripting Language.
P2PKH

GUI of Pay to Public Key Hash


P2SH (address starts with the number “3”)

• Pay to script hash (P2SH) is an advanced type of transaction used in Bitcoin


and other similar cryptocurrencies.
• P2SH or Pay-to-Script-Hash was a patch to Bitcoin added in 2012 which
altered the way it validated transactions.
• It is most commonly identifiable as the addresses in Bitcoin that start with a
“3” instead of a “1”.
• Unlike P2PKH, it allows sender to commit funds to a hash of an arbitrary valid
script.
•Example:
3J98t1WpEZ73CNmQviecrnyiWrnqRhWNLy
Bech32 (address starts with “bc1”)
•Example:
bc1qar0srrr7xfkvy5l643lydnw9re59gtzzwf5mdq
How to Get a Bitcoin Address

• To get a Bitcoin address, you first need to download a Bitcoin wallet, which is
software that allows you to securely send, receive, and store Bitcoin funds in
the Bitcoin network.
• Bitcoin wallets also store your private key, which is essentially your Bitcoin
password.
• The software will generate a brand new Bitcoin address for you every time you
create an invoice or receive a payment request for Bitcoins too.
• There are four types of Bitcoin wallets that you can use: mobile, web,
desktop, and hardware.
• Source: https://blog.hubspot.com/marketing/bitcoin-address
The Bitcoin network
• There are different types of nodes on the network.
• There are two main types of nodes,
• full nodes and SPV nodes.
• Full nodes, as the name implies, are implementations of Bitcoin core
clients performing the wallet, miner, full blockchain storage, and
network routing functions.
• It is not necessary to perform all these functions. Simple Payment
Verification (SPV) nodes or lightweight clients perform only wallet
and network routing functionality.
• Another type is solo miner nodes that can perform mining, store full
blockchain, and act as a Bitcoin network routing node.
The Bitcoin network is identified by its different magic values

• Magic values are used to indicate the message origin


network.
• A full node performs four functions: wallet, miner,
blockchain, and the network routing node.
Different types of messages that bitcoin
protocol uses
• There are 27 types of protocol messages in total,
but they're likely to increase over time as the
protocol grows.
• The most commonly used protocol messages
and their explanation are listed as follows:
The most commonly used protocol messages and their
explanation are listed as follows:
• Version:
• This is the first message that a node sends out to the network, advertising
its version and block count.
• The remote node then replies with the same information and the connection
is
then established.
• Verack:
• This is the response of the version message accepting the connection
request.
• Inv:
• This is used by nodes to advertise their knowledge of blocks and
transactions.
• Getdata:
• This is a response to inv, requesting a single block or transaction identified
by its hash.
The most commonly used protocol messages and their
explanation are listed as follows:
• Getheaders:
• This is used to request block headers in a specified range.
• Tx:
• This is used to send a transaction as a response to the getdata protocol
message.
• Block:
• This sends a block in response to the getdata protocol message.
• Headers:
• Provides a list of block headers in response to a getheaders request.
• This packet returns up to 2,000 block headers as a reply to the getheaders
request.
• Getaddr:
• This is sent as a request to get information about known peers.
• Addr:
• This provides information about nodes on the network.
Visualization of node discovery
protocol

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy