mining pools – What are bitcoin miners really solving?

The following is a description of the global, statistical gamble which is played every 10 or so minutes. The interval of the game is controlled by the difficulty which says how many “hashes” are needed per interval.

In other words, the difficulty and target define the “odds of the house” against your chance of getting a winning SHA hash. The nonce is the “scratch off” area.

Each hash consumes electricity, and emits heat, which requires additional cooling.

This is what is done with each hash:

Step 1

At a high level, the miner software takes a list of active transactions, and then groups them together in something called a “block”.

Or more accurately stated: The miner software coverts all the transactions into a summary view called a “merkle root”, and hashes it, which is representative of the transactions.

Step 2

Then mining software converts this to into a binary format called a Block Header, which also references the previous blocks (also called a chain).

Field           Purpose                          Updated when...               Size (Bytes)
Version         Block version number             You upgrade the software and   4
                                                 it specifies a new version 

hashPrevBlock   256-bit hash of the previous     A new block comes in          32
                block header    
hashMerkleRoot  256-bit hash based on all        A transaction is accepted     32
                the transactions in the block       

Time            Current timestamp as seconds     Every few seconds              4
                since 1970-01-01T00:00 UTC  

Bits            Current target in compact format   The difficulty is adjusted   4

Nonce           32-bit number (starts at 0)       A hash is tried (increments)  4

Step 3:

The miner hardware changes a small portion of this block called a “nonce”.

Step 4:

The block header is hashed and compared to the Target as if it were simply a large number like 10,000,000 > 7,000,000 (the real numbers are much bigger, and in hex). The target is compressed and stored in each block in a field called bits.

An expanded target looks like this:

  Target   0000000000000083ef00000000000000000000000000000000000000000000000

And the goal is to make sure the SHA256 hash of the block is less than this value. In the example below “83ee” is smaller than “83ef

To simplify this concept, you can ballpark the target by counting the leading zeros (as the other answer here explains). Here is an example:

Here is a sample block with transactions you can view on BlockChain.info. Look in the upper right hand corner of the webpage for this hash:

   Hash 0000000000000083ee9371ddff055eed7f02348e4eda36c741a2fc62c85bc5cf

That previous hash was from today and has 14 leading zeroes. Let’s compare that to what was needed 3 years ago with block 100 which has 8 leading zeros.

   Hash 00000000a8ed5e960dccdf309f2ee2132badcc9247755c32a4b7081422d51899

Summary

So at the end of the day, all a miner does is:

  1. Take a block header as input
  2. Change the Nonce
  3. Test if the Block Header hash is less than the Target. If it is, you win.
  4. Go to step 2 (or go to step 1 if someone else won the block)

Want to see what Bitcoin-QT does when it finds a block?… I posted it here.. The information in this post will help you understand what happened.

mining pools – What unconfirmed transactions in Mempool get into a block?

I have a question regarding picking unconfirmed transactions from the mempool. Let’s say, there are 1000 transactions in the mempool. Can I randomly select some transactions, say, transaction a, b, c, d from them, and work on the nonce and create a new block? Is there any criteria about what transactions need to be in the next block?

mining pools – Which transactions go through the SHA256 process of “trying to win the new block”?

It is commonly said that a new block that is hoped to be added to the existing blockchain is filled with transactions, and together with a nonce, go through SHA256 twice, and tries to be a small enough number (with many leading 0‘s)

Isn’t it true that each miner or mining pool, can get different transaction to fill in? Are these transactions coming in that “are hoped to be added to this new block in about 10 minutes”? Some transaction are chosen because they offer a good fee. And it is just up to the miner or mining pool to decide which transaction go in? So then, can the miner or mining pool put in one transaction, two transactions, 0 transactions, or any number of transactions?

So each miner or mining pool work off a block that are filled with different transactions plus a nonce?

mining pools – How does a Bitcoin block get generated and ‘agreed upon’ by everyone?

Miner ASICs have one job: Change the meaningless parts of the block until the difficulty target (related to the hash of the block) is satisfied.

ASICs connect to the pool to first download the block template (they regularly do that – maybe every few seconds?). The block template contains the transactions. They calculate the merkle hash of the transactions, embed it in the block header, and hash the block header many times.

When the target is satisfied, the block is published. From then on, no one can change the transactions in the block.

all that work is wasted

This is a lottery where everyone’s chances of finding the next block is proportional to their hashrates. If you need to mine all day to find one block per day — congratulations! You can afford solo mining and you don’t lose anything, and your reward is fair.

Trivia: Block mining is a Poisson process. One property of this is memory-less-ness. That is, given that the average time until the next block is 10 minutes (it is for Bitcoin):

  • After about how many blocks will someone find a block if everyone started just now: 10 minutes (t = 10)
  • What if you all had been mining for 2 minutes? Still 10 minutes (block to be released at t = 12)
  • What if you all had been mining for 20 minutes? Still 10 minutes (block to be released at t = 30)

Here’s a fun puzzle by Russel O’Connor and Pieter Wuille.

So, there is no wasting in mining: it’s memoryless. If you fail, you just keep trying, and everything works as intended in the end.

mining pools – Higher Hashrate VS Incorrect Shares

I recently started mining eth on my 5700 bios flashed to XT, mining on Nanopool. Getting around 48MH/s but i saw a method by Red Panda Mining which can increase my MH/s by around 10 giving me 60MH/s but a high ratio of incorrect shares using a config edit on Phoenix Miner. Im wondering if this is worth the increase in hashrate but ultimately still leads me to incorrect shares. My incorrect share rate is 2:1 using this edit. Thoughts?

mining pools – Why can’t default minimum fee rate be changed to 0.1-0.2 sat/vByte?

  • The primary reason for the minimum feerate (and related things like the discard feerate) is preventing the use of the P2P network as a cheap global broadcast system. If it’s easy to produce transaction that will never confirm yet will relay across the network, it’d open the network to abuse. I don’t know what the right level is to make sure that doesn’t happen, but 1 sat/vbyte seems pretty low.

  • That was before the network and mempool logic had floating fees. Now the feerate is primarily set by market pressure, and lowering the minimum would at most have an impact during times when there is ~no demand for block space. I personally think the ecosystem should expect to function fine when there is continuous back pressure, so I’m not sure what is gained by reducing it.

  • I can’t speak for anyone else, but I don’t think it’s interesting to spend review time on. Note that the PR you link to is just to increase precision of the internal data types used for feerates; it doesn’t change any relay policy.

  • I don’t think spam is the problem. Lately the feerate has been significantly higher than 1 sat/vbyte anyway, and long term I hope that whatever the minimum is set to, it’s effectively never hit. What matters is the discard feerate, which is not set by the market (it’s the “additional” feerate you need to pay to replace a transaction in the mempool through RBF or mempool limiting, in order to make sure there is some cost to relaying the transaction that is now expected to not be mined anymore). That discard feerate is by default set to 1 sat/vbyte as well, which seems low.

  • Do mining pools expose attempted nonces to the public?

    Do mining pools expose attempted nonce to the public ?

    No, that’s pointless and would be completely infeasible. The combined network tries over 100 billion billion nonces per second (as of december 2020, it’s around 120 exahash/s).

    I would think no because it would be counter competitive. I can let a giant mining farm tell me what nonces not to use

    That’s irrelevant. They are trying to find nonces for a different block candidate than you are (at the very least, they’re trying to mine a block that pays them; you’re trying a block that pays you).

    Would it be faster to continue attempting random nonces

    No, every block candidate + nonce is a completely independent attempt. Nobody will ever try the same combination again (because the timestamps change, the composition of transactions changes, and the payout depends on the miner). It doesn’t matter in what order you or anyone else tries nonces – only how many you try per second matters.

    or storing the nonces previously attempted in memory and finding them in a sorted array

    No, same reason.

    statistics – Opposing d6 Pools, # of higher dice

    I’ve read dozens of posts here, and wrestled with with anyDice suggested code, but nothing matches quite what I am looking for. I think it is simple in concept: for opposing dice pools of 1..6d6, I want to figure the probability of of higher dice.

    In my case, the count of higher dice includes a dice with a higher face than the opponents highest, and/or a higher count of the opponent’s highest face.
    A = 1234, B = 456: B nets 2 (5 and 6 > 4)
    A = 1233, B = 1223, A nets 1 (2 3s to 1 3)
    I want to analyze the probability of each 3 of higher dice for 2d6 versus 2..6d6. Any help would be appreciated.

    The closest I’ve come is https://anydice.com/program/1f78d, but that just tells me the relative probability of X # of dice of the same face.

    Thanks,

    Do mining pools expose attempted nonce to the public?

    Do mining pools expose attempted nonce to the public ?

    No, that’s pointless and would be completely infeasible. The combined network tries over 100 billion billion nonces per second (as of december 2020, it’s around 120 exahash/s).

    I would think no because it would be counter competitive. I can let a giant mining farm tell me what nonces not to use

    That’s irrelevant. They are trying to find nonces for a different block candidate than you are (at the very least, they’re trying to mine a block that pays them; you’re trying a block that pays you).

    Would it be faster to continue attempting random nonces

    No, every block candidate + nonce is a completely independent attempt. Nobody will ever try the same combination again (because the timestamps change, the composition of transactions changes, and the payout depends on the miner). It doesn’t matter in what order you or anyone else tries nonces – only how many you try per second matters.

    or storing the nonces previously attempted in memory and finding them in a sorted array

    No, same reason.