Complete Course On Blockchain and Crypto Currency
Complete Course On Blockchain and Crypto Currency
Navdeep Yadav
Co-Founder Float
Product Manager |MBA|
Course Overview Block Chain and Crypto currency
Ethereum: The NeXT Web 3.0 with Defi and 9. How to Scale
Internet Protocol Dapps Ethereum
• What is Ethereum? • Types of token • Problems with Ethereum
• Smart Contract • What is Dapps • Blockchain Trilemma
• Ethereum Request for • Building decentralised • Ethereum Scaling Solution
Comment (ERC) standard social media app • Off-Chain and on-chain
• Building Tik-Tok on • Civic token built on Scaling
Ethereum Ethereum • L0, L1 and L2 Scaling
• Ethereum benefits and real • Proof of Work Vs Proof of solution
use case Stake • Introduction to oracle
• Difference between Coin vs • Ethereum virtual machine
Token
Blockchain in the most simplest form
Blockchain in the most simplest form
Mary Alice
Blockchain in the most simplest form
I had a toy.
I gave it to you. We did not need a third person to
make the transfer for us.
Mary Alice
So, sending digital toys is not the same as giving physical toys.
Enters Blockchain!
How do we solve the problem of Double spending
Blockchain Bitcoin
What is Blockchain and Crypto currency
Various Centralized ledger
Centralize ledger
-Bank transfer
-Stock purchase
-Collaterals
What is Blockchain and Crypto currency
Blockchain is the technology of distributed ledger that give control to people instead of bank
Centralize ledger Distributed ledger
Blockchain is Peer to peer and Decentralise
“The root problem with conventional currency is all the trust that's required to make it
work. The central bank must be trusted not to debase the currency, but the history of fiat
currencies is full of breaches of that trust. Banks must be trusted to hold our money and
transfer it electronically, but they lend it out in waves of credit bubbles with barely a
fraction in reserve.” - Satoshi Nakamoto
Cryptocurrency vs Fiat currency
What is crypto currency
Crypto + Currency
Blockchain
The blockchain is a chain of data blocks. Each block can be thought of as a page in a ledger.
Block head and block body
cockpit of a truck
Block in a blockchain technology
The blockchain is a chain of data blocks. Each block can be thought of as a page in a ledger.
What is a block in a blockchain
The individual blocks are composed of several components. Roughly these can be
differentiated into the head of the block (block header) and his body (block body).
Block header
The head of the block is divided into six components:
Block body
• amount of money
• share in a company
• digital certificate of ownership
• vote during an election
Because the hash of the previous block is contained in the hash of the new block, the blocks
of the blockchain all build on each other.
Genesis Block
If anyone changes the data in a single block, the hash of that particular block changes,
but it also makes the whole chain invalid.
Genesis Block
All these hash will form a Merkle tree and every hash has a size
in bits.
The lower the goal in bits is, the harder it is to find a matching
hash.
Less the zero bigger the block size and more the data you can
store
Upcoming topic
Summarise Block chain technology
Bitcoin and Blockchain network
What Is Bitcoin ?
How does “Bitcoin” Work ?
What is Blockchain Technology ?
What makes blockchain so unique
Upcoming topic
What is Bitcoin and who created this
• Game theory
• Cryptography
• Mathematics
• Computer science
Alice Bob
Ledger
Alice Pays bob $20
You Charlie
Alice Bob
Ledger
Transaction Signature
Alice Bob
People can’t create it but they can still
duplicate the created signature.
Ledger
Alice Pays bob $20 101001101001..
Alice Bob
Ledger
Alice Pays bob $20 101001101001..
You Charlie
It should be infeasible for anyone else to forge
her signature.
Digital Signatures in Cryptography
Alice Bob
Protocol of ledger
• Anyone can add lines to the ledger
• Settles up with real money every month
• Only Signed transactions are valid
You Charlie
What if some one overspend the money
$ 100 $ 100
Ledger
Charlie Pays bob $100 101001101001.. $ 400
$ 100
Charlie Pays Alice $200 10101000111… $ 100
You Charlie
Charlie Pays you $200 1000100111…
1010101010101010101010101010101101010101010
01010000111111010101010101010101010101
01010101010101001010100101 0010100101001
256
2 Signatures are possible
Alice Bob
Ledger
Ledger -------------
-------------
-------------
-------------
-------------
-------------
Ledger Ledger
------------- -------------
------------- -------------
------------- -------------
You Charlie
What is consensus mechanisms?
Solving the puzzle (problem) also verifies that the block is valid.
However, the only way to solve the puzzle is brute force and luck.
The first person to solve it receives one candy (fee for mining).
If more than 50% of the kids verify it is correct, then they all add that block
to the top of their blocks.
Thus making sure the only agreed upon blocks are added (Consensus).
Proof of Work vs Proof of Stake explanation like I am five
If a bad kid wants to insert a bad block (or replace a good block) into the stack
He’d have to convince/bribe more than 51% of the kids to follow along
And redo all the math puzzles for each of the blocks on top of the block
This can be very costly and time-consuming
Proof of work prevents the bad actors from tampering with the blockchain.
Consensus mechanisms in BTC and ETH?
These consensus mechanisms also ensure new blocks get added to any blockchain.
Mining isn’t universal to all blockchains; it’s just one type of consensus mechanism currently used
by Bitcoin and Ethereum, though Ethereum plans to move to another—proof-of-stake (PoS)— by
2022.
Blockchain Consensus Algorithms Popular in the Market
Alice Bob
Who Owns the website?
Who hosts the ledger?
Who controls the rules of the game?
$400
Ledger
Alice Pays bob $20 101001101001..
Alice Bob
Ledger
Ledger -------------
-------------
-------------
-------------
-------------
-------------
Ledger Ledger
------------- -------------
------------- -------------
------------- -------------
You Charlie
We own our own ledger - Decentralize
Alice Bob
Ledger
Ledger -------------
-------------
-------------
-------------
-------------
-------------
Ledger Ledger
------------- -------------
------------- -------------
------------- -------------
You Charlie
Cryptographic Hash Function
Hash Function
101010101010101010101010101
01011010101010100101000011
1111010101010101010101010101
SHA 256 (“Navdeep”) = 01010101010101001010100101
0010100101001
Message or
“Hash” or “Digest”
transaction
256
2 Signatures are possible
Hash Function
101010101010101010101010101
01011010101010100101000011
1111010101010101010101010101
SHA 256 (“ ”) = 01010101010101001010100101
0010100101001
??????
“Hash” or “Digest”
256 Signatures are
2 possible
Inverse is infeasible
00000000000000000000000000000000000
SHA 256 (“ Guess 1”) = 00000000000000000000000000000000000
000000000000000000000000001
00000000000000000000000000000000000
SHA 256 (“ Guess 2”) = 00000000000000000000000000000000000
000000000000000000000000002
Who own this distributed ledger ?
Someone will do the proof of work and find a new block from the previous block
Ledger
Ledger -------------
-------------
-------------
-------------
-------------
-------------
Ledger Ledger
------------- -------------
------------- -------------
------------- -------------
You Charlie
How to Guess the next block with SHA 256 Hash
Ledger 30 Zeros
Alice Pays bob $20
000000000000000000000
Bob pays Charlie $40 SHA 256 0000000000000111101010101
010101010101010101010101010
10100101010010100101001010
Charlie Pays you $30
01
You pays Alice $10
1010101011 1
Probability of finding this is = 30
~ 1 in a billion
2
Block Creator/Miner
How Blocks are created and connected
Bob
Ledger Ledger
Alice
Ledger Ledger
Previous Hash
Miner 1
Alice Pays bob $20
0000000000000000000000000000
0000001111010101010101010101010101
0101010101010100101010010100101001
01001
How the blocks are connected with previous hash
Between all the miners who so ever will solve the puzzle first will get some mining fees
Miner 1 Miner 2
If anyone changes the data in a single block, the hash of that particular block changes,
but it also makes the whole chain invalid.
Genesis Block
Let say that you have everything you need to start computing.
This time, you chose the right number and as a result, you got a string that starts with 18 zeros.
Problem with proof of work
A machine or computer must keep incrementing a nonce until it finds the right one.
It means a computer has to brute force that number and generate millions of hashes per
second to generate the one that will have the same number of starting zeros as defined.
To execute PoW we have to spend high amounts of electricity and computer power just to brute force
hashes. The power used for PoW is just a waste of resources.
Just imagine if some cryptocurrency that uses Pow, like Bitcoin, goes to mainstream adoption.
Today, almost 50% of Bitcoin hash power is coming from a few mining pools.
That means that only a few people have to meet at the same desk to agree on a 51% attack and changing the
blockchain if they have a reason to do that. Ie (Not decentralize)
More than 70% of the mining power is coming from China due to low electricity cost
How and Why Mining happens in Bitcoin
Bitcoin mining in layman terms
You are the teacher of a math class and decide to play a game:
“Then I’m going to call out a math problem and the first kid to
solve that problem will be given that sheet of paper.”
You check the solution and then give the girl the piece of
paper and she begins to write down any transactions
between the other kids.
“Hmm..” you think to yourself.. “that was too easy and she
solved it too quickly.. I know I'll give them a much harder one
next time.”
You repeat this process over and over, every few hours
adjusting the difficulty of the math problems to ensure that a
new sheet of paper is given out roughly every 10 minutes….
Bob
Ledger Ledger
Alice
Ledger Ledger
Previous Hash
Miner 1
Alice Pays bob $20
0000000000000000000000000000
0000001111010101010101010101010101
0101010101010100101010010100101001
01001
What will happen in case of Conflicting Block
Conflicting Block
Bob
Block creator broadcasting blocks (Mining)
Alice tried adding a block only to the Alice I will fool bob
with a fake Bob
transaction
bob’s ledger
You Charlie
Ledger Ledger Ledger Ledger
Previous Hash
----- -----
POW (10101010110)
Ledger Ledger Ledger Ledger Ledger
To do 51%
attack I have to
be faster than
everyone SHA 256
Alice
0000000000000000000000000000
0000001111010101010101010101010101
0101010101010100101010010100101001
01001
Conclusion of block chain in context of bitcoin
Miner 1 Miner 2
Ledger Ledger
Ledger Ledger
----- -----
----- -----
You Charlie
How the first few bitcoins are created
Alice Bob
$ 400
You Charlie
Mining Reward and Pool Hopping Problem
All the money in the form of bitcoin comes from block reward and it will cut in half
every four year
The Bitcoin network is secured by mining, as mining validates the transactions on the
network and mints new bitcoin at the same time.
• Mining also ensures that no one entity (nodes) is in control of the blockchain or
protocol that governs it, making Bitcoin resistant to being controlled (or shut down) by
any government or central authority.
• The first miner to find a solution that is accepted by a majority of miners is permitted
to write a "block" of new transactions to the “blockchain” — Bitcoin's distributed
ledger.