Skip to main content
22 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 ...
gary's user avatar
  • 539
16 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 ...
Ethan's user avatar
  • 161
7 votes
Accepted

Chain with most proof of work - hash target or block header hash?

It's the sum of difficulty targets, not the individual difficulty scores. Therefore, two blocks at the same blockchain height are always the same cumulative difficulty¹. If it were individual ...
Murch's user avatar
  • 77k
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. ...
Murch's user avatar
  • 77k
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 ...
G. Maxwell's user avatar
  • 7,727
7 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 ...
Murch's user avatar
  • 77k
7 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 ...
Murch's user avatar
  • 77k
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 ...
chytrik's user avatar
  • 18.3k
6 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 ...
Pieter Wuille's user avatar
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 ...
G. Maxwell's user avatar
  • 7,727
6 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 ...
Murch's user avatar
  • 77k
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 ...
Ava Chow's user avatar
  • 71.6k
6 votes

Why is not good having forks in a blockchain?

if I imagine to work with isolated transactions chained each other according to money flow, then i understand that we wish to have a single chain because forks would mean the presence of double-spend ...
Ava Chow's user avatar
  • 71.6k
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 ...
Murch's user avatar
  • 77k
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 ...
natevw's user avatar
  • 223
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 ...
pinhead's user avatar
  • 5,174
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 ...
Murch's user avatar
  • 77k
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 ...
Jannes's user avatar
  • 6,344
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 ...
Pieter Wuille's user avatar
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 ...
RedGrittyBrick's user avatar
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 ...
Murch's user avatar
  • 77k
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 ...
hedgedandlevered's user avatar
3 votes
Accepted

How do miners avoid transactions getting dropped?

Miners have mempools where they store all transactions they consider to include in future blocks. They don't put transactions they received into their blocks, right away. But they don't put them into ...
UTF-8's user avatar
  • 3,234
3 votes

Bitcoin: Why can the difficulty parameter not be ignored?

However, that implies that the adversary sticks to the network's difficulty setting. If it didn't, it could create longer chains using much less computing power. The Bitcoin network's backbone is ...
Murch's user avatar
  • 77k
3 votes

Why can't a 51% attack change past blocks on the blockchain?

It could! An attacker could replace a block at arbitrary depth given that they can maintain majority hashrate sufficiently long. Every block in the Bitcoin blockchain commits to its predecessor by ...
Murch's user avatar
  • 77k
3 votes
Accepted

Does a hard fork need to include a soft fork as well?

Yes, a hard fork needs wipeout protection to prevent nodes from reorganizing to a chaintip with more work following the old rules, if the hard fork only loosens rules. (I.e. I would say that a hard ...
Murch's user avatar
  • 77k
3 votes
Accepted

If the longest chain is considered the valid blockchain by nodes, what happens if a future supercomputer alters the entire blockchain?

Yes, it is a fundamental security assumption that the majority of the hashrate on the network is honest, where honest means "not collaborating to attack". Assuming an antagonist with ...
Murch's user avatar
  • 77k
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....
Antoine Poinsot's user avatar
3 votes

How do transaction verification and adding a block to the blockchain fit together?

The nodes form a gossip network. Every time a node hears about a new (unconfirmed¹) transaction, they check whether the transaction would be eligible to be added to a block, and if they deem it valid, ...
Murch's user avatar
  • 77k
3 votes

What is the use of longest chain consensus rule?

It is not possible to prevent the existence of two chaintips at the same time while maintaining the current characteristics of Bitcoin's network. Blocks are found through a random process. Since ...
Murch's user avatar
  • 77k

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