What is Hashing & Digital Signature in The Blockchain? - YouTube

Channel: unknown

[0]
(elegant music)
[5]
- Hi everyone, today we are going to be talking
[7]
about the word Blockchain and breaking it down
[10]
to understand what does it mean
[12]
when someone says Blockchains.
[14]
We're gonna take the time to understand the cryptography
[17]
behind the Blockchain technology.
[19]
So, there are two main cryptographic concepts
[22]
that underpin Blockchain technology.
[24]
The first, is hashing and the second is digital signatures.
[29]
So, what is hashing?
[31]
Hashing refers to the concept of
[33]
taking an arbitrary amount of input data,
[36]
applying some algorithm to it
[38]
and generating a fixed size output data
[40]
called the hash.
[42]
The input can be an any number of bits
[44]
that could represent a single character,
[47]
an mp3 file, an entire novel,
[50]
a spreadsheet of your banking history,
[52]
or even the entire internet.
[55]
The point is that the input can be infinitely big.
[59]
The hashing algorithm can be chosen depending on your needs
[62]
and there are many publicly available hashing algorithms.
[66]
The point is that the algorithm takes the infinite input
[70]
of bits, applies some calculations to them,
[73]
and outputs a finite number of bits,
[76]
for example, 256 bits.
[78]
So, what can this hash be used for?
[80]
A common usage for hashes today is to fingerprint files,
[84]
also known as checksums.
[86]
This means that a hash is used to verify
[88]
that a file has not been tampered with
[91]
or modified in any way not intended by the author.
[95]
So, if wikileaks, for example, publishes a set of files
[99]
along with their MD5 hashes, whoever downloads those files
[103]
can verify that they are actually from wikileaks
[106]
by calculating the MD5 hash of the downloaded files.
[110]
And, if the hash doesn't match
[112]
what was published by wikileaks
[114]
then you know that file has been modified in some way.
[117]
So, how does the Blockchain make use of hashes?
[120]
Hashes are used in Blockchains to represent
[123]
the current state of the world.
[125]
So, the input is the entire state of the Blockchain,
[129]
meaning all the transactions that have taken place so far.
[132]
And, the resulting output hash represents the current state
[136]
of the Blockchain.
[138]
The hash is used to agree between all parties
[141]
that the world state is one in the same.
[144]
But how are these hashes actually calculated?
[147]
The first hash is calculated for the first Block,
[150]
or the Genesis Block,
[151]
using the transactions inside that Block.
[155]
The sequence of initial transactions is used to calculate
[158]
a Block hash for the Genesis Block.
[161]
For every new Block that is generated afterwards,
[165]
the previous Block's hash is also used
[168]
as well as its own transactions
[170]
as input to determine it's Block hash.
[173]
This is how a chain of Blocks is formed.
[176]
Each new Block hash pointing to the Block hash
[179]
that came before it.
[180]
This system of hashing guarantees that no transactions
[184]
in the history can be tampered with.
[186]
Because, if any single part of the transaction changes
[189]
so does that hash of the Block to which it belongs
[193]
and any following Block's hashes as a result.
[196]
So, it would be fairly easy to catch
[198]
any tampering as a result.
[200]
Because, you could just compare the hashes.
[202]
This is cool because everyone on the Blockchain
[205]
only needs to agree on 256 bits
[208]
to represent the potentially infinite state
[211]
of the Blockchain.
[213]
The Ethereum Blockchain is currently 10s of gigabytes.
[216]
But, the current state of the Blockchain,
[218]
as of this recording, is this hexadecimal has
[221]
representing 256 bits.
[225]
What about digital signatures?
[227]
Digital signatures, like real signatures,
[230]
are a way to prove that somebody is who they say they are.
[233]
Except that we use cryptography or math
[237]
which is more secure than handwritten signatures
[239]
that can be easily forged.
[241]
A digital signature is a way to prove
[244]
that a message originates from a specific person
[247]
and no one else, like a hacker.
[249]
Digital signatures are used today all over the internet.
[253]
Whenever you visit a website over https,
[256]
you are using SSL which uses digital signatures
[259]
to establish trust between you and the server.
[263]
This means that when you visit Facebook.com
[266]
your browser can check the digital signature
[268]
that came with the webpage to verify
[270]
that it indeed originated from Facebook
[273]
and not some hacker.
[275]
In asymmetric encryption systems
[277]
users generate something called a key pair,
[280]
which is a public key and a private key,
[282]
using some known algorithm.
[285]
The public key and private key are associated
[287]
with each other through some mathematical relationship.
[290]
The public key is meant to be distributed publicly
[293]
to serve as an address to receive message from other users,
[297]
like an IP address or a home address.
[300]
The private key is meant to be kept secret
[303]
and is used to digitally sign messages sent to other users.
[307]
The signature is included with the message
[309]
so that the recipient can verify
[311]
using the senders public key.
[314]
This way, the recipient can be sure that only the sender
[317]
could have sent this message.
[319]
Generating a key pair is analogous to creating an account
[322]
on the Blockchain,
[324]
but without having to actually register anywhere.
[327]
Pretty cool.
[328]
Also, every transaction that is executed on the Blockchain
[332]
is digitally signed by the sender using their private key.
[336]
The signature ensures that only the owner of the account
[339]
can move money out of the account.
[342]
To bring it all together, Blockchain could not exist
[345]
without hashing and digital signatures.
[348]
Hashing provides a way for everyone on the Blockchain
[350]
to agree on the current world state.
[353]
While, digital signatures provide a way to ensure
[355]
that all transactions are only made by the rightful owners.
[360]
We rely on these two properties to ensure
[362]
that the Blockchain has not been corrupted or compromised.
[366]
If you wanna take a deeper dive
[367]
into hashing and digital signatures,
[369]
visit Blockgeeks.com and read some of our articles
[373]
and guides and our online courses.