The project deals about how blockchain works, proof-of-work and merkle tree hash function. The project also tries to explain how the bitcoin uses ECDSA algorithmt power the cryptography.
1. BLOCK CHAIN AND BITCOIN
TEJHASKAR ASHOK KUMAR
VIGNESHWAR RAMASWAMY
2. What is blockchain?
◦ Blockchain is a decentralized, distributed back-end database that
maintains a distributed-ledger that is used to record transactions
across many computers. The main advantage of blockchain is any
record cannot be altered easily without changing the sub-sequent
blocks.
◦ A blockchain is a ledger of transactions replicated across several
computers connected to a peer-to-peer network.
◦ Blockchain has several applications in the field of crypto-currency,
banking, supply chain, healthcare, voting etc.
◦ Game theory, software Engineering and cryptography science are the
fields involved in blockchain.
3. Approaches to achieve consensus:
◦ As the blockchain are distributed systems, every node has exact same authority. So any node can easily
modify data or mislead the communication between the nodes while doing a transaction.
◦ It causes a distributed network security problem
◦ Problem : achieving consensus in a distributed network with potentially faulty nodes
◦ Approaches to Consensus/ Byzantine Fault Tolerance:
✓State Machine Replication : Leslie Lamport’s Consensus
✓Proof-Of-Work : Nakomoto’s Consensus
4. State machine replication approach
◦ State Machine Replication is a general approach for implementing a fault-tolerant system by replicating
servers and coordinating client interactions with server replicas.
◦ Technique for implementing fault-tolerant service in terms of a state machine:
➢Place copies of the state machine on multiple, independent servers
➢Receive client requests as input to the state machine.
➢Choose an ordering for the inputs.
➢Execute the inputs in the chosen order on each servers.
➢Respond to clients with the output form the state machine.
5. How blockchain works?
◦ Blockchain is a distributed ledger which is
accessible to anyone. Once a data has been
recorded to a blockchain, it becomes very
difficult to change it.
◦ Every block in the blockchain has the
following elements:
◦ Data
◦ Hash
◦ Hash of the previous block
6. How blockchain works?
◦ This is a chain of 3 blocks. Each block has a hash and hash of the
previous block.
◦ First block is genesis block as it does not point to any block.
◦ If the data in the block 2 is tampered, the hash value is changed.
So, the block 3 and all following blocks are invalid as it no longer
stores a valid hash.
◦ This technique effectively makes the blockchain so secure.
7. Proof of Work:
◦ Proof of work is a protocol that has the main goal
of deterring cyber-attacks such as a distributed denial-of-
service attack (DDoS) which has the purpose of exhausting the
resources of a computer system by sending multiple fake
requests.
◦ In blockchain, PoW is a mathematical puzzle known as nonce
which has to be solved to create a new block.
◦ This nonce ensures all the transactions in the block are valid
and verified.
◦ Blockchain uses merkle-tree based proof-of-work function.
8. Merkle-tree (hash tree):
◦ In cryptography, merkle-tree is a tree in which every leaf node
is labelled with the cryptographic hash of a data block and
every non-leaf node is labelled with the cryptographic hash in
the label of its child nodes.
◦ Each transaction in the set that makes up a block is fed through
a program that creates an encrypted code known as the hash
value.
◦ Hash values are further combined in a system known as
merkle-tree
9. Merkle-tree (Hash tree):
◦ Computer A sends a hash of the file to computer B.
◦ Computer B checks that hash against the root of the Merkle
tree.
◦ If there is no difference, we're done! Otherwise, go to step 4.
◦ If there is a difference in a single hash, computer B will request
the roots of the two subtrees of that hash.
◦ Computer A creates the necessary hashes and sends them back
to computer B.
◦ Repeat steps 4 and 5 until you've found the data blocks(s) that
are inconsistent. It's possible to find more than one data block
that is wrong because there might be more than one error in
the data.
10. Blockchain implementation
– python:
◦ This is a simple implementation of a block
using python.
◦ A chain of block can be implemented by
using python Lists.
◦ The hash of the current block acts as a
pointer to the previous block.
◦ From this, it is clear that the blockchain
uses linked-list data structure.
11. BITCOIN-INTRODUCTION
◦ What is Bitcoin?
◦ Bitcoin is a Crypto-Currency
◦ Bitcoin is the First Decentralized digital currency.
◦ Transactions takes place between users directly using cryptography.
◦ These transactions are verified by network nodes and they are
recorded in a public distributed ledger called block chain.
◦ Who invented this technology?
◦ A software developer, Satoshi nakamoto proposed bitcoin.
12. CRYPTOGRAPHY
◦ Public key cryptography ( Asymmetric cryptography)
◦ A cryptographic system that uses two pairs of keys
◦ Public keys – distributed widely
◦ Private keys - known only to the owner
◦ How the keys are generated?
◦ Depends on cryptographic algorithms which are based on mathematical problems to produce one-way
functions
13. ECDSA - Elliptic Curve Digital Signature Algorithm
◦ In bit coin,
◦ Private key is a randomly generated number.
◦ Private key is a single unsigned 256-bit integer (32 bytes).
◦ Public key is a number that corresponds to private key.
◦ Public key can be calculated from private key, but not vice versa.
◦ Compressed public keys are 33 bytes
◦ Prefix - 0x02 or 0x03
◦ X – 256-bit integer.
14. ECDSA - Elliptic Curve Digital Signature
Algorithm
◦ Uncompressed keys are 65 bytes
◦ Prefix – 0x04
◦ Two 256-bit integer values called x and y.
◦ Prefix of the compressed public key allows for the y value to be derived from the x value.
Digital Signature:
◦ A cryptographic value that is calculated from the data and secret key known only by the signer.
◦ A number that proves that a signing operation took place.
◦ A signature is mathematically generated from a hash of something to be signed, plus a private key.
◦ Resulting signatures are either 73, 72, or 71 bytes long.
15. Process
CREATE A
TRANSACTION.
ATTACH RECEIVERS
PUBLIC KEY TO THIS
AMOUNT OF COINS.
SIGN IT WITH
SENDER'S PRIVATE
KEY.
THEN, THIS
TRANSACTION IS
BROADCASTED TO
THE BITCOIN
NETWORK.
THE COMPLETE
HISTORY OF
TRANSACTIONS IS
KEPT BY EVERYONE,
SO ANYONE CAN
VERIFY WHO IS THE
CURRENT OWNER OF
ANY GROUP OF
COINS.
THIS COMPLETE
RECORD OF
TRANSACTIONS IS
KEPT IN THE BLOCK
CHAIN.
16. HASHCASH
◦ Bitcoin uses the hashcash Proof of work function as the mining core.
◦ Hashcash function makes generating bitcoins more difficult
◦ The bitcoin miners make their effort in creating hashcash proof of work function to produce a new
block in the block chain.
◦ Hashcash uses hash functions as a building block.
◦ Hashcash uses symmetric key cryptography, namely a one-way hashcash function.
◦ In bitcoin, block-chaining, and the hashcash cost-function all use SHA256 as the
underlying cryptographic hash function.
17. BITCOIN MINING
◦ Mining is a process of adding transaction records to Bitcoin public ledger of past transactions.
◦ Adding a block to the block chain is difficult, which requires time and processing power.
◦ The miner to put forth this time and electricity is the one who manages to produce the block and
gets a reward.
◦ The block producer gets a bounty of some number of bitcoins, which is agreed-upon by the network.
◦ The network rules are such that the difficulty is adjusted to keep block production to approximately 1
block per 10 minutes.
18. Double spending problem
◦ A double spend is an attack where the given set of coins is spent in
more than one transaction.
◦ Send two conflicting transactions in rapid succession into the Bitcoin
network. This is called a race attack.
◦ When digital currencies are copied, it becomes worthless.
How to deal with this problem?
◦ Bitcoin network shields from the activity of double spending.
◦ It verifies and records each transactions within the block chain.
◦ Block chain maintains a record of all the transactions made using bit
coins by miners.
◦ The ledger system in the block chain ensures that the transactions are
confirmed by miners.