Rollups are layer 2 blockchain scalability solutions where the execution of transactions is moved off the main blockchain. Basically, the layer 1 chain is used for keeping the ledger state and providing consensus, while the off-chain layer 2 framework — rollup-is used to execute the transactions and submit the updated state to layer 1.
This approach decouples the work to store the ledger state and execute transactions between the layer 1 and layer 2 respectively. The way it helps achieve scalability is by executing many more transactions within the same block period.
The users send transactions to the rollup. The rollup gets the previous state of the ledger from the layer 1, executes multiple transactions based on this state, and then submits the updated state to the layer 1. The rollup also “rolls up” or bundles all the transaction data and stores it on layer 1 so that any other verifier or rollup node could check the correctness of execution.
There are two kinds of rollups — optimistic rollups and Zero Knowledge (ZK) rollups. In optimistic rollups the transaction execution is verified by other verifiers and they could submit a fraud proof if they find anything wrong with it. While in ZK rollups a cryptographic proof of correct execution of transactions is also submitted along with the updated state and transaction data. Optimistic rollups are hence less secure than ZK rollups, while ZK rollups are slower because of additional proof generation.