What is a Sequencer in Optimism?
Published October 1st, 2022
Are you curious about the underlying infrastructure of the Optimism blockchain network? We are used to hearing about validators and nodes, but when we hear the word "Sequencer" it really does make us wonder what a Sequencer is in Optimism.
A Sequencer in Optimism is a type of node that connects the Optimism blockchain to the Ethereum network via sets of smart contracts. It executes and submits all of the transactions in the Optimism network as batches to the Ethereum network.
Seems complicated right? In this article, we try to explain further what a sequencer is, and how it is crucial to the workings of the Optimism network. We also go over nodes in Optimism and validator nodes.
Optimism is a layer 2 scaling solution for Ethereum. It is an optimistic roll-up, meaning that Optimism assumes that every transaction is not fraudulent. Transactions are rolled up into batches and submitted into Ethereum.
Ethereum then validates and finalizes these transactions. The transactions submitted on Optimism have low fees because the transaction fee that is used to submit them on Ethereum is split between all of the transactions within a batch.
The Sequencer firstly, records incoming transactions from within the Optimism network onto the Optimism blockchain. The sequencer then aggregates those transactions and reports them to the CanonicalTransactionChain smartcontract on Ethereum.
This dynamic can be illustrated in the next image. When many users on Optimism submit transactions, the Optimism Sequencer, which is a node, bundles them and submits them to the CanonicalTransactionChain on Ethereum.
There is only one Sequencer on Optimism. This has both positive and negative consequences. Firstly, there can only be one sequencer on Optimism because it is a layer 2 blockchain. Optimism doesn’t deal with the security issues of transactions; therefore, it doesn’t need to have more than one sequencer at once. The security concerns are dealt with by the Ethereum network. In the future, the Optimism Foundation plans to rotate the sequencer status to different nodes based on some type of selection method. The advantage of this is that, with there being one sequencer, transactions are allowed to be quickly executed.
Secondly, the negative consequence of this is that Optimism becomes a bit centralized. The Sequencer can censor users from submitting transactions on Optimism. We go over this scenario in the next paragraph.
The user can directly submit the transactions directly to the smartcontract called CanonicalTransactionChain which connects Optimism to Ethereum.
Since Optimism has one sequencer at any one time, the sequencer can censor users from submitting transactions. The user, assuming they are still using the Optimism ecosystem, would have to directly submit their transaction to the CanonicalTransactionChain smartcontract on Ethereum. In this case, the user would have to spend the full transaction fee on Ethereum.
Transaction fees on Optimism get divided among all of the transaction senders within a batch of transactions. By posting the transaction to CanonicalTransactionChain the user bypasses the sequencer and is allowed to use applications within the Optimism ecosystem.
Alternatively, the user can also just use Ethereum and its ecosystem, though the disadvantage with this is that they would have to pay the full transaction fee, and transactions would be slower. They would also not be able to use applications that exist within the Optimism ecosystem.
Currently, nobody is able to run a sequencer but OP Labs PBC. However, Optimism Labs indicates that in the future, they plan to let 3rd parties run sequencer nodes. They plan to do this in a decentralized way.
Once OP Labs allows others to participate in the sequencer status of Optimism, Optimism may become more decentralized. We have to remember that a sequencer is just a fancy node, with a special purpose.
Its status can potentially be given to other nodes. However, at any one moment, there can only be one Sequencer, whether it be run by OP labs or individual parties.
Optimism is not completely decentralized because if the sequencer were to censor or blacklist someone from submitting transactions, the user can just submit transactions to the CanonicalTransactionChain smartcontract.
The CanonicalTransactionChain smartcontract is on Ethereum. Ethereum is decentralized, so nobody can prevent users from accessing and submitting transactions on Ethereum.
We illustrate this in the next image, whereby the sequencer censors a user. The user can just submit transactions to Ethereum.
OP Labs does plan to make Optimism more decentralized by allowing other people to run sequencers. When this happens, the status of a node becoming a sequencer will alternate between the different people running nodes.
Optimism does not have validators because Optimism does not validate transactions. Validators are nodes that participate in a network through a consensus mechanism and are chosen to validate transactions.
For example, in the Bitcoin network, nodes that solve complex mathematical problems are allowed to publish blocks and add them to the blockchain. In simplicity, miner nodes are validators on the Bitcoin network. Proof of Work is the consensus mechanism by which nodes are chosen to validate transactions.
Optimism, on the other hand, sends transactions to Ethereum for validation. Optimism does have a node called a sequencer which rolls up transactions into batches and submits them to Ethereum. The sequencer executes the transactions but does not validate them.
Currently, anyone can run an Optimism node. Running a node is made possible by running a vanilla version of the Go-Ethereum node software. This is different from running a sequencer on Optimism. Earlier in this article we go over who can run Sequencer nodes. Optimism has a developer page for how to run an Optimism node.
Running a node only allows the individual to have a copy of the blockchain and have access to the state machine of Optimism. It also allows the developer to have access to the contents within the Optimism blockchain.
This can become useful since running a node allows developers to create different applications such as block-explorers and wallets. A successful wallet connects to a node or group of nodes to be able to scan the blockchain and get access to transactions, addresses and, the network state.