[No Audio]
Welcome again in the new section of the course.
This section is dedicated to
Blockchain using Rust. The Blockchain
technology help in securing transactions,
reduce compliance cost, and speed up data
transfer. These objectives are to a great
extent aligned with the Rust objectives, that is
security and speed. This makes Rust one of
the perfect candidate for deploying and
developing Blockchain as the underlying
environment. Before jumping into the
implementation details, it will be useful to
cover some of the fundamentals of Blockchain.
If you are already familiar with the basics,
then you may skip these videos and jump into
the implementation details directly. However,
if you feel you are not comfortable with the
basics, then I would strongly recommend you
to cover these tutorials fully. The plan is
to start by discussing the very fundamental
building block of Blockchain called a Hash.
Once we understand what a Hash is, then we
will move on to see the detail on how these
Hashes allow us to build a Blockchain. Once
these fundamentals are covered, then we will
move on to the implementation part and see
the implementation in Rust. Let's begin by
talking about Hashes. Consider a scenario in
which you have a very large file, let's say
one gigabyte of file, and you want to send it
over to a friend across the globe. And now
you do not trust the carrier of the file, you
are not sure if the carrier will be able to
deliver the file 100% intact to your friend
or not. There might be some bit swapped, and
you are very concerned about even one bit
changing. We will explain why this is very
important that not even a single bit changes
in some data. But at the moment, consider the
scenario that you are sending a very large
file, and you don't want to send this file
over a secure channel, because that would be
very slow and very expensive. Instead, what
you want to do is, you want to send this file
over a normal channel. But then there is a
problem of making sure at the other end,
that the file has been received correct, so
here's how you do it. You take this file,
let's imagine that, this is that very big,
large file. So the same concept is going to
apply whether it's this piece of text, or it's
a 1 GB file, or if it's even a larger file,
the same concept is going to apply. So for
the sake of simplicity, we are going to take
just this text. So what you are going to do
is that, you will take this file, and you are
going to put it in a function, and that is
going to compute a much much smaller
representation of this whole text. Now that
is being done using a complex algorithm
called SHA or Secure Hash Algorithm, which
applies several steps to compute the Hash
corresponding to some given data. In simple
words, the Hashes are just fingerprints of
the data. The details of the algorithm are
not very important in our context. What's
important is that, this is going to be a fixed
sized string. Typically, the variant of SHA
called SHA256 algorithm is being used to
generate 64 character long string containing
some random numbers in hexadecimal format,
which is referred to as Hash of the data. The
essential characteristic of the algorithm is
that, if you give it just one
character, or give it a whole big file of one
gigabyte, the output or Hash it will generate
will always be a fixed size. Let me put in
one character over here and compute the Hash.
You may note that, this is simple one
character and it is coming out as 64
character long Hash. Now, let me put in some
more text in the box, and it will still come
out as 64 character long string.
Intuitively, even if you put some large texts such
as 15 GB file, it is still going to come out
as 64 character long string. Please note that
this is not a compression, you cannot go back
from a Hash to the original data. This means
that if you only have the Hash, you cannot
somehow get the original data back from it.
However, if you have the same data, whenever
you put it into the algorithm, you will
always get the same Hash value for it. You
consider it as a blank box where you put
in some piece of information and outcomes a
fixed size number. In summary, if you change
the input, the output is going to change. If
you don't change the input, the output is not
going to change. And if you feed in the same
input, the same output is going to come, no
matter wherever you compute it. And you
cannot go back from a Hash to the data,
that's the basic of Hash. Another point to
note is that a single character change in the
data will completely alter the Hash. Let me
add a simple dot at the end of the text. You may
note that the Hash completely changed. This
makes it almost impossible to relate the
changes in the to text with the Hash. The
Hash is a kind of completely independent and
almost impossible to relate it to the
original text. So that is the essential idea,
and all you need to understand at the moment.
The Hash is a kind of a fingerprint of the
digital data. The Hashes are not something
which is new and has been used for a long
time, and has uses beyond a Blockchain. A
nice use case of Hashes would be that, for
instance, you want to store some big file on
some insecure data storage, and you do not
need the same file right now. But in future,
you may need it, and you don't know when
exactly you will need it. So what you do is
that, you compute the Hash of the file and
store it with you. Since the size of the Hash
is fairly small, so it won't create any issue
at your end. Now, after 10 years or so, you
would like to retrieve your files, but first,
you want to make sure that your file is
unaltered and contains exactly the same
contents that you stored. So you will compute
the Hash again and match the computed Hash
that was stored locally with you. If both the
Hashes matches, then you are sure that the
file is not changed, and is the same file. That
was all about the Hashes. In the next video,
we will see how this simple concept can be
used to build what we know as a Blockchain.
See you again and other than happy Rust programming.
[No Audio]