0% found this document useful (0 votes)
21 views32 pages

Module 3 Module 5

Block Chain Technology Unit 3 and 5 Notes

Uploaded by

TEJASWINI P
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views32 pages

Module 3 Module 5

Block Chain Technology Unit 3 and 5 Notes

Uploaded by

TEJASWINI P
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 32

MODULE 3

DOUBLE SPENDING
Double-spending is a fundamental flaw in digital cash protocols that allows the same digital
token to be spent more than once. In blockchain, double-spending occurs when someone
alters a blockchain network to insert a special block that lets them reacquire a cryptocurrency.
Or
Double spending means the expenditure of the same digital currency twice or more to avail
the multiple services. It is a technical flaw that allows users to duplicate money.
 Since digital currencies are nothing but files, a malicious user can create multiple copies
of the same currency file and can use it in multiple places.
 This issue can also occur if there is an alteration in the network or copies of the
currency are only used and not the original one.
 There are also double spends that allow hackers to reverse transactions so that
transaction happens two times.
 By doing this, the user loses money two times one for the fake block created by the
hacker and for the original block as well.
 The hacker gets incentives as well for the fake blocks that have been mined and
confirmed.

How Does Double Spending Happen?

Double spending can never arise physically . It can happen in online transactions. This
mostly occurs when there is no authority to verify the transaction . It can also happen if the
user’s wallet is not secured. Suppose a user wants to avail of services from Merchant ‘A’
and Merchant ‘B’.
 The user first made a digital transaction with Merchant ‘A’.
 The copy of the cryptocurrency is stored on the user’s computer.
 So the user uses the same cryptocurrency to pay Merchant ‘B’
 Now both the merchants have the illusion that the money has been credited since the
transactions were not confirmed by the miners.

Example: Suppose a user has 1 BTC. He/She wants to avail of services from merchant A and
merchant B. The user creates multiple copies of the same BTC and stores it. The user first
sends the original BTC to Merchant A and gets the service. Simultaneously, the user sends
the copied version of 1 BTC to Merchant B. Since the second transaction was not confirmed
by other miners, the merchant accepts the bitcoin and sends the service. But the
cryptocurrency that was sent is invalid. This is the case of Double Spending.

How Bitcoin Handles Double Spending?(extra)


 Validation: Validation of transactions by a maximum number of nodes in the
network. Once a block is created, it is added to a list of pending transactions. Users
send validation for the block. If the verifications are done then only the block is added
to the blockchain.
 Timestamp: The confirmed transactions are timestamped, therefore they are
irreversible. If a transaction is involved with a bitcoin it is verified and done. But in
the future, if other transactions are made with the same bitcoin, the transactions will
be canceled.
 Block Confirmations: Merchants get block confirmations so that they are assured
that there was no case of double spending. In bitcoin, a minimum of 6 confirmations
are done.
 Saving copies: A copy of each transaction is kept at each node so in case of network
failure the whole network does not go down.
Hash(5m)
A hash function is a mathematical function that takes an input (or 'message') and produces a
fixed-size string of bytes(sequence of numbers and letters). This output is referred as the hash
value or hash code. Hash functions are mainly used in cryptography.
The primary purpose of a cryptographic hash function is to condense arbitrary data to a fixed
size in such a way that it is computationally infeasible(impossible) to reverse the process.
To the given a hash value, it should be extremely difficult to find the original input data.
In hash it should be computationally infeasible to find two different inputs that produce the
same hash value.
The process of hashing a message
 M: This represents the message or data block, which can be of variable length.
 H: This is the hash function, which takes the message M as input.
 h: This is the output of the hash function, which is a fixed-length hash value.
 L bits: This indicates that the hash value h is of a fixed length, specifically L bits.
 length L is appended to the message to be hashed which means that adding 0’s and
1’s to the original image
Uses of Hash Function
1. Message integrity check (MIC): By sending the hash of a message along with the
message itself, the recipient can verify if the message has been altered during
transmission. If the received hash matches the recalculated hash of the received
message, it indicates that the message hasn't been tampered with.
2. Message authentication code (MAC): In this case, a keyed hash function is used,
meaning that both the sender and the receiver possess a secret key. The MAC is
generated by hashing the message along with the secret key, ensuring that only parties
with the key can generate or verify the MAC. This provides not only integrity but also
authentication.
3. Digital signature: This involves encrypting the hash value of a message with a
private key. The sender's private key is used to encrypt the hash, and the recipient can
verify the authenticity of the message by decrypting the hash with the sender's public
key. If the decrypted hash matches the hash of the received message, it confirms that
the message was signed by the holder of the private key.
10m continuation
Other usecases
1. Pseudorandom Function (PRF): It's commonly used in cryptography for tasks like
generating session keys or nonces (random numbers used only once) and deriving
keys from a master key.
2. Pseudorandom Number Generator (PRNG): A PRNG produces a sequence of
numbers that appear random but are generated by a deterministic algorithm. They are
used in various encryption algorithms. The Vernam Cipher, also known as the One-
Time Pad (OTP), is an example of a perfect PRNG when used with a truly random
key.
3. S/Key: S/Key is a method for creating a sequence of one-time passwords from a
master password. It's based on repeatedly applying a cryptographic hash function to
the master password. This provides proof of possession (what you have) by
generating a series of passwords without storing them directly.
4. Hash Functions for Password Storage: Storing hashes of passwords instead of the
passwords themselves is a common practice for security. It helps mitigate the risk of
exposure in case of a data breach. Salting, which involves adding a random value
(salt) to each password before hashing, helps prevent precomputation attacks like
rainbow tables.
5. Intrusion Detection and Virus Detection: Hash functions play a crucial role in
various security applications, including intrusion detection systems and virus
detection. Systems like Tripwire use hash values of files to detect any unauthorized
modifications or intrusions by comparing the current hash with a known good hash.
Symmetric key unkeyed hash(imp)

This diagram illustrates a digital signature scheme using a symmetric key and an unkeyed
hash function.
Symmetric Key: In symmetric key cryptography, the same secret key (K) is used for
both encryption and decryption. In this diagram, the symmetric key is used to encrypt and
decrypt the message.
Unkeyed Hash: An unkeyed hash function, also known as a message digest, takes a
variable-length input message (M) and produces a fixed-length output hash value (H(M)).
The hash function is deterministic, meaning to the given same input, it always produces
the same output. Unkeyed hash functions do not use a secret key.
Encrypted: Encrypted data refers to the process of converting plaintext (readable data)
into ciphertext (unreadable data) using an encryption algorithm and a secret key.
Unencrypted: Unencrypted data, also known as plaintext, is data that is not converted
into ciphertext using encryption. It is in a readable format and can be easily understood by
anyone who has access to it.
Message Encrypted:
1. Message Preparation: The sender (Source A) prepares the message (M) to be sent.
2. Hash Calculation: The sender calculates the hash value (H(M)) of the message using
an unkeyed hash function.
3. Encryption: The sender encrypts the message and its hash value using the symmetric
key (K) and a encryption algorithm (E). The encrypted output is E(K, [M || H(M)]),
where || denotes concatenation.
4. Transmission: The encrypted message is sent to the recipient (Destination B).
5. Decryption: The recipient decrypts the received message using the same symmetric
key (K) and decryption algorithm (E).
6. Hash Verification: The recipient calculates the hash value (H(M)) of the decrypted
message and compares it with the decrypted hash value (H(M)) received from the
sender. If the two hash values match, the recipient can be sure that the message has
not been tampered with during transmission.
Message Unencrypted:
1. Message Preparation: The sender (Source A) prepares the message (M) to be
sent.
2. Hash Calculation: The sender calculates the hash value (H(M)) of the message
using an unkeyed hash function.
3. Transmission: The sender sends the message (M) and its hash value (H(M)) to
the recipient (Destination B) without encryption.
4. Hash Verification: The recipient calculates the hash value (H(M)) of the received
message and compares it with the received hash value (H(M)). If the two hash
values match, the recipient can be sure that the message has not been tampered
with during transmission.

Symmetric key keyed hash(imp)


A keyed hash function, also known as a HMAC (Hash-based Message Authentication
Code), takes a variable-length input message (M) and a secret key (K) and produces a
fixed-length output hash value (H(K, M)).
The keyed hash function is deterministic, meaning that given the same input and key, it
always produces the same output.
In the context of symmetric key and keyed hash, unencrypted and encrypted refer to the
state of the message being transmitted between the sender (Source A) and the recipient
(Destination B).
Unencrypted:
1. Message Preparation: The sender (Source A) prepares the message (M) to be sent.
2. Keyed Hash Calculation: The sender calculates the keyed hash value (H(K, M)) of
the message using a keyed hash function and the symmetric key (K).
3. Transmission: The sender sends the message (M) and the keyed hash value (H(K,
M)) to the recipient (Destination B) without encryption.
4. Hash Verification: The recipient calculates the keyed hash value (H(K, M)) of the
received message and compares it with the received keyed hash value. If the two hash
values match, the recipient can be sure that the message has not been tampered with
during transmission.
Encrypted:
1. Message Preparation: The sender (Source A) prepares the message (M) to be
sent.
2. Keyed Hash Calculation: The sender calculates the keyed hash value (H(K, M))
of the message using a keyed hash function and the symmetric key (K).
3. Encryption: The sender encrypts the message (M) using the symmetric key (K)
and an encryption algorithm (E). The encrypted output is E(K, M).
4. Transmission: The encrypted message and the keyed hash value are sent to the
recipient (Destination B).
5. Decryption and Hash Verification: The recipient decrypts the received message
using the same symmetric key (K) and decryption algorithm (D). The recipient
also calculates the keyed hash value (H(K, M)) of the decrypted message and
compares it with the received keyed hash value. If the two hash values match, the
recipient can be sure that the message has not been tampered with during
transmission.
Digital signature

Digital Signature Process:


Part (a):
1. Message (M): The sender (Source A) wants to send a message to the receiver
(Destination B).
2. Hash Function (H): The sender applies a hash function (H) to the message (M) to
generate a fixed-length digest or hash value (H(M)). This hash value represents the
message.
3. Private Key (PR): The sender uses their private key (PR) to encrypt the hash value
(H(M)) using an encryption algorithm (E). This creates a digital signature (E(PR,
H(M))).
4. Digital Signature: The digital signature (E(PR, H(M))) is sent to the receiver.
Part (b):
1. Received Message (M): The receiver (Destination B) receives the original message
(M).
2. Received Digital Signature: The receiver also receives the digital signature (E(PR,
H(M))).
3. Hash Function (H): The receiver applies the same hash function (H) to the received
message (M) to generate a new hash value (H(M)).
4. Public Key (PU): The receiver uses the sender's public key (PU) to decrypt the
received digital signature (E(PR, H(M))).
5. Verification: The receiver compares the decrypted hash value with the newly
computed hash value (H(M)). If both hash values match, the digital signature is valid,
and the message is authenticated.
In part (b), the receiver verifies the digital signature by decrypting it using the sender's public
key and comparing the resulting hash value with a newly computed hash value of the
received message. This ensures that the message has not been tampered with during
transmission and that it indeed came from the claimed sender.
SHA-Secure Hash Function
SHA stands for secure hashing algorithm.
SHA algorithms are one-way functions, meaning that it's almost impossible to convert the
hash value back into the original data.

Example:
Suppose we have a message "Hello, World!" and we apply a hash function (e.g., SHA-256)
to it. The output hash value might look like this:
H("Hello, World!") =
315f5bdb76d078c43b8ac0064e4a0164612b1fce77c869345bfc94c75894edd3

how SHA works in a blockchain

1. The entire message is broken into blocks of 512 bits.


2. Each 512-bit block is broken into 16 sub-blocks of 32 bits each.
3. There are 64 rounds of operations.
4. The output generated is input to the next round of operations.
MINING
 Mining in blockchain is the process of adding a block to a chain of transactions on a
decentralized ledger called a blockchain.
 This process involves hardware and software that generate a cryptographic number
that is equal to or less than a number set by the Bitcoin network's algorithm.
 Mining is necessary to maintain the ledger of transactions upon which Bitcoin is used.
 Mining is important because it verifies and secures the blockchain, which allows
cryptocurrencies to function as a peer-to-peer decentralized network without any need
for oversight from a third party.
 The purpose of mining is to: Validate transaction information, Maintain the integrity
of the blockchain, and Open new blocks.
Miner:
 The miner is the one who validates the new transaction.
 The first miner to find the solution receives bitcoins as a reward, and the process
begins again.
 Miners use complex machinery and group to speed up mining operations.
 They solve complex mathematical equations in the form of cryptographic hashes.
 Different methods of mining cryptocurrencies require different amounts of time.
How mining works

1. Transaction Initiated: A new transaction is initiated, which involves the transfer of


some value or data between parties.
2. Transaction Details Broadcasted to Miners: The details of the transaction are
broadcasted to a network of miners. These miners are nodes in the blockchain
network that compete to validate the transaction.
3. Transaction Complete: Once a miner successfully validates the transaction, it is
considered complete.
4. Transaction is Added to the Blockchain: The validated transaction is then added to
the blockchain, which is a public ledger of all transactions that have occurred on the
network.
5. Mining is Completed and Miner Gets Reward: After a transaction is added to the
blockchain, the miner who validated it is rewarded with some amount of
cryptocurrency. This reward incentivizes miners to continue validating transactions
and maintaining the integrity of the blockchain.

Proof of Work
Proof of Work(PoW) is the original consensus algorithm in a blockchain network.
The algorithm is used to confirm the transaction and creates a new block to the chain.
In this algorithm, minors (a group of people) compete against each other to complete the
transaction on the network.
The process of competing against each other is called mining. As soon as miners successfully
created a valid block, he gets rewarded. The most famous application of Proof of
Work(PoW) is Bitcoin.
Producing proof of work can be a random process with low probability. In this, a lot of trial
and error is required before a valid proof of work is generated.
The main working principle of proof of work is a mathematical puzzle which can easily
prove the solution. Proof of work can be implemented in a blockchain by the Hash cash proof
of work system.

In the puzzle game, bitcoin software creates a challenge, and there is a game begins.
This game involves all miners competing against each other to solve the challenges, and this
challenge will take approximately 10 minutes to be completed.
Every single miner starts trying to find the solution to that one Nonce that will satisfy the
hash for the block.
At some specific point, one of those miners in the global community with higher speed and
great hardware specs will solve the cryptography challenge and be the winner of the game.
Now, the rest of the community will start verifying that block which is mined by the winner.
If the nonce is correct, it will end up with the new block that will be added to the blockchain.

Merkel Tree
The Merkle tree is a data structure used to encrypt transactions efficiently and securely.
Its made up of the hashes of various data blocks of transactions.
The structure of a Merkle Tree is a hierarchical way to represent hashes of the
transactions.
 Merkle Root (or Root Hash): The root of the Merkle tree is known as the Merkle
root and this Merkle root is stored in the header of the block.
 Non-Leaf Nodes: The non-leaf nodes contain the hash value of their respective
children. These are also called intermediate nodes because they contain the
intermediate hash values and the hash process continues till the root of the tree.
 Leaf Nodes: The leaf nodes contain the hash values of transaction data. Each
transaction in the block has its data hashed and then this hash value (also known as
transaction ID) is stored in leaf nodes.
How does Merkle Tree work?
Merkle tree uses the concept of cryptographic hash functions and public-key cryptography to
encrypt and verify the transactions among all the nodes in the network.
Merkle tree is made up of hashing pairs of nodes repeatedly hashed until only one hash
remains called the Root Hash or Merkle Root. It is built from the bottom using transaction
IDs which are hashes of the individual transactions. It uses cryptographic hash functions to
create digest or hash of the transactions.
In the Merkle tree structure, each non-leaf node is a hash of its previous hash. And every leaf
node is the hash of transactional data of each block.
Example
The above example is Binary Merkle Tree.

There are four transactions in a block- T1,T2,T3,T4. 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 1,2,3,4.

Consecutive pairs of leaf nodes are the in a parent node by hashing Hash1 and Hash2,
resulting in Hash12, and separately hashing Hash3 and Hash4, resulting in Hash34.

The two hashes (Hash12 and Hash34) 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.

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.

Merkle trees have three benefits:

o It provides a means to maintain the integrity and validity of data.

o It helps in saving the memory or disk space as the proofs, computationally easy and
fast.

o Their proofs and management require tiny amounts of information to be transmitted


across networks.

Following are the steps:


1. Each transaction in a block is converted into a hash individually using cryptographic
hash functions like SHA-256.
2. Hierarchical hashing takes place, creating hashes of hashed transactions using hash
functions.
3. The hashing goes on until we get a Root Hash or Merkle Root.
A Merkle tree combines all transactions in a block and generates a digital fingerprint of the
entire set of operations. It allows the network participant to verify whether the transaction got
included in the block or not.
The Merkle root ensures that data blocks sent through a peer-to-peer network are secure,
undamaged, and unaltered. Overall, it’s a method to confirm that all transactions in the
Merkle tree got added and verified.

Simple Payment Verification(SPV)


 SPV makes it extremely easy for a client to verify whether a particular transaction
exists in a block and is valid without having to download the entire blockchain. The
users will only require a copy of the block headers of the longest chain.
 This copy of headers is stored in the SPV wallet and this wallet uses the SPV client to
link a transaction to a Merkle branch in a block.
 SPV client requests proof of inclusion(Merkle proof), in the form of a Merkle branch.
The fact that the transaction can be linked to a Merkle branch is proof that the
transaction exists.
 Now by assessing the blocks which are being mined on top of the transaction’s block,
the client can also conclude that majority of the nodes have built more blocks on top
of this chain by using consensus mechanisms like Proof of Work, and hence this is the
longest, valid blockchain.

Bitcoin Privacy

Wallet privacy

Imagine this scenario. The user is in a public place, and they need to make a payment using
their bitcoin wallet. They open the wallet on their phone, but they don’t feel comfortable
having their payment and balance information clearly visible to strangers who may be
looking over their shoulder, persons lurking, or video surveillance. Hence, by giving users the
ability to hide sensitive information in their wallet, but only when desired, they gain an added
sense of physical privacy and security when using the app in public

Quickly hiding balances #


Home screen with a hidden balance and a quick reveal toggle.

The button to quickly hide sensitive information is displayed within close reach of the
balance itself. One tap hides it, and the next tap reveals it again.

This is an easy and convenient way to switch between revealed and hidden states. On the
downside, it makes it relatively easy for anyone else to reveal user information if they have
access to the device.

Unhiding the balance requires tapping and holding for a few seconds to prevent accidental
reveals.

Entering a PIN to reveal information #


Users can enable PIN entry before the balance is revealed.

To prevent this problem, users can optionally enable an additional setting to


require PIN entry for unhiding sensitive information. This reaffirms the identity of the wallet
owner for extra security. Making this optional allows users to find their own balance between
convenience and security.
An application-wide setting #

Hiding sensitive data can be toggled in the settings.


Both settings, whether sensitive information is hidden and whether PIN entry is required, are
accessible from the privacy section in the application settings.
Alternative designs #

An alternative design approach is to make the show/hide toggle only available in settings.
Having it right on the main screen makes things quite obvious for someone who has access to
a user’s device. If it is only available from settings, a third party who has access to the device
may not immediately know how to reveal information. The downside is that a user cannot
quickly hide their information if the need arises.

Hiding when inactive #

A timer counts to zero before automatic balance reveal.

Another solution is to invoke the wallet’s hidden state as a default when the app is opened to
protect against prying eyes during initial display. The pre-hidden state can be unveiled after a
tap, PIN entry, or perhaps a short 5-second timer.

This gives users some time to assess their environment before their info is displayed but
could leave them frustrated, having to wait for their information to be revealed, especially in
an urgent situation.
Other privacy aspects #

On-chain address re-use is a common privacy problem due to the traceability across
transactions. Addresses this wallet uses are swap addresses generated by a lightning service
provider. This lifts the responsibility for address management out of the hands of the user.
More on the requesting page.

Just like any other application, privacy can be impacted by the use of third-party services
(analytics, currency exchange rates, etc.) and data transfer itself, as well as any services
provided by the application developer.

Payment Verification -Bitcoin

What is the process of verification of Bitcoin transaction?


Validating a Bitcoin transaction consists of:
1. Ensuring signatures are valid.
2. Determining authenticity.
3. Confirming the accuracy of a transaction.
4. Checking available balances and transaction fee payments.
5. Preventing double-spending.

Digital Signatures: To prove that you are the owner of the bitcoin you want to send, the
transaction must be signed using your private key through a cryptographic process. This is
known as a digital signature. It's essential to keep your private key secret because it's like
your digital password.

1. Ensuring signatures are valid: This step verifies that the digital signatures provided
for the inputs of the transaction are valid and correctly signed by the private keys
corresponding to the public addresses that hold the Bitcoins being spent. This ensures
that the transaction is authorized by the rightful owner.
2. Determining authenticity: This involves checking that the transaction adheres to the
Bitcoin protocol rules and format. It ensures that the transaction has not been
tampered with and is genuine.
3. Confirming the accuracy of a transaction: This includes checking that all inputs
and outputs are correctly referenced and balanced, meaning the sum of the input
values must equal the sum of the output values plus any fees.
4. Checking available balances and transaction fee payments: This step involves
verifying that the addresses involved have sufficient balances to cover the transaction
amounts and any associated fees. It also ensures that the fees meet the network's
requirements, which can affect the transaction's inclusion speed in the blockchain.
5. Preventing double-spending: This step ensures that the same Bitcoins are not being
spent more than once. It involves checking that the inputs for the transaction have not
already been used in another transaction that has been confirmed in the blockchain.
Here's a detailed breakdown of the validation process:

1. Transaction Format Check: Ensure the transaction adheres to the correct format and
protocol rules.
2. Signature Verification:
o Verify that each input's signature is valid.
o Ensure the signatures match the public keys and that the transaction is
authorized by the correct private keys.
3. Double-Spending Check:
o Ensure the inputs of the transaction have not already been spent in another
confirmed transaction.
o Check the mempool (a pool of unconfirmed transactions) to ensure the inputs
are not being used in another unconfirmed transaction.
4. Input and Output Verification:
o Check that the referenced inputs (UTXOs) exist and are unspent.
o Confirm that the input values are greater than or equal to the output values
plus fees.
5. Balance and Fee Check:
o Verify that the sum of the input values covers the output values and any
required transaction fees.
o Ensure the transaction fee is adequate for the transaction to be processed by
miners.
6. Block Inclusion Check (once included in a block):
o Ensure the transaction is included in a valid block.
o Verify the block's validity, including proof of work, block size, and
timestamp.
7. Consensus Rules Check:
o Ensure the transaction adheres to all consensus rules, such as script validation,
size limits, and any network-specific rules.

How to resolve conflicts in Blockchain?

What re transaction?how it is stored? And resolve conflicts

Bitcoin transaction means sending bitcoin from one person to the other in the secured
blockchain network. These are messages that are digitally signed using cryptography and
are verified by the miners that are present in the blockchain network.

The steps involved in a Bitcoin Transaction are given below:


1. Jake initiates a transaction of say 15 BTC that needs to be transferred to Steve.
2. A block consisting of the transaction is flooded throughout the P2P network.
3. The miners validate the transaction via the proof-of-work consensus algorithm
4. An incentive is given for the miners who successfully create a valid block.
5. The new block consisting of the transaction gets added to the blockchain.
6. Steve receives the 15 BTC that was sent by Jake thereby completing the transaction.

Here is the interesting part and the topic that we have been waiting to address. From the
above-given steps, step 5, a conflict can arise where multiple miners create blocks at the
same time and try to add them to the last valid block of the blockchain. In this case which
block will be appended to the blockchain?
Consider Steve, Jake and Iris are miners in the blockchain and they simultaneously create
their respective blocks which are known as candidate blocks (portrayed in green, yellow,
and blue respectively). Out of these candidate blocks, a decision has to be made to choose
which of these blocks should be put in the chain.

A conflict arises when Steve, Jake, and Iris mine their block at the same time

How Does Blockchain Help Resolve Conflicts?

This conflict is resolved using the longest chain rule which is adopted by every node in the
network to achieve consensus on the valid structure of the blockchain. To add a node in the
blockchain, a miner in the network needs to have a computer with high processing power.
In this case, let us say Jake’s computer has more processing power as compared to the
computers of Steve and Iris. So, Jake can create a block faster than Steve and Iris.
Meanwhile, other miners are trying to create other valid blocks, so these blocks are created
on the block which has occurred first, and since Jake’s block was created faster than
Steve’s and Iris’s, it occurs first in the chain and the miners add their blocks (given below
in red ) on top of Jake’s blog (given below in yellow).

Other miners create their block at the top of Jake’s block

It can be seen from the above diagram that the unit with Jake’s block is the longest unit and
according to the longest chain rule , the unit with the longest length must be accepted as the
valid version of the blockchain. Therefore, the updated valid version of the blockchain
looks like the one below:
The updated version of the blockchain is distributed in the entire P2P network

What Happens To The Blocks Created By Steve And Iris?


The blocks created by Steve and Iris are discarded and they become orphan blocks since
they are not part of the main chain of blocks anymore.

Orphan blocks are discarded from the blockchain

What Happens To The Transactions Inside These Orphaned Blocks?


It is important to note that the transactions inside these orphan blocks are valid because
someone in the network has initiated it, but cannot be included in the blockchain as they do
not follow the longest chain rule. So, these transactions are sent back to the transaction
pool (which contains those transactions that are not yet mined), where the miners can pick
them from the pool and then start mining them again.

CREATION OF BLOCKS

Creation of Blocks
 To create a new block, miners must go through a process to solve a math problem.
 When finding a valid solution for the network, a new block can be taken for
granted that will be added to the blockchain by consensus.
 And for which, the miner who found the solution, will receive a reward for the
new block. This reward is known as the block reward.
 A new Bitcoin block is generated approximately every 10 minutes.

1. First stage: Transaction

The process of mining a new block starts when a user wants to send a certain amount of
cryptocurrency to another person. So send the transaction with the data from your wallet
and wait for the network to confirm the transaction. They remain there until a block is mined
where they can be included and validated.

2. Second stage: Compilation


These pending or remaining transactions on the network are collected and grouped into a
block of transactions by mining nodes. Multiple miners often select the same transactions,
and they remain unconfirmed until a block is successfully mined.

3. Third stage: Training

Each miner will select the transactions they want to include and build their own block. If
there are transactions already validated and included in the previous block, they will be
removed from this one. This new block is known as a candidate, since it is not yet valid
because it does not have a valid proof of work.

In the formation of this new block, a header must be included that contains the hash from the
previous block, the merkle root and data for mining competition.

4. Stage Four: Proof of Work

Once each miner has formed their own transaction block, they will need to find a valid
signature for that block. In other words, carry out a proof of work. Each miner must carry
out a mathematical calculation process that is unique to each block they formed. So, although
the procedure is the same, the result will be totally different for each one. This complex
calculation involves a lot of computational power, and therefore, a large expenditure of
electrical energy. Which will also depend on the system difficulty for the time of mining.

The solution miners must find is known as hash. This function is very difficult to find, but
once found, it is easy to verify by others.

To find a valid output hash, the miners perform the mathematical calculations repetitively
over and over again. Which is a random number that they use and constantly change until
they find an output signature or hash that is valid based on the condition. There is no way to
predict which nonce will solve the problem, so they must use as many as necessary.

In the case of the Bitcoin network, the system determines that the output hash must contain a
certain number of zeros at the beginning of the hash.

5. Fifth stage: Transmission

When a mining node manages to find a valid output hash for a block, it transmits that block
together with the signature to the other nodes in the network so that they can validate it.

the miner receives the reward established for mining, putting new bitcoins into circulation.
This is registered on its own node, the other nodes on the network will do so in the next step.

In addition, regardless of whether all the bitcoins have been issued or not, the miner also
receives all the mining commissions that users have put in the transactions that make up this
block.

6. Sixth stage: Verification


The other nodes in the network are in charge of validate and verify that the block and hash
meet the system conditions, verifying its legitimacy and if it actually contains the stated
number of zeros.

Here also the proof of work is confirmed, that is, the computational power spent to find the
solution, and it is noted that the miner who discovered the block can effectively make use of
the recently received bitcoins.

7. Seventh stage: Confirmation

Once the new block is added to the blockchain, all the others that are added on top of it will
count as a confirmation.

Once a block is generated, all mining nodes must start the process by forming a new block of
transactions. They cannot continue mining the previous block because each block must add
the output hash of the block that precedes it.

Unit-5
Ethereum
 Ethereum is a Blockchain network that introduced a built-in Turing-complete
programming language that can be used for creating various decentralized
applications(also called Dapps).
 The Ethereum network is fueled by its own cryptocurrency called ‘ether’.
 The Ethereum network is currently famous for allowing the implementation of smart
contracts.
 Smart contracts can be thought of as ‘cryptographic bank lockers’ which contain
certain values. These cryptographic lockers can only be unlocked when certain
conditions are met.
 Ethereum is often called Blockchain 2.0 since it proved the potential of beyond
blockchain technology.
 The consensus mechanism used in Ethereum is Proof of Stakes(PoS), which is more
energy efficient when compared to that used in the Bitcoin network, that is, Proof of
Work(PoW).
 PoS depends on the amount of stake a node holds.
How Does Ethereum Work?
 Ethereum implements an execution environment called Ethereum Virtual Machine
(EVM)
 When a transaction triggers a smart contract, all the nodes of the network will execute
every instruction.
 All the nodes will run the EVM as part of the block verification, where the nodes will
go through the transactions listed in the block and runs the code as triggered by the
transaction in the EVM.
 All the nodes on the network must perform the same calculations for keeping their
ledgers in sync.
 Every transaction must include:
o Gas limit.
o Transaction Fee that the sender is willing to pay for the transaction.
 If the total amount of gas needed to process the transaction is less than or equal to the
gas limit then the transaction will be processed and if the total amount of the gas
needed is more than the gas limit then the transaction will not be processed the fees
are still lost.
 Thus it is safe to send transactions with the gas limit above the estimate to increase
the chances of getting it processed.

Features of Ethereum-10m(smart contract,ether,dapps are explained for 5 marks write


that)
Smart contracts: Ethereum allows the creation and deployment of smart contracts. Smart
contracts are created mainly using a programming language called solidity. Solidity is an
Object Oriented Programming language that is comparatively easy to learn.
Ethereum Virtual Machine (EVM): It is designed to operate as a runtime environment for
compiling and deploying Ethereum-based smart contracts.
Ether: Ether is the cryptocurrency of the Ethereum network. It is the only acceptable form of
payment for transaction fees on the Ethereum network.
Decentralized applications (Daaps): Dapp has its backend code running on a decentralized
peer-to-peer network. It can have a frontend and user interface written in any language to
make calls and query data from its backend. They operate on Ethereum and perform the same
function irrespective of the environment in which they get executed.
Decentralized autonomous organizations (DAOs): It is a decentralized organization that
works in a democratic and decentralized fashion. DAO relies on smart contracts for decision-
making or decentralized voting systems within the organization.
Type of Ethereum Accounts
Ethereum has two types of accounts: An externally owned account (EOA), and a Contract
account.
 Externally owned account (EOA): Externally owned accounts are controlled by
private keys. Each EOA has a public-private key pair. The users can send messages
by creating and signing transactions.
 Contract Account: Contract accounts are controlled by contract codes. These codes
are stored with the account. Each contract account has an ether balance associated
with it. The contract code of these accounts gets activated every time a transaction
from an EOA or a message from another contract is received by it. When the contract
code activates, it allows to read/write the message to the local storage, send messages
and create contracts.
Real-World Applications of Ethereum(eg add if u want)5m
Voting: Voting systems are adopting Ethereum. The results of polls are available publicly,
ensuring a transparent fair system thus eliminating voting malpractices.
Agreements: With Ethereum smart contracts, agreements and contracts can be maintained
and executed without any alteration. Ethereum can be used for creating smart contracts and
for digitally recording transactions based on them.
Banking systems: Due to the decentralized nature of the Ethereum blockchain it becomes
challenging for hackers to gain unauthorized access to the network. It also makes payments
on the Ethereum network secure, so banks are using Ethereum as a channel for making
payments.
Shipping: Ethereum provides a tracking framework that helps with the tracking of cargo and
prevents goods from being misplaced.
Crowdfunding: Applying Ethereum smart contracts to blockchain-based crowdfunding
platforms helps to increase trust and information symmetry. It creates many possibilities for
startups by raising funds to create their own digital cryptocurrency.
Domain names: Ethereum name service allows crypto users to buy and manage their own
domain names on Ethereum, thus simplifying decentralized transactions without putting users
to remember long, machine-readable addresses.
Benefits of Ethereum
 Availability: As the Ethereum network is decentralized so there is no downtime. Even
if one node goes down other computing nodes are available.
 Privacy: Users don’t need to enter their personal credentials while using the network
for exchanges, thus allowing them to remain anonymous.
 Security: Ethereum is designed to be unhackable, as the hackers have to get control of
the majority of the network nodes to exploit the network.
 Less ambiguity: The smart contracts that are used as a basis for trade and agreement
on Ethereum ensure stronger contracts that differ from the normal traditional contracts
which require follow-through and interpretation.
 Rapid deployment: On Ethereum decentralized networks, enterprises can easily
deploy and manage private blockchain networks instead of coding blockchain
implementation from scratch.
 Network size: Ethereum network can work with hundreds of nodes and millions of
users.
 Data coordination: Ethereum decentralized architecture better allocates information so
that the network participants don’t have to rely on a central entity to manage the
system and mediate transactions.
Drawbacks of Ethereum
 Complicated programming language: Learning solidity from programming smart
contracts on Ethereum can be challenging and one of the main concerns is the scarcity
of beginner-friendly classes.
 Volatile cryptocurrency: Ethereum investing can be risky as the price of Ether is very
volatile, resulting in significant gains as well as a significant loss.
 Low transaction rate: Bitcoin has an average transaction rate of 7TPS and Ethereum
has an average speed of 15 TPS which is almost double that of bitcoin but it is still not
enough.

COMPONENTS OF ETHEREUM NETWORK(10M)


Component-1:
Nodes
There are two types of nodes in an Ethereum network. They are as follows.
a. Mining Node –
These nodes are responsible for writing all the transactions that have occurred
in the Ethereum network in the block.
b. Ethereum Virtual Machine Node –
These are the nodes in the Ethereum network in which Smart Contracts (it is a
type of contract between supporter and developer in which there are a set of
rules based on which both the parties agree to interact with each other. The
agreement will be automatically executed when the pre-defined rules are met.)
are implemented. By default, this node utilizes a 30303 port number for the
purpose of communication among themselves
Component-2 :
Ether –
 Just like we have money to do the exchange of goods in real world, we need Ethers to
exchange data or perform any kind of operation in Ethereum Blockchain.
 Ether is a type of cryptocurrency used in the Ethereum network just like a bitcoin is
used in a blockchain network. It is a peer-to-peer currency, similar to Bitcoin. It tracks
and promotes each transaction in the network.
 It is the second-largest cryptocurrency in the world. The first one is Bitcoin. Other
cryptocurrencies can be used to get ether tokens, but vice versa is not true.
 It means that ether tokens can’t be interchanged by other cryptocurrencies to render
computing power for Ethereum transactions. Ether is paid as a commission for any
execution that affects the state of Ethereum.
 It is used in the Ethereum algorithm as an incentive for miners who connect blocks to
the blockchain using a proof-of-work method.
 It is the only currency that can be used to pay transaction costs, which go to miners as
well. The block reward, as well as transaction fees, provide miners with an
opportunity to keep the blockchain rising.
 Aside from paying for transactions, ether is often used to purchase gas, which is used
to pay for the computation of any transaction on the Ethereum network.
Component-3 :
Gas – (2m)
 Gas is an internal currency of the Ethereum network. We need gas to run
applications on the Ethereum network, much as we need gas to run a vehicle.
 To complete every transaction on the Ethereum network, a consumer must first make
a payment—send out ethers—and the intermediate monetary value is known as
gas.
 Gas is a unit of measurement on the Ethereum network for the computing power used
to execute a smart contract or a transaction.
 The price of gas is very low compared to Ether. The execution and resource
utilization costs are predetermined in Ethereum in terms of Gas units, called gwei.
(unit of measurement of gas is gwei)2m
Component-4 :
Ethereum Accounts –
There are two types of Ethereum accounts. They are as follows.
1. Externally owned account (EOA) –
These accounts are used to store transactions.
2. Contract account –
As the name itself suggests, these accounts store the details of Smart Contracts.
Component-5 :
Nonce –
For externally owned accounts, nonce means the number of transactions via this account. For
a contract account, nonce means the number of contracts generated via this account.
Component-6 :
Storage Root –
It is the main root node of a Merkle tree. Hash of all details of the account is stored here. The
root of the Merkle tree is the verification of all transactions.
Component-7 : Algorithm Used
Ethash
The intended PoW algorithm for Ethereum 1.0 is Ethash. It’s the most recent version of
Dagger-Hashimoto, however, it’s no longer proper to call it that because many of the
algorithms’ initial characteristics have been dramatically altered in the previous month of
study and development. Since ethereum transitioned to Proof of Stake (PoS) in 2022, ethash
has become legacy and the PoS Algorithm used is – “Clique”.
Component-8 :
Execution Client –
These are core components that act as the heart of ethereum, and facilitates transaction
processing, maintaining state, and ensuring every node is following the consensus rules. Here
are key responsibilities :-
 Handling the transactions sent to the ethereum network.
 Keeping track of current state of the blockchain, syncing with the overall networks
that involves account balances, smart contract execution and block information
 Validating blocks and ensuring they adhere to the ethereum network’s agreed upon
rules
 Some examples are Geth, Nethermind, Besu etc.
Component-9 :
Consensus Client –
A consensus client is a software that implements the Proof-of-Stake Algorithm and helps the
blockchain network ensure that all the nodes agree on the state of the blockchain. It has the
following key responsibilities :-
 Transaction Validation : Ensuring that any transaction made over the ethereum
network adhere to the rules and guidelines set
 Block Proposal: Block proposal is the process of organizing a set of valid
transaction into groups and then broadcasting them to the ethereum network
for proposal as including them in the network.
DIFFERENCE BETWEEN BITCOIN AND ETHER

The word bitcoin was defined in


Ethereum was conceived in 2013 by
a white paper published on 31
programmer Vitalik Buterin, and then
October 2008. The currency
went live on 30 July 2015.
History began use in 2009.

The purpose of bitcoin was to The purpose of Ethereum was to utilize


replace national currencies blockchain technology for maintaining
during the financial crisis of a decentralized payment network and
Purpose 2008. storing computer code.
Although bitcoin do have smart
contracts, they are not as Ethereum allows us to create smart
flexible or complete as contracts. Smart contracts are
Ethereum smart contracts. computer codes that is stored on a
Smart contracts in Bitcoin does blockchain and executed when the
not have all the functionality predetermined terms and conditions
that a programming language are met.
Smart Contracts would give them.

Smart Contract Smart contracts on Bitcoin are Smart contracts on Ethereum are
Programming written in programming written in programming languages like
Language languages like Script, Clarity. Solidity, Vyper, etc.

Generally, bitcoin transactions Ethereum transactions may contain


Transactions are only for keeping notes. some executable code.

Bitcoin runs on the SHA- Ethereum runs on the Keccak-256 hash


Hash Algorithm 256 hash algorithm. algorithm.

The Proof-of-Work (PoW) is the


The Proof-of-Stake is the consensus
Consensus consensus mechanism used by
mechanism used by Ethereum.
Mechanism the Bitcoin network.

The block time of bitcoin is 10 The block time of Ethereum is 14 to 15


Block Time minutes. seconds.

The bitcoin blockchain has a The Ethereum blockchain does not


Block Limit block limit of 1 MB. have a block limit.

Bitcoin is the most popular Ether, native currency of Ethereum is


digital currency in the market to the second-largest cryptocurrency after
Popularity date. bitcoin to date.

Energy Consumption Energy consumption is very Energy consumption is very low as


high. compared to bitcoin

Energy consumption rate of


Energy consumption rate of bitcoin
Energy Consumption bitcoin mining system 3.2
mining system 1.2 Million household.
rate Million household.

Structure of bitcoin is simple and Structure of Ethereum is complex and


Structure robust. feature rich

Miner got nearly 6.25 BTC on Miner got nearly 5 BTC along with same
successfully adding new block in additional rewards on successfully
Rewards network. adding new block in network.

Assets Assets of Bitcoin is BTC. Assets of Ethereum is Ether.

Introduction to legal issues faced by Ethereum entrepreneurs(working principle law


and regulation)not sure ask once
The emergence of Ethereum and its underlying blockchain technology has opened up new
possibilities for entrepreneurs in various industries. However, with these opportunities come
a multitude of legal challenges that must be properly addressed to ensure the long-term
success of an Ethereum-based venture. This section provides an introduction to the key legal
issues that Ethereum entrepreneurs should be aware of when embarking on their projects.
Securities Regulation: In the world of Ethereum, digital tokens are often created and
exchanged on the platform. These tokens can have various purposes, from representing
ownership to providing access to a platform or service. However, depending on the nature of
the token, it may be considered a security by regulatory bodies like the U.S. Securities and
Exchange Commission (SEC). In such cases, the issuance and trading of these tokens must
comply with securities laws, which may include registration, disclosure, and reporting
requirements. Failure to comply with these regulations can lead to significant penalties and
enforcement actions.
Jurisdictional Differences: As a decentralized platform, Ethereum can be accessed and
utilized by individuals and businesses across the globe. This global nature creates a complex
legal landscape, as each jurisdiction may have its own regulations and compliance
requirements. Entrepreneurs need to be aware of the various laws and regulations that may
apply to their operations, such as data protection, taxation, and anti-money laundering (AML)
rules. Understanding and complying with these jurisdictional differences is crucial to
minimizing legal risks and ensuring smooth operations.
Intellectual Property: Protecting intellectual property (IP) is essential for any business,
including those operating in the Ethereum ecosystem. Entrepreneurs should consider
obtaining patents, trademarks, copyrights, or trade secrets to protect their innovations,
software, branding, and other valuable assets. Additionally, understanding licensing
agreements and ensuring that the business is not infringing on the IP rights of others is crucial
to avoid potential legal disputes.
Smart Contracts and Dispute Resolution: Ethereum enables the creation of smart contracts,
which are self-executing contracts with the terms of the agreement directly written into code.
While these contracts offer numerous benefits, they also present unique legal challenges.
Entrepreneurs must ensure that their smart contracts comply with applicable laws, include
necessary contractual provisions, and address potential issues related to dispute resolution,
liability, and enforceability.
Privacy and Data Protection: As businesses operating on the Ethereum platform may handle
user data, it is vital to comply with privacy and data protection regulations. This includes
adhering to the principles of the General Data Protection Regulation (GDPR) for businesses
operating within the European Union or dealing with EU citizens’ data. Implementing robust
data security measures and privacy policies can help minimize the risk of data breaches and
the associated legal ramifications.
EXPLAIN SMART CONTRACTS

Difference between pow and pos


Explain POS
Explain Dapps
What is gwi
What is gas
What are cryptographic principles
Public and private key pair
Blockchain)decentralized v/s bank(centralized-
https://www.investopedia.com/terms/b/blockchain.asp

Extra notes

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy