0% found this document useful (0 votes)
7 views18 pages

Module1 Block Infor Lect3

This presentation from St. Francis Institute of Technology covers the structure and components of a blockchain, including the block header, hash, block height, and the concept of 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 prohibits distribution or modifications.
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)
7 views18 pages

Module1 Block Infor Lect3

This presentation from St. Francis Institute of Technology covers the structure and components of a blockchain, including the block header, hash, block height, and the concept of 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 prohibits distribution or modifications.
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

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


ITC 801

Subject In-charge
Ms. Surekha MAli
Assistant Professor
Room No.
Email: [Link]@[Link]

St. Francis Institute of Technology


Department of Information Technology
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.

Contents
• Structure of a Block,
• Block Header
• Hash and Block Height
• The Genesis Block
• Linking Blocks in the Blockchain
• Merkle Tree.

Blockchain
Department of Information Technology Ms. Surekha Mali
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.

What does a block look like?

A block is a collection of transactions that get validated all together.


Blockchain
Department of Information Technology Ms. Surekha Mali
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.

What does a block look like?

Blockchain
Department of Information Technology Ms. Surekha Mali
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.

Structure of a Block
• 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.
• The 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
Size Field Description

The size of the block, in bytes, following


4 bytes Block Size
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


Blockchain
Department of Information Technology Ms. Surekha Mali
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.

Structure of a Block

Blockchain
Department of Information Technology Ms. Surekha Mali
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.

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.
❖ hashMerkleRoot: 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.

Blockchain
Department of Information Technology Ms. Surekha Mali
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.

Block header
Size Field Description

A version number to track


4 bytes Version
software/protocol upgrades

A reference to the hash of the previous


32 bytes Previous Block Hash
(parent) block in the chain

A hash of the root of the merkle tree of


32 bytes Merkle Root
this block’s transactions

The approximate creation time of this


4 bytes Timestamp
block (seconds from Unix Epoch)

The proof-of-work algorithm difficulty


4 bytes Difficulty Target
target for this block

A counter used for the proof-of-work


4 bytes Nonce
algorithm

Blockchain
Department of Information Technology Ms. Surekha Mali
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.

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.
Blockchain
Department of Information Technology Ms. Surekha Mali
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.

How Actually block in a blockchain looks like

[Link]
Blockchain
Department of Information Technology Ms. Surekha Mali
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.

The Genesis block


• The first block in the blockchain is called the genesis block and was created in 2009.
• It is the common ancestor of all the blocks in the blockchain, meaning that if you start at any block
and follow the chain backward in time, you will eventually arrive at the genesis block.
• 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. Thus, every node has the starting point for the blockchain,
a secure “root” from which to build a trusted blockchain.
• The following identifier hash belongs to the genesis block:
000000000019d6689c085ae165831e934ff763ae46a2
a6c172b3f1b60a8ce26f
• You can search for that block hash in any block explorer website, such as [Link], and you
will find a page describing the contents of this block, with a URL containing that hash:
• [Link]
8ce26f
Blockchain
Department of Information Technology Ms. Surekha Mali
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.

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 wi ll
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 i n
the local copy of the blockchain.
• The last block, the node knows about is block 277,314, with
a block header hash of
00000000000000027e7ba6fe7bad39faf3b5a83daed765f05f7d
1b71a1632249.
• It then creates block number 277,315
Blockchain
Department of Information Technology Ms. Surekha Mali
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.

Linking Blocks in the Blockchain


The bitcoin node then receives a new block from the network, which it parses as follows:

{ "size" : 43560,
"version" : 2,
"previousblockhash" : "00000000000000027e7ba6fe7bad39faf3b5a83daed765f05f7d1b71a1632249",
"merkleroot" : "5e049f4030e0ab2debb92378f53c0a6e09548aea083f3ab25e1d94ea1155e29d",
"time" : 1388185038,
"difficulty" : 1180923195.25802612,
"nonce" : 4215469401,
"tx" : [ "257e7497fb8bc68421eb2c7b699dbab234831600e7352f0d9e6522c7cf3f6c77", #[... many more
transactions omitted ...]
"05cfd38f6ae6aa83674cc99e4d75a1458c165b7ab84725eda41d018a09176634" ] }

Blockchain
Department of Information Technology Ms. Surekha Mali
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.

Markle 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, is a data structure used for efficiently
summarizing and verifying the integrity of large
sets of data. Merkle trees are binary trees
containing cryptographic hashes.

Blockchain
Department of Information Technology Ms. Surekha Mali
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.

Merkle Trees
• 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.

Blockchain
Department of Information Technology Ms. Surekha Mali
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.

Merkle Trees

Calculating the nodes in a merkle tree


Blockchain
Department of Information Technology Ms. Surekha Mali
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.

Merkle Trees
• Because the Merkle tree is a binary tree, 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.
• This is shown in Figure, where transaction C is duplicated.

Duplicating one data element achieves an even number of data elements


Blockchain
Department of Information Technology Ms. Surekha Mali
[Link] Explorer | BCH | ETH | BCH

You might also like