Blockchain Tostudy
Blockchain Tostudy
1. Goofy Coin
2. Scoorge Coin
o Proof of Work is a consensus algorithm used in Bitcoin to secure the network. Miners
solve complex mathematical puzzles to validate transactions and add blocks to the
blockchain.
o A transaction fee calculator determines the fee based on the transaction size (in
bytes) and the current fee rate set by the network. Fees incentivize miners to
prioritize transactions.
10 Marks Questions
In blockchain technology, forks refer to changes or upgrades to the blockchain protocol. These can
occur due to disagreements in the community, security upgrades, or the addition of new features.
Forks are classified into two main types:
✅ Soft Fork
Definition:
A Soft Fork is a blockchain protocol upgrade that remains backward-compatible. This means that
even nodes (computers running the blockchain software) that have not updated to the latest version
can still recognize and validate blocks created by upgraded nodes.
Backward-Compatible: Old nodes continue functioning without disruption, although they
may not understand or utilize new features introduced by the fork.
Consensus Maintenance: Soft forks maintain consensus across the network, preventing splits
or chain divergence.
Minor Changes: They often introduce optimizations, bug fixes, or feature enhancements
without fundamentally changing the blockchain's rules.
How It Works:
Old nodes, while unaware of the stricter rules, still accept the blocks as valid since they
follow the older, broader set of rules.
Example:
How It Worked: SegWit separated the digital signature (witness data) from the main
transaction data, reducing block size.
Backward Compatibility: Old nodes did not reject SegWit transactions, though they could
not recognize or benefit from the signature separation.
✅ Hard Fork
Definition:
A Hard Fork is a non-backward-compatible update to the blockchain protocol. It introduces
significant changes that older nodes cannot understand or validate. If some nodes refuse to upgrade,
the blockchain splits into two separate chains — one following the old rules and the other following
the new rules.
Creation of a New Cryptocurrency: Often, a hard fork results in the creation of a new coin.
Conflict Resolution: Hard forks are sometimes used to resolve disputes within the
community.
How It Works:
If consensus is not reached, nodes that accept the new rules upgrade their software.
Nodes that reject the changes continue using the old rules.
Example:
Solution: Bitcoin Cash increased the block size to 8 MB to allow faster and cheaper
transactions.
Outcome: The blockchain split into two networks — Bitcoin (BTC) and Bitcoin Cash (BCH).
Impact: Bitcoin Cash emerged as a new cryptocurrency with its own independent network.
Chain splits may reduce network security due to lower hash power.
Upgrade Requirement Only miners need to upgrade All nodes must upgrade
Purpose Minor upgrades and bug fixes Major changes and ideological disagreements
The Double Spending Problem refers to the possibility that a user might attempt to spend the same
digital currency twice. Unlike physical currencies (e.g., cash), which can only exist in one place at a
time, digital currencies are essentially data. Since data can be copied or manipulated, digital
currencies face the risk of fraudulent activities where the same coins are spent multiple times.
This is a major issue in decentralized systems, especially in cryptocurrencies like Bitcoin that operate
without a central authority to verify transactions. Preventing double spending is essential for
maintaining trust and ensuring the integrity of digital currencies.
Lack of Physical Form: Cryptocurrencies are purely digital and can be duplicated or falsified.
Delay in Transaction Confirmation: It takes time for a transaction to be confirmed and added
to the blockchain. During this period, malicious actors may attempt to perform double
spending.
1. Race Attack:
o One transaction is sent to a merchant for a purchase, while the other is sent to a
second wallet owned by the attacker.
o The attacker mines a block with a fraudulent transaction but does not broadcast it
immediately.
o After making a payment with the same coins, the attacker quickly broadcasts their
mined block, invalidating the payment.
3. 51% Attack:
o If an attacker controls 51% or more of the total mining power, they can manipulate
the blockchain by rewriting the transaction history and spending the same coins
multiple times.
Bitcoin solves the double spending problem using three primary mechanisms:
1. Blockchain
Once a transaction is confirmed and added to a block, it is nearly impossible to reverse it.
Miners compete to solve complex mathematical puzzles to add a block of transactions to the
blockchain.
This requires significant computational power, making it impractical for attackers to rewrite
the blockchain.
3. Consensus Mechanism
Bitcoin follows a longest chain rule — the chain with the most cumulative computational
work is considered valid.
If a malicious actor attempts double spending, the network will reject the fraudulent
transaction if the legitimate chain grows faster.
Transaction Confirmations:
o For added security, merchants often wait for 6 confirmations before considering a
transaction final.
1. First Transaction:
o The transaction is broadcast to the network and added to the blockchain once
confirmed.
o However, miners and nodes will detect that Alice has already spent her 1 BTC with
Bob.
3. Outcome:
o The first transaction to be confirmed and added to the blockchain will be considered
valid.
Public Key Infrastructure (PKI) is a system of processes, technologies, and entities designed to
manage and secure digital communications using cryptographic keys. It is widely used to ensure
confidentiality, integrity, and authentication during online interactions.
In the context of cryptocurrencies like Bitcoin, PKI provides a mechanism for verifying the legitimacy
of transactions, ensuring only authorized users can sign and approve payments.
1. Authentication:
o PKI confirms that the sender of a message is who they claim to be by validating
digital signatures using public keys.
2. Data Integrity:
o It ensures that the data (e.g., transactions) has not been altered during transmission.
3. Encryption:
o PKI encrypts sensitive information using public and private keys, protecting data
from unauthorized access.
4. Non-Repudiation:
o Once a sender signs a transaction using their private key, they cannot deny sending
it.
✅ Components of PKI
1. Public Key:
o In Bitcoin, a user's public key is derived from their private key using cryptographic
algorithms like Elliptic Curve Digital Signature Algorithm (ECDSA).
2. Private Key:
o If someone gains access to a private key, they can control the associated
cryptocurrency.
3. Digital Certificates:
o A digital certificate acts as a form of electronic identity that binds a public key to a
specific user or entity.
o In cryptocurrencies, while digital certificates are not used in the same way as
traditional PKI, wallet addresses act as identifiers.
o A CA is a trusted organization that verifies the identity of entities and issues digital
certificates.
o In Bitcoin, Certificate Authorities are not used. Instead, the blockchain itself acts as a
trust mechanism through consensus and decentralization.
✅ How PKI Works in Bitcoin
In Bitcoin, PKI is simplified and adapted for secure transactions using public-private key pairs. Here's
how it works:
The private key is kept secret and used for signing transactions.
The public key is shared with others and used to verify signatures.
The public key is further hashed to create a Bitcoin address for receiving payments.
When a user wants to send Bitcoin, they create a transaction that includes:
o Receiver’s address
o Amount
Miners and nodes verify the transaction using the sender’s public key to ensure:
Once verified, the transaction is added to a block and confirmed by the blockchain network
through the Proof of Work (PoW) consensus mechanism.
2. Alice has a private key and a corresponding public key (which has generated her Bitcoin
address).
1. Cryptographic Strength:
o Bitcoin uses Elliptic Curve Cryptography (ECC) and the ECDSA algorithm for secure
key generation and signature verification.
2. Tamper-Proof Ledger:
3. Decentralized Verification:
o Unlike traditional PKI systems that rely on CAs, Bitcoin’s security is maintained
through a decentralized network of nodes.
4. Anonymity:
o While public keys are visible, they do not reveal personal identities, providing privacy
to users.
Data Integrity Ensured using certificates and CRLs Ensured using blockchain immutability
Physical Form: Stored on physical devices like USB drives, hardware wallets, or paper wallets.
Long-Term Security: Ideal for storing large amounts of cryptocurrency securely for extended
periods.
1. Hardware Wallets:
2. Paper Wallets:
3. Air-Gapped Devices:
Online Storage: Private keys are stored digitally in applications or cloud services.
1. Mobile Wallets:
2. Desktop Wallets:
3. Web Wallets:
o Online services where users can manage their cryptocurrencies through a web
browser.
4. Exchange Wallets:
Often comes with user-friendly interfaces and additional services like staking or lending.
In Bitcoin, transaction fees are small payments users include to incentivize miners to confirm and
add their transactions to the blockchain. The fees go directly to miners as a reward for their work.
Unlike traditional payment systems that charge fees based on the transaction amount, Bitcoin fees
are calculated based on the transaction size in bytes and the fee rate (measured in Satoshis per
Byte).
✅ Definition:
A Multisignature (Multisig) is a type of Bitcoin script that requires multiple signatures (private keys)
to authorize a transaction. It enhances security by distributing control across multiple parties.
Instead of relying on a single private key, multisig wallets need a predefined number of signatures
(e.g., 2-of-3, 3-of-5).
✅ How Multisignature Works
1. Key Generation:
2. Script Creation:
o A multisig script defines how many signatures are required for a valid transaction.
3. Transaction Signing:
4. Verification:
To spend the funds, at least two out of the three participants must sign the transaction.
Use Cases:
Escrow Services: Funds are held in escrow until both parties approve the release.
✅ Advantages of Multisignature:
✅ Disadvantages of Multisignature:
Proof of Work (PoW) is the first consensus mechanism, introduced by Bitcoin. It involves miners
competing to solve complex cryptographic puzzles to validate transactions and create new blocks.
2. Hash Generation: Miners repeatedly generate hashes using the block's data and a random
number (nonce) until they find a hash that meets specific criteria.
3. Block Addition: The first miner to solve the puzzle broadcasts the block to the network.
4. Consensus: Other nodes verify the solution, and if valid, the block is added to the blockchain.
5. Reward: The successful miner receives a block reward and transaction fees.
✅ Example:
In Bitcoin, miners solve puzzles using the SHA-256 hash function. It takes enormous computational
effort to find a valid hash, but once found, it is easy for other nodes to verify.
A Decentralized Exchange (DEX) allows users to trade cryptocurrencies directly with one another
without relying on intermediaries. Transactions on DEXs are governed by smart contracts — self-
executing code that facilitates trades.
3. Liquidity Pools: Users contribute to liquidity pools to facilitate trading. In return, they earn
fees.
4. On-Chain Transactions: All trades are recorded on the blockchain, ensuring transparency.
✅ Examples of DEXs:
Uniswap (Ethereum)
SushiSwap
✅ Advantages of DEXs:
User Control: Users retain ownership of their private keys and funds.
✅ Disadvantages of DEXs:
Technical Complexity: Users need knowledge of blockchain wallets and gas fees.
✅ Cryptocurrencies
A cryptocurrency is a form of digital currency that uses cryptography to secure transactions, control
the creation of new units, and verify the transfer of assets. Unlike traditional currencies issued by
governments (fiat currencies), cryptocurrencies operate on decentralized networks using blockchain
technology.
Blockchain: A public, immutable ledger that records all transactions across the network.
1. Bitcoin (BTC)
2. Ethereum (ETH)
o Transitioned from Proof of Work (PoW) to Proof of Stake (PoS) for energy efficiency.
3. Litecoin (LTC)
o Uses the Scrypt hashing algorithm for faster and more energy-efficient mining.
A Hash Function is a cryptographic algorithm that takes an input (message or data) and produces a
fixed-length output called a hash. In cryptocurrencies, hash functions are crucial for securing
transactions, maintaining data integrity, and ensuring blockchain security.
Bitcoin uses the SHA-256 (Secure Hash Algorithm 256-bit) hash function.
Each block of transactions has a unique hash, linking it to the previous block, forming a chain
of blocks (blockchain).
1. Deterministic:
2. Collision-Resistant:
o It is nearly impossible to find two different inputs that produce the same hash.
SHA-256 (Secure Hash Algorithm 256-bit) is a cryptographic hash function used by Bitcoin.
Example:
plaintext
CopyEdit
Input: "Bitcoin"
Output: 6b9c1c1379a4e02d5640e7f9c4e9d223a6bb174c680f1a1de2a82e1f6ccf4e5
Each block contains a hash of the previous block, forming a linked chain.
Any attempt to alter transaction data will change the hash, immediately exposing fraud.
✅ Definition
Users trust the exchange to hold their funds and execute trades on their behalf.
CEXs are commonly used for trading cryptocurrencies with fiat currencies like USD, EUR, or
INR.
1. Binance:
2. Coinbase:
3. Kraken:
✅ Advantages of CEXs:
1. High Liquidity:
2. User-Friendly Interfaces:
3. Additional Services:
o Many exchanges offer margin trading, staking, lending, and futures trading.
4. Fiat Support:
o Users can directly purchase cryptocurrencies using their local currency through bank
transfers or credit cards.
✅ Disadvantages of CEXs:
1. Lack of Control:
o “Not your keys, not your coins” — If an exchange is hacked, users may lose funds.
2. Security Risks:
3. Centralization:
Fees Higher fees due to intermediaries Lower fees, only network fees
Fiat Integration Supports fiat-to-crypto transactions Usually does not support fiat
✅ Introduction to PKI
Public Key Infrastructure (PKI) is a framework that uses cryptographic methods to manage and
secure digital keys. It ensures the confidentiality, integrity, and authenticity of data during digital
communication.
In Bitcoin and other cryptocurrencies, PKI provides a secure mechanism for generating, managing,
and verifying cryptographic keys used in transactions. Every user has a pair of keys:
Public Key: Shared openly and used for verifying the authenticity of transactions.
Private Key: Kept secret and used to sign transactions, proving ownership of the funds.
1. Key Generation
Bitcoin uses Elliptic Curve Digital Signature Algorithm (ECDSA) for key generation.
The algorithm generates two mathematically linked keys: a private key and a corresponding
public key.
The private key is a 256-bit number, while the public key is derived from the private key using
elliptic curve multiplication.
The public key is then hashed using SHA-256 and RIPEMD-160 algorithms to create a Bitcoin
address.
✅ Example:
When a user wants to send Bitcoin, the transaction is digitally signed using their private key.
The signature serves as proof that the transaction was authorized by the true owner of the
funds.
Since the private key is never revealed, the security of the funds remains intact.
2. Alice’s private key signs the transaction data, creating a digital signature.
3. The signature is included in the transaction and broadcast to the Bitcoin network.
3. Verification
Nodes in the network receive Alice’s transaction and verify it using her public key.
✅ Verification Process:
1. Authentication:
o Ensures the sender of the transaction is the rightful owner of the Bitcoin being
transferred.
2. Integrity:
3. Non-Repudiation:
o The sender cannot deny initiating a transaction after it has been signed and verified.
o PKI enables Bitcoin to function without the need for a centralized authority.
1. Transaction Creation:
2. Transaction Signing:
3. Verification:
4. Confirmation:
o After the block is added to the blockchain, Bob receives the 1 BTC.
While PKI handles the signing and verification of individual transactions, Proof of Work (PoW)
ensures the consensus across the network.
PoW: Prevents double-spending and secures the network against attacks by requiring miners
to solve computationally intensive puzzles.
Together, they maintain the integrity and reliability of the Bitcoin blockchain.