What even is Cryptography?
It is the art of hiding information from non-intended actors.
How is cryptography used on the blockchain?
We need a way to prove the ownership, and authenticity of a person who wants to interact with the blockchain in a decentralized manner.
Validators verify the authenticity of the transaction using signatures that are generated using the private key of the individual. This signature ensures that the data hasn’t been modified or tampered with. It also proves that the the transaction that’s being sent is 1-1 of what the private key has intended to be sent.
What is a keypair?
A keypair is a set of 2 keys, a public key and a private key. Private key: It is intended to be kept private and it can be used to prove ownership. It is an array of unsigned integers generated using a secure random number generator. Public key: It is the corresponding public address of the private key. It is derievd from the provate key using the ed25519 algorithm.
If I have your public key, it is (near) impossible for me get your private key because the only way to do that is through brute-forcing, which may take upwards of a quadrillion years. If I have your private key, it is easy for me to get your public key.
Types of encryption
- Symmetric encryption: uses the same secret for encryption as well as decryption
- Asymmetric encryption: A public key can be used for encryption such that its corresponding private key can be used to decipher the message.
- Reverse asymmetric encryption: We could also sign some data with the private key such that the corresponding public key and its signature can be used to verify whether the data was actually signed by the key. This is known as message signing. This is also how we sign transactions.