/smart-contract-course

leaning smart contract

Primary LanguageJavaScript

Smart Contract Course

Lesson 0: The Edge of the Rabbit Hole

Welcome to the course

⌨️ (00:00:00) Lesson 0: Welcome To Blockchain

Best Practices

  • Follow the repository: While going through the course be 100% certain to follow along with the github repository. If you run into in an issue check the chronological-updates in the repo.
  • Be Active in the community: Ask questions and engage with other developers going through the course in the discussions tab, be sure to go and say hello or gm! This space is different from the other industries, you don't have to be secretive; communicate, network and learn with others :)
  • Learn at your own pace: It doesn't matter if it takes you a day, a week, a month or even a year. Progress >>> Perfection
  • Take Breaks: You will exhaust your mind and recall less if you go all out and watch the entire course in one sitting. Suggested Strategy every 25 minutes take a 5 min break, and every 2 hours take a longer 30 min break
  • Refer to Documentation: Things are constantly being updated, so whenever Patrick opens up some documentation, open it your end and maybe even have the code sample next to you.

Lesson 1: Blockchain Basics

⌨️ (00:09:05) Lesson 1: Blockchain Basics

What is a Blockchain? What does a blockchain do?

The Purpose Of Smart Contracts

Other Blockchain Benefits

  • Decentralized
  • Transparency & Flexibility
  • Speed & Efficiency
  • Security & Immutability
  • Counterparty Risk Removal
  • Trust Minimized Agreements

What have Smart Contracts done so far?

Making Your First Transaction

Gas I: Introduction to Gas

How Do Blockchains Work?

Signing Transactions

Gas II

Gas II Summary

High-Level Blockchain Fundamentals

⌨️ (02:01:16) Lesson 2: Welcome to Remix! Simple Storage

💻 Code: https://github.com/PatrickAlphaC/simple-storage-fcc

Introduction

Setting Up Your First Contract

Basic Solidity: Types

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.8; 

contract SimpleStorage {
    // boolean, uint, int, address, bytes
    bool hasFavoriateNumber = false;
    
    uint favoriateNumberUint = 123;
    string favoriateNumberInText = "Five";
    address myAdress = 0xF6CF8e675fF7e8e1C7599209771ccE9CD28427cD;
    bytes32 favoriateBytes = "cat";

    // This gets initialized to zero!
    // public visible externally and internally
    uint256 public favoriateNumber;

}

Basic Solidity: Functions

  • Functions
  • Deploying a Contract
    • Smart Contracts have addresses just like our wallets
  • Calling a public state-changing Function
  • Visibility
  • Gas III | An example
  • Scope
  • View & Pure Functions
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.8; 

contract SimpleStorage {

    uint256 public favoriateNumber;

    // function
    function store(uint256 _favoriteNumber) public {
        favoriateNumber = _favoriteNumber;
    } 

    function retriveve() public view returns(uint256) {
        return favoriateNumber;
    }

    function add() public pure returns(uint256) {
        return (1 + 1);
    }

}

Basic Solidity: Arrays & Structs

  • Structs
  • Intro to Storage
  • Arrays
  • Dynamic & Fixed Sized
  • push array function
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.8; 

contract SimpleStorage {

    uint256 favoriateNumber;

    People public person = People(
        {
            name: "cuzz",
            favoriateNumber: 1
        }
    );

    People[] public people;

    struct People {
        string name;
        uint256 favoriateNumber;
    }
    
    function addPerson(string memory _name, uint256 _favoriateNumber) public {
        people.push(People(_name,_favoriateNumber));
    }

}

Basic Solidity: Compiler Errors and Warnings

  • Yellow: Warnings are Ok
  • Red: Errors are not Ok

Memory, Storage, Calldata (Intro)

  • 6 Places you can store and access data
    • calldata
    • memory
    • storage
    • code
    • logs
    • stack

Mappings

Deploying your First Contract

  • A testnet or mainnet
  • Connecting Metamask
  • Find a faucet here
  • See the faucets at the top of this readme!
  • Interacting with Deployed Contracts

The EVM & A Recap of Lesson 2

  • The EVM

Site

Resource