AdamLLL (OP)
Newbie
Offline
Activity: 6
Merit: 1
|
When miner encountering a fork, one fork has less difficulty but longer in length, while the other fork is more difficult but short. Which fork should miners choose ?
|
|
|
|
Synchronice
|
|
May 14, 2023, 10:52:03 AM |
|
When miner encountering a fork, one fork has less difficulty but longer in length, while the other fork is more difficult but short. Which fork should miners choose ? I assume you talk about accidental hard fork when two miners find the same block simultaneously. When this happens, later block decides which chain becomes the longer one. In this case, miner should choose the longest chain because if they mine the short one, that means they are mining a fork, which is not supported, won't be supported and has no idea to mine.
|
|
|
|
zezaiement
Newbie
Offline
Activity: 21
Merit: 7
|
|
May 14, 2023, 10:56:41 AM |
|
When miner encountering a fork, one fork has less difficulty but longer in length, while the other fork is more difficult but short. Which fork should miners choose ? Miners should generally choose the fork with the longest length. In blockchain terminology, the length refers to the number of blocks on a particular fork. Choosing the longer fork ensures that the miner is contributing to the majority of the network's computing power, which enhances the security and stability of the blockchain. Visualization of a blockchain fork event: the network reconverges on a new longest chain:http://talkimg.com/images/2023/05/14/msbt_0806443ad2e86c891195.png
|
|
|
|
o_e_l_e_o
In memoriam
Legendary
Offline
Activity: 2268
Merit: 18588
|
|
May 14, 2023, 11:12:39 AM |
|
Miners should generally choose the fork with the longest length. This is wrong. Nodes will follow the chain which has the most accumulated work. This is not necessarily the chain with the longest length. Usually when we reorganize one or two blocks, then the blocks will obviously have the same difficulty and therefore represent the same amount of work, so the longest chain will be the chain with the most work. However, if a fork lasted long enough to significantly stretch beyond a difficulty retargeting and in to a new difficulty epoch, then blocks on each chain would represent a different amount of work and so the longest chain may not necessarily be the chain with the most work. Nodes will switch to a shorter chain if that chain has more accumulated work.
|
|
|
|
zezaiement
Newbie
Offline
Activity: 21
Merit: 7
|
|
May 14, 2023, 11:21:03 AM |
|
Miners should generally choose the fork with the longest length. This is wrong. Nodes will follow the chain which has the most accumulated work. This is not necessarily the chain with the longest length. Usually when we reorganize one or two blocks, then the blocks will obviously have the same difficulty and therefore represent the same amount of work, so the longest chain will be the chain with the most work. However, if a fork lasted long enough to significantly stretch beyond a difficulty retargeting and in to a new difficulty epoch, then blocks on each chain would represent a different amount of work and so the longest chain may not necessarily be the chain with the most work. Nodes will switch to a shorter chain if that chain has more accumulated work. This is also wrong, let me explain why I was not wrong. While a shorter and more difficult fork may offer higher rewards in the short term, it is important for miners to consider the long-term implications. The longer fork represents the consensus of the network, as it has accumulated more computational work and has a greater number of participants supporting it. By choosing the longer fork, miners align themselves with the majority, reducing the risk of their blocks being orphaned or invalidated in the future. It's worth noting that miners typically rely on consensus rules implemented by the network's protocol and the consensus of the majority of miners and nodes. Following these rules and aligning with the majority helps maintain the integrity and stability of the blockchain.
|
|
|
|
un_rank
|
The longer fork represents the consensus of the network, as it has accumulated more computational work and has a greater number of participants supporting it.
Being the longer chain does not mean a fork has accumulated more computational work. Proof of work is determined by the difficulty in solving the puzzles which influences the amount of computational energy that is spent. A longer chain can have significantly less computational work if it has a low difficulty level. It's worth noting that miners typically rely on consensus rules implemented by the network's protocol and the consensus of the majority of miners and nodes. Following these rules and aligning with the majority helps maintain the integrity and stability of the blockchain.
In the proof of work model, consensus should be determined by the greater work done. - Jay -
|
|
|
|
o_e_l_e_o
In memoriam
Legendary
Offline
Activity: 2268
Merit: 18588
|
|
May 14, 2023, 11:41:56 AM |
|
The longer fork represents the consensus of the network, as it has accumulated more computational work and has a greater number of participants supporting it. This is not correct. As I explained above, the longest chain does not necessarily contain the most accumulated work. I could fork bitcoin right now, drop the difficulty to 1, and then churn out 10,000 blocks in a few minutes. My new chain would be far longer than the main chain, but have much less accumulated work because the number of hashes required to generate all 10,000 of my blocks would only be tiny fraction of the number of hashes to generate a single block on the main chain. The main chain, although shorter, would have the higher amount of work, and so everyone else would stay on that chain and not switch to my longer chain. By choosing the longer fork, miners align themselves with the majority, reducing the risk of their blocks being orphaned or invalidated in the future. No, they do this by aligning themselves with the chain with most work, which again, is not the same as the longest chain.
|
|
|
|
Kryptowerk
Legendary
Offline
Activity: 2058
Merit: 1402
Disobey.
|
|
May 14, 2023, 03:45:33 PM |
|
The longer fork represents the consensus of the network, as it has accumulated more computational work and has a greater number of participants supporting it. This is not correct. As I explained above, the longest chain does not necessarily contain the most accumulated work. I could fork bitcoin right now, drop the difficulty to 1, and then churn out 10,000 blocks in a few minutes. My new chain would be far longer than the main chain, but have much less accumulated work because the number of hashes required to generate all 10,000 of my blocks would only be tiny fraction of the number of hashes to generate a single block on the main chain. The main chain, although shorter, would have the higher amount of work, and so everyone else would stay on that chain and not switch to my longer chain. By choosing the longer fork, miners align themselves with the majority, reducing the risk of their blocks being orphaned or invalidated in the future. No, they do this by aligning themselves with the chain with most work, which again, is not the same as the longest chain. That's a greate explanation and a pretty crucial point. So a difficulty comparison is done every time by just checking the zeros in front of the latest blockhash? Reading about the accidental-fork-by-miners issue, I remember there was one instance, maybe already 10 years ago, when this happened 6 or seven times in a row. It then became apparent that there was a bug causing this. Need to look up what happened there exactly.
|
|
|
|
o_e_l_e_o
In memoriam
Legendary
Offline
Activity: 2268
Merit: 18588
|
|
May 14, 2023, 03:58:47 PM |
|
That's a greate explanation and a pretty crucial point. So a difficulty comparison is done every time by just checking the zeros in front of the latest blockhash? Not quite. The amount of work is based on the current difficulty, and not the individual hashes of each block. Every block in the same difficulty epoch will add the same amount of chain work, regardless of the actual hashes or the number of leading zeroes in each hash.
|
|
|
|
zezaiement
Newbie
Offline
Activity: 21
Merit: 7
|
|
May 14, 2023, 04:03:32 PM |
|
The longer fork represents the consensus of the network, as it has accumulated more computational work and has a greater number of participants supporting it. This is not correct. As I explained above, the longest chain does not necessarily contain the most accumulated work. I could fork bitcoin right now, drop the difficulty to 1, and then churn out 10,000 blocks in a few minutes. My new chain would be far longer than the main chain, but have much less accumulated work because the number of hashes required to generate all 10,000 of my blocks would only be tiny fraction of the number of hashes to generate a single block on the main chain. The main chain, although shorter, would have the higher amount of work, and so everyone else would stay on that chain and not switch to my longer chain. By choosing the longer fork, miners align themselves with the majority, reducing the risk of their blocks being orphaned or invalidated in the future. No, they do this by aligning themselves with the chain with most work, which again, is not the same as the longest chain. That's a greate explanation and a pretty crucial point. So a difficulty comparison is done every time by just checking the zeros in front of the latest blockhash?Reading about the accidental-fork-by-miners issue, I remember there was one instance, maybe already 10 years ago, when this happened 6 or seven times in a row. It then became apparent that there was a bug causing this. Need to look up what happened there exactly. The difficulty of mining is determined by the network protocol and is adjusted periodically based on the target set by the protocol. In most blockchain systems, including Bitcoin, the difficulty adjustment algorithm takes into account the average time it took to mine a certain number of blocks in the past. If the blocks were mined too quickly, indicating that the network's total computational power exceeds the intended rate, the difficulty is increased. Conversely, if blocks were mined too slowly, the difficulty is decreased. This is designed to ensure that the average time to mine a block remains relatively constant over time.
|
|
|
|
zeuner
Member
Offline
Activity: 189
Merit: 16
|
|
May 15, 2023, 02:03:08 PM |
|
The longer fork represents the consensus of the network, as it has accumulated more computational work and has a greater number of participants supporting it.
Being the longer chain does not mean a fork has accumulated more computational work. Proof of work is determined by the difficulty in solving the puzzles which influences the amount of computational energy that is spent. A longer chain can have significantly less computational work if it has a low difficulty level. Considering that both chains are supposed to exist at the same time, and having forked apart from a common block, how would the longer chain have a lower difficulty level if both chains adhered the difficulty retargeting protocol?
|
|
|
|
o_e_l_e_o
In memoriam
Legendary
Offline
Activity: 2268
Merit: 18588
|
|
May 15, 2023, 02:11:42 PM |
|
Considering that both chains are supposed to exist at the same time, and having forked apart from a common block, how would the longer chain have a lower difficulty level if both chains adhered the difficulty retargeting protocol? I've answered this above: Usually when we reorganize one or two blocks, then the blocks will obviously have the same difficulty and therefore represent the same amount of work, so the longest chain will be the chain with the most work. However, if a fork lasted long enough to significantly stretch beyond a difficulty retargeting and in to a new difficulty epoch, then blocks on each chain would represent a different amount of work and so the longest chain may not necessarily be the chain with the most work. Nodes will switch to a shorter chain if that chain has more accumulated work.
Usually, the longest chain does indeed have the most work, since as you say, when the chains fork each block on each chain adds the exact same amount of work. If the fork continues past a retargeting, then the chains will have different difficulty adjustments since they will not have found all the blocks between the fork and the retargeting in the exact same amount of time. From that point on, the blocks added to each chain do not add the same amount of work, and so the longer chain will not necessarily be the chain with the most work.
|
|
|
|
un_rank
|
|
May 15, 2023, 06:53:02 PM |
|
In most blockchain systems, including Bitcoin, the difficulty adjustment algorithm takes into account the average time it took to mine a certain number of blocks in the past.
Bitcoin difficulty adjustment does not take a random period of time in the past, it only accounts for the last 2,016 of confirmed blocks and uses the time taken to mine a block averagely to adjust the difficulty. Considering that both chains are supposed to exist at the same time, and having forked apart from a common block, how would the longer chain have a lower difficulty level if both chains adhered the difficulty retargeting protocol?
As mentioned it depends on if the chains last into the next retargetting, which will result in different amounts of work in the different chains. - Jay -
|
|
|
|
hd49728
Legendary
Offline
Activity: 2142
Merit: 1039
|
|
May 16, 2023, 01:46:09 AM |
|
When miner encountering a fork, one fork has less difficulty but longer in length, while the other fork is more difficult but short. Which fork should miners choose ? A fork will occur when on the initial chain, there is split to two or three different chains. Miners and mining pools have to choose what chain they will continue to mine with and obey those consensus on that chain. Usually mining pools, nodes, and miners will choose a longest chain to continue their work (mining blocks and confirm transactions). They will less likely to choose shorter chains as it contains more risk for them. The second scenario only happens when some mining pools intentionally support a consensus which leads to that shorter chain so they clearly know what they are doing when they choosing that short chain, then become a fork. Hell no, do you know that most of forks are useless and will die with time? A comparative analysis of Bitcoin forks. How many Bitcoin forks are there?
|
|
|
|
bettercrypto
|
|
May 16, 2023, 09:27:25 AM |
|
When miner encountering a fork, one fork has less difficulty but longer in length, while the other fork is more difficult but short. Which fork should miners choose ? You know, the miner should choose to mine the longest chain that the network is likely to accept. Because mining a short chain will be pointless, because the network will eventually abandon that chain as well as I know and understand the point you are making. And accidental hard fork are also relatively rare and resolved quickly as well too. Source: https://en.wikipedia.org/wiki/Fork_(blockchain) https://www.bitstamp.net/learn/crypto-101/what-are-blockchain-forks/
|
|
|
|
o_e_l_e_o
In memoriam
Legendary
Offline
Activity: 2268
Merit: 18588
|
|
May 16, 2023, 10:03:34 AM |
|
Usually mining pools, nodes, and miners will choose a longest chain to continue their work You know, the miner should choose to mine the longest chain Once again, as I've said multiple times above, nodes and miners choose the chain with the most chain work, which is not synonymous with the longest chain. In the event of a fork of just one or two blocks where both chains have the same amount of work, then nodes will generally pick the chain which they saw first.
|
|
|
|
Synchronice
|
|
May 16, 2023, 11:49:51 AM |
|
Miners should generally choose the fork with the longest length. This is wrong. Nodes will follow the chain which has the most accumulated work. This is not necessarily the chain with the longest length. Usually when we reorganize one or two blocks, then the blocks will obviously have the same difficulty and therefore represent the same amount of work, so the longest chain will be the chain with the most work. However, if a fork lasted long enough to significantly stretch beyond a difficulty retargeting and in to a new difficulty epoch, then blocks on each chain would represent a different amount of work and so the longest chain may not necessarily be the chain with the most work. Nodes will switch to a shorter chain if that chain has more accumulated work. Actually, you are right! I always thought the longest chain was the answer because the whitepaper says: Nodes always consider the longest chain to be the correct one and will keep working on extending it The majority decision is represented by the longest chain, which has the greatest proof-of-work effort invested in it It's true that originally the block height was a main factor but it was changed later when people saw the danger of height over most work where one can mine blocks locally with low difficulty, manipulate timestamp and make his chain the longest chain, broadcast it and do the magic. To protect ourselves from this accident, we should follow chain with more accumulated work. Thank you for this post, you really enlightened me.
|
|
|
|
|
mindwatcher
Newbie
Offline
Activity: 3
Merit: 0
|
|
May 17, 2023, 03:05:05 PM |
|
When a fork occurs, miners have the ability to choose which blockchain branch they will work on. They make this choice using consensus algorithms, which typically rely on computational power (Proof of Work) or other criteria
|
|
|
|
IShishkin
Member
Offline
Activity: 76
Merit: 28
|
|
May 17, 2023, 04:39:13 PM |
|
1) According Bitcoin Proof-of-Work consensus, Miners follow the valid chain with the most accumulated Proof-of-Work
2) Traditionally this chain is called "the longest chain". However, this name is confusing.
3) Often the heaviest valid chain coincide with the longest valid chain in Bitcoin. However, in general case it might not be true.
4) There are theorems which claim that under certain conditions heaviest chain coincide with the longest chain.
5) In this context, other rules of Bitcoin protocol has an important role too. For example, Bitcoin client doesn't append into the blockchain blocks which have timestamps more than 2 hours into the future.
If this rule is discarded, then a solo miner can mine a longest chain by systematically putting timestamps far into the future. In this scenario, the block difficulty will decrease and this solo miner will be able to mine blocks with a little effort. However, his personal longest chain won't have the most accumulated Proof-of-Work, unless he has more computational power than the rest of the network.
If this solo miner poses more computational power than the rest of the network, he may generate the longest and the heaviest chain in the network. However, his chain might be truncated by peers, who will discard those blocks whose timestamps are far in the future. After this truncation his chain might be not as long and difficult as it was before. In this edge case scenario miners might follow the chain which is neither the longest, nor the heaviest.
|
|
|
|
|