- A blockchain is a chain of digital data blocks
- Each blocks can store digital information about financial transactions such as date, time, dollar, sender,receiver or it can be medical records or property purchase deeds and much more.
- Chaining of blocks is done through cryptographic hashing algorithms, such as SHA-256, Scrypt, etc
- Blocks which are chained together, its data can never be changed again (Immutable !)
- Entire block chain is publicly available to anyone who wants to see it, in exactly the way it was once added to the blockchain.
- Blockchain is a distributed and decentralized public ledger
- Hashing is a cryptographic method of converting input data of any kind and size, into a string of fixed number of characters.
- Characteristics of hashing cryptography algorithms : (Example : SHA-256, Scrypt, etc)
○ The same input must always generate the same output. (Determinstic !)
○ The hash should be of a fixed number of characters, regardless the size or type of input data (Compression!)
○ There should be no way to reverse the hashing process to see the original data set. (Pre-Image Resistant !)
○ Any change in the input must produce an entirely different output (Avalanche effect !)
○ Practically impossible to find two different inputs that produce the same output (Collision Resistance !)
○ Creating the hash should be a fast process that doesn’t make heavy use of computing power (Efficient !)
- The Bitcoin blockchain is the oldest blockchain in existence.
○ The blocks on the Bitcoin blockchain consist of approximately 1 MB of data each.
○ The data on the Bitcoin blockchain exclusively exists out of transaction data in regard to Bitcoin transactions.
○ It is a giant track record of all the Bitcoin transactions that have ever occurred, all the way back to the very first Bitcoin transaction.
○ Bitcoin blockchain uses SHA-256 cryptographic hashing algorithm to chain blocks Bitcoin Blockchain Example
- Block-1 registers two bitcoin transactions T1 and T2 between Damian and George.
- Signature is generated for Block-1 say, X32 using hashing algorithm
- Block-2 registers two new bitcoin transactions T3 and T4.
- The data in block 1 is now linked to block 2 by adding the signature of block 1 (X32) to the data of block 2.
- The signature of block 2 (9BZ) is now partially based on the signature of block 1, because it is included in the string of data in block 2
- The signature links the blocks to each other, making them a chain of blocks !!
What if block data is altered by malicious user ?
Let’s say transaction between Damian and George is altered and Damian now supposedly sent 500 Bitcoin to George instead of 100 Bitcoin.
- Changing any single bit of data will generate a new signature for Block-1 (say W10)
- The new signature W10 does not match the signature that was previously added to block 2 anymore.
○ Hence Block 1 and 2 are now considered no longer chained to each other !!
- This indicates to other users of this blockchain that some data in block 1 was altered, and because the blockchain should be immutable :
○ All users reject this change by shifting back to their previous record of the blockchain where all the blocks are still chained together (the record where Damian sent 100 BTC to George)
How is the data block accepted in blockchain ?
- A signature doesn’t always qualify for block to be accepted in block chain
- A block will only be accepted on the blockchain if its digital signature starts with — for example — 7 consecutive number of zeroes.
- What if the signature (hash) of a block doesn’t start with ten zeroes?
- Well, in order to find the block a signature that meets the requirements, the string of data of a block needs to be changed repeatedly until that specific string of data leads to a signature starting with ten zeroes.
- Because the transaction data and metadata (block number, timestamp, et cetera) need to stay the way they are, a small specific piece of data is added to every block that has no purpose except for being changed repeatedly in order to find an eligible signature. This piece of data is called the nonce of a block.
- The nonce is a completely random string of numbers