Sub topic 1
What a wallet really holds: keys, addresses and signatures
A crypto wallet does not hold coins. Coins are recorded on a blockchain, a shared public ledger of who owns what. A wallet holds the keys that prove ownership and authorize transfers.
Prerequisites
This chapter assumes you know what Bitcoin or Ether is, that you have used online accounts with passwords, and that you have a basic idea of public-key cryptography. The Python example needs Python 3 and no extra packages.
Keys, addresses and signatures
A private key is a secret number, usually 256 random bits. A public key is derived from it using elliptic-curve math. An address is a shorter identifier derived from the public key. You can share an address safely.
To spend coins, the wallet uses the private key to create a signature over the transaction. The network checks that signature against the public key linked to the coins. A valid signature proves authority without revealing the private key.
import secrets
private_key = secrets.token_bytes(32) # 32 bytes = 256 random bits
print(len(private_key) * 8, "bits") # prints: 256 bitsCustody means control of the keys
Custody means control of the signing keys. Whoever can sign can move the coins. Confirmed blockchain transactions generally cannot be reversed, so control of the key is control of the money.
How custodial wallets work
In a custodial wallet, a company such as an exchange generates and stores the keys. You log in with a password, often with two-factor authentication. The company signs transfers on your behalf. Your balance is a record in the company's database.
How self-custody wallets work
In a self-custody wallet, the app or device generates the keys and keeps them on your side. Only you can sign. The wallet gives you a seed phrase, a list of words that can recreate all of your keys. If you lose the phrase and the device, no company can reset access.
Exercise
A friend says their exchange balance is "in their wallet." Who holds the private keys, and what does the balance represent?
Show answer
The exchange holds the private keys, so the friend has a custodial account. The balance is a database record that the exchange controls, not coins the friend can sign for directly.