0% found this document useful (0 votes)
20 views

hyperledger gpt

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)
20 views

hyperledger gpt

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/ 5

Module - 02

Cryptographic Primi ves Used in Blockchain

Cryptographic primi ves are the building blocks of blockchain technology, ensuring security,
integrity, and transparency. The key primi ves include:

1. Cryptographic Hash Func ons:

o Generate a fixed-length output (hash) for a given input.

o Example: SHA-256 used in Bitcoin.

2. Public-Key Cryptography:

o Based on asymmetric encryp on, with a public key for encryp on and a private
key for decryp on.

o Used for digital signatures and secure transac ons.

3. Digital Signatures:

o Provide authen ca on and data integrity by signing messages with a private key
and verifying them with the public key.

o Example: ECDSA (Ellip c Curve Digital Signature Algorithm) used in Bitcoin.

4. Random Number Generators (RNGs):

o Generate random values for secure key crea on and cryptographic opera ons.

5. Merkle Trees:

o A tree structure where each leaf node is a hash of a data block, and non-leaf
nodes are hashes of their child nodes.

o Used to verify data integrity efficiently.


Cryptographic Hash Func on

A cryptographic hash func on is a mathema cal algorithm that takes an input (or message)
and returns a fixed-size string of bytes, typically represented in hexadecimal. This output is
called the hash or digest.

Proper es of Cryptographic Hash Func ons:

1. Determinis c: The same input always produces the same hash.

2. Fast Computa on: Hashing a message should be computa onally efficient.

3. Pre-Image Resistance: It should be computa onally infeasible to reverse-engineer the


original input from the hash.

4. Collision Resistance: Two different inputs should not produce the same hash.

5. Avalanche Effect: A small change in the input results in a vastly different hash.

6. Fixed Output Length: The hash length is always the same, regardless of input size.

7. Non-Predictability: The hash output should appear random, ensuring unpredictability.

SHA-256 Hash Func on

SHA-256 (Secure Hash Algorithm 256-bit) is a widely used cryptographic hash func on from
the SHA-2 family. It produces a 256-bit (32-byte) hash value.

Proper es of SHA-256:

1. Fixed Length: Always generates a 256-bit (64-character hexadecimal) hash, regardless


of input size.

2. Secure: Resistant to collisions and pre-image a acks.

3. Widely Used: Used in Bitcoin for Mining (Proof of Work), Hashing transac on data,
Genera ng Merkle tree hashes.

Example:
 Input: "Blockchain"

 SHA-256 Hash:
39b8a3cbe0e56575d12e6350f4127e6eab6e20719494a77a8370d5d382ee0000

Applica ons of SHA-256 in Blockchain:

1. Transac on Hashing: Ensures transac on integrity by hashing data.

2. Block Header Hashing: Links blocks together, ensuring the immutability of the
blockchain.

3. Proof of Work (PoW): Miners solve a computa onal puzzle using SHA-256 to create
valid blocks.

4. Merkle Trees: Verifies transac on data in a block using SHA-256 hashes.

Hash Pointer and Hash Chain

Hash Pointer:

A hash pointer is a data structure that stores the hash of a piece of data and a pointer to the
loca on of that data.

 Purpose: It provides integrity and immutability by allowing verifica on of whether the


data at the pointed loca on has been tampered with.

 Use in Blockchain: Each block contains a hash pointer to the previous block, ensuring
the en re chain's integrity.

Hash Chain:

A hash chain is a series of hash pointers linked together, forming a chain-like structure where:

 Each block contains the hash of the previous block.

 Modifying any block will invalidate all subsequent blocks due to the dependency on
hash pointers.
Example: Blockchain uses a hash chain to create an immutable ledger. Each block's hash
depends on the data and the hash of the previous block, ensuring data integrity.

Merkle Tree and its Structure

Merkle Tree:

A Merkle tree (or hash tree) is a binary tree where each leaf node represents a hash of a data
block, and each non-leaf node is a hash of its child nodes.

Structure:

1. Leaf Nodes:

o Represent the hash of individual data blocks (e.g., transac ons in a blockchain).

2. Non-Leaf Nodes:

o Contain the hash of their child nodes.

o Example: Parent Node Hash = Hash(Child1 + Child2).

3. Root Node (Merkle Root):

o The topmost node represen ng the hash of all the data in the tree.

o Any change in the data alters the Merkle root, making it easy to detect
tampering.

Merkle Tree in Blockchain:

 Used to verify transac ons efficiently without storing the en re block data.

 Simplifies valida on using Merkle proofs by traversing only a subset of the tree.
Digital Signature in Blockchain and Its Applica ons

Digital Signature:

 A digital signature is a cryptographic mechanism that validates the authen city and
integrity of a digital message or document.

 It combines hashing and public-key cryptography.

How It Works in Blockchain:

1. Message Signing:

o A user hashes the transac on data.

o The hash is encrypted with their private key to create the signature.

2. Verifica on:

o The recipient decrypts the signature using the sender’s public key.

o Compares the resul ng hash to the hash of the original message.

Applica ons of Digital Signature in Blockchain:

1. Transac on Authen ca on: Verifies the sender's iden ty in cryptocurrency


transac ons.

o Example: Bitcoin uses ECDSA (Ellip c Curve Digital Signature Algorithm).

2. Data Integrity: Ensures data has not been altered during transmission.

3. Decentralized Vo ng: Securely records votes with tamper-proof verifica on.

4. Smart Contracts: Validates the par es involved in execu ng the contract.

5. Supply Chain: Tracks and authen cates data records at every stage of the supply chain.

Advantages of Digital Signature in Blockchain:

 Non-repudia on: The sender cannot deny signing the message.

 Secure: Resistant to tampering and impersona on.

You might also like