Does it involve any picks, shovels, or caves?
NOPE.
In this lesson, I will explain what a Bitcoin miner is.
Here, we have the Bitcoin network again that contains conflicting transactions mentioned in the example. from the previous lesson.
Some nodes contain a “purple ” transaction while others contain a “red ” transaction.
But both transactions are trying to spend the same bitcoin.
How do the computers come to an AGREEMENT on which transaction is the legit one?
This is where “mining” comes in.
Let’s go inside this computer and take a deeper look.
This node is a “miner".
What is a Bitcoin miner?
A miner node is a Bitcoin full node that does additional work by confirming transactions.
All miners are nodes, but not all nodes are miners. A Bitcoin miner can’t operate without running a node. But a full node is not necessarily a miner.
While a full node will receive, store and broadcast transactions to other nodes, a miner node will do the same but it will also try to create new blocks of transactions and then attempt to broadcast them to other nodes who will then either accept or reject the new block.
As you’ll see in the next lesson, due to the way “mining” works, a miner requires the use of specialized hardware.
If you’re curious, here’s an example of a mining machine. Isn’t it beautiful?
How does a Bitcoin miner “mine”?
Let’s now go deeper and take a look inside a miner and see how it “mines” the transactions from the memory pool onto its file (the “blockchain”).
We’re now looking inside a miner’s memory pool.
It has the purple transaction in there.
But with a memory pool, you can have more than one transaction in there.
So let’s pretend there are more fresh transactions.
For example, this memory pool contains four transactions. (In reality, a memory pool can hold thousands.)
So what does miner do with all these transactions in its memory pool?
It will create a container called a “candidate block".
Which is just a container for transactions.
The miner will fill this candidate block with transactions from the memory pool.
What is a candidate block?
Think of a candidate block as a temporary block that’s created using transactions selected from the memory pool.
This temporary block is called a “candidate block” because it’s not yet a valid block. Only blocks that have actually been added to the blockchain (which is what the miner is trying to do) are considered valid blocks.
So what this miner will do is fill this candidate block with transactions from the memory pool.
Like so…
Since space is limited, only a limited number of transactions can be included in each block. Miners are incentivized to prioritize the transaction with the highest fees.
And then, it will try and add this “block” of transactions to the file (the “blockchain”).
So how does the candidate block actually get added to the blockchain?