1

If 51% of the hashrate was controlled by bad actors mining invalid blocks, this would become the longest chain. Where do nodes come into the 51% attack? The canonical chain is the longest chain. Is this true even if less than majority of the nodes accept it. I assume that the canonical chain is the one which majority of full nodes accept as the canonical chain, but how does this fut into block height. Would a 51% attack have to be 51% of hash power and nodes or just hash power? If so, why?

1

A 51% attack involves just 51% of the hashrate, no nodes are involved.

With a majority of the hashrate, miners can construct a new branch in the chain that overtakes the chain that was previously accepted.

It has to be an otherwise valid chain, as otherwise nodes would reject it. The attack doesn't let the 51% attackers make the network accept any invalid transactions - it can just roll them back.

7
  • Thank you. But aren't 51% attacks for producing invalid transactions, otherwise what is the point of an attacker? And how is it an attack? I assume it has to do with the protocol. Also, don't invalid transactions cause forks all the time in the blockchain? If this is true, wouldn't that produce the longest chain temporarily. I know that nodes accept the valid blocks, and the legitimate blockchain is the longest one. How do you have two competing chains with all valid transactions, what is the point? How does node know which block to add it it's own copy if there are two valid blocks? Apr 30 at 6:26
  • The point of a 51% attack is reverting transactions: taking money back after paying someone, and then spending it again. Or it can be used to censor a transaction from being confirmed. A 51% attacker also gets 100% of block rewards, which may be an incentive. But in no case can it be used to force the network to accept invalid transactions. The money must exist, and the sender has to have the key to spend it. Apr 30 at 6:59
  • As for choosing between valid chains: the rule is that (a) among all fully-valid chains (b) the chain with the most work (typically: longest chain) is taken and (c) in case of ties, the chain with the first-seen tip is preferred. Apr 30 at 7:00
  • Invalid transactions do not cause forks; they're just immediately ignored by the network and dropped on the floor. The same is true for blocks that contain invalid transaction, and any chain that contains such a block. Apr 30 at 7:02
  • Thank you for the detailed response Pieter! Understood. However, as for nodes, since they can't prevent 51% attacks, do they contribute to security by participating in consensus of the validity of transactions? I understand the more nodes, the more secure the network. I know they help validate blocks, is there some consensus mechanism between nodes of what is valid? Though transactions are objectively valid or invalid, so I can't see how that works. And do nodes actually contribute to decentralisation? Apr 30 at 7:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.