Ethereum Chain split November 2020

There’s been a lot of discussion about today’s Ethereum’s chain split, but I found little explanations about what a chain split is and what it means for users.

As most other public blockchains are, Ethereum is a decentralized network. Each node (i.e. computer) in the network has its own copy of the blockchain.

This means it’s important that all nodes stay in sync and in agreement on what the current data in the chain is.

When a new block is added to the chain by a miner, it’s broadcasted across the network, and every node adds it to its own copy.

Side note: if there is more than a single “new block”, the blockchain consensus algorithm decides which one wins. For Ethereum, that’s proof-of-work.

Sometimes it happens that new blocks reach different nodes at different times (it’s a big network!). A node may temporarily accept a block as the new one, but a few seconds later it receives another one that replaces it.

This is called a chain reorganization, or reorg for short.

Reorgs on mainnet usually affect only the latest block, or a few at the most. This means that a node may see data from the last 10-30 seconds change, but that’s it.

That’s also why we wait for a few “confirmations” on transactions before acting on them.

Now, when a node receives a new block, it also needs to validate it. It doesn’t matter how much effort a miner put into it - if a block has an invalid transaction, it’s rejected.

So if a block has a transaction where Alice sends 1ETH to Bob, it should end up with Alice having 1ETH less.

For a block to be deemed valid by every node in the network, every node needs to be able to execute the same transaction and arrive to the same result.

This is usually trivial for simple transactions. But transactions in Ethereum can be really complex, because of smart contracts.

Side note: this is also why the Ethereum Virtual Machine (EVM) cannot have non-deterministic operations, and why doing randomness in Ethereum is that difficult!

Now, when nodes don’t agree on the result of a transaction, they won’t agree on whether a block is valid.

And since we are in a blockchain, where each block is built on top of a previous one, if there’s disagreement on a block there will be on all subsequent ones.

This is a chain split. Nodes disagree on the result of a transaction, so they disagree on whether its block is valid, so they disagree on the rest of the chain built on top of that block.

Some nodes will then follow one chain, others will follow another.

For a user of the network, this means that if you ask different nodes, you may get different results. And, unlike in a reorg, it won’t be automatically fixed after the “right” blocks are propagated - because there’s no agreement on which the “right” blocks are!

To make matters worse, transactions broadcasted to the network can be applied to both chains. This leads to some weird results where you send a transaction and may see it as mined in a chain, but could be reverted in the other.

The fix for chain splits is for node operators to figure out the source of the disagreement, decide which chain is the “right” one, and patch their nodes. This means that all operations that happened on the “wrong” chain will be dismissed, and this can span hours.

If you are curious, the transaction that triggered the split today was identified as coming from Optimism, a very interesting Layer2 solution that really pushes the EVM to the limit.

As for the reason behind the split, Peter Szilagyi from the geth team published a great post mortem:

Another great read is from the Infura team. They were particularly hit by this issue, as they landed on the “wrong” side of the chain split. And since many dapps out there depend on Infura, they were affected as well.
Hope this post helped in clarifying the issue! Fingers crossed that we don’t have to go through another chain split anytime soon. :crossed_fingers:

This was originally a tweet thread.