You are on page 1of 43

Demystifying Blockchain and Web3

- Zaryab Afser
Who Am I?

● I write Smart Contracts on Blockchain

● I perform Security Audits of Smart Contracts

● I create technical content around Blockchain, Smart Contract & Solidity


Let’s plan the Journey

1. The History
● A brief history of the Web, and the significance of Web3, Origin of Web3

2. The Introduction
● Quick intro to Ethereum and Deep Dive into Smart Contracts

3. The Inception
● Entering the Web3 World as a Developer
Stage 1 - The History of Web3
Understanding Web3

????????
The Magna Carta

…the foundation of the freedom of any individual against


the central authority control, government or those in
power….
Understanding Web3

Web3 = An executable Magna Carta


3 imperative Components of Web3

DECENTRALIZATION

TRUSTLESS OWNERSHIP
Stage 2 - Ethereum & Smart
Contracts
Hello Blockchain

… an Open, Distributed Ledger that can record transactions


between two parties
not just in an efficient manner
But also
in a Verifiable and Permanent Fashion
The 9-Page Long Bitcoin WhitePaper
Enormous Use Cases of Blockchain
Ethereum - The Game Changer

● A blockchain-based computing platform

● Native currency - ETHER

● Allows developers to build and deploy Decentralized Apps

● Eliminates any central authority control

● Uses Proof-of-Stake Consensus mechanism


Ethereum = Innovation

Bitcoin

● Your money held in a Digital Form.


● Virtual payments without central authority

Ethereum

● Beyond simple financial transactions


● Capable of containing executable code
● Opens doors for builders to develop on top of it

Ethereum = Great for Innovations


The Idea of Consensus

● Consensus = General Agreement

● In blockchain terms, an agreement to decide the addition or

rejection of a transaction in a block.

● All nodes must be on the Same Page

● Consensus helps eliminating central authority control

● The rules of achieving consensus is what we know as

Consensus Protocol. For instance:

a. Proof of Work

b. Proof of Stake
Proof of Work
● Consensus mechanism of Bitcoin network

● This mechanism relies of Miners (Nodes).

● Miners solve extremely complex cryptographic puzzles to be


capable of mining the next new block

● High complexity of cryptographic puzzles secures the network.

● Profit from Attack < Cost of Attacking

Dark Side:

a. Enormous energy consumption

b. Slower speed.

c. Costly for miners acting as Validators.


Proof of Work
● Consensus mechanism of Ethereum network
● This mechanism relies of Validators who stakes their coins in the
network.

● Staked coins = Collaterals, when a validators is selected to validate a


transaction.

● Good performers are rewarded.

● Bad actors are penalized, using SLASHING Mechanism. Staked coins


are lost.

● Incredibly effective in terms of energy efficiency

Dark Side:

a. Slightly less decentralized than POW

b. Might affect overall security


Question ?

Is Blockchain technology
alone capable of these wide
range of
USE Cases?
Enters Smart Contracts

At the heart of Blockchains, Lies Smart Contract


Understanding Smart
Contracts
Origin of Smart Contracts

● First proposed in 1994 by Nick Szabo, an American


Computer Scientist

● Nick is quite well known for the invention of virtual


currency called "Bit Gold" in 1998.

● Smart Contracts gained Popularity after the Launch of


ETHEREUM in 2015.
What exactly are Smart Contracts?

● Self-executing digital contracts


● Executes only when certain CONDITIONS are
met
● Immutable in Nature
● Eliminates the need of MIDDLEMAN
● Wipes out Central Authority Control in
Transactions
The Working Mechanisms

Valid INPUTS
+
Valid CONDITIONS
=
VALID OUTPUT
Before You Write your Smart Contract

1. Defining the 2. Designing the Game


Checkpoints Theory
Development & Creation of Smart Contract

1. Conversion of CONTRACTUAL TERMS into CODE


Development & Creation of Smart Contract

2. Testing and Auditing of the Smart Contract


Development & Creation of Smart Contract

3. Deployment of Contract on the Blockchain


Development & Creation of Smart Contract

3. Finally, Execution of the Smart Contract


Significance of Smart Contracts

● Not Just DEFINES, but also ENFORCES the RULES

● SPEED

● RELIABILITY

● COST EFFECTIVE

● DETERMINISTIC

● ELIMINATION OF THIRD PARTY INTERFERENCE


The Concerns with Smart Contracts

Is it really all Sunshine and Rainbows ?


Limitations of Smart Contracts

● SECURITY
● Immutability in Smart Contracts
● Excessive dependency on the Underlying
Blockchain
● Nascent Stages
● Inability to interact with the Real World Data
Possible Solutions

Following Best Security Performing extensive Smart


Practices while Development Contract Security Audits
of Smart Contracts
Brief glance at Smart Contract Audits

Smart contract audits usually have 5 Imperative Steps


a. Audit Scope and Documentation Gathering
b. Evaluation of Test Cases
c. Automated Testing
d. Manual Code Review
e. Adequate Documentation of Reports
Stage 3 - The Inception
Web3 is for All

Are you a Designer?


Are you a WRITER?

Are you a Tech Are you Developer?


Enthusiast?
Alright, Where Do I Start my Web3 Journey?

Step ZERO - Start from Scratch (if need be)


Step 1st - Blockchains & Ethereum Basics
Step 2nd - Smart Contract Development
Step 3rd - Smart Contract Security
Blockchain & Ethereum Basics

● Learn the basics of Ethereum

● Ethereum Virtual Machine (EVM): turing complete

● Learn about Wallets, Accounts (EOA), Private/Public Keys

● Learn about transactions, Gas, Metamask

● Ethereum clients/Nodes, Geth

● Infura infrastructure

● Understanding Etherscan Block Explorer


Smart Contract Basics

● Basics of Smart Contract

● Life Cycle of Smart Contract

● Ethereum Higher Level languages


(Solidity, Vyper, LLL, Serpent)

● Compiling, testing, Deploying smart


Contracts

● Interacting with smart contracts using


web3.js or web3.py
Solidity Development & Learning Resources

Learning Resources Development Tools & Frameworks

● Solidity Documentation ● Remix IDE


● CryptoZombies Interactive learning ● Truffle framework
● Nader Dabit’s channel ● Hardhat
● Openzeppelin’s Smart Contract ● Ganche CLI
Devlopment Articles ● Brownie (For Python Lovers)
Raising the Bar

Imperative ERC Standards Crucial DEFI Terms & Projects


● ERC-20 - Token contract for fungible assets. ● Lending & Borrowing in Defi
● ERC-721 - Token standard for non-fungible ● Flash Loans
assets. ● On-Chain Governance mechanisms
● ERC-1155 - Token standard for semi-fungible ● Staking
tokens ● Tokenomics
● ERC-918 - Mineable Token Standard.
Important Projects
ERC’s Upgradeable Proxy Standards
● Uniswap - Decentralized Crypto Exchange
● ERC1967Proxy - Transparent Upgradeable ● Aave & Compound
Proxy ● ENS
● ERC1822Proxy - Universal Upgradeable Proxy ● L2 Solutions like Polygon etc
Standard
Smart Contract Security

What to Learn - Where to learn Security Tools


● Understanding Re-entrancy Attacks
● Slither - for automated testing of contracts
● Flash loan & Price oracle Manipulation
● Access Control checks in Contract ● Echindna - Fuzz Testing tool
● Openzeppelin’s Security guides
● Mythril - Security Analysis Tools
● Ethereum Smart Contract Security
● Surya - Contract Visualization Tool
Recommendations by ConcenSys
● The Smart Contract Security Mindset ● Tenderly - Real-Time Smart Contract Monitoring &

Play and Learn Debugging Tool


● Ethernaut
● Damn Vulnerable Defi
● Capture The Flag
With Great Power, Comes Great Responsibility
Thank You

You might also like