20 votes

What is chainwork?

Pieter's answer is good, the chainwork value is the expected work amount in the chain, expressed as a 32 bytes integer, for the double SHA-256 hashes calculation work. The chainwork is used to ...
user avatar
  • 481
15 votes

What happens if two miners mine the next block at the same time?

What Nicolai said is not completely right. The network would decide which one is the main chain according to the following block mined. Let's assume that block A and B are mined at almost the same ...
user avatar
  • 151
15 votes
Accepted

What is chainwork?

The chainwork value is really just the total amount of work in the chain. It is the total number of hashes that are expected to have been necessary to produce the current chain, in hexadecimal. ...
user avatar
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
12 votes
Accepted

Strongest vs Longest chain and orphaned blocks

The "longest" chain is the one with the most work. A chain's work is equal to the expected number of hashes it would take for someone to replicate a chain of the same number of blocks and the exact ...
user avatar
  • 8,694
10 votes
Accepted

What does "Activating Best Chain" mean?

Bitcoin Core maintains two databases: The block index The chain state (or UTXO set) The first one just contains a list of all blocks we know about, valid and invalid. It contains all forks we have ...
user avatar
9 votes
Accepted

How is a blockchain split resolved?

You're looking for CBlockIndexWorkComparator, which operates by three rules. The rules are applied one at a time, and if a rule leads to a tie, then the next rule is applied. Which blockchain has the ...
user avatar
  • 28.7k
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
7 votes

Why aren't block hashes used directly as scores for difficulty purposes?

The "apparent" work is 2x higher than actual work due to luck, but the reason it's good bitcoin doesn't use the apparent work is because it has bad stability properties due to variance, and bad game ...
user avatar
  • 7,479
7 votes
Accepted

Why Block Chain not Block Tree?

I am not sure that I can rule out that something useful could be achieved with a tree of blocks, but let me walk you through a few thoughts and you can then tell me whether they answer your question. ...
user avatar
  • 63.3k
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

Why aren't block hashes used directly as scores for difficulty purposes?

Background info: The block hash must be less than a certain value (as defined by the difficulty function) in order for the block to be valid. Generally, as time has progressed, network difficulty ...
user avatar
  • 17.3k
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.3k
6 votes
Accepted

Does local blockchain database (blkXXXXX.dat) contain abandoned forks forever?

When my node realizes that the given block needs to be abandoned - does it leave it in the database or replace the block with a valid one? It remains on disk along with its entry in the block index ...
user avatar
  • 61.3k
5 votes
Accepted

Is bitcoin just one long block chain or are there multiple chains?

The Bitcoin blockchain converges to a single-file chain because each block references exactly one predecessor, and thus there can only be one block at every height in the chain connecting the genesis ...
user avatar
  • 63.3k
5 votes
Accepted

What prevents rewriting the history of a chain with a different difficulty?

I think this would be considered a time warp attack. What prevents this strategy from working is actually quite simple, as explained in https://bitcoin.stackexchange.com/a/37960/26673: Bitcoin ...
user avatar
  • 224
5 votes

How can Segwit increase transaction throughput if the same amount of data is stored in the blockchain?

The answer to the question "Are the segwit witnesses part of the blockchain" depends on what you define as the blockchain: According to old pre-segwit nodes, the answer is no, as they don't care or ...
user avatar
5 votes
Accepted

How does Bitcoin Core know it's on the longest chain?

First of all, finding the longest chain is not the goal, but the chain with the most accumulated proof-of-work [1] Now, finding the most-work chain is the entire goal of the full node. The whole ...
user avatar
  • 4,676
4 votes

How is a blockchain split resolved?

This is explained in the Bitcoin paper: Nodes always consider the longest chain to be the correct one and will keep working on extending it. If two nodes broadcast different versions of the ...
user avatar
  • 5,114
4 votes

Would an optimization proof-of-work problem where the entity with the lowest hash wins have any security weakness or other disadvantage?

You're not thinking like an attacker yet. ;) Beside this incentivizing selfish mining, a miner can do the following attack: Mallory sends all her funds to herself every block. As soon as she finds a ...
user avatar
  • 63.3k
4 votes

Tie Breaker to reduce orphaned chains?

Consensus rules are often a lot more delicate than they might first appear. Having a tie breaker can actually enable attacks. If I find a block with a really low nonce, I can gamble to keep it secret ...
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

Can I rely on my full node to always have the most recent blocks?

how can I make sure that this block that my node received is a valid block Bitcoin Core will only announce (through ZMQ) blocks that change the tip of the best-known valid chain. This implies they ...
user avatar
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.3k
4 votes
Accepted

Bitcoin: Why can the difficulty parameter not be ignored?

It isn't strictly the longest chain that is chosen, it is the chain that has accumulated the most work (proof of work). The reason miners can't fake the difficulty is that every node checks the ...
user avatar
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.3k
3 votes
Accepted

Why is the longest block the one that gets accepted by all the nodes?

The problem here lies in a misunderstanding. It's not the longest block that wins out, but the longest blockchain (read "the blockchain with the most cumulative difficulty"). The length of a single ...
user avatar
  • 63.3k
3 votes

What does "Activating Best Chain" mean?

Appending blocks to the longest blockchain fork. _ _ _ _ _ _ _this is the best chain _ _ _ _/ \_ _ this is NOT
user avatar
  • 853
3 votes

Tie Breaker to reduce orphaned chains?

There isn't really a "race" any more than there is a race normally. Since both chains are valid, miners can choose which block they would like to build off of. There isn't an advantage to mining on ...
user avatar
3 votes
Accepted

What does the main_chain value returned by blockchain.info mean?

If a block is part of the main chain, that means that the tip of the blockchain is a descendant of that block. If a block is not part of the main chain, that means there is a longer chain of blocks ...
user avatar
  • 28.7k

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