Introduction To Blockchain

Unit 1

Q.1 }What are the types of blockchain based on transfer capabilities and access capabilities? Explain with example.

There are 3 type of blockchain

1.Public Blockchain

            In a public blockchain a user can become a member of the blockchain network. This means they can store , send and receive data after downloading the required software on their device. Allowing anyone to read and write the data stored on the blockchain as it is accessible to everyone in the world.

            A public blockchain is completely decentralised. The permissions to read and write data onto the blockchain are shred equally by all connected users, who come to a consensus before any data is stored on the database.

            The most popular example of public blockchain is Bitcoin. the digital currency allows users to use a platform for making transaction directly between them.

2.Private Blockchain

In a private blockchain, permission to write, send and receive data is controlled by one organisation. Private blockchains are typically used within an organisation with only a few specific users allowed to access it and carry out transactions.

The organisaction in control has the power to change the rules of a private blockchain and may also decline transaction based on their established rules and regulations.

An example of this is a blockchain deployed by a corporation to collaborate with other divisions or a few permissioned participants.

3.Consortium Blockchain

            A consortium blockchain, also called permissioned blockchain can be considered as a hybrid model between the low-trust offered by public blockchains and the single highly-trusted entity model of private blockchains. Instead of allowing any user to participate in the verification of the transaction process or on the other side just allowing one single company to have full control, in a consortium blockchain a few selected parties are predetermined. It only allows a limited number of users the permission to participate in the consensus process.

            For example, imagine a group or network of ten banks, each of which is connected to the blockchain network. In this example, we could imagine that for a block to be valid, seven of the ten banks have to agree.


Q.2} Explain block structure of bitcoin.                      

            Blocks are files where data pertaining to the Bitcoin network are permanently recorded. A block records some or all of the most recent Bitcoin transactions that have not yet entered any prior blocks. Thus, a block is like a page of a ledger or record book. Each time a block is ‘completed’, it gives way to the next block in the blockchain. A block is thus a permanent store of records which, once written, cannot be altered or removed.

            The Bitcoin network witnesses a great deal of transaction activity. Maintaining a record of these transactions helps users track what was paid for and by whom. The transactions executed during a given period of time are recorded into a file called a block, which is the basis of the blockchain network.
A block represents the ‘present’ and contains information about its past and future. Each time a block is completed it becomes part of the past and gives way to a new block in the blockchain. The completed block is a permanent record of transactions in the past and the new transactions are recorded in the current one.

Example of a Block (Bitcoin Block)
            By way of analogy, it is possible to compare ordinary banking transactions to transactions over the Bitcoin network. A blockchain is like a record of bank transactions, whereas a block might be a single transaction confirmation that a bank ATM prints out after you use the machine. Within the blockchain network, the individual blocks build a 'ledger' much like an ATM or bank would record your transactions.




Q.3} What is merkle tree? Explain with neat diagram.


Blockchain merkle Tree

            Merkle tree is a fundamental part of blockchain technology. It is a mathematical data structure composed of hashes of different blocks of data, and which serves as a summary of all the transactions in a block. It also allows for efficient and secure verification of content in a large body of data. It also helps to verify the consistency and content of the data. Both Bitcoin and Ethereum use Merkle Trees structure. Merkle Tree is also known as Hash Tree.

            The concept of Merkle Tree is named after Ralph Merkle, who patented the idea in 1979. Fundamentally, it is a data structure tree in which every leaf node labelled with the hash of a data block, and the non-leaf node labelled with the cryptographic hash of the labels of its child nodes. The leaf nodes are the lowest node in the tree.



How do Merkle Tree work?

            A Merkle tree stores all the transactions in a block by producing a digital fingerprint of the entire set of transactions. It allows the user to verify whether a transaction can be included in a block or not.
            Merkle trees are created by repeatedly calculating hashing pairs of nodes until there is only one hash left. This hash is called the Merkle Root, or the Root Hash. The Merkle Trees are constructed in a bottom-up approach.

            Every leaf node is a hash of transactional data, and the non-leaf node is a hash of its previous hashes. Merkle trees are in a binary tree, so it requires an even number of leaf nodes. If there is an odd number of transactions, the last hash will be duplicated once to create an even number of leaf nodes.



            The above example is the most common and simple form of a Merkle tree, i.e., Binary Merkle Tree. There are four transactions in a block: TX1, TX2, TX3, and TX4. Here you can see, there is a top hash which is the hash of the entire tree, known as the Root Hash, or the Merkle Root. Each of these is repeatedly hashed, and stored in each leaf node, resulting in Hash 0, 1, 2, and 3. Consecutive pairs of leaf nodes are then summarized in a parent node by hashing Hash0 and Hash1, resulting in Hash01, and separately hashing Hash2 and Hash3, resulting in Hash23. The two hashes (Hash01 and Hash23) are then hashed again to produce the Root Hash or the Merkle Root.

            Merkle Root is stored in the block header. The block header is the part of the bitcoin block which gets hash in the process of mining. It contains the hash of the last block, a Nonce, and the Root Hash of all the transactions in the current block in a Merkle Tree. So having the Merkle root in block header makes the transaction tamper-proof. As this Root Hash includes the hashes of all the transactions within the block, these transactions may result in saving the disk space.



            The Merkle Tree maintains the integrity of the data. If any single detail of transactions or order of the transaction's changes, then these changes reflected in the hash of that transaction. This change would cascade up the Merkle Tree to the Merkle Root, changing the value of the Merkle root and thus invalidating the block. So everyone can see that Merkle tree allows for a quick and simple test of whether a specific transaction is included in the set or not.

Merkle trees have three benefits:
  • It provides a means to maintain the integrity and validity of data.
  • It helps in saving the memory or disk space as the proofs, computationally easy and fast.
  • Their proofs and management require tiny amounts of information to be transmitted across networks



Q.4} What digital signature? Explain signing and verification process of digital signature

Digital Signature

            A digital signature is a mathematical technique used to validate the authenticity and integrity of a message, software or digital document. As the digital equivalent of a handwritten signature or stamped seal, a digital signature offers far more inherent security, and it is intended to solve the problem of tampering and impersonation in digital communications.
            Digital signatures can provide the added assurances of evidence of origin, identity and status of an electronic document, transaction or message and can acknowledge informed consent by the signer.

The following points explain the entire process in detail −

  • Each person adopting this scheme has a public-private key pair.
  • Generally, the key pairs used for encryption/decryption and signing/verifying are different. The private key used for signing is referred to as the signature key and the public key as the verification key.
  • Signer feeds data to the hash function and generates hash of data.
  • Hash value and signature key are then fed to the signature algorithm which produces the digital signature on given hash. Signature is appended to the data and then both are sent to the verifier.
  • Verifier feeds the digital signature and the verification key into the verification algorithm. The verification algorithm gives some value as output.
  • Verifier also runs same hash function on received data to generate hash value.
  • For verification, this hash value and output of verification algorithm are compared. Based on the comparison result, verifier decides whether the digital signature is valid.
  • Since digital signature is created by ‘private’ key of signer and no one else can have this key; the signer cannot repudiate signing the data in future.

It should be noticed that instead of signing data directly by signing algorithm, usually a hash of data is created. Since the hash of data is a unique representation of data, it is sufficient to sign the hash in place of data. The most important reason of using hash instead of data directly for signing is efficiency of the scheme.

Signing large data through modular exponentiation is computationally expensive and time consuming. The hash of the data is a relatively small digest of the data, hence signing a hash is more efficient than signing the entire data.










Comments

Popular posts from this blog

Blockchain Working

Distributed and Parallel Computing