Cohort 3.0 Cournal


Recorded Video Link

Video(1/2) || Video(2/2)

Link to slides

🔗

What happened?

  • Told us about the Cohort 3.0 exclusive hackathon: 🔗
  • Explained what an escrow account is.
  • We learned about the history of blockchain in the context of the 2008 Bitcoin white paper: 🔗
  • He told us to watch "The Big Short"
  • Mentioned Fractional-reserve banking: 🔗
  • Told us that money isn't backed by gold anymore (Trust issues ++)
  • Did a Hashing 101: 🔗
  • We learned about the difference between Hashing and encryption.
  • We were introduced to proof of work: 🔗
  • He mentioned something called a "wallet adapter" a couple of times (sounds interesting)
  • Offline Videos:

Stuff Harkirat told to do


Recorded Video Link

Video(1/1)

Link to slides

🔗

What happened?

  • He told us that his goal is to get 50 people into GSOC this time, and he will provide whatever help is needed.
  • Today we learned about basic HTML and CSS, some basic tags, and did flexbox at the end.
  • Mentioned digital fingerprinting, was a bit secretive about it... seems interesting.

Stuff Harkirat told to do

  • Install Visual Studio Code locally on your system.
  • Warmup Videos for HTML / CSS: Video(1/3) || Video(2/3) || Video(3/3)
  • Get HTML/CSS sorted by building a couple of landing pages.

Recorded Video Link

Video(1/1)

Link to slides

🔗

What happened?

  • Did some basic CS concepts in the context of JS.
  • Did some basic syntax of JS (Variables, Data Types, Operations, etc).
  • Nested objects were fun.

Stuff Harkirat told to do

  • Install Node.js locally.
  • Told us to clone the Landing page of Replit
  • Assignments
    • A1: Create a variable for each of the following: your favorite color, your height in centimeters, and whether you like pizza. Use appropriate variable declarations (let, const, or var). Try logging it using console.log.
    • A2: Write a function sum that finds the sum of two numbers. Side quest - Try passing in a string instead of a number and see what happens?
    • A3: Write a function called canVote that returns true or false if the age of a user is > 18.
    • A4: Write an if/else statement that checks if a number is even or odd. If it's even, print "The number is even." Otherwise, print "The number is odd."
    • A5: Write a function called sum that finds the sum from 1 to a number.
    • A6: Write a function that takes a user as input and greets them with their name and age.
    • A7: Write a function that takes a new object as input which has name, age, and gender and greets the user with their gender (Hi Mr/Mrs/Others Harkirat, your age is 21).
    • A8: Also tell the user if they are legal to vote or not.
    • A9: Write a function that takes an array of numbers as input, and returns a new array with only even values. Read about filter in JS.
    • A10: Write a function that takes an array of users as input and returns only the users who are more than 18 years old.
    • A11: Create a function that takes an array of objects as input, and returns the users whose age > 18 and are male.

Recorded Video Link

Video(1/1)

Link to slides

🔗

What happened?

  • How do traditional banks do Auth.
  • How do blockchains do Auth -> public - private key pair.
  • Not Your Key, Not Your Crypto!!!!
  • You need your own private key to roll your own crypto.
  • Dabbled into Bits and Bytes for some time, conversions, representations, hex. (basic CS stuff).
  • Use of UInt8Array to represent bytes (saves space).
  • Encryption Vs Hashing (Symmetric vs Asymmetric).
  • Signing a Txn using your private key so that it can be verified by your public key.
  • offline Videos :
    • Public Key Cryptography (from scratch) 🔗

Stuff Harkirat told to do

  • Chew some glass, figure out how to create a web-based wallet for crypto.

Recorded Video Link

Video(1/1)

Link to slides

🔗

What happened?

  • Sync vs Async JS
  • I/O heavy operations to be handled by Async JS.
  • Looked at the fs (file system) library.
  • Async is jab tak water is boiling, till then start the washing machine...
  • thread occupied - you can't stop running on the treadmill (CPU intense tasks), just because the laundry is done. (I/O Heavy op)
  • Functional Arguments.
  • setTimeout()
  • The Async architecture of JS - (Call Stack, Web Apis, Call back Queue)
  • How to make setTimeout Sync : Busy wait method

Stuff Harkirat told to do

  • Learn about promises in JS before tomorrow's class.

Recorded Video Link

Video(1/1)

Link to slides

🔗

What happened?

  • Classes in JS (declaration,etc )
  • How classes are cleaner than the native way using functions.
  • Inheritance would be covered in an offline video.
  • Map(),Date() {there are many classes provided by JS out of the box.}
  • Promises {do pretty much the same thing as callbacks but just syntax wise much cleaner}
  • Promises return you something in the future.
  • Calling a promise is easy, defining it is hard; if you know how to call it you will be fine mostly.
  • Promise class takes 1 input fn and when the first arg of that fn (the arg is also a fn) is called fir .then waala part happens.

Stuff Harkirat told to do

  • Create Promisified versions of several Async functions.
  • Try to write your own promise class (!! Hard !!)
  • offline Videos :

Recorded Video Link

Video(1/1)

Link to slides

🔗

What happened?

  • Keccak - 256:
    • a Hashing algorithms like SHA - 256
    • used by Ethereum, Polygon, Tron, etc
    • collision resistant
    • pre image resistant
  • SOLANA : EDDSA -> public-private key pair (32 byte) -> base 58 of it is what is used.
  • Every currency has its own ways of generating public - private key pair.
  • Ethereum : ECC -> public-private key pair -> Hashed using Keccak 256 (now 32 byte) -> take last 20 byte convert to hex ( this is what is used )
  • The introduction of HD wallets in BIP 32 🔗
  • Having more than 1 wallet meant having lots of public-private key pairs, HD walltets solve this problem
  • Having a HD wallet meant only need to backup private keys for recovery.
  • HD wallets allows you to store 1 single private key (SEED), from this seed you can derive many wallets, this is done using derivation paths
  • Derivation path eg : m/44'/60''/0' where m refers the root node, the 44 refers to the purpose, 60 refers to a blockchain, 0 refers to the wallets number.
  • 44': This refers to the purpose field in BIP-44, which standardizes multi-account hierarchy for deterministic wallets. The value 44' indicates that this derivation path follows BIP-44.
  • Mnemonic : a 12 word combination made from 2048 words list, help you determine the seed phrase using this. This needs to be kept confidential.
  • Frontend vs Backend vs HTTP servers
  • A block explorer like solscan querys the block chain to fetch some data. this querying is happening via http requests.
  • A frontend request fetches things like html/css
  • A backend request fetches things like user data.
  • You can query different block chains using POSTMAN ( a type of universal block explorer )
  • POSTMAN lets you send post requests (backend requests)
  • Browser / Client like POSTMAN calls a func. present on an RPC server with some args. in json format, the rpc server return the output to the client. This is JSON RPC
  • JSON RPC does what an http request does, their appeal is that it seems like you are calling a function; under the hood its just an http request at the end of the day.
  • There are more things like TRPC, GRPC, etc which do useful things like compression...
  • ETH uses RPC.
  • The RPC server nodes sit close to the blockchain and talk to it.
  • There are companies which provide RPC servers as a service.
  • Common RPC calls like getting the balance were see in this class.
  • The data we receive is in units like Lamports or wei.
  • Any financial txn company stores your data in the form of integers not decimals because of precision issues, hence units like Lamports and Wei.
  • Creating a web based wallets needs knowledge of react, this will be covered in an offline video.

Stuff Harkirat told to do

  • Try to implement the send money RPC call.

Recorded Video Link

Video(1/1)

Link to slides

🔗

What happened?

  • DOM ( Document Object Model ) manipulation:
    • Used pre - React days, might be used sometimes while doing react.
    • used to create dynamic websites.
    • DOM is a programming interface for web dev.
    • The tree representation of a html document with parents and their children is basically DOM.
    • Allows manipulation of content and structure dynamically.
  • Static Websites : the code doesnt change.
  • Dynamic Websites : Users can do stuff and HTML changes.
  • Fetching Elements, uodating Elements, Deleting Elements, Adding elements.

Stuff Harkirat told to do

  • Try to create a simple TO DO application using whatever was learned today.

Recorded Video Link

Video(1/1)

Link to slides

🔗

What happened?

  • Complex DOM manipulation:
    • DOM inside DOM.
    • Instead of having HTMl code inside inner.html, we create a div,span,button elements; then append span and button to the div and append the div to the body.
  • State and Components:
    • State : the variable things that go in the Component
    • Component : the wireframe or the structure inside which the states are updated.
    • Rendering : updating the states in the component and showing it on the DOM.
  • Writing our own render function which pushes the todos from the todo array on to the component (written once) then shows it on the DOM, so we dont have to write the DOM logic again and again.
  • Reconcilliation : Updating the difference between the old state and new state onto the DOM. ( React does this optimally )
  • React does a lot of optimizations like batch updates, etc.

Stuff Harkirat told to do

  • Try to create a TO DO application using the advanced DOM manipulation we learned today.

Recorded Video Link

Video(1/1)

Link to slides

🔗

What happened?

  • IF BTC exists why SOL or ETH?
    • BTC gave us decentralization of money, but we can do more using blockchains...
    • We can build entire applications like uber on top of the blockchain.
    • NOTE : it's a bad idea to build uber on blockchain, as they are really slow ( txn speeds )
    • A good idea : Creating our own token (eg : Dogecoin, Trump coin, etc) these are not blockchains in themselves, they are tokens made on top of existing blockchains.
  • Smart Contracts : some code you can write and deploy on a blockchain. ( SOL and ETH allow you to do this )
  • Accounts on Solana are data structures which store info ( your money, user data, more complex stuff aka Smart contracts ( == web 2 backend but deployed on blockchain ))
  • You need to pay some rent i(if min SOL balance for rent exemption not met, rent deducted, else exempt.) to have an account on it. ( its proprotional to the data stored in the account )
  • Today's class was incomplete beacuse it turned into a doubt session, watch the entire class here -> 🔗

Stuff Harkirat told to do

  • Install Solana CLI
  • Watch the offline video for today's complete class.

Recorded Video Link

Video(1/1)

Link to slides

🔗

What happened?

  • What is Node.js?
    • allows for JS to run on the server side ( backend )
    • Node is a js runtime v8 engine.
    • A competitor of Node is BUN ( does the exact same thing but is faster )(still very novel)
  • Pre req for today's class:
  • We looked at how to start a node.js project in this class.
  • What does npm do : manages external dependencies / packages / libraries / reusable code / code bases
  • Looked at the chalk library. {npm install chalk}
  • Internal packages are those provided by Node.js out of the box eg: fs, path, http, etc.
  • External packages (you gotta npm install them eg chalk, express, etc.)
  • When you push your project to github, you don't push the node modules folder just the package.json, the dev just does npm install.
  • Versioning Semantics:
    • eg ^5.3.0
    • 5 is for major or breaking changes
    • 3 is for minor changes
    • 0 is for bug fixes / patches
    • ^ this means npm will install any version compatible with 5.3.0 but less than 6.0.0 eg 5.3.1, 5.4.0, etc.
    • no ^ ( that's called version pinning )
    • You can also do "latest" (its obvious what this does)
    • ^ -> this is a caret not a tilda, ~ this is tilda.
  • package-lock.json -> this pins a version so that every dev gets the same exact package versions, you push this to github.

Stuff Harkirat told to do

  • Create a CLI of your own ( using commander library, ( program.command.alias ) )
  • Harkirat didn't say this but learn about "thenable".

Recorded Video Link

Video(1/1)

Link to slides

🔗

What happened?

  • HTTP protocol allows servers to communicate with each other.
  • Request Response Model : communication pattern between the client and server ( there are other eg : Web sockets, WEB RTC, GRPC )
  • IF interested in making own HTTP server from scratch refer RFC 2616 -> 🔗
  • Chrome dev tools will be an offline vid.
  • Domain Name / IP : eg - google.com -> this has a remote address which translates to the IP:port no( try ping google.com or equivalent to get the IP )
  • If you rent a server from AWS you get a IP ( 22.27.37 ), THEN you can buy a domain (eg harkirat.kirat.me) from godaddy and then point harkirat.kirat.me to 22.27.37
  • Ports : logical endpoints that identify specific processes. eg: app.100xdevs.com/3001 points to a specific thing and 3002, 3004, points to other things but are on the same IP.
  • Default ports for HTTP = 80 and HTTPS = 443
  • Methods : ways to structure your requests.
    • Creating something -> POST request
    • Reading something -> GET request
    • updating something -> PUT request
    • Deleting something -> DELETE request
  • When you do a POST request you get a JSON ( Javascript Object notaion )
  • Status Codes:
    • 3 digits num returned by the server to indicate outcome of client's request.
    • if something bad happens : it doesn't give 200 ok.
    • 200 series is success ( 204 is req successful but no content to return )
    • 300 series are redirects
    • 400 series are client side errors.
    • 500 series are server side erros. ( if you got this on your site, something is really wrong )
    • BAD devs don't use status codes (eg : the initial dev team at PAYTM )
  • Body -> while sending a request to the server if you want to send some data (payload), you use this.
  • Routes -> what exactly do you want to do eg: https ://api.todo.com/something -> the something is the route. it points to something specific.
  • WE generally dont create http servers from scratch.
  • In today's class we just touched express and how to build soemthing using express, the assignments of the todo app are based on this part of the class.
  • app.get('/',function(req,res)){run this code when GET request received from client}.
  • The '/' this is the endpoint it can be something like '/calendar'
  • req object gives access to all things related to the request sent by the client eg : if any payload is attached to the request sent, it can be accessed from here.
  • res object gives access to the thing the server sent to the client
  • app.listen(3000) the 3000 is the port.
  • Headers will be covered in another offline video if not already in the offline vid for this class.

Stuff Harkirat told to do

  • If this class was too overwhelming, watch this offline class : 🔗
  • Install POSTMAN
  • Easy assignment : code an in memory todo app (express)
  • Hard assignment : code a file system based todo app ( the backend part needed was covered (basics) in today's class, the front end part for fetch, cors will be an offline video )