1/13
Bitcoin Mining and Proof of Work Explained

Mining is often talked about in the media as some dark art that involves ‘solving complicated math problems’ but in reality it’s pretty easy to understand.

Let me break it down for you 👇
2/ Miners need to show proof that they’ve done a certain amount of work in order for the block they are mining to be valid. When you mine a block you earn the current period’s mining reward (currently 6.25 BTC) and all of the fees from the transactions they include in the block.
3/ So how can one prove they’ve done a certain amount of work without anyone there to watch them do it? Well, they can find the answer to a problem that we know takes them a certain amount of work to solve. There are lots of things that could be used to prove someone did work.
4/ Websites make you solve a CAPTCHA as a type of “proof of work” that proves you are a human. The tasks are difficult or impossible for a robot to complete and therefore if the correct answer is provided the website knows you are human. This helps them prevent spam and abuse.
5/ Bitcoin’s proof of work uses a one-way hash function. A function is something that is given inputs and computes an output. For example, addition is a function you are familiar with, it takes as inputs two numbers (a,b) and produces the output a+b. Add(a,b) => a + b
6/ A one-way hash function is any function that given the output y, it is impossible to determine the input x that generated it. It also means given f(x) = y we don’t learn anything about what f(x+1) might equal. The outputs have no correlation to the inputs that were used.
7/ So how can we use a hash function to prove someone did a certain amount of work? We can ask them to find an input that produces an output below a certain number. Since the output is not correlated to the input the only way to find a solution is to guess randomly.
8/ For example, imagine a function that given input X produces a number between 1 and 100. If we tell you to find an input X that produces a number less than 50 we know on avg it will take you two guesses. This means we know on avg you did the work of computing two hashes.
9/ If for that same function we ask you to find an input X that produces a number less than 10 we know on average it should take you 10 guesses. This means we know on avg you did the work of computing 10 hashes. This lets us control how much work is required to find a solution!
10/ This is exactly how the difficulty adjustment in Bitcoin works and is what keeps the time to find the next block at roughly 10 minutes. The network can just adjust this target up or down based on how much hash power is working on the network.
11/ So in order for a miner to prove they did the work needed to find an input to the function (Bitcoin uses one called SHA256) that generates an output that is less than the current difficulty target. Once an input is found they use it to produce a block and claim the reward!
12/ When the block is broadcast to the network everyone can easily verify that the block is valid by making sure the input the miner provided does indeed produce an output below the current difficulty.
13/ Hope that wasn’t too bad and that you learned something about Bitcoin mining and proof of work. If you enjoy Bitcoin content like this make sure to follow me for daily Bitcoin education. If you still have questions about mining or proof of work just ask below!

• • •

Missing some Tweet in this thread? You can try to force a refresh
 

Keep Current with John Cantrell

John Cantrell Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @JohnCantrell97

11 Jan
You’ve decided it makes sense to own some Bitcoin, congrats! You took an important step but you might be wondering…

What do I really own?
Where and what exactly are the coins?

I’ve been working on Bitcoin for years, let me help explain it in simple terms 👇
First things first, if your Bitcoin is still on an exchange or some other custodial service then you don’t really own any Bitcoin. You own a promise or an IOU that will hopefully be redeemable for Bitcoin some day.

Not your keys, not your coins. A thread for another day.
Ok so you have your keys but what coins do you actually have?

There’s not some record in a database that says “Alice owns X Bitcoins”.

Technically, you have keys that can sign a transaction that spends an unspent transaction output (UTXO).

Let’s further break that down:
Read 8 tweets
10 Jan
🧙‍♂️
Did you know it’s technically possible for your lightning channel partner to attempt to steal money that is supposed to belong to you?

Let me explain how that’s possible and why they likely won’t try it 👇
To understand why this is possible we need to understand how payments are made over lightning channels.

Let’s imagine Alice opens a 100,000 sat channel with Bob by funding a 2-of-2 multisig address that can only be spent from using both Alice and Bob’s signature.
Before Alice locks her funds in the multisig they create a commitment tx that spends from the multisig address sending Alice her 100,000 sats and 0 sats to Bob.

She gets Bob to sign it but doesn't broadcast it so she can get her money out of the multisig if Bob disappears.
Read 10 tweets
8 Jan
You’ve probably heard Bitcoin lets you send money for free. You’ve also probably heard Bitcoin transactions are too expensive.

What’s going on here and why is there so much confusion around the cost to send Bitcoin? It’s kind of complicated, so let me break it down for you 👇
Technically it’s possible to make a Bitcoin transaction for free but in practice it’s really difficult. There’s nothing stopping miners from including transactions that do not pay a fee but most nodes on the network won’t relay transactions with a fee under a certain amount.
This means you either need to be a miner or somehow send your transaction directly to a miner. The latter case is still unlikely to work unless the miner is your friend because miner’s are incentivized to include transactions that pay them the most in fees.
Read 15 tweets
7 Jan
If you’ve spent any time researching Bitcoin then you’ve probably heard about the Lightning Network but…

Why does it exist?
What is it?
How does it help Bitcoin scale?

I’ve been working with it for years, let me help explain it in simple terms 👇
Bitcoin produces blocks every 10 mins and they can hold a limited number of transactions. This limited space creates a fee market where users can bid for their transactions to be included in a block. This means transactions take at least 10 minutes and must pay fees to miners.
The Lightning Network is a p2p network of payment channels

A payment channel is a contract between two people where they commit funds using a single onchain tx. Once the funds are committed they can make an unlimited amount of instant & free payments over the channel.
Read 14 tweets
6 Jan
The Fundamental Trade-Off Between Scalability and Decentralization And Why I’m Focused On Bitcoin

A core principle in Bitcoin is that every participant keeps a copy of the ledger and is able to verify every change made to that ledger. Without this we must trust someone else.
Decentralization is not a binary value but more of a sliding scale. It’s closely related to the number of participants in a system that can keep a copy of the ledger and are able to verify it. More participants, more decentralization. Less participants, less decentralization.
Like decentralization, scalability is also not a binary value. In monetary systems like Bitcoin, most people refer to scalability in terms of the number of transactions it can handle per time period. The more transactions it can process per second, the more scalable the system
Read 12 tweets
5 Jan
How Will We Onboard Earth’s 7.753 Billion People To The Lightning Network?

I ran the numbers, let’s see how we can onboard the entire population of Earth onto the Lightning Network, how long it might take, and what we can do to speed the process up 👇
To onboard onto the lightning network it requires sending btc into a 2-of-2 multisig funding transaction with your channel partner. To optimize space in this transaction we want 1 native segwit input and a single channel funding output. This produces a tx of roughly 121vbytes.
If 100% of the transactions in a block were these channel opening txs we could onboard about 8,264 people to lightning per block. With a global population of 7.753 billion people it would take roughly 938,166 blocks or 17.8 YEARS for everyone on Earth to have a channel.
Read 10 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Too expensive? Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal

Or Donate anonymously using crypto!

Ethereum

0xfe58350B80634f60Fa6Dc149a72b4DFbc17D341E copy

Bitcoin

3ATGMxNzCUFzxpMCHL5sWSt4DVtS8UqXpi copy

Thank you for your support!

Follow Us on Twitter!

:(