Blockchain, Bitcoin, and Cryptocurrency Notes

Traditional Transactions

  • Scenario: Buying something worth 50 ADCW.
  • Process:
    • Customer (you) gives card to merchant.
    • Merchant contacts the bank (represented by someone in the class).
    • Merchant asks the bank if the customer has enough funds.
    • The bank checks the balance (e.g., 73 ADCW).
    • If sufficient funds are available, the transaction goes through.
  • Role of the Bank: The bank stores all transaction data and is responsible for all transactions.
  • Limitation: A single entity (the bank) holds all the power.
  • Example: Trying to buy something for 100 ADCW when the balance is 73 ADCW will be rejected.

2008 Financial Crash and the Rise of Blockchain

  • Context: The 2008 financial crash, particularly the housing market crash, was due to banks lending money irresponsibly.
  • Impact: People lost money, couldn't pay mortgages, and lost their homes.
  • Result: This led to the boom of blockchain, Bitcoin, and other cryptocurrencies.

Cryptocurrency Scenario

  • Process: Instead of a bank, everyone in the room is queried to validate a transaction.
  • Example: Asking everyone if a purchase of 100 KCTW is possible.
  • Outcome:
    • If everyone agrees, the transaction is valid.
    • If someone disagrees or has mismatched information, the discrepancy is identified.
  • Accountability: Everyone holds the information, and accountability is collective.
  • Benefit: Prevents a single entity from manipulating data.
  • Example of Mismatch: A handwritten '0' making '73' look like '730' can be caught by others.

Key Concept: Decentralization

  • Everyone holds transaction information.
  • No single entity can alter the information unnoticed due to collective verification.
  • Addresses the issue of trusting one central authority.
  • Risk: Double majority issues which is unlikely due to technology.

Bitcoin Value and Market Influence

  • November 2021: One Bitcoin was worth £80,000.
  • Recent Fluctuations:
    • Passed $90,650, then dipped back.
    • Briefly showed over $100,000.
    • Current value (as of the recording): $78,000.
  • Market Influencers:
    • US elections: Unexpected results significantly influenced Bitcoin's value.
    • Elon Musk: His involvement also affects the market.
  • Government Interest: Governments and financial sectors are heavily invested in cryptocurrency.
  • Acceptance as Currency:
    • Companies like Microsoft and possibly Tesla accept Bitcoin.
    • Increasingly used for transactions in places like California.

Blockchain Technology

  • NFTs (Non-Fungible Tokens): Powered by blockchain technology.
  • Inventor of Bitcoin: Satoshi (pseudonym) in Feb 2008; identity remains unknown.
  • Satoshi as a Unit: Smallest fraction of a Bitcoin (similar to cents in a pound).
  • Wallet-Based System: Bitcoin is purely software-based; wallets are created via Bitcoin addresses.
  • Transaction Sharing: Bitcoin addresses are shared during transactions.

Blockchain as a Digital Ledger

  • Concept: Blockchain is a digital ledger recording all transactions.
  • Process:
    • Transactions are broadcasted to the network.
    • Everyone in the network verifies the transaction.
    • Miners verify transactions, ensuring they are legitimate.
    • If verified, the transaction is approved.
  • Difference from Traditional Transactions: Banks verify in traditional systems, whereas everyone in the network does in blockchain.

Bitcoin Software and Transaction History

  • Software Size: Bitcoin software can be hundreds of gigabytes due to storing all transaction history since 2008. Every transaction is stored.
  • Core Properties of Blockchain:
    • Agreement: Everyone agrees on transaction validity.
    • Persistence: Once verified, transactions are permanently added to the ledger and cannot be changed.
    • Liveness: Changes can be made if everyone agrees to the change.

Hash Functions

  • Definition: A mathematical function that is easy to compute in one direction but hard to reverse.
  • One-Way Function: Easy to get the output but almost impossible to determine the input.
  • Sensitivity to Change: A minor change in the input drastically changes the output.
  • Example: Using the demoblockchain.org website to demonstrate SHA256.
  • SHA256:
    • Output: 256 bits (64 hexadecimal characters).
    • Property: Even a small input change results in a completely different output, making it hard to reverse engineer.
    • The encryption output is always fixed, regardless of the length of the input.
    • Secure Hash Algorithm

Block Structure

  • Each block contains:
    • Version information
    • Timestamp
    • Merkle root.
    • Previous block hash.
    • Transactions.
  • All this data is processed through a hash function to produce the block hash.

Merkle Root

  • Purpose: Efficiently store transaction information.
  • Process:
    • Each transaction has a hash value.
    • Instead of storing every hash, pairs of hashes are combined and hashed together.
    • This process repeats up the tree until a single root hash (Merkle root) is obtained.
  • Handling Imbalance:
    • If there's an odd number of transactions, the last hash is duplicated to create balance.
  • Benefit: The Merkle root contains a summary of all transactions in the block.

Blockchain Structure

  • Blocks of transactions are chained together.
  • Each block contains a reference to the previous block's hash.
  • This structure ensures transaction history cannot be amended and prevents double-spending.
  • SHA (Secure Hash Algorithm) is used to ensure security.

SHA (Secure Hash Algorithm) cont.

  • SHA generates a fixed-size output from variable-size input.
  • It is a one-way function, making it hard to reverse calculate the original input.
  • Two different inputs rarely generate the same output.
  • SHA algorithms are published and regulated by the National Institute of Standards and Technology (NIST).
  • SHA-256 is part of the SHA-2 series.

SHA-256 Algorithm

  • The input is divided into 512-bit blocks.
  • Each block undergoes 64 rounds of calculations (iterations).
  • These calculations involve bitwise operations and other complex functions.
  • The final output is a 256-bit hash value.

Verifying Transaction Integrity

  • If someone tries to claim a false transaction, the network can verify its authenticity.
  • The SHA-256 algorithm ensures same input will always generate the same output.
  • Any discrepancies in the input will result in a completely different hash value, revealing the attempted alteration.

Mining

  • Goal: Find an input that produces a specific output (hash) with a certain number of leading zeros.
  • Process: Miners try different inputs until they find one that meets the criteria.
  • Reward: If successful, the miner creates a new block and receives newly generated Bitcoins.
  • Proof of Work: The miner broadcasts the input and resulting hash to the network for verification.
  • Energy Consumption: Mining requires high-power computers, consuming a significant amount of energy.
  • Incentive: The reward for mining a new block decreases over time.
    • Initially 50 Bitcoins (2009-2013).
    • Currently 6.25 Bitcoins (worth approximately half a million dollars).

Bitcoin Limits

  • Creation Limit: Approximately one new Bitcoin is generated every 10 minutes.
  • Total Supply Cap: A maximum of 21,000,000 Bitcoins will ever exist.
  • Current Circulation: Around 19,000,000 Bitcoins have already been mined.
  • Dogecoin: Unlike Bitcoin, Dogecoin has no supply cap.

Use Cases for Blockchain Technology

  • Digital rights management (NFTs).
  • Microfinancing.
  • Global payments.
  • Supply chain tracking (e.g., tracking the origin and storage conditions of an expensive wine bottle).

Decentralization Advantages

  • No single entity controls the network.
  • Accountability is distributed among all participants.

Implementing a New Currency

  • Gather a group of friends to invest money.
  • Create a new SHA function.
  • Ensure the SHA function is secure to prevent easy mining and manipulation.

Decrypting SHA

  • If SHA is decrypted, anyone can mine, driving the price down and invalidating proof of work.

Quantum Computing Threat

  • Quantum computers potentially will be able to decrypt SHA in future, which might impact Bitcoin.

Volatility

  • Cryptocurrencies are extremely volatile, more so than the stock market. Bitcoin is decentralized with no government control.