1. Blockchain Technology
What is Blockchain:
Blockchain is a decentralized and distributed digital ledger to record transactions across the many nodes in the network, which cannot be
altered retroactively without the altering the subsequent blocks and the collusion with other nodes on the network.
Despite its apparent complexity, a blockchain is just another type of database for recording transactions – one that is copied to all of the
computers in a participating network, making changes to recorded/verified transactions at one node makes irrelevant as the blocks are
added by consensus of nodes
There are huge expectations on Blockchain technology and no one knows really what are the cost impacts, in which domains and precisely
how to implement.
Gartner Hype Cycle for Emerging Technologies – blockchain still has to reach the
peak of inflated expectations – Copyright Gartner all rights reserved – read full article
and view full chart on Forbes
If you see Gartner Hype for emerging technologies
published in 2016, blockchain is still an innovation trigger
and reaching the peak of inflated expectations
2. Proves that the signer had access to the private key
Sender can encrypt a message using Receiver’ public key and send it to Receiver over an untrusted network so
that Receiver can then decrypt the message using his private key
Hash functions take input data of arbitrary size and deterministically map it to an output of fixed size (typically
smaller than the input size) that resembles random data. SHA256 generates 256 bits
Data structure takes a list of transactions and combines them using a binary tree structure, where the root
node is called the Merkle Root
In order to prevent double-spends, you have to be able to quickly perform the following two database
operations: Lookup if a transaction has already been spent and Insert a new valid transaction
Having nodes communicate directly with one another (as opposed to using a trusted third-party) is unlike
most applications we use on a daily basis.
Works by calculating the hash of a message, along with many different nonces, until you find a resulting digest
that meets a rare criteria.
Blockchain Technology – Technologies
Let us examine Blockchain from Technology perspective. Most Blockchains use six major technologies
Asymmetric Encryption
Transaction Signing
HASH Function – SHA256
Transaction/Block hashing
Merkel Trees
Efficient way to package Txns.
Key-Value Database
Look up previous Txns.
P2P Communication Protocol
Sharing Txns. and Blocks
Proof Of Work
Method to achieve Consensus
3. Blockchain Technology – Life Cycle
Couple of examples explaining end to end Life Cycle of Blockchain Technology
Courtesy from http://insurancefunda.in/bitcoin-cryptocurrency/
The steps identified here are
• Someone requests a transaction
• Transaction broadcasted to P2P computers (nodes).
• Validation, miners verify the transaction.
• Transactions combined to form a data block.
• New block added to existing Blockchain.
• The transaction is complete.
This image is a cut out from a larger infographic created by Accenture.
The steps identified here are
• Request of transaction is submitted to the network.
• The transaction is validated by the network.
• The verified transaction is combined with other verified transactions into a block in the
blockchain.
• Transaction is complete.
4. Blockchain Technology - Components
What is Blockchain:
Basic Components in Blockchain architecture are (TXN/Block structure differs between Bitcoin and Ethereum and to avoid
confusion, here I am focusing on Bitcoin)
Decentralized Nodes Distributed LedgerTransaction
TECHNICAL DATA
VERSION
Lock Time (delay)
Number of Inputs
Number of Outputs
INPUTS
Previous TXN Hash/Output Index
Private Unlock Script Script Length
OUTPUT
Amount
Public Locking Script Script Length
Block
TRANSACTION COUNT
Previous TXN Hash/Output Index
Private Unlock
Script
Script Length
BLOCK CONTENT
Coinbase TX Bitcoin TX
HEADER
VERSION
Merkel Root
Previous Block Hash
Timestamp
Difficulty
Nonce
5. Blockchain Technology – what is what
Hash – SHA-256 • SHA-256 is one of the number of Cryptographic hash functions available
• Hash is like a signature for text or data file
• As the name suggests it generates 256 bits signature irrespective of text size/file size. If you are using an hexadecimal representation, each digit
codes for 4 bits ; so you need 64 digits to represent 256 bits
• Same Hash will be generated every time for the same text.
• Hash cannot be translated back to initial text just due to the fact that there are 2^256 combinations of 256 bits signatures should be tried. To have a
little more illustration, if you take fastest Super computer available today which has 10.5 Petaflops, it takes a little over Billion years to guess the
string that generated the HASH
• User Selects a string of letters/numbers and Special characters as a key
to Initiate transaction. This is Private key.
• Using this Private Key, user generates Public Key (SHA256 hash),
which can be shared across the network to receive the funds, records,
transactions, files etc..
• So in other words your Security key/text hash itself is your Public Key.
For instance If A would like to send amount to B.
• If A has no public key or lost the Public key, generates Public key with
Secret key. If A’s secret key is (I am A), public key will be generated as
(7170DE91DAD405CEE38CFE24DDE3F686B7EE37198A466E6DD6226CBD84E4E
457)
• A requests Public key of B
• If B has public key, logs into the system, with the name B is
comfortable (bob_played_baseball) will generates Public
Key(1FAE99945313EE181FBC3FBAC5C2C5887334F807B0AEC85566715237DBF
429C6) and share the Public key with A
• A logs into system and with Public key of A initiates transaction to send
information/money to B’ Public Key
Here is the html link to see how the hash SHA256 will be generated. Try it your self (probably you might
have to adjust the viewing area
Hash – SHA-256 BlockTransactions Key-Value Base Mining Blockchain Distributed
6. Blockchain Technology - what is what
Transactions • Transaction is basically an entry in the ledger having details no more than Originator, Receiver, details related to transfer and timestamp
• Transactions are signed by the Originator with his/her Secret Key, part of Public key
• Transactions from Multiple users are bundled and distributed to the different nodes (decentralized) periodically as unconfirmed blocks
• Each node validates and authenticates the transactions in the block against the distributed databases existing with each of the node
• Transactions get accepted in the ledger when a sufficiently large number of parties reach a consensus on a batch of transactions or block being
valid.
• If you think of blockchain as a ledger book, then each block is a page in the ledger and each transaction is an individual asset transfer on a ledger page.
• Data within the blockchain is actually not encrypted and at the same time cannot be altered.
Format of Transaction:
Transactions contain one-or-more inputs and one-or-more outputs.
• An input is a reference to always output from a previous transaction
• An output specifies an amount and a address .
Input
0.75
Input
2.25
Output
3.00
Input
3.00
Output
1.00
Output
1.25
Output
0.75
Linked Transactions
Transaction
TECHNICAL DATA
VERSION
Lock Time (delay)
Number of Inputs
Number of Outputs
INPUTS
Previous TXN Hash/Output Index
Private Unlock Script Script Length
OUTPUT
Amount
Public Locking Script Script Length
Hash – SHA-256 BlockTransactions Key-Value Base Mining Blockchain Distributed
7. Blockchain Technology - what is what
Block Blocks are data structures whose purpose is to bundle transactions and distribute to all nodes in the network
Block are created by process called Mining, Mining is the process of adding transaction records to public ledger of past transactions
Users create transactions and submit them to the network, where they sit in a pool waiting to be included in a block.
Blocks contain a block header, which is the metadata that helps to verify the validity of a block.
Block
TRANSACTION COUNT
Previous TXN Hash/Output Index
Private Unlock Script Script Length
BLOCK CONTENT
Coinbase TX Bitcoin TX
HEADER
VERSION
Merkel Root
Previous Block Hash
Timestamp
Difficulty
Nonce
Typical block metadata contains:
version - the current version of the block structure
previous block header hash - the reference this block's parent block
Merkle Root hash - a cryptographic hash of all of the transactions included in this
block
time - the time that this block was created
nBits - the current difficulty that was used to create this block
nonce ("number used once") - a random value that the creator of a block is
allowed to manipulate however they so choose
Hash – SHA-256 BlockTransactions Key-Value Base Mining Blockchain Distributed
8. Blockchain Technology - what is what
Block
Merkle Root hash - a cryptographic hash of all of the transactions included in this block
Merkel Root
HABCD
Hash (HAB + HCD)
HAB
HA (Hash of Txn. A)
HB (Hash of Txn. B)
HCD
HC (Hash of Txn. C)
HD (Hash of Txn. D)
An arbitrary number miners change to modify the header hash in order to produce a hash less
than or equal to the target threshold.
Target threshold is defined in the block header as
Merkel Root Hash
nonce
nbits
Hash – SHA-256 BlockTransactions Key-Value Base Mining Blockchain Distributed
9. Blockchain Technology - what is what
Key-Value Base • In the entire Blockchain, miners will not have a clue whether the sender has sufficient funds/inputs to transfer to the receiver.
• Key-Value base or Coinbase maintains the transactions value of each transaction between two parties
• Miner system checks the last block where in Sender received the currency/asset to validate whether Sender has sufficient assets to transfer
• Coinbase blocks are distributed across all the nodes in the network
• As these are distributed across and validations basically results creation of Block in Blockchain, any change in any block will be rejected due to
confirmation of Block by consensus
Hash – SHA-256 BlockTransactions Key-Value Base Mining Blockchain Distributed
10. Blockchain Technology - what is what
Mining
Is a process by which transactions are verified and added to the public ledger, known as the block chain.
Key component that need to be met by Miner to make a Block valid and added to Block chain is Target Difficulty, defines proof of work.
Target is generated by Network and defines what makes Black’ hash Valid or not
If the Hash of block is higher than Target, it is not valid.
For instance if Target is 1,931,136,454,487.72, combined hash of block (including all the contents in block like txns, header etc..) will be
00000000000000000020c60222099aaebc6e7795784f74628ec640b223d3d339
Miner needs to keep changing nonce (number used once) to arrive at the Hash for the black less than Target hash and should contain same leading zeros (18 here)
Hash – SHA-256 BlockTransactions Key-Value Base Mining Blockchain Distributed
InsertingNewBlocktoBlockchain
Combined Hash <
Target Hash
Start Proposed New Block
Hash of most recent Block
Combined Hash
SHA 256
nonce
Nonce + 1No
Combined Hash will be Block Hash and
Block is update to local Block Chain
Yes
Block is distributed to Peers in the
network
Block is validated by peers
Block Valid
Yes
Other Miners update their local
copy
No
Block Rejected
Is Block Valid?
11. Blockchain Technology - what is what
Blockchain Miner creates a block by
1. Gathering a set of pending transactions, prioritizing those with transaction fees
2. Verifying the transactions
3. Solving a hashing problem
4. Validating the block with peers
Verification of Block by peers
• Miner distributes completed block among peers for validation and acceptance
• Miners validates blocks
Block header hash is less than the target
Block size is within acceptable limits
Block timestamp is less than two hours in the future.
The first transaction is a coinbase transaction ( and only the first )
The coinbase transaction has a valid reward.
All transactions within the blocks are valid ( also have a checklist on their own )
Every node validates independently new blocks following the exact same rules. This assures that miners cannot cheat. This is a key component of the decentralized consensus.
If the block is valid, the other miners will update their own copy of the blockchain with the new block.
Hash of this newly created Block will be used as an Input to the Next Block
Hash – SHA-256 BlockTransactions Key-Value Base Mining Blockchain Distributed
Distributed
Hinweis der Redaktion
How did it Start :
In the beginning, there was one transaction.
It had no inputs, it just had an output crediting an address (owned by Bob) some value. There were no inputs, because, well, an input references the output of a previous transaction. This is the first transaction. So no inputs.
Eventually, Bob will want to spend that value by transferring it to someone else (Alice). So Bob creates a transaction.
That transaction has one input, which is a reference to the output of that very first transaction - remember: Bob controls the keys to the address that the original output credits.
That transaction has one output, which is some public address to which Alice holds the private key, and an amount of currency to be sent.
Now Alice controls this value. By virtue of her private key, she is able to sign off on another transaction that sends up to the amount she received to a different address, controlled by some other entity.
It is this simple value-transfer mechanism using "transactions" over time that create a blockchain. As each transaction occurs, it gets added to the blockchain ledger, leading us to the next topic: blocks, miners, and verification.