What is Hashing & Digital Signature in The Blockchain?

(elegant music) – Hi everyone, today we are going to be talking about the word Blockchain and breaking it down to understand what does it mean when someone says Blockchains We're gonna take the time to understand the cryptography behind the Blockchain technology

So, there are two main cryptographic concepts that underpin Blockchain technology The first, is hashing and the second is digital signatures So, what is hashing? Hashing refers to the concept of taking an arbitrary amount of input data, applying some algorithm to it and generating a fixed size output data called the hash The input can be an any number of bits that could represent a single character, an mp3 file, an entire novel, a spreadsheet of your banking history, or even the entire internet The point is that the input can be infinitely big

The hashing algorithm can be chosen depending on your needs and there are many publicly available hashing algorithms The point is that the algorithm takes the infinite input of bits, applies some calculations to them, and outputs a finite number of bits, for example, 256 bits So, what can this hash be used for? A common usage for hashes today is to fingerprint files, also known as checksums This means that a hash is used to verify that a file has not been tampered with or modified in any way not intended by the author So, if wikileaks, for example, publishes a set of files along with their MD5 hashes, whoever downloads those files can verify that they are actually from wikileaks by calculating the MD5 hash of the downloaded files

And, if the hash doesn't match what was published by wikileaks then you know that file has been modified in some way So, how does the Blockchain make use of hashes? Hashes are used in Blockchains to represent the current state of the world So, the input is the entire state of the Blockchain, meaning all the transactions that have taken place so far And, the resulting output hash represents the current state of the Blockchain The hash is used to agree between all parties that the world state is one in the same

But how are these hashes actually calculated? The first hash is calculated for the first Block, or the Genesis Block, using the transactions inside that Block The sequence of initial transactions is used to calculate a Block hash for the Genesis Block For every new Block that is generated afterwards, the previous Block's hash is also used as well as its own transactions as input to determine it's Block hash This is how a chain of Blocks is formed Each new Block hash pointing to the Block hash that came before it

This system of hashing guarantees that no transactions in the history can be tampered with Because, if any single part of the transaction changes so does that hash of the Block to which it belongs and any following Block's hashes as a result So, it would be fairly easy to catch any tampering as a result Because, you could just compare the hashes This is cool because everyone on the Blockchain only needs to agree on 256 bits to represent the potentially infinite state of the Blockchain

The Ethereum Blockchain is currently 10s of gigabytes But, the current state of the Blockchain, as of this recording, is this hexadecimal has representing 256 bits What about digital signatures? Digital signatures, like real signatures, are a way to prove that somebody is who they say they are Except that we use cryptography or math which is more secure than handwritten signatures that can be easily forged A digital signature is a way to prove that a message originates from a specific person and no one else, like a hacker

Digital signatures are used today all over the internet Whenever you visit a website over https, you are using SSL which uses digital signatures to establish trust between you and the server This means that when you visit Facebookcom your browser can check the digital signature that came with the webpage to verify that it indeed originated from Facebook and not some hacker In asymmetric encryption systems users generate something called a key pair, which is a public key and a private key, using some known algorithm

The public key and private key are associated with each other through some mathematical relationship The public key is meant to be distributed publicly to serve as an address to receive message from other users, like an IP address or a home address The private key is meant to be kept secret and is used to digitally sign messages sent to other users The signature is included with the message so that the recipient can verify using the senders public key This way, the recipient can be sure that only the sender could have sent this message

Generating a key pair is analogous to creating an account on the Blockchain, but without having to actually register anywhere Pretty cool Also, every transaction that is executed on the Blockchain is digitally signed by the sender using their private key The signature ensures that only the owner of the account can move money out of the account To bring it all together, Blockchain could not exist without hashing and digital signatures

Hashing provides a way for everyone on the Blockchain to agree on the current world state While, digital signatures provide a way to ensure that all transactions are only made by the rightful owners We rely on these two properties to ensure that the Blockchain has not been corrupted or compromised If you wanna take a deeper dive into hashing and digital signatures, visit Blockgeekscom and read some of our articles and guides and our online courses

This website is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon properties including, but not limited to, Amazon.com.