2022 Developer Survey is open! Take survey.
21 votes

How does AsicBoost work?

Introduction AsicBoost speeds up Bitcoin mining in general (for ASICs and CPUs alike) by reducing the frequency of computing one part of the SHA-256 calculation. A Bitcoin block header is 80 bytes ...
user avatar
  • 883
13 votes

What is the extraNonce?

This really helped me understand it: A solo miner increments Nonce until it overflows. Then it increments extraNonce and resets Nonce. extraNonce is located in the coinbase transaction, so changing ...
user avatar
  • 4,307
11 votes
Accepted

Probablity Distribution of mining

The time between consecutive blocks follows the exponential distribution, with mean (roughly) 10 minutes. This means that the variance is 100 minutes^2.
user avatar
11 votes
Accepted

What is SPV mining, and how did it (inadvertently) cause the fork after BIP66 was activated?

SPV mining is the term commonly used for 'less-than-full-node-validation' mining. It usually means that miners skip the verification of the block and the transactions within, and immediately start ...
user avatar
  • 13.7k
10 votes
Accepted

Visualize Bitcoin Hashing

I got linked this question. I made a tool which includes a component that allows one to simulate mining: http://yogh.io/#mine:last It's not entirely accurate; it doesn't support BIP 34, so the ...
user avatar
  • 116
9 votes
Accepted

When does a miner decide to stop collecting transactions and start calculating hashes to try to win?

I am confused about whether a miner chooses to wait for more transactions (more fees) or starts as soon as it receives the first transaction from the network. Once a miner has started calculating the ...
user avatar
  • 15k
8 votes

Want to write my own solo cpu bitcoin miner

Tim S. pretty much covered it, but I wanted to 2 great resources which have been very helpful for myself and many others: Ken Shirriff's blog has a few Bitcoin mining related posts which use Python ...
user avatar
8 votes

Want to write my own solo cpu bitcoin miner

I'm not sure that a guide as basic as you describe is even possible. It depends on what exactly you mean. Mining itself isn't too complicated to read and understand, but writing a start-to-end app ...
user avatar
  • 4,327
8 votes
Accepted

How will mining work after 2140?

There’s no such thing as a block without a coinbase transaction. Even if the block reward plus fees is zero, it is still a mandatory transaction at the start of every block, it just pays nothing.
user avatar
  • 15k
7 votes
Accepted

How hard is it to alter a block after it was found?

Once a miner has found a block, how easy it is for him to add or remove a tx included in that very block? It is impossible. The solved block depends on every byte of transaction data, nothing can be ...
user avatar
  • 13.7k
7 votes

Probablity Distribution of mining

The expected time (mean) for a new block is of course 10 minutes, assuming constant hashrate, and no block propagation time. The tricky part is that there is no such thing as a point in time. You can ...
user avatar
7 votes

Has the nonce used in mining been sized?

First of all, when 1 second has passed, the miner can just increment the timestamp in the header. This already gives us 4 Ghash/s rather than 4 GHash/block. When this is not enough, and the nonce ...
user avatar
7 votes
Accepted

Why does the daemon require peers in order to start mining?

I wanted to start mining bitcoin from the genesis block I'm pretty sure regtest will let you do that. why wouldn't the peer just let me mine on my own chain and not broadcast my results to anybody?...
user avatar
  • 28.6k
7 votes
Accepted

What is the most lightweight proof-of-work algorithm?

Contrary to the name the proof of work used in Litecoin is significantly more difficult than SHA256 to verify (it slows sync times noticeably), while simultaneously not achieving it's goals of being ...
user avatar
  • 15k
7 votes
Accepted

Why does an adversary have to control 50% of the computing power to double spend?

There are two assumptions in your question that aren't completely correct. 1) Each node would then require 68 minutes to find a proof of work (trying 2^52 hashes). The process of finding a new block ...
user avatar
  • 62.5k
6 votes
Accepted

How is it that concurrent miners do not subvert each other's work?

The number of hashes a miner has tried in the past does not affect the probability that a miner will get the correct hash in the next immediate calculation. Thus, it does not matter for the miner from ...
user avatar
  • 2,052
6 votes

How does AsicBoost work?

I'm reproducing figures 2 and 3 from the paper below to provide an alternative interpretation. Fig 2: Fig 3: Historically, mining is composed of an inner loop (red) and an outer loop (green). Each ...
user avatar
5 votes

Why don't any of the SHA-256 vulnerabilities matter for mining?

The attacks are against a "poor man's" version of SHA-256, where less rounds are performed than in the real SHA-256. They are useless for breaking SHA-256 itself, and more so for the double SHA-256 ...
user avatar
5 votes

How are eth transaction faster than btc?

Most simple and foreseen reason: Bitcoin's blocktime is set at 10 minutes, while Ethereum has a block every 10-20 seconds, making it much faster. See Ghost protocol, https://www.cryptocompare.com/...
user avatar
4 votes

How hard is it to alter a block after it was found?

From the original Bitcoin paper: ... we implement the proof-of-work by incrementing a nonce in the block until a value is found that gives the block's hash the required zero bits. Once the CPU ...
user avatar
  • 28.6k
4 votes

Why don't any of the SHA-256 vulnerabilities matter for mining?

Sha256 has no known vulnerabilities as of yet. As Meni Rosenfeld mentioned, the mentioned attacks only concern part of the rounds of Sha256, in order to have an actuall effective attack you'd have to ...
user avatar
4 votes

How is it that concurrent miners do not subvert each other's work?

An analogy for mining would be the following: You are at a lottery booth. The lottery booth has 1,000 lottery tickets in a bowl (which are always mixed perfectly). There is only one ticket with a ...
user avatar
  • 62.5k
4 votes

How do Bitcoin clients/miners verify balances quickly?

Balances Bitcoin doesn't care about balances. Miners also don't. Your wallet may keep track of your balance but it doesn't need to know about anyone else's. No one else cares about your balance. It is ...
user avatar
3 votes
Accepted

Why does the bitcoin mining code have the same if statement twice?

This is double-checked locking, which is ...a software design pattern used to reduce the overhead of acquiring a lock by first testing the locking criterion [...] without actually acquiring the ...
user avatar
3 votes
Accepted

Explain this comment on nNonce from the bitcoin miner.cpp source?

What does it mean that the input buffers are 16-byte aligned? Is that important for calculating the hash? It means that the lower four bits of the starting address are always zero. I assume that this ...
user avatar
  • 28.6k
3 votes
Accepted

If block sizes go up, won't sigop limits have to change too?

Yes, the maximum number of signature operations per block also need to change. It may change dynamically with the block size limit. The code currently assumes a ratio of MAX_BLOCK_SIZE to ...
user avatar
  • 13.7k
3 votes

Has anyone verified what your CPU is being used to do when it "mines" for bitcoins?

Yes, it is verified. If you wouldn't do the work requested by the proof-of-work then you wouldn't be able to obtain the block reward. Therefore the fact that you're rewarded by the system means you're ...
user avatar
  • 5,114
3 votes
Accepted

Where is the code that specifies when a block is released?

Every time a block is successfully mined, the miner releases it immediately. The mining difficulty is adjusted over time to keep the average block release rate at roughly ten minutes. Successfully ...
user avatar
3 votes

Could a miner set a maximium transaction fee rate?

Yes, miners can choose exactly what transactions to include in their candidate blocks, including the choice to not include anything at all. Of course, if a high fee paying transaction is available, ...
user avatar
2 votes
Accepted

In pooled mining, what is pdiff, bdiff and ldiff?

What are the meanings of pdiff, bdiff, and ldiff? The numbers are the current difficulty of the network(s). bdiff is the target difficulty of the whole Bitcoin network. ldiff is the target ...
user avatar
  • 343

Only top scored, non community-wiki answers of a minimum length are eligible