IFCCI

Bitcoin Mining

What is a Mempool?

3 分钟阅读第 10 课,共 12 课
83%

学习目标

  1. 1Define what a mempool is and its role in the Bitcoin transaction process
  2. 2Understand the difference between unconfirmed transactions (mempool) and confirmed transactions (blockchain)
  3. 3Explain how mining resolves conflicting transactions through competition
  4. 4Describe the step-by-step process from transaction creation to blockchain confirmation

How Bitcoin Decides Which Transaction to Keep

Bitcoin elegantly solves the problem of conflicting transactions with a system called mining.

Let's break it down.

Step 1: Transactions Go to the Memory Pool

When a transaction is made on the Bitcoin network, it's not immediately written to the blockchain. Instead, it's first sent to a temporary holding area called the memory pool, or mempool for short.

Every full node (computer running the Bitcoin software) has its own mempool. It stores unconfirmed transactions that the node has verified as valid. Think of it like a queue where transactions wait their turn to be added to the blockchain.

  • The mempool holds unconfirmed transactions.
  • The blockchain holds confirmed transactions bundled into blocks.

Step 2: Conflicting Transactions Enter the Network

Let's say you try to cheat the system:

  • On one part of the network, you send Transaction A (purple) using your bitcoin to one person.
  • Then on another node, you send Transaction B (red), using the same bitcoin to someone else.

Both transactions will enter the network and spread to other nodes.

Each node stores the transactions in its mempool but does not immediately update the blockchain. Some nodes may get Transaction A first, others may get Transaction B.

But again—nothing is final yet. These are just unconfirmed transactions waiting in mempools.

Step 3: Mining Decides Which Transaction Gets Confirmed

Here's where mining comes in.

All miners on the network start working to confirm transactions from their mempools by adding them to a new block on the blockchain.

They compete to be the first to successfully add a block (which includes a set of transactions) to the blockchain.

Let's say one miner (the yellow node) wins the race. It adds a block that includes Transaction A to its copy of the blockchain.

Once that happens:

  • It shares the updated blockchain with other nodes.
  • Other nodes accept this version as the official record.
  • They remove Transaction B from their mempools since the bitcoin it tried to spend has already been used in Transaction A.

Final Outcome

Now the entire Bitcoin network agrees on a single version of the blockchain that includes only Transaction A. The attempted double-spend in Transaction B fails.

This process of competition—mining—ensures only one valid transaction makes it to the blockchain, solving the double-spending problem.

So, to recap:

  • Transactions go to the mempool first.
  • Nodes compete through mining to confirm transactions.
  • The first valid block added to the blockchain becomes the official record.
  • Conflicting transactions are discarded.

And that's how Bitcoin picks which transaction to keep.

核心要点

  1. 1The mempool (memory pool) is a temporary holding area on each node where unconfirmed but valid transactions wait before being added to the blockchain
  2. 2When conflicting transactions enter the network, they sit in mempools as unconfirmed—nothing is final until a miner confirms one
  3. 3Miners compete to add blocks of transactions to the blockchain, and the winning miner's block becomes the official record
  4. 4Once a transaction is confirmed in a block, conflicting transactions using the same bitcoin are automatically discarded from all mempools

Knowledge Check

1. What is the mempool in the Bitcoin network?