What is mining?
@danielabrozzoni - Shoes in Bitcoin
(For beginners)
Bitcoin basics
Transaction
A document stating that you're moving Bitcoin from one address to another
![](https://s3.amazonaws.com/media-p.slid.es/uploads/932084/images/8369699/7BAA2EEA-7435-4E5B-AB27-006F3C39EF41.png)
Block
A "file" which contains various transactions, plus some other metadata
![](https://s3.amazonaws.com/media-p.slid.es/uploads/932084/images/8369307/C0C1B408-A0E6-4EA1-B89E-488EBF1701E9.png)
Mempool
Set of all the transactions not yet included in a block
![](https://s3.amazonaws.com/media-p.slid.es/uploads/932084/images/8369314/0ABFF42F-7494-46BF-9D55-EC53F033CA2E.png)
Blockchain
Each block contains a reference to the previous one, creating a chain. A new block is added to the chain every 10 minutes on average
![](https://s3.amazonaws.com/media-p.slid.es/uploads/932084/images/8369308/6D92DB7A-CE8C-43A9-B1D2-E80CFDD8CE6B.png)
Miner
An entity who adds blocks to the blockchain
![](https://s3.amazonaws.com/media-p.slid.es/uploads/932084/images/8369315/6E5E34F8-A329-40AB-AA8E-296D2EE73E05.png)
What happens when you use Bitcoin?
![](https://s3.amazonaws.com/media-p.slid.es/uploads/932084/images/8368793/780E7644-913D-4953-B858-B8DD0362BDD2.png)
You just met a cute girl and want to send all your BTC to her...
![](https://s3.amazonaws.com/media-p.slid.es/uploads/932084/images/8368795/1DECE22D-131B-4D4B-83A6-799051E84319.png)
...You open your wallet and she gives you her address...
...Your wallet prepares a transaction...
![](https://s3.amazonaws.com/media-p.slid.es/uploads/932084/images/8368797/ADBD7356-D4D7-4680-B018-9A2B080FC53E.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/932084/images/8368797/ADBD7356-D4D7-4680-B018-9A2B080FC53E.png)
...You send the transaction to the network, and it ends up in mempool...
![](https://s3.amazonaws.com/media-p.slid.es/uploads/932084/images/8368800/7B422D95-B3FB-4DD0-85D7-777D8A1990DC.png)
...A miner sees your transaction and decides to put it in a block...
![](https://s3.amazonaws.com/media-p.slid.es/uploads/932084/images/8368806/8CC17CD7-7CC8-44FB-8551-2B2259D2ABB5.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/932084/images/8368807/B623D660-ADA1-45FA-9A50-C41804445011.png)
...The miner successfully mines the block...
![](https://s3.amazonaws.com/media-p.slid.es/uploads/932084/images/8368809/BB76AD86-9BC5-4A9D-879D-51BBB0182DFE.png)
...After six blocks, your transaction can't be reverted!
![](https://s3.amazonaws.com/media-p.slid.es/uploads/932084/images/8368813/D3F1CF47-F9AC-43B6-AD2E-9B6969D81D4E.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/932084/images/8368814/DFA135B2-4696-429A-8AF3-769EC84E336D.png)
Mining
- Miners use energy to add new blocks to the blockchain
- Miners have a economic incentive to work
- The first transaction of the block is called coinbase
- Pays to the miner some Bitcoin for the work done
- Newly issued Bitcoin
- Transaction fees
- Pays to the miner some Bitcoin for the work done
Incentives
Incentives - newly issued
- At the moment each block issues 6.25 new Bitcoin
- Those are called "virgin", because they have no previous history
- The number of Bitcoin issued each block decreases over time
- In 2140 no more Bitcoin will be issued
- There will never be more than 21 milion Bitcoin!
Incentives - newly issued
![](https://www.investopedia.com/thmb/ZkDSZd6tiZ2uUBjRGS-hUUwpeXQ=/2972x0/filters:no_upscale():max_bytes(150000):strip_icc():format(webp)/dotdash_Final_How_Does_Bitcoin_Mining_Work_Dec_2020-02-5e922571968a41a29c1b01f5a15c2496.jpg)
- Miners also earn the fees of all the transactions in the block
- Each transaction must include a small fee to pay the miner
- The miners choose the transaction with higher fees first
- If you're in a rush, just pay more!
Incentives - transaction fees
- The fee doesn't depend on how many Bitcoin you're moving!
- It depends on the traffic in the Bitcoin network
- The more congested the network is, the higher the fees
- It depends on how quickly you want the transaction to be confirmed
- You can pay a super low fee if you're fine with waiting days
- It depends on your address type
- It's cheaper to spend from addresses starting with "bc1..."
Incentives - transaction fees
- The miner chooses some transactions to include from the mempool
- The miner adds the coinbase transaction, which pays the reward
- The miner has to solve a puzzle to make the block valid
- When the puzzle is solved, the miner can publish the block
How to build a block
- Mathematical puzzle needed to create a new block
- The only way of solving it is trying random answers until you find one that works
- Let's try to understand the mining puzzle with an analogy...
The mining puzzle
The mining puzzle: an analogy
The game is rolling dices, to win score less than the target
The mining puzzle
- Imagine playing rolling dices against thousands of opponents
- Only the first player who beats the target wins
- The more times you roll the dices, the higher the chance of winning
- You would roll the dices as quickly as possible
- You would avoid wasting time between the rolls
The mining puzzle
- Mining is really similar to our rolling dices game:
- Mining devices spend all day trying random numbers until they find the solution to the puzzle
- The first one who finds the solution gets the reward, and the game starts again
- Miners have to be as efficient as possible to maximize their reward
Adjusting the difficulty
- The more players join the rolling dices game, the quicker the solution will be found
- We don't want that! We want one block to be found every 10 minutes
- Game difficulty is adjusted every 2016 blocks
- If the previous 2016 blocks where mined too slowly, the game becomes easier
- If the previous 2016 blocks where mined too quickly, the game becomes more difficult
Mining device
- A mining device is a computer built only for Bitcoin mining
- You can't surf the internet on a mining device, you can only try solving the puzzle
![](https://s3.amazonaws.com/media-p.slid.es/uploads/932084/images/8368203/photo_2020-11-12_11-54-12.jpg)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/932084/images/8368210/photo_2021-03-20_17-06-08.jpg)
Mining device
- You can't mine Bitcoin on your own computer/ smartphone
- They're not powerful enough
- You would ruin your hardware
- You wouldn't earn anything
- Any app who claims to make you mine BTC on your device is a scam. Be aware!
Mining pool
- Let's say you have some mining devices and you're able to find one block once a year
- That's ~7 BTC in revenue per year
- You would have to spend one whole year paying bills before being able to earn something
- That's unfortunate!
Mining pool
- Joining a mining pool means starting to mine with other people, and then sharing the reward
- Each miner gets a reward proportional to how many calculations their devices did
- Miners get paid a bit less (due to pool fees), but they're paid multiple times a day
Questions?
Mining for beginners
By Daniela Brozzoni
Mining for beginners
- 879