Bitcoin Forks and SegWit and BlockChain Merkel Tree

Last updated on Oct 20 2021
Avinash Malviya

Table of Contents

Bitcoin Forks and SegWit and BlockChain Merkel Tree

In this blog, we are going to learn about the bitcoin forks and Segregated Witness (SegWit). Let us first discuss what Bitcoin Forks is.

Bitcoin Forks

A fork is a change to the digital currency software which creates two different paths of the blockchain with a shared history. The forks can be temporary, or lasting for a few minutes, or can be permanent.
There are many reasons why a fork happens. The changes made to the bitcoin software can require either a Soft Fork or Hard Fork.

Soft Fork

A soft fork introduces a change which is backwards compatible with the previous version. It means there is no need to upgrade the older version of the bitcoin software necessarily. The users who are running the older version of the software will still recognize new blocks created by computers. It is called soft because both groups of users (old and new users) will continue to mine new blocks on the same blockchain. As they remain part of the same network, a soft fork will never result in the formation of a new digital currency.
A soft fork is considered complete when the majority of nodes in the bitcoin network have updated their software. If this doesn’t happen, the minority group may eventually decide to abandon the proposed update or move to implement a hard fork instead.

Hard Fork

A hard fork introduces a change that forces everyone to upgrade the software. The hard fork is not backwards compatible with older versions of the software. The users who are running the older version of the software in the Bitcoin network needs to upgrade their software to recognize new blocks.
As a result, hard forks lead to a split in the blockchain network with a group of users to form a cryptocurrency. The new network takes an exact copy of the blockchain as it was at the point of the split, and after that, both versions remain separate. Users who owned bitcoin at the time of the split can often claim new coins on the forked network.

Segregated Witness

The concept of Segregated Witness is invented by Pieter Wuille, who is a part of the bitcoin core development team since 2011. SegWit(Segregated Witness) is a protocol upgrade that changes the structure of bitcoin transaction data. It was activated on bitcoin on 23 August 2017 and characterized as a soft fork in the bitcoin chain, and then it has been widely accepted by bitcoin miners and users.
The segregated witness improves the scalability of bitcoin without increasing the block size. If it is activated, then it will fixed transaction malleability. It does this by allowing transaction-producing software to separate transaction signatures from the part of the data in a transaction that is covered by the transaction id and storing it outside the base transaction block.
The soft fork that was represented for segregated witness does not require upgrading to remain on the blockchain. It means that if miners have not upgraded the segregated witness can still remain on the blockchain. They won’t have access all the functionality that segregated witness can provide and also being able to participate in segregated witness transaction. However, they would still be able to validate the block that does not include the segregated witness information in them.
Now, we analyze about the segregated witness. To do this, let us first understand the contents of the bitcoin transaction. There are three main components of the bitcoin transaction. They are
1. Input: Where the coin/funds are coming from.
2. Amount: How many bitcoins are coming from the source.
3. Output: Where that bitcoin are actually headed.
A transaction is very similar to a bank check, which contains inputs, amount, and output. For the transaction to happen, someone who has bitcoin needs to sign that transaction. The signature makes sure that your bitcoin cannot be used by someone who is not authorized. It is because you have the private keys that can be controlled by you only.
Now in SegWit transaction, the digital signature needs to be segregated from the transaction data. It would increase the 1 MB limit for block sizes. The digital signature freezes up about 60-65% of the space in a given transaction. SegWit transaction ignores the data attached to a signature by pulled out the signature from within the input and moving it to a structure towards the end of a transaction. It also solves the problem where a receiver could intercept and modify the sender’s transaction ID to get more coins from the sender. Since the digital signature would be detached from the input, the unauthorized party would have no way of changing the transaction ID without also nullifying the digital signature.

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 trees 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.

Page 3 Image 1
Merkle tree

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.

Page 4 Image 2
Merkle Root

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.
So, this brings us to the end of blog. This Tecklearn ‘Bitcoin Forks and SegWit and BlockChain Merkel Tree’ blog helps you with commonly asked questions if you are looking out for a job in BlockChain or Ethereum. If you wish to learn BlockChain or Ethereum and build a career in BlockChain domain, then check out our interactive, Blockchain and Ethereum Developer Training, that comes with 24*7 support to guide you throughout your learning period. Please find the link for course details:

https://www.tecklearn.com/course/blockchain-and-ethereum-certification-training/

Blockchain and Ethereum Developer Training

About the Course

Tecklearn’s Blockchain and Ethereum Certification Training course in the blockchain technology that covers essential concepts like Blockchain programming, Ethereum, Solidity, Digital ledger types, Smart Contracts, Multichain, Bitcoin mining, Cryptocurrency, etc. The course provides an overview of the structure and mechanism of Blockchain. You will learn about the Ethereum ecosystem, how smart contracts are developed using Solidity and how to deploy a business network using Hyperledger Compose.

Why Should you take BlockChain and Ethereum Certification Training?

• The average salary of a Blockchain Ethereum Developer is $158,860 per annum – Paysa.com.
• Blockchain tech has gone far beyond its beginnings in banking and cryptocurrency: In 2019, businesses are expected to spend $2.9B on the technology.
• IBM reports that Blockchain markets are headed to $60 Billion worldwide by 2024.

What you will Learn in this Course?

Introduction and origin of Blockchain

• How does our current financial system work?
• What can be the possible solution
• What is a distributed system
• What is Blockchain
• How does a Blockchain work
• Components of Blockchain
• Business network
• Consensus, Provenances, immutability and finality

Cryptocurrency and Blockchain

• Distributed system
• Distributed Ledger technology
• Global Payments
• Why BlockChain
• BlockChain and use case needs
• Requirements of blockchain for business
• BlockChain benefits
• Types of BlockChain
• Hands on

Bitcoin Platform

• What is Bitcoin?
• Why use Bitcoins?
• Bitcoin Ecosystem
• Structure of a Bitcoin Transaction
• Merkel Trees
• Scripting language in Bitcoin
• Applications of Bitcoin script
• Nodes in a Bitcoin Network
• Bitcoin Economics
• What is Bitcoin Mining?
• Types of Mining
• Mining and Consensus
• Hands On

Introduction to Ethereum

• What is Ethereum?
• Ethereum Layers
• Introducing Smart Contracts
• Cryptocurrency in Ethereum
• Mining in Ethereum
• Consensus Mechanism
• Platform Functions in Ethereum
• Technologies that support Ethereum
• Ethereum Programming Language
• Components for the development of Ethereum DApps
• Editors and tools
• Frontend Development
• Ethereum Test Networks
• ERC Tokens
• Hands On

Solidity

• Introducing Solidity
• Sample Code, Layout of Source File
• Structure of a Contract
• State Variables, Functions Types, Reference Types
• Special Variables and Functions, Expressions and Control Structures
• Function Calls, Error Handling
• Visibility for Functions and State Variables
• Inheritance, Constructors
• Importing Smart Contracts
• Gas Limit and Loops
• Sending and Receiving Ether
• Recommendations
• Contract ABI
• Setting up the development environment and Deploying DApp
• Hands On

Hyperledger

• Introduction to Hyperledger
• Hyperledger architecture
• Hyperledger Fabric V1 Architecture
• Consensus
• Hyperledger API
• Hyperledger Application Model
• Hyperledger project and tools
• Network Topology
• Exploring Hyperledger frameworks
• Business Network Deployment on Hyperledger Composer Playground
• Sample Transaction
• Service invoices
• Hands On

Hyperledger Composer

• Development Environment using Composer
• Developing business networks
• Testing business networks
• Introduction to Hyperledger Fabric
• Hyperledger Fabric Model
• Ways to create Hyperledger Fabric Blockchain Network
• Hands On

Create and Deploy Your Private Blockchain On Multichain

• What Is MultiChain
• MultiChain Privacy and Permissions
• Mining in MultiChain
• Multiple configurable Blockchains using MultiChain
• Setting up a Private Blockchain
• Hands On

Blockchain Use Cases

• Potential use cases in Blockchain
• BlockChain project

Got a question for us? Please mention it in the comments section and we will get back to you.

0 responses on "Bitcoin Forks and SegWit and BlockChain Merkel Tree"

Leave a Message

Your email address will not be published. Required fields are marked *