Source: Crush Crypto
The creation of Bitcoin in 2009 marked the birth of the first digital currency to achieve widespread adoption across the globe. However, the concept of a secure digital currency has been around since the 1980s and there have been many previous attempts that directly inspired Satoshi Nakamoto’s creation of Bitcoin.
- Encryption: Encoding text into an unreadable format.
- Decryption: Reserving encryption – converting a jumbled message into its original form.
- Cipher: An algorithm for performing encryption or decryption, usually a well-defined set of steps that can be followed.
Cryptography before the modern age was synonymous to encryption – the process of converting information from a readable format to something that makes no sense. Encryption techniques date back as far as the ancient Egyptians, and have roots spanning all throughout history.
For example, the Caesar Cipher is a famous cipher used by Julius Caesar to securely communicate with his generals. The cipher “shifts” each letter in a message by a certain amount – with a shift of 2, A would become C, B would become D, and so on.
Blockchain technology makes use of cryptography in multiple different ways – for wallets, transactions, security, and privacy-preserving protocols. This article will cover some important cryptography topics that relate to blockchain technology including public-key cryptography, hashing, and Merkle trees.
Public-key cryptography (also called asymmetric cryptography) is a cryptographic system that uses a pair of keys – a public key and a private key. The public key may be widely distributed, but the private key is meant to be known only by its owner. Keys are always created in a pair – every public key must have a corresponding private key.
Public-key cryptography is most often used for encrypting messages between two people or two computers in a secure way. Anyone can use someone’s public key to encrypt a message, but once encrypted, the only way to decrypt that message is by using the corresponding private key.
Let’s say Alice wants to send an encrypted message to Bob. It would work like this:
- Alice uses Bob’s public key to encrypt the message.
- Alice sends the encrypted message to Bob – if a third party intercepted it, all they would see is random numbers and letters.
- Bob uses his private key to decrypt and read the message.
A diagram illustrating this process is shown below:
Public-key cryptography is a fundamental element of blockchain technology – it is the underlying technology for wallets and transactions. When a user creates a wallet on a blockchain, they are generating a public-private key pair.
The address of that wallet, or how it’s represented on the blockchain, is a string of numbers and letters generated from the public key. Due to the nature of blockchain technology, this address is public to everyone and can be used to check the balance in that wallet or send coins to it.
The private key associated with a wallet is how to prove ownership and control the wallet. It is the only way to send coins out of it, and a lost private key means the coins inside will be stuck there forever.
A transaction on the blockchain is nothing more than a broadcasted message that essentially says, “Take X coins from my wallet and credit X coins into another wallet”. Once confirmed, the transaction is immutably written into the ledger, and the balances are updated.
However, this transaction message requires a signature from the private key of the sending wallet to be valid. After broadcasting, anyone can use that wallet’s public key to ensure the digital signature coming from the private key is authentic. This is one role of block validators before they add any transaction (i.e. message) to the blockchain.
Cryptographic hashing is another fundamental piece of blockchain technology and is directly responsible for producing immutability – one of blockchain’s most…