Date: 9:30-11 AM SGT, May 28th 2024 / 9:30-11 PM EST, May 27th 2024
Session Title: Introduction to Blockchain and Smart Contracts
NTU I&E x HackQuest MOOC is free and open to all individuals interested in Web3. The MOOC is led by top voices in crypto including Yat Siu (Co-founder, Animoca), Ed Felten (Co-founder, Offchain Labs), Sergey Gorbunov (Co-founder, Axelar), Scott Moore (Co-founder, Gitcoin), Haider Rafique (CMO, OKX), Austin Griffith (Developer Onboarding, Ethereum Foundation), Anna Yuan (Stablecoins Lead, Solana Foundation), and many more. For those who prefer having a text summary and review material, this study note provides a recap of what’s covered during the MOOC. Happy learning!
Overview
Main Topic: Understanding blockchain technology, its applications, and smart contracts.
Objectives:
Section 1: Introduction to Blockchain and the Bitcoin Revolution
1.1 What is Money?
Money serves three main functions:
Fiat Money:
1.2 Digital Money and the Double-Spending Problem
Digital money exists in digital form and can be transferred instantaneously. However, it faces the double-spending problem, where a digital token can be duplicated and spent more than once. Traditional banks solve this through centralized ledgers, but this introduces the need for trust in a central authority.
1.3 Introduction to Bitcoin (Oct 2008)
Bitcoin was proposed by Satoshi Nakamoto as a peer-to-peer electronic cash system. It aims to solve the double-spending problem without requiring a central authority.
Section 2: Blockchain Primer
2.1 Hash Function
A hash function converts a variable-length input into a fixed-size numerical value.
2.2 Hash Pointer
A hash pointer points to data storage and includes a cryptographic hash of the data, ensuring data integrity by allowing verification that the data hasn't been altered.
2.3 Blockchain Structure
2.4 Public and Private Keys
Public Key: Used for encryption.
Private Key: Used for decryption.
Digital signatures ensure that only the owner can create a signature, but anyone can verify its authenticity.
2.5 Peer-to-Peer (P2P) Network
In a P2P network, identical information is stored on each server or node. This allows direct transactions without intermediaries, providing high resistance to censorship and being cost-effective and secure.
Section 3: Centralized vs. Decentralized Systems
3.1 Centralized System
Example: Centralized ledger systems require a bookkeeper to record transactions.
3.2 Decentralized System
Example: Decentralized ledger systems where every individual maintains a copy of the ledger.
PoW is a consensus mechanism where miners compete to solve complex mathematical problems. The first miner to solve the problem adds the next block to the blockchain. PoW is resource-intensive, requiring significant energy and computational power.
4.2 Proof of Stake (PoS)
PoS selects miners based on their stake in the system. Miners with more stake have a higher probability of adding the next block. This method reduces the environmental impact compared to PoW.
4.3 Mining Pools
Miners form pools to combine their computational power and share the rewards. This reduces reward variance and facilitates network upgrades.
Section 5: Blockchain 2.0 and Decentralized Applications (DApps)
5.1 Decentralized Applications (DApps)
DApps are user-defined, self-executing programs that run on a blockchain. They manage the exchange of digital assets across various sectors. Examples include Ethereum, which uses smart contracts to facilitate and verify transactions.
5.2 Smart Contracts
5.3 Blockchain Applications
Key Takeaways
Questions
Answer: Each block contains multiple transactions stored in a Merkle tree structure, which helps maintain the integrity of the transactions. Miners need to verify each transaction's inputs and outputs to ensure they are legitimate. They then compute the hash of the entire block, including a nonce, to add it to the blockchain.
Answer: Currently, there isn't much direct application of AI in blockchain due to the infrastructure's reliance on cryptography and distributed systems. However, blockchain can be used as a platform for trading AI models, leveraging its cost-reducing and verification capabilities.
Answer: Yes, there are upgradable smart contract frameworks that use a proxy contract linking to real implementations. The proxy remains stable, while the implementations can change as needed.
Answer: In a proof-of-stake system, miners don't solve mathematical problems but still need to verify the blocks. Incorrect blocks can damage the miner's reputation and future chances of adding blocks.
Answer: Wallet usability is crucial for user adoption. Improvements in this area are ongoing, but the professor hasn't closely followed the latest advancements. Usability solutions are likely to be successful in the future.