6

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 as they learn about it. Another reason for the network to quickly converge on one best chain follows from how Bitcoin miners get paid. When miners construct ...


5

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 meaning of its existence is finding the most-work chain, and so you can pick almost any line out of the networking and validation modules of the code and explain it ...


4

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 block for that height, until proven otherwise by another chaintip accumulating a greater total difficulty (i.e. adding another block). When another chaintip ...


4

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 together with all their ancestors are fully valid. and it is not an orphan block At the time it is announced, you know that it is part of the best-known valid ...


2

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 spanned by fully validating nodes ("full nodes"). This type of Bitcoin client participates in the peer-to-peer network by unilaterally validating and ...


2

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 difficulty of every new block. An attacker who faked this would never be able to spend the proceeds and would become isolated from other nodes as a known bad node. ...


2

Now image this happens again etc. For the two chains to remain even, the new blocks would have to be found repeatedly at exactly the same time. It gets less and less likely that this will happen repeatedly. The probability depends on block interval, which is regulated at 10 minutes, and how fast the new block announcements propagate on the network. ...


2

They will exchange chainwork. The one that claims a lower chainwork will query the other to confirm that its claim for a higher chainwork is legitimate. If it can confirm the claim, then it will switch to the chain with the higher total work.


1

An attack that attempts to outpace the mining power of the whole network by itself is called a majority-attack or "51%-attack". Concretely, your example is a doublespend attack by means of a majority attack. When the attacker publishes their chain-tip, each node performs a chain-reorganization to switch to the best chain. Concretely, the blocks B4 ...


1

When miners generate a block template, they select most transactions from their mempool with one exception. Each miner creates their own coinbase transaction. The coinbase transaction pays out the block reward—and if a miner finds a valid block, they want to pay themselves! Since the Merkle root in the block header is a digest of all transactions in the ...


1

When a set of new transactions is broadcast ... Individual transactions get broadcast, not specific well-defined sets. That is, the identity or membership of a set of transactions is not preserved as data diffuses across the network. ... to all the Bitcoin mining pools, The broadcast (as you would guess from that name) is sent to nodes in general not to ...


1

Miner ASICs have one job: Change the meaningless parts of the block until the difficulty target (related to the hash of the block) is satisfied. ASICs connect to the pool to first download the block template (they regularly do that - maybe every few seconds?). The block template contains the transactions. They calculate the merkle hash of the transactions, ...


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