Asymmetric cryptography or public cryptography is an essential component of cryptocurrencies like Bitcoin and Ethereum. These advanced cryptographic techniques ensure that the source of transactions is legitimate and that hackers can not steal a users funds. Here’s an in-depth look at how blockchains accomplish this with public key cryptography:
What is Public Key Cryptography?
Public Key Cryptography is a cryptographic system that relies on a pair of keys, a private key which is kept secret and a public key which is broadcasted out to the network. This system helps ensure the authenticity and integrity of a message by relying on advanced cryptographic techniques.
Here’s an example of how public key cryptography is used in practice: Let’s say a user Alice wants to send a message to Bob over an unreliable channel of communication like the internet. Alice could use public key cryptography by generating a set of public and private keys. She could then post her public key to Bob. Now, whenever she wants to communicate to Bob, she can add a digital signature to her message by using her private key. This would prove that she is the creator of the message. Bob can verify the same using the message he received and Alice’s public key.
Public Key Cryptography in Bitcoin
Public Key Cryptography is an essential part of Bitcoin’s protocol and is used in several places to ensure the integrity of messages created in the protocol. Wallet creation and signing of transactions, which are the core components of any currency rely heavily on public key cryptography. Bitcoin’s protocol uses what’s called the Elliptic Curve Digital Signature Algorithm (ECDSA) to create a new set of private key and corresponding public key. The public key is then used with a hash function to create the public address that Bitcoin users use to send and receive funds. The private key is kept secret and is used to sign a digital transaction to make sure the origin of the transaction is legitimate.
Digital signatures are quite similar to actual signatures on a document. They help ensure that the author of a transaction is, in fact, the individual who holds the private key. Digital signatures are the backbone of Bitcoin and every transaction has a different digital signature that depends on the private key of the user. Also, given the message, the public key of the user and the signature, it is non-trivial to check if the signature is authentic. More formally, digital signatures depend on two functions:
Sign (Message, Private Key) -> Signature
Given the message we want to sign and a private key, this function produces a unique digital signature for the message.
Verify (Message, Public Key, Signature) -> True/False
Given the message we want to verify, the signature and the public key, this function gives a binary output depending on whether the signature is authentic
Once the transaction is signed by the owner, the transaction is sent to the memory pool where it sits to be processed by miners. The miners use the sender’s public key to ensure that the digital signature is authentic so that a hacker cannot spend a user’s funds without their consent. If the ownership and digital signature check out, they include the transaction in the next block, and the money is sent from one wallet to another.
Proof of Work
The other major use of cryptography in the Bitcoin protocol is in computing the proof of work function. Miners rely on computing the “SHA256 Hash Function” for a lot of inputs until they find the nonce for a given block before adding it to the blockchain. The difficulty of the mining process is changed by how many zeroes the hash must begin with to be added to the blockchain. This is a unique system as it adjusts higher or lower depending on how many people are mining at any given time. It also makes it computationally infeasible for an attack vendor to go and edit transactions that are already recorded on the blockchain.
Learn more about Blockchain with our Certified Blockchain Expert Certification
Latest posts by Toshendra Kumar Sharma (see all)
- How Can Blockchain Transform Higher Education? - 22 January, 2019
- Why HR Teams Need Blockchain Technology? - 21 January, 2019
- Why Blockchain Is Useful To Lawyers? - 19 January, 2019
- Blockchain Brings Social Benefits To Emerging Economies - 18 January, 2019
- Chilean Treasury Introduces Blockchain Platform For Public Payments - 18 January, 2019