[Ethereum] What action would actually lead to an invalid block and what happens to the valid transactions in that block

blocksminingtransactions

I'm trying to figure out how an invalid block would come into existence and what happens (technically) to valid transactions in the invalid block.

From what I understand, invalid transactions (like spending more ETH than the account balance) won't even make it into the block. So is it always fraud or chance (when 2 miners solve the puzzle at the same time for instance)?

Also, when a block does turn out to be invalid, are the valid transactions that were included returned to the transaction pool? Can someone explain to me how this works? Also in the case of two miners publishing a block at the same time…are both including the same transactions, are they still in the pool until ..x.. confirmations have occured?

A lot of questions, I'm just a bit unclear on actual 'invalid block' reasons and how the system makes sure all valid transactions will still be included in another block

thanks!

Best Answer

I'm trying to figure out how an invalid block would come into existence

A miner can create an invalid block in many ways (such as putting an invalid timestamp on it), including having invalid transaction in the block.

But the invalid block basically does not exist because all other miners and nodes will just ignore the block.

From what I understand, invalid transactions (like spending more ETH than the account balance) won't even make it into the block. So is it always fraud or chance

Correct, miners will not include invalid transactions in a block: they would not get any rewards from it. An invalid transaction is generally fraud or could be created by using buggy software. Generally, a valid transaction (that's not in a block yet) will always remain valid: if Alice writes a check to pay Bob, the check will always be valid: only Alice could try to invalidate the check by say sending all her money to Charlie using the same check number.

when a block does turn out to be invalid, are the valid transactions that were included returned to the transaction pool?

Each miner has their own transaction pool, and they each can decide which transactions to include a block. Since an invalid block is just ignored, miners and nodes will keep all transactions in the invalid block in their transaction pool (they don't even know that there were transactions in the invalid block, to remove them from the pool in the first place).

in the case of two miners publishing a block at the same time...are both including the same transactions, are they still in the pool until ..x.. confirmations have occured?

Generally, no, both miners are not including the same transactions. By chance, both may have included the same transactions, but each miner can decide what to include, and the order of the transactions. Each miner and node can have their own rule about when transactions will be removed from the pool, as this isn't part of the protocol.

I'm just a bit unclear on actual 'invalid block' reasons and how the system makes sure all valid transactions will still be included in another block

An invalid block is ignored, so any transactions in it do not affect the transaction pool. The transactions will remain in the pool and since miners would like to collect the gas/transaction fees, they are likely to include them in another block.

Related Topic