Share Your Experience With Others

Overview of Blockchain

Blockchain:

  1. The algorithm behind distributed ledger technology
  2. By Satoshi Nakamoto
  3. Used In
    • Crypto-Currency
    • Business Network Applications
    • Banking & Finacial
    • Real Estate
    • Election

History:

  1. Inspired by timestamp-based ordering algorithms to prevent tampering of documents.
  2. First introduced in a research paper in 2008.
    1. The major purpose was to :
      • To solve the double-spending problem
      • And eliminate the need of central trusted third party

Double Spending Problem:

Double spending.png

  1. Before the first transaction gets confirmed, the amount is double spent on the recipient.
  2. Here we are considering this transaction is happening in a distributed system in which multiple servers or nodes having a copy of Alice balance.
  3. Before all the nodes get the updated balance of Alice or confirmed from all the nodes someone just made a fault entry that Alice sent $5 to Tom, so this creates the problem in a distributed transaction.

The Need Of Third Party For Trust:

third party.png

P2P(Process to Process) cryptographic payment system solves these both problems.

  • Blockchain is larger number of distributed blocks of data.
  • Holds the ledger of transactions from the beginning of time(of the system)
  • When the first block is added to the blockchain at time T0(T zero), it is called the Genesis block.
  • Each block in the chain has reference to the previous block.Blocks.png
  • The blocks are distributed over a P2P network.
  • P2P network in which every node is connected to each other node either directly or indirectly.
  • Each node/peer contain entire copy of the blockchain.
  • Whenever a new transaction is added:
    • Added in a block on the node.
    • Block is broadcasted to all the nodes.interconnect
  • Once all the nodes verified the transaction that is added to the node.
  • P2P network is to establish a trusted framework.
  • If 51% of the nodes remain honest nodes which means the nodes which are having the correct info of transactions are higher in the system.
  • It will be difficult for the fraudulent nodes to catchup.tree.png

The Block Structure:

  • The block contains the ledger/transaction data
  • The block data is hashed by cryptographic hash functions.
  • Cryptographic Hash Functions
    • One way hash functions
    • It is difficult to find another hash value for the same string.tree.png
  • Block Structure
    • Block No.
      • Data:
        • Transaction/Ledger
      • Nonce
        • Block Hash
        • Prev Block Hash

Hashing of Block:

tree

Forming A Chain:

  • The first is the Genesis block(the previous pointer is 0).
  • The valid block is added to the chain.
  • Each block contains a pointer to the previous hash.
  • The chain of blocks contains the ledger of all the systems.

Anyone trying to change the data in any of the blocks in the blockchain will:

  • Change the hash of the current block
  • The prev pointer of the next block will be changed.
  • And hence all subsequent blocks will be changed.
  • Hence this breaks the chain.
  • However, the attacker will be required to hash all the blocks again to change the complete chain.
  • Proof of work will make this further difficult.

Proof of Work:

  • Produce a challenge to the user/computer.
  • Basically, we create a challenge for the user/computer to generate data according to the nonce value we provide in the block.
  • If the user/computer is capable to generate the proof of work, user/computer is validated and added to the blockchain.
  • And eliminate entities which are slow or not capable enough to generate the proof of work.
  • Find or generate a value which is :
    • Difficult to generate
    • And yet easily verifiable
    • For example:
      • Proof of work: Block hash should have n leading zeros. For example n=4, hash should have value 4 leading zeros.
      • 0000Ab23………………………………………………………0Ab23.
      • Leading 4 zeros initially in this hash.

How to get such proof of work:

  • Generate Nonce, maybe by BruteForce such that:
    • Combination of Nonce and Block data generates the leading zeros.
    • As per the difficulty of the challenge (value of n).
    • More the value of n more the difficulty.
    • We can have our own custom algorithm to make this more difficult.

Significance of Proof of Work:

  • Signifies that the computation required is exponential to the no. of leading zeros required.
  • Once the CPU effort has been expended to make satisfy proof of work the block can’t be changed.
  • Until redoing the proof of work(if the data of the block has been changed).
  • Redoing will require the entire chain to be redone.

A Validity of Proof of Work:

  • Even if the attacker tries to catch up and produce the proof-of-work faster, the added block will be assessed again when a new block is added.
  • Chain with longest proof-of-work will be accepted.
  • A parallel chain is formed.
  • Other blocks will be rejected ( called the dangling block/branch).
  • Consensus will verify the block.
  • As no. of blocks increases, the probability of a slower attacker catching up diminishes.

Transactions:

  • Transactions are generally stored in Merkel tree.
  • Transactions are hashed & paired again.
  • Each transaction record is hashed.
  • The process repeats until there is only one root hash.tree.png

How The User Authentication Happens In Blockchain?

  • Each transaction record is signed by the private key of the sender.
  • The signature is appended with the transaction.
  • At any point of time, it can be validated that transaction if initiated by a particular sender.
  • The public key of the sender can be used to generate the signature which can be validated.
  • A lot of other cryptographic arrangements can be used for further securing the transaction records.

Leave a comment