Optimistic Scaling Solutions
It is no secret that Ethereum has yet to resolve the tradeoffs that come from prioritizing transaction speed and costs over security. This has persisted for years, but fortunately some solutions have been proposed to help reduce the costliness of transactions while still leveraging the security that comes from the Ethereum Network.
"Rollups" are one such solution and perhaps the most popular L2 scaling solution. What makes it "L2"? Well, L2 refers to Layer-2 insofar as it operates as a layer outside of the Ethereum (L1) layer. Think of it as like an underworld. You go through the Underworld and come ressurect back to L1 after you have executed all the tasks you'd like to execute. These "tasks" are really transactions which are, you guessed it, rolled up into the main (L1) network.
Before these transactions are rolled up, they undergo scrutiny in the form of a validation layer that uses fancy cryptography to verify their state to prove they are valid and viable for submission to the main (L1) network.
What is this "fancy cryptography"? In the world of Optimistic Rollups, they refer to a cryptographic method called a "fraud proof", which means the state that is passed on from L2 to L1 is given the BOTD and assumed to be valid, unless another party challenges it. You might be asking, why give them the benefit of the doubt? Well, mostly because this is cheaper and because there is an incentive not to lie -- in other words, there is a punishment for those sneaky snakes who try to play the system. Continuing with the Underworld metaphor, the gatekeepers of the Underworld (L2) are referred to as Sequencers.
Sequencers process, bundle, and submit L2 transactions to an L1 and are required to post up a bond (aka lock funds) to gaurantee authenticity of their submissions, which are "slashed" if caught being deceptive.
Breakdown of the Process
Let's breakdown the exact sequence of events for these transactions:
1. User Submits Transaction. The tranasction is originally initiated on a roll-up contract, which sends the transaction to an off-chain sequencer.
2. Sequencer Executes Transaction. Locally executed and confirmed.
3. Sequencer Bundles Transactions. As described above, the transactions locally executed and confirmed by the sequencer are bundled into a batch.
4. Sequencer Sends Batch to Ethereum. The batches transactions that are locally executed and confirmed by the sequencer are submitted to the L1 chain via a single transaction, which reduces the cost of individual transactions.
Just like it sounds -- optimistic solutions are optimistic about the transactions they submit, though not naïve. Just like a criminal trial (in the USA) you are innocent until proven guilty, however also like a trial -- it takes time to ensure you are not up to no good.
As such, it takes some time for the submitted transactions to actually make it onto the main chain. In the case of optimistic solutions, when a transaction is challenged, it may take upwards to 7 days for the funds to clear, which means you, as a end-user have to be willing to wait for much longer than you would compared to using an L1 solution directly.
This is why these L2 solutions have been relatively slow to reach the level of adoption of alternative L1 solutions, such as Avalanche and Fantom, where you can benefit from the EVM technology without having to suffer from long wait times or costly transactions. Ultimately, I prefer to stick to alternatives to Ethereum, such as Avalanche and Fantom, over waiting around for L2 solutions to process my transactions. I find them just as reliable and I am not willing to wait for up to 7 days for my transactions to confirm.