WORKSHOP 1
BASICS-OF-BLOCKCHAIN
Basics-of-Blockchain
Workshop Day_1
Somewhere in the parallel universe ;)
Dude, I need
some money
Cool, I’m sending it
to your account.
Thanks bruv !
Sent, vro.
Harsh
Behind the scenes!
Issues with this approach
● What if that register in which the transaction was logged gets burnt in a
fire or destroyed by any means ?
● What if, by mistake, your bank had written $2000 instead of $1500?
● What if the bank did that on purpose?
Solutions?
● Is it possible to get rid of the middleman?
● Can we hold the records to ourselves?
Replacing the middleman
● Everyone should have a copy of the
register.
● When a transaction happens, all the
copies of register must be updated.
● Registers once updated, must be
immutable
Building the Solution
● An Empty Folder, storing the pages
● When A Transaction Happens:
○ Everyone checks whether A has enough balance to transfer amount X
to C
○ Everyone makes sure A actually made a transaction to C and of X
amount
○ Everyone update their page
● Transactions Continue to Happen
● Putting away the Page
Putting away the page
● Page should be sealed so that it remains unaltered
● Sealed with a unique Key that everyone agrees upon
● Earlier the bank provided this trust
● Now, this seal will provide the trust instead
How to create such seal digitally?
The Magic Machine
● This machine should provide us the seal for our given input
● Given a specific input, the output must be fixed and unique
● This machine’s outputs are irreversible, i.e. given the output we can’t find
the input.
● Given an output, bruteforce is the only solution to find input.
+
Seal
Required
Input data Output(000…)
Seal Number 1 Our Output - 111….
Seal Number 2 Our Output - 010...
Seal Number n …. Our Output - 000…..
The final key Got Required Output!!!!
And the magic happens !!!!
Harsh
How do we seal a page?
● A prerequisite for output is defined, which sets the difficulty level.
● Everybody in the network simultaneously starts trying different values for
seal number, until the magic machine satisfies the required output condition.
● The one who finds it, broadcasts it to all.
How do we seal a page? (Contd.)
● Everyone verifies if the broadcasted key satisfies the required output
condition.
● Why should not I sit idle and wait for somebody else to broadcast the key?
● The first person to find the correct key is rewarded.
Is the seal trustworthy ?
● What if someone tries to modify a previously sealed page?
● Can we link the pages?
● How can we do that?
Threat to this network
● What if the majority turns to be dishonest?
● This would simply break the network.
● Such type of an attack is called the “51% attack”.
● More diverse a Blockchain network would be, the safer it would be.
Connecting the Dots
● An Empty Folder - A Blockchain
● Validating a transaction - Consensus
● Transactions Continues to Happen - Keep adding transactions until a block is full
● Magic Machine - Hash Function
● Finding the key - Proof Of Work
● Putting Away The Page with the seal - Mining a new block
So basically what is blockchain and how it is
helping ?
Now, by this we understood few points -
● Technically, blockchain is a kind of database with a digital record of all
transactions that are immutable.
● Blocks are linked together in single list via hashes of previous block,hence
the name blockchain.
● Can be used anywhere the data needs to be distributed and immutable,
blockchain can be used, Eg- digital voting applications, digital identity etc.
Revising Object Oriented Programming
Off topic information
Classes - A class is a user defined blueprint or prototype from which
objects are created. It represents the set of properties or methods that
are common to all objects of one type.
Objective 1 - Coding a block
Let’s dive into some code !
Questions to dig deeper!
● Are we checking the validity of transactions?
● Are we preventing all the other malicious activities on our network?
● What about confidentiality of data?
Oops... Time's Up!!
♫ We'll tell you all about it when we see you again! ♫
PS: 1st year recruitments soon !