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

UNIT-IV

Bitcoin is a decentralized digital currency created in 2008 by Satoshi Nakamoto, allowing peer-to-peer transactions without intermediaries like banks. Key features include limited supply, security through cryptographic techniques, pseudonymity, and global accessibility. Transactions are recorded on a public ledger called the blockchain, ensuring transparency and immutability.
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)
11 views

UNIT-IV

Bitcoin is a decentralized digital currency created in 2008 by Satoshi Nakamoto, allowing peer-to-peer transactions without intermediaries like banks. Key features include limited supply, security through cryptographic techniques, pseudonymity, and global accessibility. Transactions are recorded on a public ledger called the blockchain, ensuring transparency and immutability.
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/ 38

UNIT-IV

WHAT IS BITCOIN

• Bitcoin is a decentralized digital currency that is exchanged between two


parties without involving intermediaries like banks or other financial
institutions.
• It was invented in 2008 by Satoshi Nakamoto and was released as open-
source software in 2009.
• Bitcoin operates on a peer-to-peer network, meaning transactions take place
directly between users without the need for intermediaries like banks or
payment processors.
KEY FEATURES OF BITCOIN

• Decentralization: Bitcoin operates on a decentralized network of computers called


nodes. These nodes collectively maintain a public ledger called the blockchain, which
records all transactions made with Bitcoin.
• Limited Supply: The maximum amount of Bitcoins that can be issued is limited to 21
million. This number is also called 'max supply'. This limit was introduced by Satoshi
Nakamoto since the creation of the cryptocurrency to curb inflation and make crypto
scarce and therefore more valuable.
• Security: Bitcoin transactions are secured by cryptographic techniques and verified by
network nodes through a process called mining. Miners compete to solve complex
mathematical puzzles to validate transactions and add them to the blockchain. This
process ensures the security and integrity of the network.
KEY FEATURES OF BITCOIN [CONT…]

• Pseudonymity: While Bitcoin transactions are recorded on the blockchain,


the identities of the users involved are not directly tied to their transactions.
Instead, users are represented by cryptographic addresses, providing a
degree of privacy.
• Global Accessibility: Bitcoin can be sent or received anywhere in the world,
as long as there is an internet connection. This accessibility makes it
particularly useful for international remittances and transactions.
HOW DOES BITCOIN WORK

• Bitcoin achieves elimination of intermediaries with the help of its underlying technology, blockchain.
• Currently if you have to transfer funds to someone, one of the possible ways is by giving cash or
alternatively use a trusted intermediary (example, a bank). Both the mechanisms, whether it be
physical cash or electronic transfer, involve an intermediary .When intermediaries are involved, there
are transaction costs.
• How the blockchain technology helps achieve elimination of intermediaries is by replacing trust that
intermediaries bring to the table with cryptographic proof by the use of CPU computing power.
• This cryptographic trust is built into Bitcoin through a wallet, a public key and a private key in the
program.
• Anyone can create a Bitcoin wallet for free by downloading the Bitcoin program. Each wallet contains
a public key and a private key.
• The public key is like an address or an account number via which any person can receive Bitcoins.
HOW DOES BITCOIN WORK [CONT.. ]

• A private key is like a digital signature via which a person can send Bitcoins. The name
suggests that private keys should be only held and known by the owner and public keys can be
shared with anyone for receiving Bitcoins. That is where you would have heard in the news
about Bitcoins being lost either due to a private key not being accessible or stolen by hackers.
• Owners of Bitcoin addresses are not explicitly identified, but all transactions on the blockchain
are public.
• Since the inception of Bitcoin in 2009, each and every transaction that has occurred is stored in
a ledger, which is considered immutable, non-tamperable and irreversible.
• Bitcoin transactions are verified via telecommunication network nodes through cryptography
and are then recorded in a decentralized distributed ledger called blockchain. This is one of the
distinguishing aspects of Bitcoin from some other crypto assets
DIGITAL KEYS AND ADDRESS
• On the Bitcoin network, possession of bitcoins and the transfer of value via transactions are reliant upon
private keys, public keys, and addresses.
• Elliptic Curve Cryptography (ECC) is used to generate public and private key pairs in the Bitcoin network.
• Private keys in Bitcoin:
• Private keys are required to be kept safe and normally reside only on the owner’s side. Private keys are used to
digitally sign transactions, proving ownership of bitcoins.

• Private keys are fundamentally 256-bit numbers randomly chosen in the range specified by the SECP256K1
ECDSA curve recommendation. Any randomly chosen 256-bit number from 0x1 (1) 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. It is a way to represent the full-size private key in a different format. WIF can be converted into a
private key and vice versa
• For example, consider the following private key:
• A3ED7EC8A03667180D01FB4251A546C2B9F2FE33507C68B7D9D4E1FA5714195201
• When converted into WIF format, it looks as shown here:
• L2iN7umV7kbr6LuCmgM27rBnptGbDVc8g4ZBm6EbgTPQXnj1RCZP
DIGITAL KEYS [CONT..]

• mini private key format is sometimes used to create a private key with a maximum of 30
characters to allow storage where physical space is limited.
• A private key encoded using mini private key format is also sometimes called a minikey. The
first character of the mini private key is always the uppercase letter S. A mini private key can
be converted into a normal-sized private key, but an existing normal-sized private key cannot
be converted into a mini private key. This format was used in Casascius physical bitcoins. The
Bitcoin core client also allows the encryption of the wallet that contains the private keys.
• Public keys in Bitcoin :
• All network participants can see public keys on the blockchain. Public keys are derived from private
keys due to their special mathematical relationship.
• Once a transaction signed with the private key is broadcast on the Bitcoin network, public keys are
used by the nodes to verify that the transaction has indeed been signed with the corresponding
private key.
• This process of verification proves the ownership of the Bitcoin.
DIGITAL KEYS [CONT..]

• Bitcoin uses ECC based on the SECP256K1 standard. More specifically, it makes use
of an Elliptic Curve Digital Signature Algorithm (ECDSA) to ensure that funds remain
secure and can only be spent by the legitimate owner.
• Public keys can be represented in uncompressed or compressed format and are
fundamentally x and y coordinates on an elliptic curve.
• The compressed version of public keys includes only the x part since the y part can
be derived from it.
• Initially, the Bitcoin client used uncompressed keys, but starting from Bitcoin Core
client 0.6, compressed keys are used as standard. This resulted in an almost 50%
reduction of space used to store public keys in the blockchain.
DIGITAL KEYS [CONT..]

• Keys are identified by various prefixes, described as follows:


• Uncompressed public keys use 0x04 as the prefix. Uncompressed public keys are 65 bytes
long. They are encoded as 256-bit unsigned big-endian integers (32 bytes), which are
concatenated together and finally prefixed with a byte 0x04. This means 1 byte for the 0x04
prefix, 32 bytes for the x integer, and 32 bytes for the y integer, which makes it 65 bytes in
total.
• Compressed public keys start with 0x03 if the y 32-byte (256-bit) part of the public key is
odd. It is 33 bytes in length as 1 byte is used by the 0x03 prefix (depicting an odd y) and 32
bytes are used for storing the x coordinate.
• Compressed public keys start with 0x02 if the y 32-byte (256-bit) part of the public key is
even. It is 33 bytes in length as 1 byte is used by the 0x02 prefix (depicting an even y) and
32 bytes are used for storing the x coordinate.
ADDRESSES
• In the preceding diagram, there are a number of steps:
• 1. In the first step, we have a randomly generated ECDSA private key.
• 2. The public key is derived from the ECDSA private key.
• 3. The public key is hashed using the SHA-256 cryptographic hash
function.
• 4. The hash generated in step 3 is hashed using the RIPEMD-160 hash
function.
• 5. The version number is prefixed to the RIPEMD-160 hash generated
in step 4.
• 6. The result produced in step 5 is hashed using the SHA-256
cryptographic hash function.
• 7. SHA-256 is applied again.
• 8. The first 4 bytes of the result produced from step 7 are the address
checksum.
• 9. This checksum is appended to the RIPEMD-160 hash generated in
step 4.
• 10. The resultant byte string is encoded into a Base58-encoded string
by applying the Base58 encoding function.
• 11. Finally, the result is a typical Bitcoin address.
TYPICAL BITCOIN ADDRESSES

• Bitcoin addresses are 26-35 characters long and begin with the digits 1 or 3. A typical Bitcoin
address looks like the string shown here:
• 15ccPQG3PQXcj7fhgmWAHN7SQ7JBvfNFGb

• there are two types of addresses


• P2PKH (Pay-to-Public-Key-Hash)
• P2SH (Pay to Script Hash)

• the commonly used P2PKH and the P2SH type ,starting with numbers 1 and 3, respectively.
In the early days, Bitcoin used direct Pay-to-Pubkey, which has now been superseded by
P2PKH.
• However, direct Pay-to-Pubkey is still used in Bitcoin for coinbase addresses. Addresses
should not be used more than once; otherwise, privacy and security issues can arise.
WHAT IS BITCOIN , EXPLAIN PEER-TO-PEER
TRANSACTIONS , TRANSPARENCY,
IMMUTABILITY
• Bitcoin is a cryptocurrency, a form of electronic money.
• It operates as a decentralized digital currency, independent of traditional
banks.
• Users can send Bitcoin directly to each other without intermediaries, thanks
to the peer-to-peer (P2P) nature of the Bitcoin blockchain network.
• Key Features of Bitcoin:
• Peer-to-Peer Transactions
• Transparency
• Immutability
FEATURES [CONT..]

• Peer-to-Peer Transactions : Bitcoin transactions occur directly between users without


involving banks or other third parties.
• This decentralized approach empowers individuals to control their funds and eliminates the
need for intermediaries.
• Transparency : All Bitcoin transactions are recorded on a public ledger called the blockchain.
• Once added to the blockchain, transactions cannot be altered or deleted, ensuring
transparency and trust.
• Immutability: The blockchain’s structure guarantees immutability.
• Each transaction forms a “block” linked in chronological order, creating an unchangeable
chain.
• This permanence builds confidence among participants in the system.
TRANSACTIONS
• Transactions are at the core of the Bitcoin ecosystem. Transactions can be as simple as just sending
• some bitcoins to a Bitcoin address, or can be quite complex, depending on the requirements.
• A Bitcoin transaction is composed of several elements:
• Transaction ID: A 32 byte long unique transaction identifier
• Size: This is the size of the transaction in bytes.
• Weight: This is a metric given for the block and transaction sizes since the introduction of the SegWit
soft-fork version of Bitcoin.
• Time: This is the time when the block containing this transaction was mined.
• Included in block: This shows the block number on the blockchain in which the transaction is included.
• Confirmations: This is the number of confirmations completed by miners for this transaction.
• Total input: This is the number of total inputs in the transaction.
• Total output: This is the number of total outputs from the transaction.
• Fees: This is the total fee charged.
• Witness: This is the witness for this transaction—used only in SegWit
• Each transaction is composed of at least one input and output. 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 (mining) new coins rather than spending
previously created coins, then there is no input, and therefore no signature is
needed. This transaction is called a coinbase transaction.
TYPES OF BITCOIN TRANSACTIONS

• Standard Transactions: These are the most basic type of Bitcoin


transactions where bitcoins are transferred from one user's wallet to another.
They involve sending a certain amount of bitcoins from one Bitcoin address
to another, with the transaction recorded on the blockchain.
• Multisignature Transactions (Multi-sig): In a multisignature transaction,
multiple digital signatures are required to authorize the spending of bitcoins.
This adds an extra layer of security by requiring the consent of multiple
parties to complete the transaction. Multisig transactions are often used for
escrow services, joint accounts, or any situation where more than one party
needs to approve a transaction.
TYPES OF BITCOIN TRANSACTIONS

• Pay-to-Pubkey (P2PK): This type of transaction involves sending bitcoins


to a public key directly, instead of to a Bitcoin address derived from that
public key. P2PK transactions are relatively uncommon compared to other
types, as they are less efficient and less secure than using Bitcoin addresses.
• Pay-to-Pubkey Hash (P2PKH): P2PKH transactions are the most common
type of Bitcoin transactions. They involve sending bitcoins to a Bitcoin
address, which is derived from the recipient's public key by applying a
cryptographic hash function. P2PKH transactions provide a good balance
between security and efficiency.
• Segregated Witness (SegWit) Transactions: SegWit is a protocol
upgrade implemented to improve Bitcoin's scalability and transaction
malleability. SegWit transactions segregate the witness data (signatures)
from the transaction data, allowing more transactions to fit into each block
and enabling further optimization of the Bitcoin network.
THE TRANSACTION LIFECYCLE
THE TRANSACTION LIFECYCLE

• The lifecycle of a Bitcoin transaction. The steps of the process are as follows:
• A user/sender sends a transaction using wallet software or some other interface.
• The wallet software signs the transaction using the sender’s private key.
• The transaction is broadcast to the Bitcoin network using a flooding algorithm, which is an
algorithm to distribute data to every node in the network.
• Mining nodes (miners) who are listening for the transactions verify and include this transaction in
the next block to be mined. Just before the transactions are placed in the block, they are placed in
a special memory buffer called the transaction pool.
• Next, the mining starts, which is the process through which the blockchain is secured and new
coins are generated as a reward for the miners who spend appropriate computational resources.
Once a miner solves the Proof of Work (PoW) problem, it broadcasts the newly mined block to the
network. The nodes verify the block and propagate the block further, and confirmations start to
generate.
• Finally, the confirmations start to appear in the receiver’s wallet and after approximately three
confirmations, the transaction is considered finalized and confirmed
TRANSFER MONEY USING THE BITCOIN
NETWORK FROM ONE USER TO ANOTHER.
• Sending Bitcoin starts with a Bitcoin wallet for sending, receiving, and securing BTC.
• The wallet’s primary function is allowing you to generate and store your private keys,
the keys that give you control over your Bitcoin accounts.
• Initiating the Transaction:
• Initiating a transaction with your Bitcoin wallet usually means specifying the amount of
BTC you would like to send, and specifying the address you’d like to send it to.
• From there, it will present you with the intent; a sort of digital proposal.
• The proposal will include all of the proposed transaction’s details, although some wallets
will display more detailed information than others.
• At this point, you’ll have the chance to reject or confirm the transaction.
CONT..

• Signing a Bitcoin Transaction:


• When you click confirm, your Bitcoin wallet uses the account’s private key to sign
the transaction.
• Signing a transaction is like giving a digital seal of approval(it tells the miners you
agree to the proposal’s terms)
• Once signed, the transaction is sent to the Bitcoin network’s nodes
• Once it is verified, a miner will include the transaction in a block and it will be
added to the chain.
CONT..

• Sending Bitcoin :
• It’s important to note that the Bitcoin network uses the UTXO (unspent transaction
outputs) model to handle transactions.
• When you send BTC, you send the intended recipient an entire UTXO and then receive
a smaller UTXO back as change.
• When you want to buy something else, you can send the previous smaller UTXO and
receive your change back in a new even smaller UTXO.
• Essentially, you can’t transact on the Bitcoin network without sending the entire UTXO.
• This solves the “double-spending” challenge cryptocurrencies face. Every time a
transaction is executed, the input is deleted and a new output (or UTXO) is created.
• UTXOs are much like banknotes you use in everyday life.
CONT..

• Example :
• Imagine you want to buy some bread that costs $1 but you only have a $20 note
in your pocket. You must hand over the full $20 note to the shopkeeper.
• In return, the shopkeeper will need to give you your change.
• In this example, you receive your $19 change as a single banknote.
• To explain, since Bitcoin is a digital currency it doesn’t require physical
denominations for people to carry around. As such, you receive your change back
in one sum; in the form of a UTXO.
HOW PUBLIC KEYS AND PRIVATE KEYS ARE
USED TO GENERATE BITCOIN ADDRESSES?

• The digital keys are not actually stored in the network, but are instead
created and stored by users in a file, or simple database, called a wallet.
• The digital keys in a user’s wallet are completely independent of the bitcoin
protocol and can be generated and managed by the user’s wallet software
without reference to the blockchain or access to the Internet.
• Every bitcoin transaction requires a valid signature to be included in the
blockchain, which can only be generated with valid digital keys; therefore,
anyone with a copy of those keys has control of the bitcoin in that account.
• Keys come in pairs consisting of a private (secret) key and a public key.
PRIVATE AND PUBLIC KEYS
• A bitcoin wallet contains a collection of key pairs, each consisting of a private key
and a public key.
• The private key (k) is a number, usually picked at random.
• From the private key, we use elliptic curve multiplication, a one-way cryptographic
function, to generate a public key (K).
• From the public key (K), we use a one-way cryptographic hash function to generate
a bitcoin address (A).
• we will start with generating the private key, elliptic curve math that is used to turn
that into a public key, and finally, generate a bitcoin address from the public key.
GENERATING A PRIVATE KEY

• A private key is simply a number, picked at random.


• The private key is used to create signatures that are required to spend bitcoin by proving
ownership of funds used in a transaction.
• The first and most important step in generating keys is to find a secure source of
randomness.
• Creating a bitcoin key is essentially the same as “Pick a number between 1 and 2256.”
• The exact method you use to pick that number does not matter as long as it is not
predictable or repeatable.
• Bitcoin software uses the underlying operating system’s random number generators to
produce 256 bits of randomness.
GENERATING A PUBLIC KEYS
• Starting with a private key in the form of a randomly generated number k, we multiply it by a
predetermined point on the curve called the generator point G to produce another point
somewhere else on the curve, which is the corresponding public key K.
• The public key is calculated from the private key using elliptic curve multiplication, which is
irreversible: K = k * G, where k is the private key, G is a constant point called the generator
point, and K is the resulting public key.
• he reverse operation, known as “finding the discrete logarithm”—calculating k if you know K—
is as difficult as trying all possible values of k, i.e., a brute-force search.

• where k is the private key, G is the generator point, and K is the resulting public key, a point on
the curve. Because the generator point is always the same for all bitcoin users, a private key k
multiplied with G will always result in the same public key K. The relationship between k and K
is fixed, but can only be calculated in one direction, from k to K. That’s why a bitcoin address
(derived from K) can be shared with anyone and does not reveal the user’s private key (k).
BLOCKCHAIN ROLE IN BITCOIN

• The Bitcoin blockchain can be defined as a public, distributed ledger holding


a timestamped, ordered, and immutable record of all transactions on the
Bitcoin network.
• Transactions are picked up by miners and bundled into blocks for mining.
• Each block is identified by a hash and is linked to its previous block by
referencing the previous block’s hash in its header.
• a blockchain is a chain of blocks where each block is linked to the previous block by
referencing the previous block header’s hash.
• This linking makes sure that no transaction can be modified unless the block that records
it and all blocks that follow it are also modified.
• The first block is not linked to any previous block and is known as the genesis block.
• On the left-hand side, blocks are shown starting from bottom to top. Each block contains
transactions and block headers, which are further magnified on the right-hand side.
• At the top, first, the block header is enlarged to show various elements within the block
header. Then on the right-hand side, the Merkle root element of the block header is
shown in a magnified view, which shows how the Merkle root is constructed.
MINERS
• Mining is a process by which new blocks are added to the blockchain.
• This process is resource-intensive due to the requirements of PoW, where miners
compete to find a number less than the difficulty target of the network.
• This difficulty in finding the correct value (also sometimes called the mathematical
puzzle) is there to ensure that miners have spent the required resources before a new
proposed block can be accepted.
• The miners mint new coins by solving the PoW problem, also known as the partial
hash inversion problem.
• This process consumes a high amount of resources, including computing power and
electricity.
• This process also secures the system against fraud and double-spending attacks while
adding more virtual currency to the Bitcoin ecosystem.
• Once a node connects to the Bitcoin network, there are several tasks that a Bitcoin miner
performs:
• Syncing 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 mentioned here in the context of the Bitcoin miner;
however, this is not necessarily a task that only concerns miners. Other nodes, such as full
nodes who are not necessarily mining, also sync with the network to update the local
blockchain database.

• Transaction validation:
• Transactions broadcast 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 the
verification of the nonce value.

• Creating a new block:


• Miners propose a new block by combining transactions broadcast on the network after
validating them.
• Performing PoW:
• This task is the core of the mining process, and this is where miners find a valid
block by solving a computational puzzle. The block header contains a 32-bit
nonce field and 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 (PoW), 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 bitcoins and any associated transaction fees.

You might also like