Not your Bitcoin basics← Back to YourBitcoinBasics.com

From Chapter 8: “To see every step, go to NotYourBitcoinBasics.com/buying.”

What happens when you buy bitcoin

In simple words

You pay, and the bitcoin shows up in your exchange account or in your own wallet. That is all you see. Behind the scenes, the exchange signs a transaction, a miner adds it to the ledger, and your wallet reads the ledger.

A diagram with you on the left and the exchange on the right. Step 1, custodial: you pay $100 and see 120,000 sats in your exchange account. Or step 2, self-custody: you ask to withdraw and give your address. Behind the scenes, step 3: the exchange signs a transaction that spends 5,000,000 sats and creates 120,000 sats locked to your address, 4,879,500 sats of change, and a 500 sat fee. Step 4: a miner adds the transaction to a new block. Step 5: your wallet reads the ledger and shows 120,000 sats.
What you do and see (the thick orange arrows), and what happens behind the scenes (the thin dashed arrows).

How to read the picture

The thick orange arrows are the things you do and see. The thin dashed arrows happen behind the scenes. The example uses $100 at a price of about $83,000 for one bitcoin. That buys about 120,000 sats.

Step 1. You pay $100 (custodial)

You pay the exchange. The exchange writes “120,000 sats” next to your name in its own records. Those records are a company database. They are not the blockchain.

You can stop here. You see 120,000 sats in your exchange account. Your own wallet shows nothing. The exchange holds the keys, and what you hold is an IOU, a promise from the company. Nothing has changed on the blockchain. This is rung one of the custody ladder in Chapter 9.

Step 2. You ask to withdraw (self-custody)

Open your own wallet and tap Receive. The wallet shows an address. Copy the address and paste it into the exchange’s withdrawal screen. Check the whole address, then confirm.

A few minutes later, you see 120,000 sats in your own wallet. You hold the keys. Sometimes it takes longer. An exchange may hold a first withdrawal for review, and many exchanges send withdrawals in groups. In this example the exchange pays the miner’s fee. Many exchanges charge you a withdrawal fee instead.

Steps 3, 4 and 5 happen without you.

Step 3. The exchange signs a transaction

The exchange’s wallet holds an entry on the ledger worth 5,000,000 sats. The exchange uses its private key to sign a transaction. The transaction spends that whole entry and creates new ones:

It works like paying with a $50 bill and getting change. To see why Bitcoin works in pieces and not balances, see Pieces, not balances.

Step 4. A miner adds the transaction to a new page

The transaction waits with other people’s payments. A miner puts it into the next block, which is a new page of the ledger.

The old 5,000,000 sat entry is not erased or changed. It stays on its old page forever, marked as spent. It can never be spent again. Pages are added to the ledger. They are never changed.

Step 5. Your wallet reads the ledger

Your wallet looks through the ledger for entries locked to your addresses. It finds the new one and shows 120,000 sats.

The bitcoin is not inside the wallet. It is an entry on the ledger that only your private key can move.

Where is the private key?

The private key is on your device, which is your phone or your hardware wallet. It is locked by your PIN. It never goes to the exchange, and you never type it anywhere. The address you gave the exchange is made from your public key. An address is safe to share.

What if you lose the device?

The bitcoin is still on the ledger. A person who finds the device needs your PIN to use it, and most hardware wallets erase themselves after a set number of wrong tries.

Get a new device and type in your 12 or 24 words. The new device rebuilds the same keys and finds the same bitcoin. Then move the bitcoin to a brand-new wallet with new words, because the old device is out of your hands.

Two things the picture leaves out

A real wallet makes many keys and many addresses from one set of seed words. The picture shows one of each. To see how, go to How 12 or 24 words become every key.

An exchange often pays many customers in one transaction. Your withdrawal may share a transaction with withdrawals to people you will never meet.

Try it

The next time you withdraw, find your transaction. Open the transaction in your wallet and choose the option to view it on a block explorer. Find three things: the entry locked to your address, the block it is in, and the fee.

New to block explorers? Start with the guide at YourBitcoinBasics.com/mempool

Words on this page

Exchange
A store that sells bitcoin to the public, like a currency booth.
Custodial
Someone else holds your key.
Self-custody
You hold your own key.
Address
The number on the mailbox, the thing you hand to someone who wants to pay you.
Private key
The secret that lets you move your entry.
Public key
The key you can share. It is made from your private key, and your wallet turns it into the addresses people pay you at.
Miner
A computer competing to add the next block, paid in new bitcoin and fees when it wins.
Block
A page of the ledger, a batch of transactions added about every 10 minutes.
Mempool
The queue of checked, unconfirmed transactions, waiting for a miner to put them in a block.
Seed phrase
The 12 or 24 words that rebuild every key in your wallet.
UTXO
An unspent entry on the ledger, a specific amount of bitcoin, locked to your key, that you have not spent yet.

Sources

  1. This page walks through the example in Chapter 8 of Your Bitcoin Basics.
  2. Satoshi Nakamoto, “Bitcoin: A Peer-to-Peer Electronic Cash System” (2008), sections 2 and 9. https://bitcoin.org/bitcoin.pdf