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 ...
  • 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 ...
  • 4,357
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 ...
  • 13.8k
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 ...
  • 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 ...
  • 15.2k
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 ...
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 ...
  • 4,387
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.
  • 15.2k
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 ...
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 ...
  • 13.8k
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 ...
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?...
  • 28.9k
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 ...
  • 15.2k
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 ...
  • 65.3k
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 ...
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 ...
  • 2,062
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 ...
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/...
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 ...
  • 28.9k
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 ...
  • 65.3k
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 ...
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 ...
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 ...
  • 5,134
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 ...
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 ...
  • 28.9k
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 ...
  • 13.8k
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, ...
2 votes

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

Because it's irrelevant how long an individual honest node takes to mine a block. The honest nodes work independently, but if any of them mine a block they all move on to the next block. Nodes aren't ...
  • 121
2 votes

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

Hashcash with SHA256 is about the best possible compute bound proof-of-work. In a memory bound proof-of-work (which Litecoin's is not), like my Cuckoo Cycle, memory latency, rather than computation, ...
2 votes
Accepted

Where can I find the structure and layout of what exactly gets hashed by miners?

The data that's hashed is the block header. You can find a description of the format and layout at https://en.bitcoin.it/wiki/Block_hashing_algorithm

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