Public and private keys are strings of text or numbers used to encrypt and decrypt data and “sign” transactions. They come in pairs. They are part of a wider technology known as “public-key cryptography” which is a foundational technology that underpins much of the internet today. For example, it’s what allows you to submit your credit card information over the internet, knowing that only the receiver will be able to see or decrypt your card information.
Within Blockchain and DLT networks, public and private keys serve an essential purpose - they are what enable the network to verify whether someone wishing to execute a transaction, such as sending a token, has the authority to do so.
Private keys, as the name suggests, are kept private. Each private key creates a matched public key that can be freely provided to anyone (together, they are called your “keypair”). You can’t go the other way: through some mathematical cleverness, nobody with the public key can ever figure out what the matching private key is. The magic happens when, for example, a user uses the private key to sign something, e.g., a message, transaction, or piece of data associated with the public key. In that case, anyone can be 100% certain that only the person who has the private key that matches the public key could have signed it.
A public key is like a business card that says, “this is me!” - while the private key lets you prove without a doubt that you are the person on the card. Anyone can even send an encrypted message to a given public key that only the holder of the matched private key can read!
On blockchains and DLT networks, the public key is used to create your address where you can hold and transact tokens. Each transaction through that account must be signed by the matching private key for that account/public key; this lets the network automatically verify without a doubt that the right person is requesting the transaction – as long as nobody else knows the private key!
It is absolutely essential that you keep your private key (or seed phrase - basically a kind of private key) safe. If someone has access to your private key or seed phrase, they have control of your account and any of the tokens it holds.