
Blockchain Fundamentals
Understanding the core concepts of blockchain technology, including distributed ledger, cryptographic principles, consensus mechanisms and other fundamental knowledge.
1.1 Blockchain Concepts & Principles
What is Double Spending
Double spending refers to the same digital currency being used repeatedly two or more times.
In digital currency systems, since digital information can be copied, without proper mechanisms, there could be situations where the same money is paid to multiple recipients.
Why Digital Signatures Cannot Solve Double Spending in Peer-to-Peer Communication
The purpose of digital signatures is to verify the authenticity and integrity of transactions, ensuring that the transaction is initiated by the private key holder and has not been tampered with during transmission.
However, digital signatures cannot ensure that the same money hasn’t been spent twice. This is because digital signatures only focus on the validity of individual transactions, not whether this money has been spent before.
Illustrated Explanation
Step 1: Alice initiates Transaction 1 (payment to Bob)
┌─────────┐
│ Trans 1 │ → Digital signature valid ✅
└─────────┘
(Alice's 1 BTC payment to Bob)
Step 2: Alice simultaneously initiates Transaction 2 (payment to Charlie)
┌─────────┐
│ Trans 2 │ → Digital signature also valid ✅
└─────────┘
(Alice's *same* 1 BTC payment to Charlie)
Result: Both transaction signatures are valid, but the system cannot automatically identify which one should be rejected.
How to Actually Solve Double Spending?
Blockchain Solution
Achieved through Distributed Ledger + Consensus Mechanism:
- Transaction Ordering: All transactions are recorded in blocks in chronological order
- Global State Verification: Nodes check whether currency has been spent (trace transaction history)
- Consensus Rules: Among conflicting transactions, only the first confirmed transaction is valid
Blockchain Double Spending Prevention Diagram
Block 0: Genesis Block
└─ Transaction 0: Alice receives 1 BTC (unspent)
Block 1 (confirmed first)
└─ Transaction 1: Alice → Bob (1 BTC)
→ Verification passed: Transaction 0's 1 BTC *unspent* ✅
Block 2 (confirmed later)
└─ Transaction 2: Alice → Charlie (1 BTC)
→ Verification failed: Transaction 0's 1 BTC *already spent in Block 1* ❌
What is Blockchain
Blockchain is a distributed database technology that stores data in blocks linked chronologically. Each block contains a batch of transaction records and a hash value pointing to the previous block, forming an immutable chain structure.
Distributed Ledger Technology
Distributed Ledger is a database that is shared and synchronized across multiple nodes, with each node maintaining a complete copy of the ledger. This design eliminates dependence on central authorities and improves system transparency and trustworthiness.
Characteristics of Blockchain
- Decentralization: No need for central authorities
- Transparency: All transaction records are publicly verifiable
- Immutability: Confirmed transactions cannot be modified
- Consensus Mechanism: Network consistency ensured through algorithms
- Anonymity: User identities protected through public key addresses
1.2 Cryptographic Foundations
Hash Functions
Hash functions are algorithms that convert input data of any length into fixed-length output. In blockchain, hash functions are used for:
- Creating unique identifiers for blocks
- Verifying data integrity
- Building Merkle tree structures
Digital Signatures
Digital signatures use public key cryptography principles to ensure:
- Authentication: Prove the identity of transaction initiators
- Integrity: Ensure transaction content hasn’t been tampered with
- Non-repudiation: Initiators cannot deny signed transactions
Merkle Trees
Merkle trees are binary tree structures used to efficiently verify the integrity of large amounts of data. Blockchain uses Merkle trees to:
- Quickly verify if transactions are included in blocks
- Reduce data transmission volume
- Support lightweight clients
1.3 Consensus Mechanisms
Proof of Work (PoW)
Proof of Work requires miners to solve computationally intensive mathematical problems to create new blocks. Characteristics:
- High Security: Requires massive computational resources to attack
- High Energy Consumption: Requires substantial electricity for mining
- Decentralized: Anyone can participate in mining
Proof of Stake (PoS)
Proof of Stake selects validators based on the amount and duration of tokens held. Characteristics:
- Low Energy Consumption: No need for massive computation
- Environmentally Friendly: More sustainable
- Economic Incentives: Validators have economic motivation for honest behavior
Other Consensus Algorithms
- Delegated Proof of Stake (DPoS): Token holders vote to select validators
- Practical Byzantine Fault Tolerance (PBFT): Suitable for consortium chains
- Proof of Authority (PoA): Identity-based consensus
1.4 Blockchain Network Types
Public Blockchains
Fully decentralized blockchains where anyone can:
- Participate in the network
- View all transactions
- Submit transactions
- Participate in consensus processes
Examples: Bitcoin, Ethereum
Private Blockchains
Controlled by a single organization blockchains with characteristics:
- Restricted access
- Fast transaction speeds
- Good privacy protection
- High degree of centralization
Consortium Blockchains
Maintained by multiple organizations blockchains, between public and private chains:
- Semi-decentralized
- Access control
- Better performance
- Suitable for inter-enterprise cooperation
1.5 Bitcoin Case Study
Bitcoin Whitepaper Analysis
Satoshi Nakamoto’s Bitcoin whitepaper published in 2008 first proposed:
- Peer-to-peer electronic cash system
- Value transfer without third parties
- Using proof of work to solve double spending
Bitcoin Network Architecture
User Wallet → Tx Broadcast → Mempool → Miner Package → Block Confirm
↓ ↓ ↓ ↓ ↓
Generate Tx → Network Prop → Wait Conf → Mining Comp → Chain Record
Transaction Verification Process
- Syntax Verification: Check transaction format
- Digital Signature Verification: Verify initiator identity
- Balance Verification: Check for sufficient balance
- Double Spending Check: Ensure UTXO hasn’t been spent
- Consensus Confirmation: Wait for network confirmation
Learning Resources
Practical Exercises
- Read the Bitcoin Whitepaper to understand its core concepts
- Set up a Bitcoin testnet to experience the transaction process
- Implement simple hash functions to understand cryptographic principles
- Analyze real Bitcoin transactions to understand data structures