Blockchain and Applications
MODULE-2
SRINIVAS P M
1
Structure of bitcoin
First, let us see that what the main components of a Bitcoin network are. Bitcoin is
composed of the elements
listed here. We will further expand on these elements as we progress through the
chapter.
Digital keys
Addresses
Transactions
Blockchain
Miners
The Bitcoin network
Wallets (client software)
Cryptography
A model of the generic encryption and decryption
Explanations of concepts such as entity, sender, receiver,
adversary, key, and channel
1. Entity: Either a person or system that sends, receives, or performs
operations on data
2. Sender: This is an entity that transmits the data
3. Receiver: This is an entity that takes delivery of the data
4. Adversary: This is an entity that tries to circumvent the security
service
5. Key: A key is data that is used to encrypt or decrypt other data
6. Channel: Channel provides a medium of communication between
entities
Cryptographic primitives
Services Provided by Cryptography
1. Confidentiality
2. Integrity
3. Authentication
4. Entity Authentication
5. Data Origin Authentication
6. Non-Repudiation
7. Accountability
Asymmetric cryptography
Asymmetric cryptography refers to a type of cryptography where
the key that is used to encrypt the data is different from the key that
is used to decrypt the data.
This is also known as public key cryptography.
It uses both public and private keys to encrypt and decrypt data,
respectively.
Various asymmetric cryptography schemes are in use, including
RSA, DSA, and ElGammal.
An overview of public key cryptography
Encryption/decryption using public/private keys
Model of a public-key cryptography signature scheme
Security mechanisms offered by public key cryptosystems
1. Key establishment,
2. Digital signatures,
3. Identification,
4. Encryption,
5. Decryption.
Mathematical functions public key cryptography algorithms
1. Integer Factorization
2. Discrete Logarithm
3. Elliptic Curves
The RSA Algorithm
ECC Diffie–Hellman Key Exchange
Hash functions
Hash functions are used to create fixed-length digests of
arbitrarily-long input strings.
Hash functions are keyless, and they provide the data integrity
service.
They are usually built using iterated and dedicated hash function
construction techniques.
Various families of hash functions are available, such as MD, SHA-
1, SHA-2, SHA-3, RIPEMD, and Whirlpool.
Hash functions are commonly used for digital signatures and
Message Authentication Codes (MACs), such as HMACs.
Some applications use hash functions as a means for generating
Pseudo-random Numbers Generator (PRNGs).
Properties of Hash Functions
1. Compression of arbitrary messages into fixed-length digest
2. Easy to compute
3. Preimage resistance
4. Second preimage resistance
5. Collision resistance
6. Message Digest
Applications of Cryptographic Hash Functions
1. Message Authentication
2. Digital Signatures
Message Authentication
Message authentication is a mechanism or service used to verify
the integrity of a message.
Message authentication assures that data received are exactly as
sent (i.e., there is no modification, insertion, deletion, or replay).
When a hash function is used to provide message authentication,
the hash function value is often referred to as a message digest.
The sender computes a hash value as a function of the bits in the
message and transmits both the hash value and the message.
The receiver performs the same hash calculation on the message
bits and compares this value with the incoming hash value.
If there is a mismatch, the receiver knows that the message (or
possibly the hash value) has been altered
Attack Against Hash Function
Variety of ways in which a hash code can be used
Digital Signatures
Design of SHA-256
SHA-256 has the input message size < 264-bits. Block size is 512-
bits, and it has a word size of 32-bits. The output is a 256-bit digest.
The compression function processes a 512-bit message block and a
256-bit intermediate hash value. There are two main components of
this function: the compression function and a message schedule.
1. Pre-processing:
1. Padding of the message is used to adjust the length of a block to
512-bits if it is smaller than the
required block size of 512-bits.
2. Parsing the message into message blocks, which ensures that the
message and its padding is divided into equal blocks of 512-bits.
3. Setting up the initial hash value, which consists of the eight 32-bit
words obtained by taking the first 32-bits of the fractional parts of the
square roots of the first eight prime numbers. These initial values are
randomly chosen to initialize the process, and they provide a level of
confidence that no backdoor exists in the algorithm.
2. Hash computation:
4. Each message block is then processed in a sequence, and it requires
64 rounds to compute the full hash output. Each round uses slightly
different constants to ensure that no two rounds are the same.
5. The message schedule is prepared.
6. Eight working variables are initialized.
7. The intermediate hash value is calculated.
8. Finally, the message is processed, and the output hash is produced:
One round of a SHA-256 compression function
Merkle trees
Financial markets and trading
Financial markets enable trading of financial securities such as bonds,
equities, derivatives and currencies. There are broadly three types of
markets: money markets, credit markets, and capital markets:
Money markets: These are short-term markets where money is lent to
companies or banks to do interbank lending. Foreign exchange or FX is
another category of money markets where currencies are traded.
Credit markets: These consist mostly of retail banks where they borrow
money from central banks and loan it to companies or households in the
form of mortgages or loans.
Capital markets: These facilitate the buying and selling of financial
instruments, mainly stocks and bonds. Capital markets can be divided into
two types: primary and secondary markets. Stocks are issued directly by
the companies to investors in primary markets, whereas in secondary
markets, investors resell their securities to other investors via stock
exchanges. Various electronic trading systems are used by exchanges
today to facilitate the trading of financial instruments.