The term “wallet” as it relates to cryptocurrencies is a little bit deceiving. A cryptocurrency wallet is a piece of software which lets users send and receive and store cryptocurrency. It does this by generating messages about changes they want to make to their balance on a single shared public ledger known as a blockchain. The term is deceptive because no cryptocurrency is actually saved in a wallet as one might imagine. Because of this, wallets don’t really have cryptocurrency coming in and out of them either.
Instead of storing digital coins, a cryptocurrency wallet stores and uses what is known as a “private key”. Private keys, as indicated by the name, are kept private, but through a special mathematical function private keys can generate thousands of related “public keys” to which they are uniquely linked. Public keys are the accounts which are publicly listed on a blockchain displaying balances. For a user to receive a cryptoasset to their wallet, user 1’s wallet generates a public key and gives it to user 2. User 2 then uses their wallet to transfer some of their balance to the public key of user 1. The blockchain reflects this change in balance by subtracting value from user 2’s account and adding it to user 1’s.
To send a transaction, a wallet uses its private key to sign a digital message requesting a change in balance which it then sends to the network of computers maintaining the blockchain. Because the private key is mathematically linked to the public key that owns the balance on the blockchain, this message proves to the network that the sender of the transaction is the true owner of the balance and the requested change in balance is valid. Once a wallet creates a message requesting to change their balance, the message is broadcast across the network of computers maintaining the blockchain and the blockchain updates to reflect the changes (subtracted value from one account, added value to another).
Through this function of using a private key to generate public accounts and sign unique messages about desired changes to the balance of these public accounts, a cryptoasset wallet allows users to effectively store, send and receive cryptoassets. In reality, however, the only thing “stored” in the wallet software is the private key and the function of the wallet is to write public messages that mathematically prove that the writer of these messages owns the private key. The math involved in this process is known as asymmetric encryption.