14 votes
Accepted

Can the blockchain be outpaced by a chain of low-difficulty blocks?

There are two problems with this: The "longest" block chain is selected not by total number of blocks, but by total difficulty. A chain with a large number of low-difficulty blocks would ...
user avatar
8 votes

51% attack and rewriting to the latest checkpoint

As long as both competing chain-tips are adhering to the same rules, the chain with the most aggregate difficulty ("heavier") will win, regardless of height. Nodes performing the initial sync would ...
user avatar
  • 63.4k
8 votes
Accepted

What is the length of largest known reorganization in bitcoin?

There have been only two large re-orgs in Bitcoin's history. The first is the value overflow incident in August 2010 that caused a re-org of 53 blocks and the March 12, 2013 fork that caused a re-org ...
user avatar
  • 6,908
7 votes
Accepted

Can an attacker with 51% of hash power change old blocks?

An attacker has a hard time changing the past An attacker has very limited influence to change old blocks, because he has to replace all blocks that confirm the event he wants to change and keep up ...
user avatar
  • 63.4k
7 votes
Accepted

Can a shorter chain overcome a longer one?

Background info: Strongest vs Longest chain and orphaned blocks How does a client decide which is the longest block chain if there is a fork? Where exactly is the "off-by-one" difficulty ...
user avatar
  • 13.7k
6 votes

Can the blockchain be outpaced by a chain of low-difficulty blocks?

Nate gave a good answer on the modern meaning of "longest chain"-- as a historical curiosity, the originally released Bitcoin software behaved like you were expecting and that attack would actually ...
user avatar
  • 7,479
6 votes
Accepted

How does the BTC protocol guarantee that a "main" blockchain emerges?

Bitcoin nodes consider the chain with the most accumulated proof-of-work the best chain. Whenever one chain tip pulls ahead by adding another block, all nodes will reorganize to that chaintip as soon ...
user avatar
  • 63.4k
5 votes
Accepted

What happens to my outgoing txs in a block reorganization?

Will it be included in one of blocks E, F, G or another block? It's likely already included in one of those blocks. If not, it can be included in a block after that. Do I need to resend it? ...
user avatar
  • 28.7k
5 votes

How frequent are side-chain reorganizations of various lengths?

Random reorganizations of length more than 1 are rare. To get a fork of length 1, you need two miners find a winning nonce at nearly the same time. To get a fork of length 2, you need the same (1) ...
user avatar
4 votes
Accepted

When an attacker publishes a longer chain, does Bitcoin Core emit a warning?

When a previously unknown chain fork of at least 7 blocks length is published, how does Bitcoin Core react? It reorganizes to that chain, any transactions that were lost are returned to the nodes ...
user avatar
  • 15k
4 votes
Accepted

Would it be possible to overtake the network by running a secluded mining operation for many years?

'Longer' means 'more total work spent'. You're not going to be working harder than all miners put together are you? Then the only way to get some money is to join the existing miners and work with ...
user avatar
  • 6,189
4 votes

Can there be stale blocks in "header first" implementation?

Stale and orphan blocks are confusing terms with many meanings, depending on whom you ask. If by stale blocks you mean "blocks that are on branches off the main chain, but are otherwise valid", yes, ...
user avatar
4 votes
Accepted

How long are orphaned or stale blocks kept in bitcoin core nodes memory?

What you are referring to are stale blocks. Orphaned blocks are one for which the previous (parent) hash field points to an unknown block or to a block not yet processed by the local node. Since ...
user avatar
  • 6,908
4 votes
Accepted

How often does temporary fork occur and how long does it last?

Blockchain forks occur when two blocks are found at the same height. Only one of the two chaintips can become part of the best chain. Each full node will consider the first block it saw to be the best ...
user avatar
  • 63.4k
4 votes

Can a proof of work chain have finality?

The Bitcoin blockchain has probabilistic finality. Theoretically, the best chaintip could be replaced in a reorganization to different chaintip, but the proof-of-work necessary to produce such a ...
user avatar
  • 63.4k
4 votes

Can you get the longest chain by keeping a constant low difficulty?

As Mike and Antoine already explained, we pick the best chain by total accumulated work, not by height, where the work is counted per the blocks' difficulty. However, the original release of Bitcoin ...
user avatar
  • 63.4k
3 votes
Accepted

Why is the Bitcoin blockchain designed so that a block can be unconfirmed?

Every Bitcoin node creates it's own blockchain. When a new block is found, it is broadcasted to the network. Other nodes will only consider the highest blockchain as being the "real" blockchain. ...
user avatar
3 votes

How to detect reorganization from bitcoind via ZMQ?

You can use the rawblock interface in order to determine whether there was a reorg. Every time you receive a new block, you decode the block, in particular the block header. Then you store in your ...
user avatar
  • 61.4k
3 votes
Accepted

Understanding getchaintips in terms of chain reorganisations

valid-fork means that the blocks were fully downloaded and validated. It is likely that they were part of the active chain but were reorganized after a better chain was received. valid-headers means ...
user avatar
  • 61.4k
3 votes
Accepted

What is the proper way to handle reorgs when fetching headers

The getheaders message allows you to list multiple block hashes. So instead of just putting the current chain tip, you can insert multiple block hashes. Responding nodes will see if any of those ...
user avatar
  • 61.4k
3 votes

Incoming transaction has been marked as pending since 2013. How can I retrieve it?

Just to clarify how Bitcoin works: How can I retrieve it? You don't ever really retrieve Bitcoin money, it is always kept track of in the list of transactions that almost every Bitcoin user has ...
user avatar
3 votes
Accepted

What are the use cases where very old rev*.dat files are needed?

and they're 1::1 with block files (i.e., for a given NNNNN the files blkNNNNN.dat and revNNNNN.dat hold information for the same blocks), and they're written and chunked in the order in which blocks ...
user avatar
  • 61.4k
3 votes

What is the downside of having a default setting in which nodes will invalidate blocks that comprise a surprise reorg?

What you describe is basically a rolling checkpoints system. While it reduces the risk of a hostile deep reorg, it introduces a new attack where an attacker can cause consensus splits. If we assume ...
user avatar
  • 61.4k
3 votes

Can you get the longest chain by keeping a constant low difficulty?

What matters is the cumulative work, not the length of the chain. A block solved at a higher difficulty will add more work than a block (or several blocks for that matter) solved at a lower difficulty....
user avatar
2 votes
Accepted

Conflicted transactions in blockchain reorganizations

I know you're looking for some magic constant, but it doesn't exist. Your code needs to deal with reorgs of any depth back to the genesis block. This may seem like a annoyance of dealing with the ...
user avatar
2 votes

In what order do new blocks get processed?

First to clarify: Two competing blocks at the same height that build on the same parent block always have the same amount of proof of work, as that depends on the difficulty, which will be the same ...
user avatar
  • 63.4k
2 votes
Accepted

In what scenarios can the blockchain size decrease for bitcoin?

It looks like this part of the code is what was adding all those UpdateTip messages: https://github.com/bitcoin/bitcoin/blob/8fe30fb4d130532d4a0e4c9d143f03e1b85a749e/src/main.cpp#L2234 Essentially, ...
user avatar
  • 7,629
2 votes

What happens to non-standard transactions in the case of a blockchain reorg?

Each of the blockchain forks assumes itself to be the only valid blockchain. They do not change their behavior due to a competing chain. They will require checks and confirm transactions completely ...
user avatar
  • 63.4k
2 votes

What would you do while a hard fork lasts?

A contentious hardfork (where some portion of the network doesn't agree to modify their consensus rules) is effectively a doomsday scenario, there's no making this safe or making tools which allow you ...
user avatar
  • 15k
2 votes

How does Bitcoin avoid splitting into multiple p2p networks?

As long as everyone follows the same rules, mining is convergent, because the expected interval of ten minutes allows every full node to catch up to the current state of the network. Separate p2p ...
user avatar
  • 63.4k

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