0 - Unit-1 - Introducntion To Crypto Currencies

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 49

Introduction to Cryptocurrencies: Cryptographic Hash Functions

• Introduction to Cryptocurrencies

• Definition:

• Cryptocurrencies are digital or virtual currencies that use cryptography for

security.

• Key Features:

• Decentralized systems

• Operate on blockchain technology

• Examples include Bitcoin, Ethereum, and Litecoin


Cryptographic Hash Functions
A cryptographic hash function is like a special kind of blender for data. You put
in any kind of data (like a document or a password), and it mixes it up to
produce a unique, fixed-size string of characters (like a smoothie)

Key Features:

• Deterministic: If you put the same data into the blender, you’ll always get the
same smoothie.

• Fast Computation: It can mix up the data quickly.

• Pre-image Resistance: It’s really hard to figure out what the original data was
just by looking at the smoothie.

• Small Changes in Input Produce Large Changes in Output: Even if you


change just one tiny thing in the data, the resulting smoothie will look
Cryptographic Hash Functions
• Collision Resistance: It’s very unlikely that two different sets of data will

produce the same smoothie.

• Fixed Output Length: No matter how much data you put in, the smoothie

will always be the same size.

Popular Hash Functions in Cryptocurrencies:

Cryptocurrencies use specific hash functions to keep things secure. Here are

some popular ones:


Cryptographic Hash Functions
• SHA-256 (Secure Hash Algorithm 256-bit):

• Used by Bitcoin.

• Produces a 256-bit hash value (like a 256-character smoothie).

• RIPEMD-160:

• Often used with SHA-256 in Bitcoin addresses.

• Produces a 160-bit hash value (like a 160-character smoothie).

• Keccak-256:

• Used in Ethereum.
Hash Pointers and Data Structures
Hash Pointers

• A hash pointer is a data structure that acts as a pointer to the location of some

information, along with a cryptographic hash of the information. This

combination provides both the address of the data and a way to verify its

integrity.

How It Works:

• Pointer: Points to the location of the data.

• Hash: A cryptographic hash of the data, ensuring that any change in the data

will result in a different hash.


Hash Pointers and Data Structures

• Applications:

 Blockchain: Each block contains a hash pointer to the previous block,

ensuring the integrity of the entire chain.

 Linked Lists: Hash pointers can be used in linked lists to ensure that the

data in each node has not been tampered with.


Hash Pointers and Data Structures

• Data Structures Using Hash Pointers

1.Blockchain:

oStructure: Each block contains a hash pointer to the previous block,

creating a chain.

oIntegrity: Any change in a block will change its hash, breaking the

chain and signalling tampering.

Block N: Data + Previous Block Hash -> Hash Function -> Block N Hash
Hash Pointers and Data Structures

• Data Structures Using Hash Pointers

2.Merkle Trees:

• Structure: Leaf nodes contain hashes of data blocks, and non-leaf nodes

contain hashes of their child nodes.

• Verification: Efficiently verify the integrity of large datasets by checking

the path from a leaf node to the root.


Hash Pointers and Data Structures

• Root Hash

/ \

Hash 0 Hash 1

/ \ / \

Hash 0-0 Hash 0-1 Hash 1-0 Hash 1-1

| | | |

Data 0 Data 1 Data 2 Data 3


Hash Pointers and Data Structures

• Data Structures Using Hash Pointers

3. Hash Tables:

oStructure: Uses hash functions to map keys to values.

oEfficiency: Provides efficient data retrieval by using the hash of the

key to locate the value.

Key -> Hash Function -> Index -> Value


Hash Pointers and Data Structures

• Data Structures Using Hash Pointers

4.Linked Lists with Hash Pointers:

oStructure: Each node contains a hash pointer to the next node.

oIntegrity: Ensures that the data in each node has not been tampered

with.

Node 1: Data + Hash Pointer -> Node 2: Data + Hash Pointer -> ...
Hash Pointers and Data Structures

• Data Structures Using Hash Pointers

Example: Blockchain

In a blockchain, each block contains:

• Data: Transactions or other information.

• Hash Pointer: A hash of the previous block’s data and its hash pointer.
Hash Pointers and Data Structures

• Data Structures Using Hash Pointers

• This structure ensures that:

• Any change in a block will change its hash.

• The hash pointer in the next block will no longer match,

breaking the chain and signaling tampering.


Benefits
Security: Hash pointers ensure data integrity and detect tampering.
Efficiency: Hash pointers allow for efficient verification of data integrity.
Scalability: Suitable for large datasets and complex data structures.
Digital Signatures

• A digital signature is a type of electronic signature that uses

cryptographic techniques to ensure the authenticity and integrity of

digital messages or documents.


Digital Signatures

• How It Works

1.Creating a Digital Signature:

• When you sign a document digitally, a unique digital fingerprint (hash)

of the document is created using a hash function.

• This hash is then encrypted with your private key to create the digital

signature.
Digital Signatures

• How It Works

2.Verifying a Digital Signature:

• The recipient uses your public key to decrypt the digital signature.

• The recipient also generates a hash of the received document.

• If the decrypted hash matches the generated hash, the signature is

verified, confirming the document’s integrity and your identity as the

signer.
Digital Signatures

Key Features

• Authenticity: Confirms the identity of the signer.

• Integrity: Ensures the document has not been altered since it was

signed.

• Non-repudiation: The signer cannot deny signing the document.


Digital Signatures

Applications

• Email Security: Ensuring the authenticity of the sender and the integrity

of the message.

• Software Distribution: Verifying that software has not been tampered

with.

• Legal Documents: Providing a secure and verifiable way to sign

contracts and agreements.


Public Keys as Identities:

In the realm of cryptography, public keys can serve as digital identities.

What is a Public Key?

• A public key is part of a pair of keys used in public-key cryptography. The

pair consists of:

- Public Key: Can be shared openly and used by others to encrypt

messages or verify digital signatures.

- Private Key: Kept secret and used to decrypt messages or create

digital signatures.
Public Keys as Identities:

How Public Keys Act as Identities

• Identification: Your public key can be shared with anyone, much like a

username. It allows others to identify you and send you encrypted

messages.
Public Keys as Identities:

Verification: When you sign a document with your private key, others can use

your public key to verify that the signature is indeed yours and that the document

hasn’t been altered.

Example

• Imagine you have a public key and a private key:

- You share your public key with your friends.

- When you send a message, you sign it with your private key.

- Your friends use your public key to verify that the message is from you and
A Simple Cryptocurrency:
• Key Concepts

1.Decentralization:

Cryptocurrencies are not controlled by any central authority like a bank or


government. Instead, they operate on a network of computers

2.Blockchain Technology:

Think of a blockchain as a digital ledger or a record book. Every transaction is


recorded in this ledger, and everyone can see it.

3.Cryptography:

Cryptography is like a secret code that secures transactions and controls the
creation of new units of cryptocurrency.
A Simple Cryptocurrency:
• How It Works

1.Transactions:

• When you send cryptocurrency, the transaction is broadcast to a network


of computers (nodes).

• These nodes validate the transaction and add it to the blockchain.

2.Mining:

• Some cryptocurrencies, like Bitcoin, use a process called mining. Miners


solve complex mathematical problems to validate transactions and add
them to the blockchain.

• Miners are rewarded with new cryptocurrency units for their work.
A Simple Cryptocurrency:
• How It Works

3.Wallets:

• Cryptocurrencies are stored in digital wallets, which can be software-


based (online) or hardware-based (offline).
A Simple Cryptocurrency:

• How a cryptocurrency transaction works:

1.User A wants to send cryptocurrency to User B.

2.User A creates a transaction and broadcasts it to the network.

3.The transaction is verified by multiple nodes (computers) in the

network.

4.Once verified, the transaction is added to a block in the blockchain.

5.User B receives the cryptocurrency.


A Simple Cryptocurrency:
Benefits

• Security: Cryptographic techniques make it very secure.

• Transparency: Blockchain technology ensures all transactions are public


and verifiable.

• Decentralization: No central authority controls the currency.

Challenges

• Volatility: Cryptocurrency prices can be very volatile.

• Regulation: The regulatory environment is still evolving.

• Adoption: While growing, cryptocurrency adoption is not yet universal.


How Bitcoin Achieves Decentralization:
Centralization vs. Decentralization

Centralization: In a centralized system, a single entity or a small group of

entities control the entire system. Examples include traditional banks and

government institutions. They have the authority to make decisions,

validate transactions, and maintain records.

Decentralization: In a decentralized system, control is distributed across

multiple entities. No single entity has complete authority. This is the

model used by Bitcoin and other cryptocurrencies.


How Bitcoin Achieves Decentralization:
1.Blockchain Technology:

• Bitcoin uses a public ledger called the blockchain, where all transactions are

recorded. This ledger is maintained by a network of computers (nodes) around

the world.

2.Distributed Consensus:

• Transactions are validated by multiple nodes through a process called mining.

Miners solve complex mathematical problems to add new blocks to the

blockchain. This ensures that no single entity can control the entire network.
How Bitcoin Achieves Decentralization:
A simple flowchart to help visualize how Bitcoin achieves

decentralization:
Centralized System:
[Central Authority] -> [Validates Transactions] -> [Maintains Records]

Decentralized System (Bitcoin):


[User A] -> [Broadcasts Transaction] -> [Network of Nodes]
-> [Nodes Validate Transaction]
-> [Transaction Added to Blockchain]
-> [User B Receives Bitcoin]
How Bitcoin Achieves Decentralization:

• In a centralized system, a central authority controls everything. In

Bitcoin’s decentralized system, the network of nodes collectively

validates and records transactions, ensuring no single point of control.


Distributed Consensus:

• Distributed consensus is a key concept in decentralized systems like

Bitcoin. It ensures that all participants in the network agree on the state

of the blockchain, even though there is no central authority. Here’s how

it works:

• How Distributed Consensus Works

1.Transaction Broadcast:

• When a user initiates a transaction, it is broadcast to the entire network

of nodes.
Distributed Consensus:

• How Distributed Consensus Works

2.Transaction Validation:

• Nodes (computers in the network) validate the transaction to ensure it

is legitimate. This involves checking that the sender has enough balance

and that the transaction follows the network’s rules.


Distributed Consensus:

• How Distributed Consensus Works

3.Mining and Proof of Work:

• Miners compete to solve a complex mathematical problem. The first

miner to solve the problem gets to add the new block of transactions to

the blockchain.

• This process is known as Proof of Work. It requires significant

computational power, making it difficult for any single entity to control

the network.
Distributed Consensus:

• How Distributed Consensus Works

4.Block Addition:

• Once a miner solves the problem, the new block is added to the

blockchain.

• The solution is broadcast to the network, and other nodes verify it. If

the solution is correct, the block is accepted, and the miner is rewarded

with new bitcoins.


Distributed Consensus:

• How Distributed Consensus Works

5. Consensus Achieved:

oAll nodes update their copy of the blockchain to include the new

block. This ensures that all participants have the same version of the

blockchain.
Distributed Consensus:
• A simple flowchart to illustrate distributed consensus in Bitcoin:
[User A] -> [Broadcasts Transaction] -> [Network of Nodes]
-> [Nodes Validate Transaction]
-> [Miners Compete to Solve Problem]
-> [First Miner Solves Problem]
-> [New Block Added to Blockchain]
-> [Network Verifies Solution]
-> [Consensus Achieved]
-> [User B Receives Bitcoin]

This process ensures that the network remains secure, transparent, and

decentralized, with all participants agreeing on the state of the blockchain.


Consensus without Identity: The
Blockchain:
• In traditional systems, achieving consensus usually involves identifying
and verifying the participants. However, Bitcoin and other
cryptocurrencies achieve consensus without relying on identities. Here’s
how it works:

Centralization vs. Decentralization

• Centralization: In centralized systems, a single authority or a small group


of entities control the entire system. They validate transactions and
maintain records.

• Decentralization: In decentralized systems like Bitcoin, control is


distributed across a network of nodes. No single entity has complete
authority.
How Bitcoin Achieves Consensus Without
Identity:
1.Peer-to-Peer Network:

• Bitcoin operates on a peer-to-peer network where all nodes are equal.


There is no central authority to assign or verify identities.

2.Proof of Work:

• Miners compete to solve complex mathematical problems. The first


miner to solve the problem gets to add a new block to the blockchain
and is rewarded with new bitcoins.

• This process is known as Proof of Work and ensures that the network
remains secure and decentralized.
How Bitcoin Achieves Consensus Without
Identity:
3.Random Node Selection:

• The process of mining effectively selects a random node to propose the


next block. This randomness helps prevent any single entity from
gaining control over the network.

4.Sybil Resistance:

• Without identities, the system is vulnerable to Sybil attacks, where a


single entity creates multiple fake nodes to gain control. Proof of Work
mitigates this by making it computationally expensive to create multiple
nodes.
How Bitcoin Achieves Consensus Without
Identity:
5. Pseudonymity:

• Bitcoin allows users to participate without revealing their real identities.

Instead, they use cryptographic keys (public and private keys) to sign

transactions and prove ownership.


How Bitcoin Achieves Consensus Without
AIdentity:
simple flowchart to illustrate how Bitcoin achieves consensus without
identity:
[User A] -> [Broadcasts Transaction] -> [Network of Nodes]
-> [Nodes Validate Transaction]
-> [Miners Compete to Solve Problem]
-> [First Miner Solves Problem]
-> [New Block Added to Blockchain]
-> [Network Verifies Solution]
-> [Consensus Achieved]
-> [User B Receives Bitcoin]
How Bitcoin Achieves Consensus Without
Identity:
A simple flowchart to illustrate how Bitcoin achieves consensus without

identity:

This process ensures that the network remains secure, transparent, and

decentralized, with all participants agreeing on the state of the

blockchain without needing to know each other’s identities


Incentives and Proof of Work
• Proof of Work (PoW)

• Proof of Work is a consensus mechanism used by Bitcoin and many

other cryptocurrencies to secure the network and validate transactions.

Here’s how it works:

1.Mining:

• Miners compete to solve a complex mathematical problem, which


requires significant computational power.

• The first miner to solve the problem gets to add a new block of
transactions to the blockchain.
Incentives and Proof of Work
• Proof of Work (PoW)

2.Difficulty Adjustment:

• The difficulty of the mathematical problem adjusts over time to ensure


that blocks are added at a consistent rate (approximately every 10
minutes for Bitcoin).

3.Validation:

• Once a miner solves the problem, the solution is broadcast to the


network.

• Other nodes verify the solution. If it is correct, the new block is added
to the blockchain.
Incentives and Proof of Work
• Incentives

Incentives are crucial to motivate miners to participate in the network

and maintain its security. Here are the main incentives:

1.Block Rewards:

• Miners receive a reward in the form of new cryptocurrency units (e.g.,

bitcoins) for successfully adding a block to the blockchain.

• This reward decreases over time through a process called “halving.” For

Bitcoin, the reward halves approximately every four years.


Incentives and Proof of Work
2.Transaction Fees:

• In addition to block rewards, miners also earn transaction fees paid by

users who want their transactions included in the blockchain.

• As block rewards decrease over time, transaction fees become a more

significant part of miners’ incentives.


Incentives and Proof of Work
A simple flowchart to illustrate Proof of Work and incentives:
[User A] -> [Broadcasts Transaction] -> [Network of Nodes]
-> [Nodes Validate Transaction]
-> [Miners Compete to Solve Problem]
-> [First Miner Solves Problem]
-> [New Block Added to Blockchain]
-> [Miner Receives Block Reward and Transaction
Fees]
-> [Network Verifies Solution]
-> [Consensus Achieved]
-> [User B Receives Bitcoin]
Incentives and Proof of Work
Benefits of Proof of Work

 Security: The computational effort required to solve the problem makes

it difficult for any single entity to control the network.

 Decentralization: PoW ensures that control is distributed across many

participants, preventing centralization.


Incentives and Proof of Work
Challenges of Proof of Work

• Energy Consumption: PoW requires significant computational power,


leading to high energy consumption.

• Scalability: The time and resources required for mining can limit the
scalability of the network.

You might also like