Why You Can Trust Blockchain (Even When You Can’t Trust People)?

Published:

Author:

Sankrit K.

Why You Can Trust Blockchain (Even When You Can’t Trust People)?

Takeaways

  • Blockchains eliminate the need for intermediaries using cryptography.
  • Cryptography goes beyond encryption and helps with data integrity and identity verification.
  • Hashing ensures data integrity by converting input into fixed-length outputs that are irreversible, unlike encryption.
  • Digital signatures use private keys to prove message authenticity in decentralized systems.
  • Cryptography isn't foolproof. Its effectiveness depends on variables like proper implementation, key management, and consensus mechanisms.

For the longest time, we have relied on trusted third parties (middlemen) to interact with people worldwide.

When browsing websites, we rely on Certificate Authorities (CAs) to verify the website's legitimacy. When sending money, we rely on banks to ensure our money is received by the right person.

But what if the middleman is no longer honest (compromised)? Is there a way to operate without a middleman, i.e., run trustlessly?

Blockchains are the answer to this. They facilitate secure, trustless interactions between peers by leveraging cryptography.

In this article, we will discuss the role of cryptography in keeping blockchains secure and tamper-proof.

Understanding Cryptography

Cryptography is the science of securing information through probabilistic algorithms and mathematical calculations. It is used to provide confidentiality, integrity, and authentication of data.

In simpler words, cryptography can be called the 'science of chance' because it relies on probabilities rather than certainties.

It involves the study of codes and ciphers, where a code is simply a mechanism for replacing ordinary text with something else, and a cipher is a mechanism for scrambling or transforming the data.

This cipher mechanism can be cracked by guesswork. But the mathematics behind that is such that the time taken to crack the code is long enough that it may as well be considered unbreakable.

Cryptography In Blockchains: Going Beyond Encryption

Cryptography is the foundation for blockchains and cryptocurrencies (hence the name).

When people think about cryptography in blockchain, the first thing that pops up in their minds is "encryption."

Encryption is the process of transforming plaintext into ciphertext, which can only be read by someone who has the appropriate decryption key. This is essentially how public-private key cryptography works.

They assume "everything in a blockchain is encrypted."

That is not entirely true. Cryptography has many use cases in blockchain than just encryption. The main ones are:

  • Hashing
  • Authentication
  • Digital signatures

Hashing

Hashing is the process of taking data and turning it into a unique, fixed-length string called a hash. Hashes are used to index data in databases, detect duplicates, identify files, and validate the integrity of data.

Hashing is designed to provide integrity, that is, to verify that a piece of data has not been altered or tampered with. A hash function takes an input of any length and produces an output of a fixed length, usually much smaller than the input.

For example, take the SHA-256 hashing algorithm (the one used by Bitcoin). The way it works is that no matter the size of your data if you run it through this algorithm, you will get an output that is always 64 characters in length.

In the above image, you can see we passed two texts of different lengths through the SHA-256 hashing algorithm, and we got an output that is 64 characters long. You can play around with the algorithm yourself using this tool.

Hashing might sound similar to encryption, but it is not.

A key difference between encryption and hashing is that encryption is a reversible process, while hashing is irreversible. This means that in the case of encryption, the original plaintext can be recovered from the ciphertext using the appropriate decryption key, but it is impossible to recover the initial input from the hash.

Authentication

In a decentralized environment like blockchain, where there is no central authority or trusted intermediary, cryptographic authentication plays a significant role in verifying the identity of users and ensuring that only authorized parties can access certain resources or perform specific actions.

One common method of authentication in the blockchain is through digital signatures.

Digital signatures provide a way to prove that a message or transaction was created by a particular user and has not been tampered with since it was signed. This is done by generating a unique digital signature for each message using the user's private key, which can only be decrypted using their public key.

Another method of authentication in the blockchain is through public key cryptography.

Each user on the network has a public key and a private key, and these keys are used to encrypt and decrypt messages and transactions.

When a user wants to authenticate themselves to another user, they can send a message encrypted with their private key. The recipient can then use the sender's public key to decrypt the message and verify the sender's identity. This is known as a challenge-response protocol.

Related Article: What Is A Wallet Address? A Beginners Guide To Crypto Wallet Addresses

Digital Signatures

A digital signature is a cryptographic technique that is used to ensure the authenticity and integrity of a message or document.

Basically, digital signatures are used to prove that a message or document has not been altered since it was signed and to identify the signer. It also ensures that the signer cannot later deny having signed the message. This is called "non-repudiation."

Creating a digital signature is reasonably straightforward. It involves only two steps:

  1. Apply a hash function (like SHA-256) to the message or document you want to send.
  2. Now, encrypt the resulting hash value with your own private key, i.e., the signer's private key.

You have successfully created a digital signature!

Here's a breakdown of what is happening in the background of each step:

  • In step 1, you have hashed the message. So, nobody will be able to reverse engineer the algorithm to see what your secret message is. It is protected.
  • In step 2, you encrypt it with your own private key. Since encryption is reversible (as discussed earlier), and because you have encrypted with your private key, it can be proven that you are the true signer of the document.

Don't Fly Blind

While cryptography is an essential tool for ensuring the security and privacy of our digital communications and transactions, it is not foolproof and cannot be trusted blindly. It is essential that users of cryptographic systems understand the underlying technologies behind them and are aware of any potential weaknesses or vulnerabilities.

For instance, cryptography is also used in Web2. We don't realize it, but we are constantly interacting with public key cryptography when we visit a website. The reason why things are not falling apart is because of trusted intermediaries.

In a blockchain, the work of intermediaries is taken over by the consensus mechanism and validator nodes. Hence, cryptography, on its own, may prove to be harmful if there are no validators.

Written by

Sankrit K.

Sankrit is a content writer and a subject matter expert in web3. His experience includes working with Ledger, Alchemy, and CoinGecko to supercharge content-led growth. Sankrit specializes in creating content that is easy to understand while accurately explaining technical concepts.

Share to