Back

NTU MOOC Study Notes - Session 2 Web2 to Web3: A Developer’s Guide

By
HackQuest
Jun 28, 2024
4 min read

Date: 9-10:30 AM SGT, June 4th 2024 / 9-10:30 PM EST, June 3rd 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 how to build applications on Ethereum and explore Web3 technologies.

Objectives:

1.Learn about the fundamentals of Ethereum and Web3.
2.Understand the tools and resources available for building on Ethereum.
3.Explore key concepts such as smart contracts, decentralized applications (DApps), and cryptographic principles.

Section 1: Fundamental Concepts

1.1 Blockchain Evolution

Mainframes to Personal Computers: Transition from centralized to decentralized computing.
Internet and Cloud Computing: Virtual machines and networked computing.
AI and Crypto: Emerging technologies transforming data processing and security.
"The reason why Ethereum is so interesting is that anyone can build Bitcoin right now with just a few lines of code. But Ethereum allows you to deploy decentralized applications on top of it very easily by just writing some code.”

1.2 Importance of Crypto

Decentralization: Essential for censorship resistance and pushing power to the edges.
Misconceptions: Crypto is often misunderstood due to associations with scams.
💡
Web3 is trying to create decentralization, pushing that power to the edge to get rid of centralized power and walled gardens.

1.3 Cryptographic Principles

Hash Functions: One-way functions critical for data integrity and security. Example: SHA-256, used in Bitcoin.
Public and Private Keys: Essential for encryption, decryption, and digital signatures.
Digital Signatures: Ensure authenticity and integrity of messages.
Demonstration: Generating hash functions and key pairs to show their importance in blockchain.
Dice Game Example: Dice game demonstration - This game illustrates the improbability of guessing Ethereum private keys, highlighting the robustness and security of cryptographic principles.
"These cryptographic principles are the heart of this technology, ensuring data integrity and security in blockchain applications.”

image
Preview

1.4 Real-world Applications

Discussion on how cryptographic principles are applied in real-world scenarios.
Examples: Secure email communication, SSL/TLS for web security.

Section 2: Building on Ethereum

2.1 Key Concepts and Tools

Transactions:
Components: To and From addresses, Value, Gas, and Data fields.
Gas Mechanism: Determines transaction fees and prioritization.
EIP-1559: Stabilizes gas fees and introduces a base fee.

2.2 Development Tools

Solidity: Primary programming language for writing smart contracts on Ethereum. Focus on syntax and structure.
Remix IDE: Web-based development environment for deploying smart contracts. Step-by-step guide to using Remix.
Truffle Suite: Development framework for building DApps. Includes testing and deployment features.
💡
A clear learning path for new devs (technical person): - Start with just getting some concepts on , read through the Basics section - Check out - Once getting the hang of it, go deeper to try learning moments on to build actual things

image
Preview

2.3 Build Session

Using Remix to deploy a simple smart contract: deploying a "Hello World" contract and interacting with it via the Remix console.
Scaffold-ETH: - A framework for rapid prototyping on Ethereum, used to write and deploy Solidity smart contracts in a local development environment.
"Scaffold-ETH provides a great environment to tinker around with Ethereum smart contracts, making it easy to prototype and deploy decentralized applications quickly.”

Section 3: Smart Contracts and DApps

Definition: Self-executing contracts with terms directly written into code.
Deployment: Initiated by transactions with code in the data field.
Functions: Execute predefined actions when conditions are met.
Example: A simple token contract is used to illustrate the concept.
Code example: Basic ERC-20 token contract.
Explanation of each function: totalSupply, balanceOf, transfer.
"Smart contracts are like vending machines that anyone can access and that can't be stopped, not even by the person who deploys them.”
Interaction with Smart Contracts: DApps use smart contracts to handle backend logic.
Example: Interactive demo of a DApp interacting with a deployed smart contract.
Use case: Voting DApp where users can cast votes stored on the blockchain.
User interface: Simple front-end interacting with the smart contract.
💡
How do you write smart contracts that don’t use much gas? Tips on reducing gas fees: cost is based on the code and it’s incentivized to not store things on chain, not use heavy computing, and do many things off-chain

3.3 Use Cases

Financial services: DeFi platforms enable lending, borrowing, and trading.
Supply chain management: Tracking goods and verifying authenticity.
Gaming: Ownership of in-game assets through NFTs.
image
Preview
image
Preview
With just a few lines of code, we can create a decentralized digital currency similar to Bitcoin. While Bitcoin required the creation of an entire economic and financial system, including mining incentives and a peer-to-peer network, Ethereum provides all of this infrastructure for you. All you need to do is write the rules of the code, ensuring that no human can alter it. The machines will execute the code exactly as programmed, making the system censorship-resistant and unstoppable.
💡
This new type of computing, which operates at a nation-state level, allows you as the coder to write simple rules in Solidity. You can deploy these smart contracts for a matter of pennies on a Layer 2 solution, building a robust and infinite system around them.

Key Takeaways

Building on Ethereum involves understanding both theoretical and practical aspects of blockchain technology. From cryptographic principles to smart contract development, this course provides a comprehensive overview for transitioning from Web2 to Web3.

Q&A

1.Question 1: How will quantum computing impact blockchain and cryptographic systems?

Answer: Quantum computing could potentially solve some cryptographic challenges more easily, which might necessitate different approaches and types of security in the future. Vitalik Buterin has discussed making systems more quantum-safe. While this is out of my wheelhouse, I believe that the people building these platforms understand how to make them secure against such threats.

2.Question 2: What is the IDE theme that's being used in the shared screen?

Answer: Just the default Solidity syntax highlighting in VS Code. You can find it by searching for Solidity extensions in the VS Code marketplace.

image
Preview
3.Question 3: What would you build if you had 72 hours for a hackathon project?

Answer: If I had 72 hours for a hackathon project, I would use Scaffold-ETH to quickly prototype and build something innovative. Some ideas could include creating a meme coin menu game, building a gasless app using technologies like ZK Sync or Basse, or exploring smart wallets with account abstraction. The key is to leverage the latest technologies and be creative to build something impactful and functional within the time constraints.

Stay connected with us

More Blog about ’Study Notes‘

View All
loading...