How Bitcoin Wallets Work
Bitcoin wallets hold a user’s keys, allowing users to receive bitcoin, sign transactions, and check their account balance. The private and public keys held in a bitcoin wallet serve two distinct functions, but are tied together in creation.
Bitcoin wallets contain a user’s keys, not their actual bitcoin. Conceptually, a wallet is like a keychain in the sense that it holds many pairs of private and public keys. These keys are used to sign transactions, allowing a user to prove they own transaction outputs on the blockchain, i.e. their bitcoin. All bitcoin is recorded on the blockchain in the form of transaction outputs.
If a user loses their wallet, they can use a mnemonic phrase, known as a seed, to restore the wallet. Keeping private keys and seed phrases secure is essential to protecting against internal and external threats that can compromise the users bitcoin.
Wallets Use Private and Public Keys
Cryptographic key pairs are used to send and receive Bitcoin. A key pair is comprised of a private key and a corresponding public key. Private keys are used for sending bitcoin and must be kept secret. Public keys are used for receiving bitcoin and can be shared with anyone. Public keys are derived directly from a corresponding private key.
➤ Learn more about private and public keys.
Creating a Bitcoin Wallet
When you create your Bitcoin wallet, a seed is created. Seeds are displayed in the form of a series of words, known as a mnemonic phrase. This seed is used to derive every individual Bitcoin key that you’ll use to send and receive bitcoin. You should never share this seed with unknown parties.
This design is known as a Hierarchical Deterministic (HD) framework, which is an industry standard for Bitcoin key generation and management.
Most wallets will automatically create new public keys each time you want to receive bitcoin. This alleviates the problem of public key or address reuse. If you use the same public key every time you receive bitcoin, it would become trivial for anyone to track your entire payment history. Treating keys as single use tokens greatly improves a user’s privacy.
Addresses vs. Public Keys
Public keys are often conflated with addresses. An address is derived directly from a public key through a hashing algorithm, and almost all wallets and transactions will display addresses rather than public keys. Behind every address is a public key.
Addresses are shorter than public keys, and usually begin with a ‘1’, ‘3’, or ‘bc1’, while public keys begin with ‘02’, ‘03’, or ‘04’.
➤ Learn more about deciphering Bitcoin data.
Backing Up Your Bitcoin Wallet
As long as a user knows their recovery seed, typically a 12- or 24-word list that was initialized with their wallet, they will always be able to restore their wallet.
A wallet will store many addresses and private keys as you send and receive bitcoin, but you only need to backup your wallet once. Because an HD wallet creates addresses deterministically using the same seed, all of your addresses can be backed up using the mnemonic word representation of that seed, also known as a recovery phrase.
Likewise, if your recovery phrase is exposed to someone, they have the ability to steal all of your funds. Keeping the recovery phrase safe from strangers and ensuring you do not lose or forget it are equally important.
➤ Learn more about backing up and restoring a self custody wallet.
Bitcoin Wallets and the Bitcoin Network
Bitcoin wallets are lightweight pieces of software, and they do not usually store the entire blockchain. Thus, in order to keep track of a user’s balance and inform them of their transaction statuses, a Bitcoin wallet must query the blockchain.
Some wallets query central servers run by the wallet provider, but the best wallets allow users to connect their wallet to their own node. Using a wallet which queries their own node will protect a user’s privacy by avoiding sharing their addresses and transactions with a third party. Additionally, it enables users to use Bitcoin in a trustless manner.
Key Takeaways
- Wallets are software apps which generate and store keys used to send and receive bitcoin.
- Wallets can be backed up by storing the 12-24 word recovery phrase given by the wallet at inception.
- This recovery phrase allows ultimate recovery of all funds within a wallet, so they must be protected against loss and theft.