Hey everyone, welcome back to the course.
So now, after going through what blockchain is and learning about the history of the blockchain, let's
check out some of the blockchain fundamentals which defines the functionality and interaction capabilities
of the blockchain.
The most critical of all the concepts are the keys.
A key in a cryptographic world is a string of secure alphanumeric characters which help you to secure
your data by encrypting the data.
There are two types of key generation algorithms symmetric and asymmetric.
Symmetric cryptography algorithms generate only one key which is shared between users.
Users use the same key to encrypt and decrypt the data.
Symmetric algorithms are faster than the asymmetric algorithms, but initial key distribution is always
a problem with symmetric algorithms.
Examples of symmetric cryptography algorithms are Ace algorithm, which is used in TLS services and
RC four algorithm used in wireless encryption services.
The second type of key generation cryptographic algorithm is a symmetric algorithm.
These algorithms have a key pair where a private key is generated through a logic computation, and
a public key is derived from the private key.
Users who are sending the data can encrypt the data using their private key, and users receiving the
data can view the data using the sender's public key.
As the name suggests, a public key can be made public and available to all.
A symmetric algorithms are one way algorithms where you can derive the public key from the private key,
but vice versa is not possible.
Asymmetric algorithms are slower compared to symmetric algorithms.
Moreover, generating a larger key size further affects the performance.
You always need to balance out performance and security with key generation algorithms.
Examples of asymmetric algorithms are RSA algorithm, which is used with excess of servers in cloud
computing and ECC algorithm, which is used within the world of the blockchain.
In blockchain, we heavily use ECC algorithm for key generation.
It is a type of asymmetric algorithm and more secure than others.
We don't directly use the private key and public key in each algorithm.
We apply a certain transformation and bass convergence to make it suitable for blockchain when importing
ECC private keys.
A shorter format known as wallet import format is often used, which offers a few advantages over the
standard formats.
The wallet import format is more concise and includes built in error checking codes so that the typos
can be automatically be detected and corrected.
Moreover, it also includes special bits indicating how it is intended to be used.
The private key is used to generate a blockchain address from the public.
Key hash values and the checksum data are converted to an alphanumeric representation using a custom
scheme to generate an accepted address for blockchain.
Blockchain addresses are like email addresses.
You can send cryptocurrency to a person by sending coins to one of their addresses.
Let's now understand how these three different entities work and why do we need them.
Private keys are required in blockchain to generate a unique signature for the transaction.
The generated signature can be used for verification and validation of the transaction and showcase
the ownership of a specific user by checking the transaction signature.
We can also verify that nobody has altered it.
In simple words, private keys are used to sign the transactions containing cryptocurrencies, which
you want to transact with other users.
This signature for the transactions provide proof of ownership to other participants over the blockchain.
Private keys are like secret keys for your accounts.
If someone obtains your private key, then he or she can easily take out your cryptocurrencies.
This has happened with numerous hacks over exchanges throughout the world.
Some exchanges store private keys on a secure, centralized server.
Hackers were able to access and hack these central servers.
This gave them the access to all the private keys of the users registered with the crypto exchange,
and they were able to transfer the cryptocurrencies out of the users accounts by using the hacked private
keys.
A simple example of a private key is shown on the screen where you can see that it has a alphanumeric
string of a certain fixed length with different characters.
Public keys are generated from the private keys and they are irreversible.
You can generate a public key from a private key, but vice versa is not possible.
Even a supercomputer may take multi-million years to derive a private key from a given public key.
Public keys are named as such because they can be distributed to anyone in public.
They are open for public viewing and help the receiving party to verify the data.
The person sending a transaction can encrypt the data using the private key and on the other end the
receiver can verify the data using the public key provided to him by the same person.
You can see an example of public key on the screen.
This is also an alphanumeric string similar to a private key.
The example public key is generated from the algorithm.
Every public key is 256 bits long in blockchain and the final hash, which is also your wallet address
is derived from the public key is 160 bits long.
SEC uses the coordinate system for cryptography, thus the generated public key has both X and Y coordinates.
Addresses are generated from the public key, where it represents a possible destination for a cryptocurrency
payment or data upload.
An address is also an alphanumeric string of fixed length, which is generated by transforming public
keys through hash functions and encodings.
Several characters inside an address are used as a checksum so that typographical errors can be automatically
found and rejected.
For example, in Bitcoin, addresses are 34 characters.
They consist of random digits and uppercase and lowercase letters with the exception that the uppercase
letter or uppercase letter I lowercase letter L and the number zero are never used.
This is to prevent visual ambiguity.
Addresses always appear between a transaction where two parties are sending some data or currency.
A simple example of address can be seen on the screen.
This image shows the generation hierarchy for keys and addresses.
A private key is a large, randomly generated number.
Different algorithms have different parameters for generation of private keys.
For example, in the RSA algorithm, a private key is a large, random prime number.
A public key is generated from the private key and distributed to everyone.
This is a one way algorithm where you can easily generate a public key from a private key, but the
reverse is not possible.
A person sending a transaction or data can encrypt the data using the private key, and others who want
to view the data can use the sender's public key to access the data.
An address is generated from the public key by putting the key through different transformations and
Encodings and address is used to receive the transaction in blockchain.
We have already discussed a bit about addresses and keys to know more.
You can also go through the wiki pages containing the research papers on blockchain.
Now let's go and understand some more blockchain fundamentals related to transactions and blocks.