How exactly does a bitcoin transaction work?


The Life of a Bitcoin Transaction

If you want to see exactly how bitcoin is moved around the network, you’re in the right place. We will continue building on concepts we’ve already talked about, so make sure you have spent time on our other lessons.

Back to Review

lifeoft.png

1

Get a copy of the blockchain

In order to interact with the shared list of transactions, we need a copy of it!

lt1.png
 

2

Run Bitcoin

We need to a run Bitcoin computer program. Once you download it, you will be automatically connected to other computers who are also running bitcoin. These computers will send you their copy of the blockchain, and your computer will save the file.

lt2.png
 

3

Reference a time you received Bitcoin

Remember there is no Bitcoin stored in your computer, it only exists on the blockchain. That means in order to send someone bitcoin, you have to reference a previous transaction on the blockchain when someone sent bitcoin to you. Bitcoin Core keeps track of all transactions ever made, but it specifically watches transactions that haven’t been sent to someone else already. Each one of these “unspent” transactions is called a UTXO. So if you are ready to spend bitcoin, you need to tell Bitcoin Core which UTXO you would like to spend.

lt3.png
 

4

Sign the message with your private keys

Once you’ve picked the UTXO you want to spend, you need to create your digital signature. This is what you will send other computers in the network to prove you were the recipient of this UTXO. Bitcoin Core is also your wallet, which stores your private keys. Tell Bitcoin Core the UTXO you want to spend, and it will work through some special math to produce your digital signature from your private key.

lt4.png
 

5

Broadcast your message to the network

Now you have a message to send to the network. It says, “I want to spend this UTXO, which is X amount of bitcoin. I want to send it to this address. Here is my digital signature, which proves I was the recipient of this UTXO.”

lt5.png
 

6

Other computers in the network will pick up your message

First your computer will send this message to the several computers that are connected to it, via the internet. Then those computers will send the message to every computer that they are connected to. This process continues.. and in just a few seconds every computer in the network will have seen your message!

lt6.png
 

7

Miners see your message and include it in their next block

Now the race begins. Computers who are using special equipment to add blocks to the chain will see your message and group it with other transaction messages. Remember, whoever wins the guessing game gets to add their version of the next block to the chain.. while also getting a reward of bitcoin. Each block can only fit so many transactions, so your message may not be included in the next block if there are many others in line before you.

lt7.png
 

8

Once a miner solves a block, they send it to the rest of the network

Once a mining computer wins the guessing game, it’s their turn to add a block to the chain. They will send out their block with your transaction inside!

lt8.png
 

9

Computers in the network will verify the block and add to their chain

Now the rest of the network will add this new block to their chain, and your transaction is official and confirmed.

lt9.png
 

REPEAT!

The recipient of your bitcoin can now use this same process to pass their bitcoin to someone else. So you can see, bitcoin isn’t really a digital token.. it’s just a series of transfers on a list called a blockchain. They will point to this exact transaction showing that they were the recipient, prove it with their private key, and broadcast a message sending their bitcoin to someone else!