What's up with Optimistic Ethereum
Dear Bankless Nation,
A lot of us are probably getting a little annoyed with gas fees.
$10 to send someone ETH, $50 to trade on Uniswap, $100s to deploy a DAO or any sort of complex computation. This isn’t what we signed up for. We’re supposed to be democratizing access to finance—lowering the cost to transact for everyone.
Yes, gas fees can be a positive sign as it shows there’s a demand for Ethereum. Better yet, it shows that people are actually willing to pay a lot to use Ethereum. It means the network has valuable block space. And yet…it’s a barrier to those with less.
Ethereum needs to scale. Specifically, it needs to scale its trustless transactions per second (TPS). And while Eth2 is making progress, we need scaling solutions today.
Layer 2 is often touted as our best scaling option. The industry has spent years trying figure out the best Layer 2 model. We’ve seen state channels, plasma, and now, rollups. All have their own trade-offs. Vitalik outlines them elegantly here (📺 watch the video).
Here’s our ELI5:
Layer 2 Crypto Rollups:
State Channels
State Channels are like bar tabs. You and one other entity can generate an infinite number of transactions between each other, and once the night is over, the tab is ‘settled’ and a single transaction is made to Ethereum. It’s possible to include multiple people in this tab, but it becomes difficult to scale State Channels to a lot of participants.
Also, incorporating logic into these transactions also complicates things a bit. State Channels are great for transfers, but anything more complex becomes really difficult.
Plasma
Plasma is an attempt to create a more flexible bar tab, that enables many-to-many asset transfers, rather than just one-to-one or one-to-few. Additionally, Plasma enables more complex transaction logic, and are ‘smart-contract enabled’ in certain flavors of plasma. Like State Channels, Plasma is completely separated from the Ethereum L1, which gives it near-limitless scalability ceilings. Millions of TPS.
There’s only one problem: the ‘data-availability problem’. Being entirely disconnected from Ethereum gives Plasma unrestricted cap on scale, but it creates game-theoretic issues when the Plasma chain and the Ethereum chain try to sync up about the state of truth.
Ethereum can never truly know the state of any Plasma chain, and thus cannot export its security to any plasma chain. You can cheat on a Plasma chain, and Ethereum may never know about it.
Rollups
The reason Rollups have become the defacto L2 scaling method is that they offer similar capabilities as Plasma, but they also solve the data availability problem. Rollups offer many-to-many transactions, smart-contract capabilities, and significantly reduced total L1 blockspace requirements.
Rollups provide less raw TPS than Plasma, but they are also able to completely and uncompromisingly extend Ethereum’s security assurance to the L2. Instead of the million+ TPS that Plasma boasts, rollups can offer around ~5,000 TPS. This is a much lower ceiling, but in practice it’s more than sufficient for most of Ethereum’s needs.
Rollups accomplish this by regularly posting transactions of rollup activity to the mainchain which updates Ethereum about the state of things on the sidechain. Multiple transactions in a rollup are ‘rolled-up’ into a ‘state root’, which contains all the necessary information to validate every single transaction that occurred on L2. (As usual, there’s some cryptography magic involved in all this.)
By making these regular updates about the state of the Rollup L2 to the Ethereum L1, Ethereum consensus is extended to the L2 rollups. Any lying or cheating on the L2 is operating in plain sight of Ethereum’s L1 consensus, and thus the security of Optimistic or ZK rollups is synonymous with the security of Ethereum. This preserves Ethereum’s trustlessness and extends the ethos and values of Ethereum into its scaling layers. (Btw, if you want to understand the differences between Optimistic and Sk rollups watch the video with Vitalik.)
That’s why rollups are so promising. It sufficiently scales the network with full security guarantees.
Now we get to Optimism.
Optimism is a brand new optimistic rollup protocol for Ethereum that promises to scale DeFi and it just launched on mainnet with Synthetix a few weeks ago.
So how good is it? Well, at least one multi-billion dollar DeFi protocol is committing to using it as its path to scale. Synthetix is one of the most computation-heavy protocols on Ethereum—minting, claiming, trading—all of these can cost hundreds of dollars per week (or even per action) to complete.
As a result of the gas prices and the compute requirements of Synthetix, it’s become too expensive to stake SNX—a crucial action to scale the network’s economic bandwidth for synthetic assets.
So they’re moving these functions to Optimism.
To get an update on their progress we brought in the Synthetix core developers to tell us what they’ve learned so far, why they chose Optimism, and what’s next.
Layer 2’s aren’t perfect yet, but don’t be mistaken…
They’re coming.
- RSA, David, & Lucas
Guest Writer: Garth Travers, Community at Synthetix
What we learned from Optimism
What was the thought process behind what can move to the L2?
Migrating a protocol to a new Layer 2 solution was always going to be a huge undertaking, so it has been critical to ensure risk has been minimised as much as possible.
Vitalik himself said in this post, “I expect that a lot of the work will be done by the major defi projects, who have a large incentive to economize on fees and to make sure that their systems continue to be easy to use; we can do a lot by leaning on them as highly motivated early adopters.” As a major DeFi project that also happens to be one of the more computation-heavy protocols on Ethereum, Synthetix was a natural choice to work closely alongside the Optimism team to help pioneer this next phase in scalability.
The transition to Optimistic Ethereum (OΞ) needed to take the right steps in the right order. The current intended end state for the L2 transition is for staking SNX to only exist on L2, and Synth exchanges to be available on both L2 and L1. This is because Synth exchanges are more important to the wider DeFi ecosystem than staking, and there is no telling how long it might take for the rest of DeFi to join Synthetix on L2. Once full functionality is live on L2 and staking is no longer supported on L1, Synths will be able to be teleported across layers.
What was the thought process behind keeping some things on the L1?
An iterative transition period was chosen to reduce the risk that users might be affected by any potential issues. This first phase allows SNX holders to migrate their SNX to L2 if they want, where they can stake L2 SNX and mint L2 sUSD, but there is no utility to this L2 sUSD yet. The synthetixDAO is paying an incentive to be shared among L2 stakers for at least the first month. This is separate to the weekly inflationary staking rewards available to SNX stakers on L1. The intention was that this would incentivise smaller SNX holders to move over to L2, where although the rewards are lower than L1, the gas costs are non-existent, as L1 gas costs have been a particular pain point for smaller holders throughout the life of Synthetix.
This incentivised optional migration period, which offers a sensible option for smaller holders who might have felt priced out of staking on L1, ensures that larger holders can follow suit when the L2 environment has matured and the migration/staking experience has improved. It also means that the current deep liquidity of Synths can continue to remain central to the DeFi ecosystem on L1 while the migration phases are carried out.
How much gas do you think is able to be saved by the L2 transition?
As of today (Monday, February 1st), 2761 token transfers have gone through the L2 bridge contract. And here are the gas costs of some relevant functions on the L1 Synthetix contracts:
- burnSynths: 469,628 ETH
- issueMaxSynths: 442,780 ETH
- claimFees: 415,251 ETH
If each week a single SNX holder typically burns Synths once, mints Synths once, and claims rewards once at today’s pretty cheap price of 50 GWEI, then that comes to 0.06638295 ETH saved per week per person. At current ETH prices ($1550), that’s $102.
Across 2761 SNX holders, that’s 183.28 ETH, or almost $275K. And that’s only for one week!
It’s worth noting that in this transition phase of the L2 migration, currently all L2 gas costs are subsidised by the Optimism team, whereas in the future there will be some gas costs on L2, though they will be much, much lower than L1 (~99% lower).
What were the critical variables that helped guide decisions?
In collaborating as a community on decisions for the Synthetix protocol, it’s important to consider the two different demographics the protocol supports: SNX stakers and Synth traders. And now that Synthetix has been growing more and more integrated across the DeFi ecosystem, with Curve’s new cross-asset swaps being a great example of this, there’s an even larger group of users depending on Synthetix being fully functional without interruptions.
Another variable that guided decision-making was coming up with a staged process in which it would make sense at a particular time to begin transitioning some of the weekly inflationary SNX staking rewards from L1 to L2. This will naturally need to go through the Synthetix community governance process as a Synthetix Improvement Proposal (SIP), to be voted on by the Spartan Council. But for a SIP to gain consensus among the Council, it is likely that it will need to have been demonstrated already that both SNX staking and Synth exchanges are functioning smoothly on L2 before some of the L1 rewards begin to be diverted across.
Why Optimistic Ethereum over other L2 solutions?
There were two primary factors when it came to choosing Optimism over the other potential L2 solutions. First, Synthetix’s suite of smart contracts are some of the most complex in DeFi, so any solution that required rewriting contracts in a new language wasn’t viable, as we truly want to avoid having to maintain more than one distinct codebase at a time.
Also, it’s not only a technical issue, but a social one too. For the Ethereum space to settle on an L2 solution (if indeed this happens at all) it will require significant social coordination. The proven track record of the Optimism team and their high profiles within the space helped convince the Synthetix core contributors that it would lead the charge within DeFi for a scalable solution.
There is a detailed article published by Synthetix founder Kain Warwick on this question if you wish to read more about it.
Other than gas savings, what are other improvements to the Synthetix system as a result of the L2?
Gas savings have a number of flow-on effects. They allow a greater number of SNX stakers to participate in providing collateral for the system, which means A) more collateral and thus more Synths, and B) a more distributed network of stakers. It also lowers a major barrier to entry when it comes to trading via the Synthetix protocol: if you have to factor in exchange fees as well as gas costs, then centralised exchanges might seem a more attractive option to some traders, even if they can acknowledge the benefits of decentralised trading.
The speed of L2 transactions is another major benefit. Staking SNX has a number of different steps that often need to be performed regularly, including burning, minting, and claiming rewards, not to mention such other steps as vesting, etc. Some of these are often bundled together, e.g. you might mint some more Synths against the SNX staking rewards you just claimed. L2 will speed these processes up drastically, ensuring much smoother interactions with the protocol and less time spent on the Synthetix dApps.
How is Synthetix obfuscating the L1/L2 difference in the UI/UX?
At the moment, L1 staking exists on the Staking dApp and L2 staking exists on an L2 version of Mintr, the previous staking dApp. This decision was made simply because the L2 Mintr was already functioning from the testnet trials carried out with Optimism last year. Having each layer siloed from each other is also helpful for the time being, as currently only Metamask supports L2, whereas L1 staking is supported by a wide range of wallet options.
But over time L2 functionality will be added into Staking. It hasn’t been decided yet exactly how the differences between layers will be displayed visually, but the community provided positive feedback during the first testnet trial about our designers’ choice to use an altered colour palette in the dApp to signify that users were trialling the future.
More information on Synthetix and Optimistic Ethereum
If you’re interested in learning more, Kain Warwick published several pieces on the Synthetix blog about Optimistic Ethereum, including his plan for the transition and what factors were considered when opting for Optimism over the other L2 solutions.
Action steps
- Learn more about Layer 2 solutions on Ethereum
- Read more on why Synthetix chose Optimism
- Watch Vitalik explain layer 2 scaling and optimistic rollups
Author Bio
Garth Travers leads communications at Synthetix where he’s held the position since it was known as Havven in 2017. You can find him in the Synthetix Discord or on Twitter, making memes and leaking alpha.