0% found this document useful (0 votes)
8 views15 pages

Module1_Lect4

This presentation provides an introduction to blockchain technology, focusing on the structure of a block, including its header and body, as well as key concepts like block hash, block height, and the Genesis block. It explains how blocks are linked in the blockchain and introduces the Merkle tree as a method for summarizing transactions. The content is intended for educational purposes and is owned by St. Francis Institute of Technology.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views15 pages

Module1_Lect4

This presentation provides an introduction to blockchain technology, focusing on the structure of a block, including its header and body, as well as key concepts like block hash, block height, and the Genesis block. It explains how blocks are linked in the blockchain and introduces the Merkle tree as a method for summarizing transactions. The content is intended for educational purposes and is owned by St. Francis Institute of Technology.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 15

The material in this presentation belongs to St. Francis Institute of Technology and is solely for educational purposes.

Distribution and modifications of the content is prohibited.

Blockchain
and DLT
(BLCH)
ITC801

Subject In-charge
Dr. Joanne Gomes
Professor Dept. of Information Technology SFIT
Room No. 316
email: [email protected]
Module 1
Lecture 4
Introduction To Blockchain Technology
Topics
• Block in a Blockchain:
– Structure of a Block,
– Block Header
– Hash and Block Height
– The Genesis Block
– Linking Blocks in the Blockchain
– Merkle Tree.
Structure of a Block in Blockchain
• The blockchain data structure is an ordered,
back-linked list of blocks of transactions, which
are connected with each other using hash
pointers.
• Each block within the blockchain is identified by
a hash and consists of a header section and a
body section.

• Th block header:
– It consists of six components such as version,
previous block hash, merkle tree hash,
timestamp, difficulty level and nonce.

• The body section:


– It consist of the list of transactions
Structure of a Block in Blockchain
Structure of a Block
• Structure of a block in Bitcoin blockchain
Size Field Description
4 bytes Block Size The size of the block, in bytes, following this field
80 bytes Block Header Several fields form the block header
1-9 bytes (VarInt) Transaction Counter How many transactions follow
Variable Transactions The transactions recorded in this block
Block Header

• Block Header:
➢ Version: This 4-byte field indicates the version number of
Bitcoin protocol being used, typically contains value “1.”
➢ hashPrevBlock: This 32-byte field contains a 256-bit hash
of the previous block header.
➢ hashMerkleRootHash: This 32-byte field contains a
256-bit hash of the root hash of the Merkle tree of
all the transactions in the current block.
➢ Time: This 4-byte field contains a timestamp of the
current block that is used to situate it
chronologically in the blockchain.
➢ Bits: This 4-byte field contains the target difficulty of
the current Bitcoin block which determines how
difficult the target hash will be to find.
➢ Nonce: This 4-byte field contains a 32-bit number
that a miner must alter in order to correctly solve
the computational puzzle for the current block.
Structure of a Block-header
• Sample size of a block-header in Bitcoin blockchain

Size Field Description


4 bytes Version A version number to track software/protocol
Previous Block Hash upgrades
32 bytes Previous Block Hash A reference to the hash of the previous (parent)
block in the chain
32 bytes Merkle Root A hash of the root of the merkle tree of this block’s
transactions
4 bytes Timestamp The approximate creation time of this block (seconds
from Unix Epoch)
4 bytes Difficulty Target The proof-of-work algorithm difficulty target for this
block
4 bytes Nonce A counter used for the proof-of-work algorithm
Structure of a Block-header

Size Field Description


4 bytes Version A version number to track software/protocol
Previous Block Hash upgrades
32 bytes Previous Block Hash A reference to the hash of the previous (parent)
block in the chain
32 bytes Merkle Root A hash of the root of the merkle tree of this block’s
transactions
4 bytes Timestamp The approximate creation time of this block (seconds
from Unix Epoch)
4 bytes Difficulty Target The proof-of-work algorithm difficulty target for this
block
4 bytes Nonce A counter used for the proof-of-work algorithm
Block Identifiers: Hash and Block Height
• Block-Hash:
– The primary identifier of a block is its cryptographic hash (32-byte), a digital fingerprint,
made by hashing the block header twice through the SHA256 algorithm.
– It is more accurately the block header hash, because only the block header is used to
compute it.
– block hash is not included inside the block’s data structure. Instead, the block’s hash is
computed by each node as the block is received from the network.
• Block-Height:
– Second identifier of a block is its position in the blockchain and is called as block-height.
– The block height of a particular block is defined as the number of blocks preceding it in the
blockchain. The first block ever created is at block height 0 (zero) called Genesis block.
– Each subsequent block added “on top” of that first block is one position “higher” in the
blockchain, like boxes stacked one on top of the other.
– The block height on January 1, 2014, was approximately 278,000, meaning there were
278,000 blocks stacked on top of the first block created in January 2009.
– Unlike the block hash, the block height is not a unique identifier as two blocks can have
same height.
The Genesis Block
• The Genesis Block, also known as Block 0, is the very first block upon which
additional blocks in a blockchain are added.
• It was created in 2009.
• The genesis block is statically encoded within the bitcoin client software,
such that it cannot be altered.
• Every node always “knows” the genesis block’s hash and structure, the fixed
time it was created, and even the single transaction within.
• It contains the secret message that was embedded by Satoshi Nakamoto,
bitcoin’s creator which is, "The Times 03/Jan/2009 Chancellor on brink of
second bailout for banks.".
• Hash of Genesis Block is
000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f
Linking Blocks in the Blockchain
• Bitcoin full nodes maintain a local copy of the blockchain,
starting at the genesis block.
• The local copy of the blockchain is constantly updated as
new blocks are found and used to extend the chain.
• As a node receives incoming blocks from the network, it will
validate these blocks and then link them to the existing
blockchain.
• To establish a link, a node will examine the incoming block
header and look for the “previous block hash.”
• Let’s assume, for example, that a node has 277,314 blocks
in the local copy of the blockchain.
• The last block, the node knows about is block 277,314, with
a block header hash of
00000000000000027e7ba6fe7bad39faf3b5a83daed765f05f
7d1b71a1632249.
• It then creates block number 277,315
Merkle Tree
• Each block in the bitcoin blockchain contains a summary of all the transactions in the block, using a
merkle tree.
• A merkle tree, also known as a binary hash tree, containing cryptographic hashes.
• It is a data structure used for efficiently summarizing and verifying the integrity of large sets of data.
• The term “tree” is used in computer science to describe a branching data structure, but these trees are
usually displayed upside down with the “root” at the top and the “leaves” at the bottom of a diagram.
• It produces an overall digital fingerprint (hash) of the entire set of transactions
Merkle Tree
• A Merkle tree is constructed by recursively hashing pairs of nodes until there is only one
hash, called the root, or merkle root.
• It is constructed bottom-up.
• The cryptographic hash algorithm used in bitcoin’s merkle trees is SHA256. It is applied
twice, so also known as double-SHA256.
H(A) = SHA256(SHA256(Transaction A))
• The two 32-byte hashes of the children are concatenated to create a 64-byte string, this
string is then double-hashed to produce the parent node’s hash:
H(AB) = SHA256(SHA256(H(A) + H(B)))
• The process continues until there is only one node at the top, the node known as the Merkle
root.
• That 32-byte hash is stored in the block header and summarizes all the data in all four
transactions.
• It needs an even number of leaf nodes.
• If there is an odd number of transactions to summarize, the last transaction hash will be
duplicated to create an even number of leaf nodes, also known as a balanced tree.
Thank You

You might also like