You’ve got some bitcoin. Now you want to move them to a different address.
To do this you need to make a transaction.
1. How do you make a transaction?
This is the same for any bitcoin wallet you use:
- Enter the address. This is where you want to “send” the bitcoins.
- Enter the amount. The amount of bitcoins you want to send. Will most likely be in BTC or Satoshis.
- Set the fee. (optional) This sets the “priority” for how quickly the transaction will become finalized.
Then just click “send” and you’re done.
From here you’ll just be waiting for the transaction to get confirmed…
Note: When you send the transaction your wallet should give you a TXID, which is like a unique reference number for the transaction. You can use it to check the transaction’s status on a blockchain explorer.
2. What happens when you make a bitcoin transaction?
When you click “send”, your wallet sends your transaction in to one of the nodes on the bitcoin network. From here it gets relayed from node to node until every node on the network has a copy of your transaction.
At first, your transaction gets stored in the memory pool of each node, which is like a temporary “waiting area” for transactions that have been recently broadcast across the network.
After roughly 10 minutes, one of the nodes on the network will add the latest transactions from their memory pool on to their blockchain, and share this new block of transactions with the other nodes.
As a result, each of the nodes has updated their blockchain to include the latest transactions on the network. These transactions have now been confirmed.
Lastly, this process repeats itself so that new blocks of transactions are continuously being added to the blockchains on the network at regular 10-minute intervals.
So in summary, after you make a transaction you are basically waiting for it to be added to the blockchain, which is referred to as being “confirmed”.
3. How does a transaction make it in to the blockchain?
Each node has the opportunity to try and add the transactions from their memory pool on to their blockchain. This process is known as mining.
To add transactions on to the blockchain, a miner gathers transactions from their memory pool in to a container called a candidate block. From here, the node uses energy to try and “mine” this block on to the top of the blockchain.
Tip: Any node on the network can become a miner. But it’s cool if you just want to be a node (and not mine blocks).
As a result the mining process is basically a network-wide competition, where any node on the network has a chance of mining the next block. A node that can mine faster has a better chance of mining the next block, but the process of mining is unpredictable, so no single node is in control of adding blocks to the blockchain.
After about 10 minutes (on average), one of the mining nodes will eventually mine the next block and share it with all the other nodes. Each node then checks the block (to make sure it has been mined correctly) and adds it to their blockchain.
Now everyone has the latest block. From here, each miner contructs a new candidate block (with new transactions from the memory pool) and starts trying to mine the next block on to the chain.
So in summary, miners are constantly working to extend the blockchain with new blocks of transactions.
Why do transactions have to be mined?
The mechanism of mining provides the following benefits:
- Prevents conflicting transactions from being written to the blockchain. If two conflicting transactions were sent in to the network (e.g. trying to send the same bitcoins to two different places), thanks to mining only one of those transactions will actually be written to the blockchain.
- Any node can mine the next block of transactions. Due to the fact that the mining mechanism is unpredictable, any node can be the one to add the next block, which means that no single node is in control of the transactions that get added to the blockchain.
- Transactions cannot be removed from the blockchain (easily). Mining a block requires energy, which makes it difficult for any individual to acquire enough energy to be able to mine blocks quickly enough to rewrite the blockchain.
All in all, mining is what allows multiple computers to agree upon the same copy of a regularly updating file, which is essential for a digital currency that depends upon having a shared ledger of transactions across computers.
See Mining for more details.
4. What are transaction fees?
A bitcoin transaction can include a sum of bitcoins as a fee. This fee will be collected by a miner, and acts as an incentive for miners to include your transaction in their candidate block.
Because a candidate block can only hold a certain amount of transactions (or data to be precise), so if a lot of people are making transactions at any given time, there may be more transactions inside the memory pool than can fit inside a block.
Therefore, miners will choose to populate their candidate blocks with transactions that have the highest fees on them, because they can collect these fees (via the coinbase transaction) if they are successful in mining the block.
Tip: The memory pool is like a queue, and the transactions with the highest fees are at the front.
So when there are a lot of transactions in the memory pool, the higher the fee you place on your transaction, the higher the effective “priority” that transaction has for getting included in a block.
When you set a fee on your transaction, you are effectively determining it’s position in the memory pool, and how quickly you’d like the transaction to be mined.
What fee should I put on my transaction?
This depends on how many transactions are currently in the memory pool.
Mempool Size: 38484 transactions (55.26 MB) Candidate Block: 2370 transactions (1.26 MB)
A good wallet uses the current size of the memory pool to recommend various fee sizes based on how quickly you’d like your transaction to be mined.
Within 2 Blocks: 101 sat/byte Within 3 Blocks: 101 sat/byte Within 4 Blocks: 96 sat/byte Within 5 Blocks: 92 sat/byte Within 10 Blocks: 75 sat/byte Within 25 Blocks: 56 sat/byte Within 144 Blocks: 11 sat/byte Within 432 Blocks: 3 sat/byte
I’m getting the fee estimates above using Bitcoin Core’s
bitcoin-cli estimatesmartfee command. Many popular bitcoin wallets use this command to help provide suggestions for fees.
Note: These are just estimates. Nobody can guarantee when your transaction will get mined. More transactions could enter the network push you toward the back of the queue.
However, you can always choose to set your own custom fee on your transaction. You can check out the current status of the memory pool yourself and decide on a fee that you think will work best:
But in general:
- If there are more transactions in the memory pool than can fit inside a candidate block, you are competing with the other transactions in the memory pool to get inside the block (so the fee amount will vary based on your preference for how quickly you want the transaction to be mined).
- If there are less transactions in the memory pool than can fit inside a candidate block, you can set the minimum fee (1 sat/byte).
Tip: Don’t put too high a fee on your transaction unless you really need to.
Note: Transactions are sorted by sat/byte, which is the size of the fee (in satoshis) divided by the size of the transaction in bytes. This is because miners want to get the most in fees for the amount of space each transaction takes up in a block.
What happens if I put too low a fee on my transaction?
By setting a low fee on your transaction you’re putting it at “the back of the queue” in the memory pool. This is fine, but it means that you’re going to be waiting for a quiet period where the the memory pool is cleared out so that your transaction can be included in a block.
However, transactions will only stay in a node’s memory pool for 72 hours (usually3), and after this time period a node will remove the transaction from its memory pool. As a result, it’s like your transaction never happened.
Warning: Don’t consider a bitcoin transaction as being final until it has been confirmed (i.e. mined in to the blockchain). Transactions in the memory pool may end up not being confirmed if the fee is low and/or there are lots of transactions being sent in to the network.
Tip: If your transaction doesn’t get mined within 72 hours, you can always re-insert it back in to the network for the chance to get mined again.
5. How many confirmations should I wait for?
- 1 confirmation is usually enough.
- 2 confirmations if you want to be extra sure in case of a natural chain reorganisation.
- 3+ confirmations if you are concerned about a network-scale attack to reverse your transaction.
A “confirmation” refers to your transaction getting mined in to a block. Additional confirmations are when further blocks are mined on top of the block your transaction was included in.
Why does this matter?
Well, I know I sait that you cannot remove a transaction from the blockchain, but it is technically possible. Due to the way blockchain works, a bad miner with a lot of mining power could use their energy to build a new longer blockchain for nodes to adopt, and replace blocks (and transactions) that are currently in the chain.
This has not yet happened in Bitcoin.
So this is why it’s commonly recommended to wait for 6 confirmations (or more) to be sure a transaction cannot be reversed, because at this point it’s no longer “computationally feasible” for a miner to replace that number of blocks. However, unless you’re protecting yourself from a bad miner performing an attack against the entire network, this is overkill.
A more reasonable amount of time to wait to be confident that a transaction isn’t going to be undone is 2 confirmations. This is just because the top block in the blockchain has a tendency to change around with another block during natural chain reorganisations.
Chain reorganisation happen roughly once every
38.4 days (once every
So when your transaction makes it past the first block, you can be confident that it isn’t going to be undone via natural causes.
6. How can I check the status of my transaction?
One of the coolest things about bitcoin is you can use blockchain explorers to see the details of transactions as they’re in the memory pool or blockchain.
When you make a bitcoin transaction, your wallet should give you the TXID for that transaction. This is like a unique reference number for the transaction, and you can use it to find the transaction in a blockchain explorer:
- learnmeabitcoin.com/explorer - An explorer I made. I designed it to be fast and simple.
- blockstream.info - Another popular explorer, although more focused on technical details.
Now, a blockchain explorer is basically just a website that acts as a window in to a bitcoin node. So by entering your TXID, you’re just asking the explorer to look in to its blockchain (or memory pool) and show you the details of a transaction it has received.
I won’t cover all the details of what explorers can show you, but some of things I find most useful are:
- The number of confirmations. Is the in the memory pool or has it been mined in to a block?
- The movement of bitcoins. Which address(es) did the bitcoins come from and which address(es) are they being locked up to?
- The locks on the bitcoins. How were the bitcoins locked up?5
Anyway, your wallet will probably tell you the basic information about your transaction (such as whether it has been confirmed or not), but a blockchain explorer allows you to dig in to the details of the transaction, which is pretty cool.
You can also find the transaction in your own Bitcoin Core node with:
bitcoin-cli gettransaction [txid]
Here are my top tips:
- Use a wallet that you feel comfortable with.
- Set the lowest fee you can get away with.
- Follow the transaction’s progress with a blockchain explorer.
You’ll get the hang of it after your first few transactions.
This has been one excellent guide (you’re welcome), but experience is the best teacher.
A block used to only be able to hold 1MB of data, but the method for working out the amount of data a block can hold changed in July 2017 thanks to Segregated Witness. As a result blocks can now hold around 1.7MB of transaction data.↩︎
Each node can set the maximum size of their memory pools with the
-maxmempooloption (default is 300MB).↩︎
Each node can set how long they hold on to memory pool transactions for with the
-mempoolexpiryoption (default is 72 hours).↩︎
You can see the number of chain reorganisations your node has experienced by running
bitcoin-cli getchaintipsand looking at the number of
valid-forks. This data is based on my node which has been running continuously since 17 December 2016.↩︎