Private and Public Keys
@ The goal of public and private keys is to prove that a spent transaction was indeed signed by the owner of the
funds, and was not forged.
@ When you own cryptocurrencies, what you really own is a “private key” which unlocks the right for its owner to
spend the associated cryptocurrencies. As it provides access to your cryptocurrencies, it should remain private.
@ It’s possible to recover the public key if you own the private key. However, it’s impossible to find the private key
using only the public key.
If you’ve been dabbling in crypto for a little while, you may be wondering how on earth your
crypto wallet works. You wouldn’t be alone, as they aren’t the most straightforward pieces of
tech to grasp.
Of course, there are many sides to how a crypto wallet works: the underlying blockchain tech
that allows it to operate, the device you use to initiate the transaction, and how that device
interacts with the network. But if you want to take a deep dive into understanding crypto wallets,
you may want to start with how they work on the blockchain first.
You probably already know that your crypto wallet uses public and private keys to operate. But
did you know that public and private keys existed long before cryptocurrency? It’s all thanks to a
cryptography concept called Public Key Cryptography (PKC) or Asymmetric Encryption.
But what on earth is that exactly?
The Origin of Public and Private Keys
The general purpose of PKC is to enable secure, private communication using digital signatures
in a public channel with potentially malicious eavesdroppers.
In doing so, PKC allows for transitions from one state to another while making reversing the
process nearly impossible. This process proves you have access to the secret without exposing it
to any other parties. To do this successfully, PKC uses an important one-way mathematical
concept called a Trapdoor function. Put simply, Trapdoor Functions are mathematics problems
that are easy to compute in one direction but nearly impossible to reverse. In essence, it’s perfect
for validating authenticity as the trapdoor function means it cannot be forged.
To clarify, solving this problem will take computers enormous amounts of time (i.e., thousands
of years) to compute the correct answer. In the context of PKC, such mathematical tricks as
Prime Factorization are the trapdoor functions that make reverse-engineering (i.e., forging)
cryptographic signatures impossible. Essentially it requires the computer to solve a virtually
unsolvable math problem.
To keep you secure, PKC relies on a two-key model: the public and private keys. It’s these two
important components that work together to keep your important information safe. But what’s
that to do with crypto?
Public and Private Keys in Cryptocurrency
Well, private and public keys are integral for public blockchains to operate. In the context of
cryptocurrencies, PKC is used to prove that a transaction was signed by the owner of the funds
rather than the result of forgery.
So how does that fit into the blockchain tech you already know about? And what on earth does
“signing” a transaction entail? Let’s refresh ourselves on how public and private keys work in
crypto wallets first.
Public and Private Keys in Crypto Wallets
Typically, crypto wallets each use a private and public key. To clarify, your public key can be
shared with anyone. Conversely, your private key is the code that will allow anyone access to the
funds stored at that public address.
But actually, there’s a little more to it than that.
What Are Private Keys?
Private keys are at the base of every blockchain account, and necessary for even the simplest of
actions. For starters, when people say they “own” cryptocurrencies, what they really own is the
private key to the wallet that stores those assets. To clarify, cryptocurrencies are always stored
on the blockchain network, not within a crypto wallet itself. Instead, you own the private key that
allows access to the account.
This private key unlocks the right for its owner to spend the associated cryptocurrencies.
However, should anyone get hold of it, it would also grant them access to your account. That’s
why – as the name suggests – it should remain private. There’s only one private key to your
account and it functions as your private password only you should know.
However, your private key doesn’t just grant access to funds, it controls the whole basis of how
your crypto wallet works and how you interact with other accounts. Most crypto wallets will
actually use your private key to create your public key.
What Are Public Keys?
Public keys are visible to all users in the network, and sometimes even beyond the network too.
Essentially, public keys act like an account number. They make each wallet uniquely identifiable
to participants on the network. Like the private key, a public key is made up of a long sequence
of numbers. Typically, it’s generated using the private key, but that’s not always the case. It also
allows you to create something you’re probably more familiar with, a blockchain address.
Usually, your blockchain address is just a hashed version of that public key.
What Is a Blockchain Address?
Your blockchain address is the code you can share with others to receive cryptocurrencies.
Typically, it’s derived from your public key. When you send cryptocurrency to someone else,
this is the address they will see. For Ethereum, it’s that long hexadecimal number starting with
0x. Then for Bitcoin, you might notice that your wallet will generate a new address each time
you transact. Both of these methods are fine, and, to clarify, this blockchain address is
completely safe to share.
Public Vs Private Keys: How Do They Work?
So now you know what private and public keys are; what about how they work? Well, each of
them has its specific roles but is equally important when executing transactions or signing
approvals. That said, how your public and private keys interact depends entirely on what you’re
trying to do with your crypto wallet.
While PKC allows for encryption and signing, crypto networks only use the latter. Signing is for
verifying the authenticity of a transaction, guaranteeing it wasn’t forged or tampered with. Let’s
see how it works.
Signing a Transaction with your private key
For example, let’s say you want to send 1ETH to your friend Bob using the Ethereum Network.
In this case, you would find out Bob’s blockchain address, which. Just like you, Bob also has a
set of public and private keys, and his private key is the only one that controls the address of the
corresponding public key.
When you try to send any Ether, you will have to initiate a transaction request. Within that
request, you specify the amount you want to send and where you want to send it—in this case we
want to send 1 ETH to Bob’s account. From there, your crypto wallet uses your private key to
sign the transaction. A signature is like a digital fingerprint; it proves to the blockchain that you
intend to carry out the plan in the attached message. It also proves you are who you say you are.
Your signature is created by your private key and includes the transaction details, which
eventually become part of the transaction’s data.
Once you sign, the signed transaction is broadcast to the network. That means every node in the
network can review it. In this example, Ethereum validators verify that the signature matches
your public key, guaranteeing you are who you say you are, and thus own the funds that you are
trying to spend. They also check that Bob’s address actually exists on the network and that the
transaction is sound overall. If the conditions are met, the transaction will be confirmed. The 1
Ether will disappear from your account and arrive in Bob’s.
As the owner of your private key, only you can sign the transaction capable of moving your
funds. As long as you keep your private key private, no one can move your funds on the
blockchain. Yes– even though you are sharing your public key, your address, and the signatures
of all your transactions, your funds remain safe. This is the brilliance of trapdoor functions in
action.
Private Vs Public Keys: The basis of your crypto wallet
Of course, public and private keys are just the beginning of understanding the inner workings of
your crypto wallet. While they provide the basis for peer-to-peer transfer of value, crypto wallets
have evolved to do much more. Today, there are countless different types of wallets, each using
this technology slightly differently.
Want to know more about your crypto wallet? Read on to dive into how today’s wallets work,
allowing you to manage countless accounts from a single interface.
Difference between Private Key
and Public Key
Private Keys and Public Keys terms are used in cryptography. These keys are
used to encrypt/decrypt sensitive data. Read through this article to find out
more about private and public keys and how they are different from each other.
What is Private Key?
The private key is used in both encryption as well as decryption. This key is
shared between the sender and receiver of the encrypted sensitive information.
The private key is also called "symmetric" because it is shared by both parties.
Private key cryptography is faster than public-key cryptography mechanism.
A private key is generally a lengthy, non-guessable sequence of bits created
randomly or pseudo-randomly. The complexity and length of a private key
define how easy it is for an attacker to carry out a bruteforce attack, in which
they test out several keys until they find the appropriate one.
What is Public Key?
Asymmetric cryptography, often known as public-key cryptography, is a type
of encryption that employs pairs of keys. A public key (which may be known to
others) and a private key (which may not be known to anyone except the
owner) make up each pair. Cryptographic techniques based on mathematical
problems known as one-way functions are used to generate such key pairs.
A private key should be kept secret for effective security; a public key can be
freely circulated without jeopardizing security.
In such a system, anybody can encrypt a message using the intended receiver's
public key, but only the receiver's private key can decode the message. This
allows a server application to produce a cryptographic key for compatible
symmetric-key cryptography, then encrypt that freshly generated symmetric
key using a client's freely disclosed public key.
A public-key encryption system's most apparent application is for encrypting
communication to guarantee secrecy – a message that a sender encrypts using
the recipient's public key and can only be decoded by the recipient's associated
private key.
Difference between Private Key and Public Key
The following table highlights the important differences between Private Keys
and Public Keys.
Key Private Key Public Key
Private key is used for both
encrypting and decrypting the Public key is used only for the
Algorithm sensitive data. It is shared between purpose of encrypting the
the sender and receiver of encrypted data.
data.
Performanc The public key mechanism is
The private key mechanism is faster.
e slower.
The private key is kept secret and The public key is free to use
Secrecy not public to anyone apart from the and the private key is kept
sender and the receiver. secret only.
The public key mechanism is
The private key mechanism is called
called "asymmetric" because
Type "symmetric" because a single key is
there are two keys for
shared between two parties.
different purposes.
The public key can be used by
The private key is to be shared anyone but the private key is
Sharing
between two parties. to be shared between two
parties only.
Performance testing checks the
Load testing checks the
Targets reliability, scalability, and speed of
sustainability of the system.
the system.
Conclusion
To conclude, private keys can be used for both encryption and decryption, while
Public keys are used only for the purpose of encrypting the sensitive data.
Private keys are shared between the sender and the receiver, whereas public
keys can be freely circulated among multiple users.