Nothing Special   »   [go: up one dir, main page]

Public Key: Meaning, Overview, and Special Considerations

What Is a Public Key?

On a blockchain, a public key is a hashed version of a cryptocurrency's private key. Blockchains use public keys in different ways, but generally, they are digital signatures used to provide proof of ownership and create a public address.

Learn more about public keys and how they are used on most blockchains.

Key Takeaways

  • A public key is a cryptographic code used to create a blockchain address.
  • When a transaction is received, users are issued a private key, which is used to generate the public key.
  • The private key is made available only to its user and authorizes the user to facilitate transactions from their account.
  • The public key is used as a digital signature, which proves ownership of the private key and creates cryptocurrency public addresses.

How a Public Key Is Created

A unique pair of keys is created when a cryptocurrency user receives a crypto transaction: a public key and a private key. The private key is randomly generated and sent through a hashing function (usually an elliptical curve function) to create the public key.

How a Public Key Is Used

In general, before a transaction is broadcast, it is digitally signed using the hashed private key. The signature proves ownership of the private key, although it does not divulge the details of the private key to anyone. Since a public key is fashioned from the private key, the user's public key is used to prove that the digital signature came from the private key. Once the transaction has been verified as valid, the funds are sent to the recipient's public address. The recipient's wallet then generates new private and public keys.

The public key is used to create a public address. When the public key is made, it is a long string of letters and numbers, so it needs to be compressed and shortened to form the public address. On the Bitcoin blockchain, the public address is sent through another function (two zeros are added, and it is sent through Base58Check) to be encoded further. Ethereum uses the last 20 bytes of the public key and adds 0x to the front of it for the public address.

Public Key vs. Public Address

It's common to hear that the public key is the address where your cryptocurrency is. However, this is misleading because cryptocurrency isn't stored anywhere—it is code and bits with assigned ownership. Also, the public key's primary function (on blockchains) is to generate a public address, which is what is broadcast to the network.

Although the public key and address are worked out from the private key, the reverse case is nearly impossible.

So, when two people enter into an agreement where one sends the other tokens or coins, they reveal their public addresses to each other. The public address is like a bank account number. The sender needs the number to send the funds to the recipient, who will then be able to access it with the private key. The recipient can also verify the sender’s batch of coins using their public address, which will be displayed on their screen. The public keys themselves are never exchanged.

Public Key Considerations

The cryptocurrency networks stay secure by using complicated mathematical functions to ensure that a private key is not able to be worked out from the public key.

Since it's impossible to regenerate the private key from the public key or address, if a user loses a private key, any bitcoin or altcoin associated with their public address will be inaccessible forever. On the other hand, a user who loses a public key can have it recreated with the private key.

How Do You Generate a Public Key in Ethereum?

The public key is generated automatically on Ethereum by a wallet.

How Big Is the Ethereum Public Key?

The Ethereum public key is 64 bytes, or 128 characters in hexadecimal format.

How Do I Find My Crypto Public Key?

In crypto, public keys in their entirety are not usually displayed anywhere you can find them because they are not relevant to users. You will generally be able to see your private keys and address in your wallet, and your public address on a blockchain explorer—but not a public key, which differs from your public address.

The Bottom Line

On blockchains with cryptocurrencies, public keys are usually generated from private keys and used to create addresses. Bitcoin uses the public key to make a public key hash and Bitcoin address, and Ethereum uses a portion of it to make public addresses. They are also used to digitally sign transactions on both blockchains.

The comments, opinions, and analyses expressed on Investopedia are for informational purposes online. Read our warranty and liability disclaimer for more info.

Article Sources
Investopedia requires writers to use primary sources to support their work. These include white papers, government data, original reporting, and interviews with industry experts. We also reference original research from other reputable publishers where appropriate. You can learn more about the standards we follow in producing accurate, unbiased content in our editorial policy.
  1. O'Reilly. "Mastering Bitcoin: Chapter 4. Keys, Addresses, Wallets."

  2. Ethereum.org. "Ethereum Accounts."

Take the Next Step to Invest
×
The offers that appear in this table are from partnerships from which Investopedia receives compensation. This compensation may impact how and where listings appear. Investopedia does not include all offers available in the marketplace.