Back

NTU MOOC Study Notes - Session 1 Introduction to Blockchain and Smart Contracts: A Technical Perspective

By
HackQuest
May 28, 2024
4 min read

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:

1.Learn about the evolution of money and the role of digital currencies.
2.Understand how blockchain technology works.
3.Explore the concept of decentralized applications and smart contracts.


Section 1: Introduction to Blockchain and the Bitcoin Revolution

1.1 What is Money?

Money serves three main functions:

1.Medium of Exchange: Used for buying and selling goods and services.
2.Unit of Account: Provides a standard measure of value.
3.Store of Value: Maintains value over time for saving.

Fiat Money:

●Centralized and government-issued (e.g., USD, EUR).
●Value is derived from government regulation or law.
πŸ’‘
Drawbacks:
●Centralized control.
●Unlimited quantity, leading to potential inflation.

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.

β€œWith the digital money, since all these are represented as numbers, if you pay someone, how do we make sure that your account balance is deducted with the right amount? This is known as the double-spending problem.”

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.

image
Preview

β€œBitcoin is really a revolution to the currency system that we've been using for so many years. It's a big thing because it changes how we can deal with value in a digital form.”

πŸ’‘
Bitcoin Facts:
●Digital Currency: Uses cryptography for regulation and verification.
●Decentralized: Operates without a central bank.
●Storage: Bitcoins are stored in digital wallets.
●Transactions: Recorded permanently and anonymously on a public ledger.


Section 2: Blockchain Primer

image
Preview

2.1 Hash Function

A hash function converts a variable-length input into a fixed-size numerical value.

"Cryptographic hash functions are one-way functions that are easy to compute but hard to invert.”

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

β€œA blockchain is a chain of blocks, each containing data and the hash of the previous block. This structure makes the blockchain tamper-evident. Any change in a block will alter its hash and break the chain, indicating tampering.”

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

πŸ’‘
Problems:
●Corruption
●Mismanagement
●Single point of failure
●Non-resilient

Example: Centralized ledger systems require a bookkeeper to record transactions.

image
Preview

3.2 Decentralized System

β€œIn a decentralized system, there is no central copy of the transaction ledger. Instead, there are multiple copies distributed over the network, and everyone can verify the content to ensure all transactions are correct.”
image
Preview
πŸ’‘
Advantages:
●Trusted: Trust is distributed across the network.
●Transparent: All transactions are visible to all participants.
●Shared and Resilient: No single point of failure.
●Immutable: Once recorded, data cannot be altered without altering subsequent blocks.

Example: Decentralized ledger systems where every individual maintains a copy of the ledger.

image
Preview

Section 4: Mining and Consensus Mechanisms

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.

image
Preview

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.

πŸ’‘
However, it introduces centralization risks with pool managers.


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.

image
Preview

5.2 Smart Contracts

"Smart contracts are immutable, self-enforcing programs that execute automatically when predefined conditions are met. They eliminate the need for intermediaries, reducing costs and increasing efficiency.”

5.3 Blockchain Applications

●Banking, insurance, decentralized exchanges.
●Nearly $30 billion locked inside DeFi systems.
●4.4 million wallets in use.
●Energy Trading:
●Direct peer-to-peer exchange of surplus electricity.
●Reduces transaction costs.
●Supply Chain Management:
●Enhanced visibility and traceability.
●Improved financing and contracting processes.

Key Takeaways

πŸ’‘
Blockchain provides a decentralized, secure way to handle transactions and store data. Bitcoin introduced a solution to the double-spending problem without requiring a central authority. Decentralized applications and smart contracts offer innovative methods for managing digital assets and transactions.


Questions

1.Question 1: What is the behavior if one block contains multiple transactions? How does it compute and verify?

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.

2.Question 2: How does AI fit into the blockchain space?

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.

3.Question 3: Can smart contracts update their versions to handle issues like bugs or feature updates?

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.

4.Question 4: Do virtual machine miners actively verify on the chain in a proof-of-stake system

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.

5.Question 5: What do you think about the different types of wallets in the market, like multi- signature or NPC wallets?

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.

Stay connected with us

More Blog about ’Study Notesβ€˜

View All
loading...