Lesson 0: Welcome to Blockchain
- Bitcoin was the first one to take blockchain mainstream
- Bitcoin is like a digital gold
- Ethereum allows for smart contracts
- Chainlink provides data and external computation to smart contracts
- Hybrid Smart Contracts combine on-chain and off-chain componets
Features and advantasges of blockchains and smart contracts
- Decentralized
- Transparency & Flexibility
- Speed and Efficiency
- Security & Immutability
- Removal of counterparty risk
- Trust Minimized Agreements
MetaMask
Concept | Can Access | Private or Public |
---|---|---|
Mnemonic | All of yout accounts | Keep Private! |
Private Key | 1 of your accounts | Keep Private! |
Public Address | Nothing | It's public |
Gas term
- Gas: Measure of computation use
- Gas Price: How much it costs per unit of gas
- Gas Limit: Max amount of gas in a transaction
Transaction Fee: Gas Used x Gas Price
- ie: 21,000 gas @ 1 GWEI per gas = 21,000 GWEI
Gas Price is based off the "demand" of the blockchain.
The more people want to make transactions, the higher the gas price, and therefore the higher the gransaction fees.
Fundamentals of a blockchain
Hash:
- A unique fixed length string, meant to identify a piece of data. They are created by placing said data into a "hash function"
Genesis Block:
- The first block in a blockchain
Hash Algorithm:
- A function that computes data into a unique hash
Mining:
- The process of finding the "solution" to the blockchain "problem".
- In out example, the "problem" was to find a hash that starts with four zeros.
- Nodes get paid for mining blocks.
Block:
- A list of transactions mined together
Decentralized:
- Having no single point of authority
Nonce:
- A "number used once" to find the "solution" to the blockchain problem.
- It's also used to define the transaction number for an account/address.
Private Key:
- Only known to the key holder, it's used to "sign" transactions
Public Key:
- Is derived from your private key. Anyone can "see" it, and use it to verify that a transaction came from you.
Private key ||| > Public Key > Address
- Private key creates your public key which then can create your address
- A big barrier here because your private key you want to keep private and your public key and your address can all be public information
Node:
- A single instance in a decentralized network
- Anyone can join the network
- Blockchains are resilient, the most popular chains, like bitcoin and ethereum, have thousands of nodes.
- Blockchain nodes keep lists of the transactions that occur
Consensus:
- Consensus is the mechanism used to agree on the state of a blockchain
Consensus protocol:
- Chain Selection
- Sybil Resistance:
- A blockchain's ability to defend against users creating a large number of pseudo-anonymous identities to gain a disproportionately advantageous influence over said system.
- It's basically a way for a blockchain to defend against somebody making a bunch of fake blockchains so that they can get more and more rewards.
PoW and PoS:
- Proof Of Work (PoW)
- Proof of Stake (PoS)
- Proof of stake nodes put up collateral as a sybil resistance mechanism
- Validators:
- Nodes are actually randomly chosen to propose the new block and then the rest of the validators will validate if that node has proposed the block honestly
Nakamoto Consensus:
- A combination of proof of work and longest chain rule
Block Confirmations
- The number of confirmations is the nmber of additional blocks added on after our transaction went through in a block
Sybil Attack
- A user creates a whole bunch of pseudo-anonymous accounts to try to influence a network
51% Attack
- Blockchains are going to agree that the longest chain is the one that they're going to go with, so long as it matches up with 51% of the rest of the network. This means that if you have the longest chain and 51% of the rest of network, you can do what's called a fork in the network and bring the network onto your now longest chain.
Scalability
- A block only has so much block space and the nodes can only add so many transactions, so when a lot of people want to use a blockchain, the gas price skyrockets
Sharding
- A blockchain of blockchains
Layer 1:
- Base layer blockchain implementation
Layer 2:
- Any application built on top of a layer 2
Recap
- ETH and BTC are Proof Of Work
- ETH 2.0 will be Proof of Stake
- PoW & PoS are sybil resistance mechanisms
- The bigger the blockchain, the more secure
- Consensus is how blockchains decide whtat the state of the chain is
- Sharding and rollups are scalability solutions
- Only so many transactions can fit into a block
- Gas prices are how much it costs to perform exectuions on-chain