Today, we are excited to introduce Layer2.finance, a Celer Network project that aims to bring mass audiences to the existing Decentralized Finance (DeFi) ecosystem with layer-2 scaling technology. Layer2.finance acts as a low-cost and trust-free gateway for the “early majority” users to explore and benefit from the existing DeFi ecosystem without the concerns of high transaction (gas) costs offsetting their gains.
Layer2.finance enables quadratic scaling of the existing layer-1 DeFi ecosystem “in-place” with no protocol migration needed and therefore, does not cause liquidity fragmentation or break composability. Layer2.finance achieves this using an optimized layer-2 rollup construct to aggregate N small-fish users’ fund allocation transactions on layer-2 into a single one on layer-1 in a trust-free fashion. In this blog post, we’ll discuss the motivation, architecture and launch plan for Layer2.finance.
DeFi adoption slows down and it’s gonna only get worse
We’ve seen more than 100X growth in DeFi in these two short years. The immense potential of a financial ecosystem without trusted intermediaries is truly thrilling! It felt as if parabolic growth was inevitable for DeFi where free and flat financial markets could break down the nation-state silos and quickly bring the mass population to a level playing field with established institutions.
However, on-chain data tells a different story. What started as a movement to provide fair and non-discriminatory access to a global and efficient financial market for humankind, especially for the unbanked population, is now being taken over by a vicious spiral of capital gentrification, setting up a playground that benefits only the elites.
Figure 2 shows that after the DeFi-summer’s amazing growth, the momentum has slowed down. If we take a look more closely at some of the more widely recognized “entry protocols” such as yEarn, Maker, Compound and Curve, the growth slowdown is even more apparent.
Another important metric to consider is the number of Daily Active Users (DAU) because, to a certain degree, it helps weed out the common practice of multiple-accounts-per-person and might provide a more accurate estimation of the level of active engagement in the DeFi ecosystem. After an impressive 10X run up during the last DeFi-summer, DAU growth has significantly slowed down, hovering around 40K DAU.
To put these numbers into perspective, if we take any single (constraint No.1) iOS (constraint No.2) mobile game ranked around ~1500 position on the grossing chart (constraint No.3) in the U.S. market (constraint No.4), we can see a DAU number doubling that of the entire current DeFi world At this rate, in a year, the total number of DAU in DeFi may not even be able to beat a random game.
This is just UNACCEPTABLE.
BUT WAIT! This just doesn’t make sense. DeFi can help people to increase their yields on savings. Even reliable and long-standing protocols like Compound generate 250X higher interest compared to a traditional checking account.
Let’s say we forget about mom and pop and just focus on the “early-majority” of users, 25-40 year-olds who are tech-savvy, financially literate, and earning above $30,000 in annual income. For this group of users, it would be reasonable to say that the allure of 250X higher yield in their everyday savings would drive them to invest a few hundred to a few thousands of dollars, and soon drive the exponential growth of this market.
SO WHY NOT? WHY NOT put $500 to get that 10% APY?
Well, because blockchain transaction costs (gas fees) are not based on the transaction value and this, ironically, leads to a DeFi ecosystem that heavily discriminates against the “small-fish” new users. To the people trying to join the game with only $500, the 10% APY is just a pipe dream.
Here are a pair of examples to explain:
- Alice wires $600 to Coinbase.
- Alice buys $100 worth of ETH and converts $500 to USDC.
- Alice withdraws both to her wallet, paying ~$10 in transaction fees.
- Alice puts $500 to Compound, costing her about $60 for 10% APY.
- Alice is confused: why am I paying 14% upfront cost for a floating 10% APY?
- Alice gives up on DeFi without even going into the interesting stuff.
- Bella wires $6M to Coinbase.
- Bella buys $100 worth of ETH and converts $5.9999M to USDC.
- Bella withdraws both to Metamask, paying ~$10 in transaction fees.
- Bella puts $4M to Compound and pays the exact same $60 for 10% APY. She then receives a yield covering more than her transaction cost in under 2 hours.
- Bella then tries out various different protocols and quickly optimizes her yield to 50% for the remaining $2M.
- In just 30 days, Bella spent $10,000 in transaction fees trying 50 different protocols but harvested $70,000+ yield with $60,000 net gain. Bella is quite happy!
It’s clear that today’s “early majority” simply cannot afford to enter the DeFi ecosystem because even the long-term yield would not cover the upfront transaction fee.
What’s more concerning is that while users like Alice are discouraged from entering DeFi because of high fees, more and more “whales” like Bella will leverage their position in DeFi for a positive ROI. This further increases the cost of using DeFi not only for Alice but also for the many smaller investors that are still in the game today. The equilibrium is a system that serves people in a priority list of capital size in the market: i.e. capital gentrification.
This is not what we signed up for and as a community, we need to solve this issue.
Layer2 Rollup to the rescue? Not so fast.
By now, everyone in the DeFi space has probably heard about layer-2 rollup as a solution that can lower the gas cost via higher throughput and therefore solve the above challenges. One popular opinion is that once there is an EVM-compatible Optimistic Rollup in production, DeFi protocols can be quickly redeployed to a single rollup (not multiple because it does not break composability). Everyone will move to the DeFi rollup to use DeFi protocols from there.
But not so fast, there are several fundamental challenges that make this solution not very feasible.
From a technical perspective, a single-rollup construct has two major challenges.
Firstly, scalability on both computation and storage is still -bounded when using a single rollup. For a rollup to maintain reasonable liveness, multiple sequencers are needed to be in sync with each other in terms of computation and storage. With DeFi transactions being computationally heavy, we can expect realistically a 50X-100X gain compared to layer-1. This will bring us roughly to 2-4 million DAU for the entire DeFi ecosystem, which is still far from achieving true mass adoption. Furthermore, the cost of using such a rollup for individual users will quickly rise with state querying services, monitoring services, emergency withdrawal services, “slow path” fallback services and more. Being a single chain, quadratic scaling is also not possible even if ETH2.0 provides superb data scalability. Finally, in our opinion, with a reasonable liveness and efficiency tradeoff, a single rollup will likely converge to the scalability of a relatively centralized DPoS chain in reality.
Secondly, deep security implications to the surrounding ecosystem and external dependency all require a significant amount of community effort and time to resolve. For example, here are a few questions we need to consider:
- How should users’ interaction with wallets change under optimistic cases and under chain-halt cases?
- How do centralized exchanges deal with layer-2 deposits and withdrawals?
- Is there enough state querying and gateway services that can scale to 100X capacity compared to today’s service levels?
- Can users quickly and safely be notified and fallback to a slow path when validators attempt to halt the chain progress?
- What about DeFi protocols relying on external Oracle services? Will these Oracles adapt with sufficient anti-censorship and layer-1 fallback capabilities to ensure a strong enough synchronization guarantee?
All of these questions must be carefully answered, before we just drop $100billion into the system. Therefore, from a technical point of view, we argue it is very hard for the DeFi ecosystem to move to a single rollup chain in a short period of time.
In addition to the technical challenges, from an economic incentive perspective, fragmentation of liquidity is bound to happen and it reduces market efficiency.
As described above, scalability of layer-2 rollup comes with various tradeoffs such as complex interaction, delayed layer-1-level transaction security, added infrastructure cost to monitor transactions, risk of block rollback, risk of censorship and front-run, and more. These tradeoffs make sense for users with small capital because their other choice is to not benefit from DeFi at all.
However, for whales, since layer-1 cost is already a tiny fraction of their gains, the reduced cost simply cannot justify the tradeoff described above. Therefore, the whales are incentivized to stay in the layer-1 DeFi ecosystem.
Going down this path, even after we find reasonable tradeoff points for all technical challenges, we will still end up with a fragmented DeFi ecosystem where arbitrage costs between layer-1 and potentially multiple layer-2 DeFi chains will significantly reduce the overall market efficiency.
We need a different solution.
Layer2.finance: Don’t ask DeFi to migrate to Layer2, bring Layer-2 to DeFi instead!
To enable mass adoption of the DeFi ecosystem and solve the aforementioned challenges, we introduce Layer2.finance. Layer2.finance uses layer-2 rollup in a different way. Similar to any rollup, a user can deposit funds to Layer2.finance rollup chain by making a deposit transaction to the rollup contract on layer1.
However, different from most popular approaches, Layer2.finance does not migrate DeFi protocols themselves to layer2. Layer2.finance generalizes the interface between layer-1 and layer-2 beyond simple fund deposit and withdrawal transactions and enables computation instruction relaying. It accepts a large number of users’ “fund allocation instructions” as rollup transactions, computes the aggregated effect of all these small liquidity movements and then makes a small number of rebalancing transactions across supported protocols to match the aggregated effect. In effect, Layer2.finance reduces the O(N) fund allocation operation cost for N users to O(1) operation cost for supported protocols.
As a result, users can freely explore and move between different DeFi protocols with extremely low cost by pooling their funds and then aggregating their actions on the pooled liquidity with zero-trust to any centralized third party.
Next, we use an example to walk through the high-level architecture of Layer2.finance.
Generate fund allocation proposal
Alice, Bob and Charlie (A,B and C for short) start by putting funds into the rollup fund pool contract like they would do to any garden-variety rollup. They then can start using their funds on layer2. The account and fund state on Layer2.finance rollup is more than just an address-to-value map. For each user, any portion of her funds can be in three different statuses: 1. Idle; 2. Committed; 3. Allocated. Idle is self-explanatory.
“Committed” means that the user has sent out a layer-2 transaction to express the intention to allocate the fund to certain DeFi strategies (we will explain this later) or withdraw funds from certain DeFi strategies. We need this “Committed” status because there is a delay between a newly aggregated fund allocation proposal getting posted on-chain and the time point it is actually executed. We will talk about the reason for the delay and the tradeoff in choosing between ZK and Optimistic rollup in the next subsection.
A user’s funds in “Allocated” status is represented by a certain amount of “liquidity certificates” received by the user after the fund allocation is executed on-chain. It is similar to the cToken or yToken concept used in Compound and yEarn. These yield-bearing liquidity certificates can later be used to redeem the underlying liquidity along with yields back to Idle funds. In Layer2.finance, we call these yield-bearing liquidity certificates stToken (st: strategy).
Note that both stToken and Idle liquidity can be in “Committed” status when a user is in the process of deploying and withdrawing liquidity.
Now, A,B and C start to send out transactions to commit their Idle liquidity to different strategies to gain yields as described in Figure 3. They can also withdraw their liquidity from already allocated protocols. The block producer collects these transactions on the rollup blockchain. Whenever these small transactions aggregate to large enough fund allocation changes or a certain period of time has passed, the block producer on the rollup will produce a block on the rollup chain. The block producer posts to layer-1 not only the state roots for each user’s account status, but also the aggregated “fund allocation proposal” for the whole pool to rebalance across different connected DeFi yield protocols. In this particular example, the fund allocation proposal basically says “allocate $300 to strategy 0 and allocate $500 to strategy 1”。
The block producer is a logical concept and will eventually be the decentralized Celer State Guardian Network to ensure censorship resistance and added security for this rollup chain.
Delay of the fund allocation proposal execution: the choice between ZK and Optimistic Rollup
After the block is produced and state roots along with fund allocation proposal is posted on-chain, there is a delay until the fund movement actually happens. It is critical to note that Layer2.finance now extends the simple state interface of “who has how much money” between layer2 and layer1 to a more generalized “instruction interfacing” in the form of fund allocation proposal, i.e. “allocate how much fund to which protocols”.
When using Optimistic Rollup for Layer2.finance, the delay is the challenge period to make sure the aggregate fund allocation proposal is finalized before moving funds accordingly. This is different from fund withdrawal, as there is no possibility for a third party to exit the system with these funds. And due to the long block time depending on batching on the platform and the simplicity of challenge proof, the challenge period can be shortened from weeks to hours.
When using ZK-rollup, the state root validity needs no challenge period and the fund movement delay is on the level of block time.
In the 1.0 version, we choose to use an Optimistic Rollup approach for simplicity and faster iteration. However, in the future, we plan to move to ZK rollup for shortened delay to execution once the protocol matures.
Execution of fund allocation proposal
When the delay passes, the fund allocation proposal is executed on-chain. Instead of directly interacting with each and every different DeFi protocols, we define a common abstraction layer called Strategy Adapter. For those familiar with the concept of yEarn vaults, it is the exact same concept. This layer serves three purposes:
- Liquidity certificate (stToken) abstraction. The strategy adapter keeps track of the underlying value of total deposited liquidity and generates back a certain amount of yield bearing tokens (stTokens) to be received by the users of Layer2.finance.
- Easy extension. By defining a common interface to the Layer2.finance rollup contract, it is easier to extend the right side of protocol to any yield bearing protocols.
- Flexible strategy configuration. Strategy abstraction opens the flexibility to use different strategies (e.g. collateral ratio) to the same yield protocol or even combine multiple DeFi protocols into a single strategy.
We intend to work with the developer communities in the DeFi space, such as yEarn, Curve, Aave, Compound and more, to build adapters and enable more users’ access to these amazing products.
When the fund allocation execution actually happens on-chain, the layer-2 block producer layer will pick up this layer-1 transaction and generate a layer-2 transaction to add stTokens to the layer-2 state for each user (in this case A,B,C) with Committed funds and clear out those funds in Committed status. In this step, we use a generalized reverse communication from layer-1 to layer-2 to achieve this.
The system will then operate in cycles and allow users to freely choose and move between different strategies corresponding to different protocols.
Advantages of Layer2.finance as a DeFi scaling solution
We summarize the key benefits of using Layer2.finance for the mass audience as the followings:
- Low-cost. As Layer2.finance aggregates small liquidity together, the cost of allocating funds and generating yields for each user is much less. More people using it will actually lower the cost of interacting with DeFi protocols for individual users, although there is a fixed cost for data availability. We estimate an 1000X cost reduction is entirely possible.
- Maintaining composability, no liquidity fragmentation and no need to migrate DeFi protocols. Layer2.finance scale up DeFi protocols in-place. Therefore, it won’t cause any liquidity fragmentation and will in fact enhance the composability of DeFi protocols further.
- Enable Quadratic Scaling. If a single Layer2.finance rollup chain becomes too crowded or the state becomes too large to maintain, it is trivial to spin up a new chain as it connects to the same exact liquidity system in layer-1 DeFi. While in the short-term it is limited to the on-chain storage capacity, in the future with ETH2.0, the quadratic scaling ceiling will be much higher.
- Flexible sharding of DeFi. Other than scalability, there can be many reasons to spin up multiple Layer2.finance chains, such as different batching configuration, different risk profiles of strategies (degen or not?) and many more. This effectively achieves functional sharding in DeFi ecosystem
Limitations and tradeoffs
While we believe Layer2.finance is the solution to bring mass adoption to DeFi, we also want to be clear about the tradeoffs that are unique to this solution. And then we can better argue if it is “worth it”.
- Delay due to aggregation. No matter whether we choose the ZK Rollup approach or the Optimistic Rollup approach. There is an inherent delay from a user expressing intention to make a fund allocation to the time when the fund allocation actually happens. This is due to the layer-2 aggregation that Layer2.finance relies on. However, we argue that it is a reasonable tradeoff because the alternative is for these small-liquidity users to not benefit from DeFi at all. This delay can always be dynamically adjusted to find the right tradeoff point between cost and reactiveness.
- Limitations on advanced operations. Different from a raw interface to the DeFi ecosystem, Layer2.finance provides users with abstractions of strategy. Users cannot perform highly advanced and customized composition of multiple DeFi protocols. However, we argue this is not a concern because advanced DeFi users are not the target audience for Layer2.finance.
There are other limitations as well, most notably front-running and transaction censorship. However, they are not unique to Layer2.finance but also applies to other rollup constructs. In fact, the severity of such issues are much less considering the quadratic scaling nature of Layer2.finance.
When can we expect Layer2.finance to Launch?
We aim to launch Layer2.finance 1.0 in Q1 2021 depending on the security audit timeline and also number of strategies supported. We plan to upgrade to ZK rollup based aggregation after the initial phase of iterations.
To the DeFi community, if you would like us to support and lower your cost of using certain protocols, please let us know in our Discord channel.
Economics of the protocol
There is no plan to have a new token as of now. Layer2.finance is an ecosystem project and utilizes Celer’s open-source layer-2 technology stack. After initial iterations, the key infrastructure of block producers will run on Celer’s State Guardian Network. You can stake $CELR to become state guardian network validator here. However, the exact economics are still being figured out as we accept community feedback.
To bootstrap liquidity on the platform, we potentially will consider liquidity mining.
Finally, Layer2.finance aims to adopt a percentage based fee model as rewards to the SGN for the work done as block producers/sequencers.
The detailed economics and fee model are not in the scope of this blog and will be described in more detail in future posts.
Let’s not wait until tomorrow and scale up DeFi today!