4 ms·
This happens fairly frequently. Whenever you see a new block that forms a longer chain than the chain you currently know, you throw your work away and use that
by hanbura 9y ago
This happens fairly frequently.
Whenever you see a new block that forms a longer chain than the chain you currently know, you throw your work away and use that block as your new starting point. But you only do that if the new block has a longer chain, not for a chain of equal length.
So if two miners both mine a new block that follows the same block, one will be seen first by some miners, the other will be seen first by others. That gives them different mining power, meaning the chains grow with different speed. After 1-3 blocks this mining power difference will lead to one of both chains being longer from everyone's point of view. At that point the longer chain won, the shorter is forgotten and all work put into it becomes worthless.
That encourages miners to make sure they use new blocks as fast as possible. Unless of course you have more mining power than everyone else combined.
- annabellish 9y agoWhat happens to the transactions in the chain that were thrown away? Are they just lost now? Do they need to be added again?
- hdhzy 9y agoUsually the second miner also saw and included the same transactions so they are not lost. If they didn't the transaction is undone in a sense that it just didn't happen. Of course it can still be picked by the next miner. The chain that is longest (by difficulty) is by definition a log of everything that happened. Transactions that are not part of that chain are just candidates, nothing less nothing more.
- jackhack 9y ago>the shorter is forgotten and all work put into it becomes worthless Then one can commit work to (what is believed to be) the current, longest chain, only to find later that a branch occurred and the work was lost? As such it is then incumbent upon the contributor to follow the chain for some period of time until other work has contriubted to the chain? So how long is long enough? one contribution? ten? Serious question. How does one know with certainty that work was accepted by group consensus? This uncertainty seems to undermine the idea that blockchain is a trustworthy, predictable, verifiable ledger of activity if the work contributed cannot be known as reliably preserved at the time it is submitted, only later in review. I admit I'm fairly ignorant of the details of this, just attempting to understand. I hope I am misunderstanding something; somebody please steer me back onto the path.
- SomeStupidPoint 9y agoIf you had more computing power than the network, you could (theoretically) undo all of BTC by completely replacing the chain. I think in practice, they would ignore such a rewrite of history.
- hdhzy 9y agoIf you find a valid block then it's more profitable to switch to this block as a base. Chain splits happen when someone finds a block but is not aware of other valid block.
- JamesLeonis 9y ago> So how long is long enough? one contribution? ten? Serious question. The formal name of this is Proof Of Work (PoC). The idea is to make "mining" blocks take non-trivial amount of computational work in order to forge another transaction block. When a miner finds a valid nonce, it announces it to the rest of the network so others can begin working on that chain. When I say non-trivial amount of work, it would take my computer (nVidia 1080 @ 20MH/s) ~3.5 years to mine one Ethereum block as of now. Comparatively, the combined power in the Ethereum network (119.4 TH/s) mines blocks every 24 seconds. Additionally, the miner that finds the correct nonce that makes a valid block is rewarded. This incentivizes each miner to keep up to date with the latest blockchain and abandon lagging branches and work. > How does one know with certainty that work was accepted by group consensus? Through these rewards and the large computational work involved in mining new blocks, the majority of the miners aggressively gravitate to the longest chain. That means that the longer chain continues to grow longer much faster than the other branches. It's this aggressive growth combined with the reward incentives on the longest chain that keeps the whole network honest. Why mine a block that the network won't reward you for? For the individual miner, it's in their best interests to always be working on the longest chain. > This uncertainty seems to undermine the idea that blockchain is a trustworthy, predictable, verifiable ledger of activity if the work contributed cannot be known as reliably preserved at the time it is submitted, only later in review. This is part of the security of the blockchain. This prevents malicious agents from pushing "valid" blocks, even if they manage to get all the dots in a row. The computational work involved in building the next block is vastly outpaced by the general network; by the time you minted you "attack" block, many many many new blocks were already minted by the network and they won't accept your block. This "consensus" keeps these attacks from happening. However, this still can be attacked. If an agent gained control of the majority of the network computational power, then they can mine blocks faster than the honest miners, thus growing the longest chain and thus control exactly what transactions/blocks are mined. This is referred to as the 51% attack because they become the Consensus. But, using my calculations above, I would need somewhere around ~6*10^6 nVidia 1080 cards all working for me to gain majority in the Ethereum network. So I sleep comfortably at night knowing my ETH is safe.