Blockchain Technology and Applications: Bitcoin Basics - Peking University Professor Xiao Zhen's Course Notes

·

Introduction - What is Blockchain?

Blockchain, as the name suggests, is a chain of blocks linked together. It is a distributed database technology that allows multiple participants to collectively maintain a continuously growing list of data records, known as blocks. Each block contains a series of verified transactions and is cryptographically linked to the previous block, forming a chain-like structure.

Key characteristics of blockchain include:

Applications of Blockchain

Often dubbed the "slowest database," blockchain's most common use case is cryptocurrencies like Bitcoin and Ethereum.


Prerequisites and Resources

Foundational Knowledge

Recommended References


Bitcoin Fundamentals

Core Topics Covered

  1. Cryptography Basics
  2. Bitcoin’s Data Structure
  3. Consensus Protocols and System Implementation
  4. Mining Algorithms and Difficulty Adjustment
  5. Bitcoin Scripting
  6. Soft Forks vs. Hard Forks
  7. Anonymity and Privacy Protection

BTC - Cryptographic Principles

Bitcoin operates on two primary cryptographic concepts: Hashing and Digital Signatures.

Hash Functions

A hash function converts variable-length input x into a fixed-length output y (Hash(x) = y). Bitcoin uses SHA-256, which exhibits these critical properties:

  1. Collision Resistance

    • Extremely difficult to find two inputs yielding the same output.
    • Ensures data integrity; altered data will have a different hash.
  2. Hiding (Preimage Resistance)

    • Outputs cannot be reverse-engineered to reveal inputs.
    • Requires a large input space; sometimes expanded using a nonce.
  3. Puzzle Friendliness

    • Outputs are unpredictable, requiring brute-force computation (essential for mining).

👉 Learn more about SHA-256’s role in Bitcoin

Digital Signatures

Bitcoin uses asymmetric encryption (public/private keys) for account management:

Advantages over symmetric encryption include eliminating key-exchange risks. However, asymmetric encryption is slower.


BTC - Data Structures

Blockchain Design

A blockchain is a linked list of blocks where pointers are replaced with hash pointers—storing the previous block’s hash. This ensures tamper-evidence:

Each block (1MB) holds ~4000 transactions (~250B each) and includes:

Merkle Trees

Transactions are organized in a Merkle Tree—a binary tree with hash pointers:

Merkle Proofs

Light nodes (e.g., mobile wallets) only store block headers. To verify a transaction’s inclusion:

  1. Request a Merkle Proof from a full node (adjacent hashes).
  2. Recompute the root hash locally using the proof.
  3. Match it against the header’s root hash.

Collision resistance ensures fake proofs are computationally infeasible.


FAQ Section

1. Why is blockchain called a "distributed database"?

It disperses data across multiple nodes, eliminating central authority while maintaining consistency via consensus.

2. How does SHA-256 prevent tampering?

Its collision-resistant property ensures any data change alters the hash, making edits detectable.

3. What’s the difference between soft and hard forks?

4. Can quantum computers break Bitcoin’s cryptography?

While theoretically possible, current quantum tech lacks practicality. Future upgrades may address this.

👉 Explore Bitcoin’s security mechanisms