Day 1 of #30DaysOfWeb3 : Blockchain, Smart Contracts and Crypto Wallet Basics

A complete Blog series on web3 where we will cover various topics and build fun projects too. Stay Tuned

Day 1 of #30DaysOfWeb3 : Blockchain, Smart Contracts and Crypto Wallet Basics

Photo by NASA on Unsplash

Hey Crypto Geeks , I have started #30DaysOfWeb3. I will be sharing everyday's learning with my blog series.

So Lets get started.

Starting with Fun facts :


  1. Root of decentralization : Internet was invented during the 1970s(cold war between the USA and Russia). US government built a network of many computers all across the country to preserve their defense system.
  2. Birthday of Internet : Jan 1st, 1983. Prior to this there was not any standard way to communicate.
  3. Web 1.0 : Version of web existed between 1990 to 2004 that consisted of static websites owned by individual companies. Commonly referred to as the "read-only" web.
  4. Web 2.0 : After 2005, Internet Speed Increased, Websites started layout designs, chat application developed, users interaction increased. Cloud platforms like aws, google cloud , azure etc. developed that hosted sites and data of users on their servers also known as centralized web. Commonly referred to as the "read-write" web.
  5. AWS Outage : In 2017, AWS experienced a massive outage caused by engineer who executed wrong command and it lasted around 4 hours. AWS hosted platforms such as Coursera, Medium, Docker, Slack, etc were also down.
  6. Web 3.0 : Return of Decentralization. Data is encrypted and securely stored across multiple nodes owned by individuals called blockchain. Bitcoin being the first ever application of web3. Crypto Wallet login instead of lengthy signup process like in Web2. Outage is not possible in Web3. Commonly referred to as the "read-write-own" web.

Blockchain


A blockchain is a immutable peer-to-peer Digital Ledger Technology (DLT) that consists of growing list of records, called blocks. Each block contains a cryptographic hash of the previous block, a timestamp, and transaction data. Nodes(a computer in peer-to-peer network) collectively adhere to a protocol to add and validate new transaction blocks. Private blockchains also were proposed for enterprise use. Consortium and Hybrid are also another types of blockchain.

First public blockchain application was created by Satoshi Nakamoto in 2008 called bitcoin.

Blockchain Transactions Working


      => Transaction is requested by user 
      => Miners creates a block representing that transaction 
      => Block is sent to every node 
      => Nodes validates all transaction in that block 
      => Miners receive reward paid by users as gas 
      => Block is now added to blockchain 
      => Block is broadcasted to all nodes 
      => Transaction is complete.

Transaction


Any 'write' operation to the blockchain which costs money such as deploying a smart contract onto the chain, purchasing an NFT, sending crypto, purchasing an ENS name, etc. is a transaction.

'Read' operations are free on blockchain.

Gas


Every user needs to pay some cryptocurrency in order to add transaction to the blockchain. Every line of code in the transaction has some cost and its unit is called as gas. Gas fees is amount to be paid for each gas. Some gas fees is burnt and some is rewarded to miner(Who computes your transaction using some algorithm) and some is refunded back to user.

Gas fees goes up when there is lot of traffic on network and higher gas fees transactions has high chances of confirming in less time.

Proof of Work vs Proof of Stake


These are algorithms behind any blockchain to add a transaction to the chain. Proof of work is computation heavy as every miner participate in a race to solve a complex mathematical problem to add a block to the chain. Proof of Stake randomly chooses a validator from group of nodes who have staked their coins onto the platform.

Smart contracts


Smart contracts are written and compiled computer programs. They are deployed onto blockchain just like a transaction and are immutable. Using the address users can interact with functions written in SCs such as mint a coin, accept crypto, add two numbers, etc. Solidity is one of the language supported to write smart contracts.

Smart contracts are an added feature of Ethererum over Bitcoin launched by Vitalik Buterin.

Crypto Wallet


Storage for your digital assets like cryptocurrencies, erc tokens, etc and created using cryptography functions.

N-number of accounts are generated with 12 words phrase called mnenomic.

Every account is created by public private key pair. Public key is your public address and private key is used to access and initiate transaction from your account. Examples are Metamask, Coinbase Wallet, Phantom Wallet, etc.

Types of Wallets


Hot wallets like metamask are always online and prone to attacks. Cold wallets(Recommended) like ledger, trezor are in form of hardware device that require physical input to unlock.