Module 3&1-new
Module 3&1-new
• Let a = 4, p = 3,
• a,b,c,d,e are real numbers and and and take on values in the real
numbers
ELLIPTIC CURVE ARITHMETIC
• Above equations are said to be cubic, or of degree 3, because the highest exponent they
contain is a 3.
• Also included in the definition of an elliptic curve is a single element denoted O and
called the point at infinity or the zero point
• To plot such a curve, we need to compute
M + P + 64 = n x 512
i.e M = length of original message
P = padded bits
• Step 4: Compression function: The main part of the hashing algorithm lies in
this step. The entire message block that we have ‘n x 512’ bits long is divided
into ‘n’ chunks of 512 bits and each of these 512 bits, are then put through 64
rounds of operations and the output obtained is fed as input for the next round
of operation.
SHA-256
• In the image above we can clearly see the 64 rounds of operation that is
performed on a 512 bit message. We can observe that two inputs that we send
in are W(i) & K(i), for the first 16 rounds we further break down 512 bit
message into 16 parts each of 32 bit but after that we need to calculate the
value for W(i) at each step.
SHA-256
• Step 5: output : The output from every round acts as an input for the
next round and this process keeps on continuing till the last bits of the
message remains and the result of the last round for the nᵗʰ part of the
message block will give us the result i.e. the hash for the entire
message. The length of the output is 256 bits.
Applications of cryptographic hash functions
• There are various constructs that have been built using basic cryptographic parameters
to solve different problems in computing.
• These constructs are also used in blockchains to provide various protocol-specific
services.
• Following are applications of hash functions in blockchains are to provide various
security services:
• Hash functions are used in cryptographic puzzles such as the Proof of Work (PoW)
mechanism in Bitcoin.
• Bitcoin's PoW makes use of the SHA-256 cryptographic hash function.
Applications of cryptographic hash functions
•Digital keys
•Addresses
•Transactions
•Blockchain
•Miners
•The Bitcoin network
•Wallets (client software)
Cryptographic keys
• On the Bitcoin network, possession of bitcoins and transfer of value
via transactions is reliant upon private keys, public keys, and
addresses.
• Elliptic Curve Cryptography (ECC) is used to generate public and
private key pairs in the Bitcoin network.
Private keys in Bitcoin
• Private keys are required to be kept safe and normally resides only
on the owner's side.
• Private keys are used to digitally sign the transactions proving the
ownership of the bitcoins.
• Private keys are fundamentally 256-bit numbers and letters
• Private keys are usually encoded using Wallet Import Format
(WIF) in order to make them easier to copy and use.
• Wallet Import Format (WIF) is a standardized method for
displaying Bitcoin private keys using the Base58Check encoding
scheme. (https://en.bitcoin.it/wiki/Wallet_import_format)
Public Keys in Bitcoin
• Public keys exist on the blockchain and all network participants can
see them.
• Public keys are derived from private keys due to their special
mathematical relationship with those private keys
• Once a transaction signed with the private key is broadcast on the
Bitcoin network, public keys are used by the nodes to verify that the
transaction has indeed been signed with the corresponding private key.
• This process of verification proves the ownership of the bitcoin.
• Bitcoin uses Elliptic Curve Digital Signature Algorithm (ECDSA)
• Public keys can be represented in uncompressed or compressed
format, and are fundamentally x and y coordinates on an elliptic curve.
Addresses in Bitcoin
• A Bitcoin address is a unique identifier that serves as a virtual location where the
cryptocurrency can be sent
• A Bitcoin address is created by taking the corresponding public key of a private key and
hashing it twice, first with the SHA256 algorithm and then with RIPEMD160.
• The resultant 160-bit hash is then prefixed with a version number and finally encoded
with a Base58Check encoding scheme.
• The Bitcoin addresses are 26-35 characters long and begin with digits 1 or 3.
• 1
• P2SH Address
5. Next, the mining starts, which is the process through which the blockchain is secured and
new coins are generated as a reward for the miners who spend appropriate computational
resources. Once a miner solves the PoW problem, it broadcasts the newly mined block to the
network. The nodes verify the block and propagate the block further, and confirmations start
to generate.
6. Finally, the confirmations start to appear in the receiver's wallet and after approximately
three confirmations, the transaction is considered finalized and confirmed. However, three to
six is just a recommended number; the transaction can be considered final even after the first
confirmation. The key idea behind waiting for six confirmations is that the probability of
double spending is virtually eliminated after six confirmations.
Tutorial 4
• Fee rate
• Miners prioritize transactions based on satoshis per byte (sat/B).
• The effective fee rate is:
• Fee Rate=Transaction Fee/
Transaction Size in Bytes(in satoshis per byte)
• If the network is congested, users pay higher fees to get included in
the next block.
• If the network is less congested, lower fees may still result in fast
confirmations.
Transaction fees
• Example Calculation:
• Input: 0.5 BTC
• Output: 0.499 BTC
• Transaction Size: 250 bytes
• Transaction Fee=0.5−0.499=0.001 BTC
• Convert to satoshis (1 BTC = 100,000,000 satoshis):
• Transaction Fee=100,000 satoshi
• Fee Rate=100,000/250=400 sat/B
• Miners prefer transactions with higher sat/B because they maximize their rewards.
The transaction data structure
• A transaction on the Bitcoin network is represented by a data structure that consists of
several fields.
• A transaction at a high level contains metadata, inputs, and outputs.
• Transactions are combined to create a block's body.
The transaction data structure
• Metadata
• This part of the transaction contains values such as the size of the transaction, the
number of inputs and outputs, the hash of the transaction, and a lock_time field.
• Inputs
• Generally, each input spends a previous output.
• Each output is considered an Unspent Transaction Output (UTXO) until an
input consumes it.
• A UTXO is an unspent transaction output that can be spent as an input to a new
transaction.
transaction input data structure
The transaction data structure
• Outputs
• Outputs have three fields, and they contain instructions for sending bitcoins.
• The first field contains the amount of Satoshis, whereas the second field contains
the size of the locking script.
• Finally, the third field contains a locking script that holds the conditions that need
to be met in order for the output to be spent.
• Verification
• Verification is performed using Bitcoin's scripting language
Coinbase transactions
A general commands each unit, and they can only communicate with each
other using a messenger.
To be successful, the generals must coordinate their plan and decide whether
to attack or retreat.
The problem is that any generals could potentially be disloyal and act
maliciously to obstruct agreement upon a united plan.
The requirement now becomes that every honest general must somehow
agree on the same decision even in the presence of treacherous generals.
• The game theory analogy behind the Byzantine Generals Problem is that
several generals have surrounded the city, but they must collectively decide
when to attack.
• If all generals attack at the same time, they will win, but if they attack at
different times, they will lose.
• The generals have no secure communication channels with one another because
any messages they send or receive may have been intercepted or deceptively
sent by defenders.
• How can the generals organize to attack at the same time?
Fault Tolerance
• A fundamental requirement in a consensus mechanism is that it must
be fault-tolerant.
• In other words, it must be able to tolerate a number of failures in a
network and should continue to work even in the presence of faults.
Types of fault-tolerant consensus
• Fault-tolerant algorithms can be divided into two types of fault-tolerance.
• The first is Crash fault-tolerance (CFT) and the other is Byzantine faulttolerance
(BFT).
• CFT covers only crash faults or, in other words, benign faults.
• In contrast, BFT deals with the type of faults that are arbitrary and can even be malicious.
• Replication is a standard approach to make a system fault-tolerant.
• Replication results in a synchronized copy of data across all nodes in a network.
• This technique improves the fault tolerance and availability of the network.
• This means that even if some of the nodes become faulty, the overall system/network
remains available due to the data being available on multiple nodes.
Classification