After buying your first Bitcoin, you realize new terms you have never heard before using cryptocurrency. Most new users are already familiar with a digital wallet, but what are “private keys” and “public keys”? Then you realize that these are essential components of owning your Bitcoin. They grant you control of your own money without a bank. It is empowering to have custody of your own Bitcoin, but that requires due diligence in responsibility. To further understand, let us take a look at the techniques behind it.
Public Key Cryptography
The foundation of cryptocurrency is rooted in public key cryptography. This is a system in which keys are generated, called the private key and public key. This is generated by the Bitcoin software. The private key is created first, and is generated using ECDSA (Elliptic Curve Digital Signature Algorithm). This is a mathematical formula that creates the private key, which is actually just a string of numbers and letters. A Bitcoin private key looks like the following (below key is not real, and it is just an example, do not use it):
It appears in hexadecimal format and is 256-bits in length. That is 64 characters long and 32 bytes in size. The private key creates a digital signature used to verify the identity of a wallet’s owner (i.e. the user). From the private key, a public key is also created.
The public key is also 256-bits long and was mathematically derived from the private key. The public key is used to generate a unique wallet public address. More than one address can be created, but for simplicity, let us stick to the concept of one address. This is created from a hash of the public key.
Both private key and public key must be unique since there will be conflict on the network regarding who owns Bitcoin if two users have the same keys. They are just strings of numbers that act as a code to provide cryptographic security for the user’s Bitcoin.
It is called “public” since this is the technique used in open networks like Bitcoin. It is available for anyone to use as long as they have a wallet with keys. The purpose of a wallet is to store the keys, not Bitcoin. This is because Bitcoin is just a value that is stored on the blockchain. The private key is what authorizes access to Bitcoin via the wallet.
How Keys Work
The private key is the most important component since without it you cannot create the public key and public address. The private key is used whenever the user wants to spend Bitcoin. When the user spends their Bitcoin, the private key must authorize the user first. Without the private key, a user cannot spend their Bitcoin. This is a security check to verify that the one spending the Bitcoin is the actual owner based on a digital signature. Once verified, the Bitcoin is unlocked and can be spent on a transaction.
The public key is the component used to create a Bitcoin address. This is like the address used to receive your e-mail or delivery package. The public address is what tells an application’s wallet where to send the Bitcoin. In creating the public address, the public key undergoes what is called a “double-hash” process. First it is hashed using the SHA-256 algorithm followed by RIPEMD160 hashing. This results in a 160-bit hash of the original 256-bit public key. It is then encoded in Base58 to result in the public address. A typical Bitcoin public address has the following format (example taken from BitcoinWiki, do not use):
As you can see it has been further shortened to 34 characters after Base58 encoding. This is what a user needs in order to receive Bitcoin.
Your Keys, Your Coins
Using public key cryptography is important for use on public networks like Bitcoin. Without keys, data could easily be compromised and there would be no security on the network. Having a private key secures your Bitcoin from other users and verifies your ownership. Think of it like your keys at home. You have a key to your car and to your house. If you don’t have the key, you cannot start your car or enter your house.
As long as you have your private key, you can access your Bitcoin. This is why it is important to understand when holding your own Bitcoin away from a digital exchange. On an exchange, you are using a custodial wallet. Your private key is under the exchange and not in your possession. With a personal wallet that is not on an exchange, you have complete control. You just have to make sure you keep your private key safe. Never reveal it to others and it is probably best to make a backup. It is recommended to store the backup offline inside a thumb drive. You can also use a hardware wallet which provides more security since it is offline and only connects online when accessing your Bitcoin.
You cannot replace your private key once it is lost. There can only be one unique private key. It is best to have a backup of it. A private key should not be shared with a third party or other users since they can gain access to your Bitcoin. The third-party should never have access to your private key. Give them your public address instead if they want to send you Bitcoin. As long as your keys are safe, your Bitcoin will always be in your hands.
Glossary Of Terms
Blockchain – A decentralized database for recording verifiable transactions.
Cryptocurrency – A digital asset used as a store of value or form of payment, secured with cryptography.
Digital Exchange – A financial service provider that offers buying, trading, selling and managing of digital assets like Bitcoin.
Digital Signature – A code that is linked to the user’s private key that provides verification of a user’s authenticity.
Digital Wallet – Software that holds a user’s private key which authorizes their access to Bitcoin.
ECDSA (Elliptic Curve Digital Signature Algorithm) – A cryptographic algorithm used in digital signature encryption.
Hash – A one way cryptographic function that produces a fixed output for a variable input.
Hexadecimal – A base 16 number system used to represent Bitcoin private key.
Public Key Cryptography – An asymmetric cryptography technique that uses keys for authorization and verification of a user.
Public Address – Derived from the public key, this identifies a user’s wallet on the network for receiving Bitcoin.
Private Key – Unique mathematical code generated by the Bitcoin software that authorizes a user’s access to their Bitcoin.
Public Key – A unique number that is mathematically derived from the private key that is used to generate a public address.