Block Chain
Chapter5 introduction to blockchain
What is blockchain
Definition of blockchain in one sentence: An "append only transaction log"
Characteristics of Blockchain
1. Decentralized
2. Immutable
3. Transparent
4. Trust and Security: Disintermediated and Encryption
5. Consensus-based
One ledger, 怎么不一样
A ledger is like a database, a Google or Excel spreadsheet
• Add new records by appending rows
• Each row contains information
• Account balances, who owns certain
assets
• Memory and execution state of a computer program
Traditional Ledgers
Format:
Physical: Traditionally, ledgers were physical books or papers where transactions were recorded manually.
Digital: In modern finance, ledgers are often digital, stored in databases, and managed by centralized software systems.
Centralization:
Typically maintained by a central authority or organization, such as a bank or a company’s accounting department.
The central authority has control over the ledger and the ability to modify entries.
Transparency:
Access to the ledger is usually restricted to authorized personnel within the organization.
Transparency is limited to those who have permission to view or audit the records.
Security:
Security depends on the organization’s internal policies and systems, including physical security and IT security measures.
Vulnerable to insider threats and errors due to centralized control.
Auditability:
Audits are conducted by internal or external auditors who must trust the organization’s records.
Auditing can be a time-consuming process, often requiring manual verification.
Blockchain-Based Ledgers
Format:
Distributed: Blockchain is a type of distributed ledger technology (DLT) where each participant (node) has a copy of the entire ledger.
Transactions are recorded in blocks, which are linked together in a chain.
Decentralization:
No central authority controls the ledger. Instead, it is maintained by a network of nodes that validate and record transactions.
Decisions are made through consensus mechanisms (e.g., Proof of Work, Proof of Stake).
Transparency:
Transactions are visible to all participants in the network, providing a high level of transparency.
Public blockchains, like Bitcoin and Ethereum, allow anyone to view the transaction history.
Security:
Security is enhanced through cryptographic techniques and consensus protocols.
The decentralized nature reduces the risk of single points of failure and makes unauthorized alterations extremely difficult.
Auditability:
Every transaction is time-stamped and linked to previous transactions, creating an immutable record.
The transparency and immutability of blockchain make auditing straightforward and efficient, as records cannot be altered retroactively without consensus.
Key Differences
Control and Trust: Traditional ledgers require trust in a central authority,
whereas blockchain-based ledgers rely on cryptographic proof and decentralized consensus.
Immutability: Blockchain ledgers are immutable, meaning once a transaction is recorded,
it cannot be changed without altering all subsequent blocks, which is computationally infeasible.
Access and Participation: Public blockchains are open to anyone, promoting transparency and inclusivity, while traditional ledgers are typically closed and controlled by specific entities.
Efficiency: Blockchain can streamline processes like settlement and reconciliation, reducing the need for intermediaries and the potential for errors.
Consensus mechanism: proof of work, proof of stake
Proof of Work (PoW)
Overview
Concept: PoW is a consensus mechanism that requires participants (miners) to perform computational work to solve complex mathematical puzzles. The first miner to solve the puzzle gets to add the next block to the blockchain and is rewarded with cryptocurrency.
Used by: Bitcoin, Ethereum (prior to its transition to PoS with Ethereum 2.0), and other cryptocurrencies.
How It Works
Mining: Miners compete to solve a cryptographic puzzle, which involves finding a nonce (a random number) that, when hashed with the block's data, produces a hash that meets a certain difficulty target (usually a number of leading zeros).
Difficulty Adjustment: The difficulty of the puzzle adjusts periodically to ensure that blocks are mined at a consistent rate (e.g., every 10 minutes for Bitcoin).
Block Reward: The first miner to solve the puzzle and validate the block is rewarded with newly minted cryptocurrency and transaction fees from the block.
Security: PoW secures the network by making it computationally expensive and time-consuming to alter any aspect of the blockchain, as an attacker would need to redo the PoW for all subsequent blocks.
Advantages
Security: Highly secure due to the computational effort required to alter the blockchain.
Proven: Has been successfully used in Bitcoin for over a decade.
Disadvantages
Energy Consumption: Requires a large amount of electricity, as miners use significant computational power to solve puzzles.
Centralization Risk: Can lead to centralization of mining power in regions with cheap electricity, or among those who can afford specialized hardware (ASICs).
Proof of Stake (PoS)
Overview
Concept: PoS is a consensus mechanism where validators are chosen to create new blocks based on the number of coins they hold and are willing to "stake" as collateral. The more coins a validator stakes, the higher the chance they have of being selected to validate a block.
Used by: Ethereum 2.0, Cardano, Polkadot, and other cryptocurrencies.
How It Works
Staking: Participants lock up a certain amount of cryptocurrency as a stake. This stake acts as collateral and can be forfeited
if the validator acts maliciously.
Validator Selection: Validators are chosen to propose and validate new blocks based on the size of their stake
and other factors like random selection or coin age (in some PoS variants).
Block Reward: Validators receive transaction fees and sometimes additional cryptocurrency as a reward for validating blocks.
Security: PoS secures the network by aligning the interests of validators with the network's health.
Malicious behavior results in the loss of staked coins.
Advantages
Energy Efficiency: Much less energy-intensive than PoW, as it doesn't require solving complex puzzles.
Decentralization: Reduces the need for expensive hardware, potentially lowering barriers to entry.
Disadvantages
Initial Distribution: Requires an initial distribution of coins, which can lead to centralization if a few entities hold large stakes.
Security Concerns: Some argue PoS is less battle-tested than PoW and may have vulnerabilities that have yet to be discovered.
Key Differences
Energy Consumption: PoW requires significant energy for mining operations, while PoS is more energy-efficient.
Security Model: PoW relies on computational work, whereas PoS relies on economic incentives and penalties.
Hardware Requirements: PoW needs specialized mining hardware, while PoS only requires maintaining a node with sufficient stake.
How does a blockchain works
Proof of work: Limit L=2的220次方
挖矿计算等式
What is a blockchain nonce
short for "number only used once"
Blockchain Applications:
Pros of Blockchain
• Improved accuracy by removing human involvement in verification
• Cost reductions by eliminating third-party verification
• Decentralization makes it harder to tamper with
• Transactions are secure, private, and efficient
• Transparent technology
• Efficiency and speed
Supply chain management, cyber security, voting, other application
1. Cryptocurrencies
Bitcoin and Altcoins: The most well-known application, where blockchain is used to create and manage digital currencies like Bitcoin, Ethereum, Litecoin, and others.
2. Smart Contracts
Ethereum: A platform that allows developers to create decentralized applications (dApps) using smart contracts, which are self-executing contracts with the terms of the agreement directly written into code.
Use Cases: Automating processes in sectors like real estate (automated property sales), insurance (automated claims processing), and finance (decentralized finance or DeFi applications).
3. Supply Chain Management
Transparency and Traceability: Blockchain can track the movement of goods from origin to consumer, providing transparency and reducing fraud.
Examples: Companies like IBM and Maersk have developed blockchain solutions to track shipping containers and ensure the authenticity of goods.
4. Healthcare
Secure Health Records: Blockchain can be used to securely store and share patient records, ensuring privacy and data integrity.
Drug Traceability: It can also track the production and distribution of pharmaceuticals to prevent counterfeit drugs.
5. Voting Systems
Secure and Transparent Voting: Blockchain can be used to create tamper-proof voting systems, ensuring transparency and reducing fraud in elections.
6. Identity Management
Decentralized Identity: Blockchain can provide secure digital identities that are controlled by individuals rather than centralized authorities, reducing identity theft and fraud.
7. Real Estate
Property Transactions: Blockchain can simplify property transactions by reducing paperwork and enabling smart contracts for automatic execution of sales.
8. Finance and Banking
Cross-Border Payments: Blockchain can facilitate faster and cheaper cross-border transactions by eliminating intermediaries.
DeFi (Decentralized Finance): Platforms like Uniswap and Compound allow users to lend, borrow, and trade cryptocurrencies without traditional banks.
9. Energy Sector
Peer-to-Peer Energy Trading: Blockchain enables decentralized energy markets where individuals can buy and sell energy directly to each other.
Grid Management: It can also help in managing and optimizing energy grids through transparent and secure data sharing.
10. Intellectual Property and Royalties
Content Distribution: Blockchain can ensure creators are fairly compensated by tracking the use and distribution of digital content.
Patent Management: It can provide a secure and immutable record of patent registrations and ownership.
11. Gaming
In-Game Assets: Blockchain can be used to create, manage, and trade digital assets in games, providing players with true ownership of in-game items.
12. Charity and Donations
Transparent Donations: Blockchain can track donations to ensure they reach the intended recipients, increasing trust in charitable organizations.
13. Government and Public Records
Land Registry: Blockchain can provide secure and transparent records of land ownership and transfers.
Public Services: It can improve the efficiency and transparency of public services by automating processes and reducing bureaucracy.