June 30, 2024 · Reading Time: 5 minutes

How Layer 2 scaling improves DeFi

Share this post:

Blockchain’s very beginnings are rooted in the idea that there can be an alternative to the traditional financial institutions that led us to the 2008 financial crisis. The vision is simple: Why trust middlemen to handle your money if blockchain empowers you to do so yourself? And thus, an entire industry dedicated to that core idea, known as decentralized finance (DeFi), was born.

DeFi lets you borrow, lend, and trade using permissionless blockchain networks, without having to rely on centralized banks or middlemen. With DeFi, smart contracts handle transactions, making everything faster, cheaper, and more accessible.

The cool part? DeFi opens the world of finance to everyone, offering high-yield opportunities and services to anyone with internet access. This shift breaks down barriers and cuts out intermediaries, totally transforming how we manage money.

One of the main hurdles to achieving the potential of DeFi is the need for scalability. DeFi on Layer 1 (L1) blockchains, such as Ethereum, requires more transaction capacity. Without it, users experience congestion, high fees, and slow transaction times during busy periods, hindering DeFi’s growth and user experience. It’s true that blockchains like Solana prioritize scalability, but that comes at the cost of decentralization—aka not a good enough solution.

This is where Layer 2 (L2) scaling solutions on top of Ethereum come in, empowering DeFi applications to expand and offer a better user experience.

Why DeFi needs scalability

To understand why DeFi needs scalability, let’s look at Uniswap, a popular DeFi application that allows users to trade cryptocurrencies directly with one another. Originally, Uniswap was launched solely and directly on Ethereum, the largest L1 blockchain for general-purpose computation (Bitcoin, on the other hand, has until now focused almost exclusively on peer-to-peer transactions).

When DeFi began to take off, Uniswap saw a huge surge in users. Everyone wanted to trade their tokens, but Ethereum wasn’t built to handle so many transactions at once. The network became congested. Transaction fees, known as gas fees, soared, and transaction times slowed down significantly, trashing Uniswap’s user experience. And so Uniswap deployed to multiple L2 networks: Optimism, Arbitrum, and Base, which use optimistic rollups to boost the Ethereum blockchain’s scalability. They do this by processing transactions offchain and batch-submitting them to the main chain.

The result: DeFi applications like Uniswap become more efficient, economical, and user-friendly, better able to handle activity spikes, paving the way for broader adoption and innovation.

Benefits of Layer 2 for DeFi

Layer 2 enables DeFi applications to scale by:

  • Offloading transaction execution: L2 moves the heavy computation associated with transaction execution from the congested and more expensive base layer (the L1). This frees up space on L1 for essential functions like security and settlement.
  • Parallel processing: Some L2 solutions utilize sidechains or rollup technology to process transactions in parallel with the main chain. This significantly increases the overall transaction throughput of the system.
  • Bundling transactions: L2s bundle many transactions into either a compressed format (optimistic rollups) or a proof attesting to their validity (validity rollups)for submission to the L1. This reduces the number of individual transactions competing for block space, effectively lowering fees.

Practically, these techniques work together to enable DeFi applications to efficiently handle a much higher volume of transactions without compromising on performance, leading to:

  • Reduced transaction costs: L2 solutions can minimize gas fees by processing transactions off the base layer blockchain before settling them there. By doing so, users can execute trades at a fraction of the typical cost, making DeFi more accessible.
  • Faster transaction speeds: L2 scaling solutions can make transaction speed nearly instantaneous, compared to several minutes on Ethereum. This speed is essential for applications that require quick transaction finality, such as decentralized exchanges.
  • Potential for better UX: Faster and cheaper transactions lead to a smoother user experience. This improved experience can drive higher adoption rates, as users find the platforms more efficient and user-friendly.

More scalable, more secure

Starknet is already transforming L2 scaling for DeFi with its faster and cheaper transactions. Transactions on Starknet have recently been as low as $.002 (!!!), making DeFi more accessible than ever.

As a validity rollup, Starknet is also much more secure than optimistic rollups because it submits a proof to L1 along with every batch of transactions, attesting to the validity of each transaction in the batch with math. Optimistic rollups, on the other hand, assume transactions are valid and rely on incentivizing network participants to challenge fraudulent transactions. Of course, when it comes to security, math > incentives.

1-click DeFi on Starknet

The real game changer for DeFi on Starknet is the user experience, improved greatly by Starknet’s native account abstraction. Account abstraction enables dApp builders to offer a far better UX that comes very close to a Web2 experience, and on Starknet, account abstraction is built into the network.

With native account abstraction, wallets can offer users familiar Web2 security methods, such as two-factor authentication, three-factor authentication, and spending limits, as well as multi-sig approvals. There’s also the advantage of simplifying transactions—fewer complicated private keys, and much more face ID and fingerprint ID to sign transactions.

Native account abstraction on Starknet also enables DeFi-specific improvements to UX, such as making it possible to complete DeFi transactions in a single click. Whereas, typically, you’d need to approve a token and then execute the swap in two different steps, on Starknet, it can all be done in one transaction—approve and swap in one go. This streamlined process saves time and reduces friction, making DeFi more user-friendly.

That also applies to offering up funds for a liquidity pool. For example, to provide liquidity for an ETH/USDC pair on a platform without account abstraction, you’d have to perform the following steps as three separate transactions:

  1. Approve ETH
  2. Approve USDC
  3. Provide liquidity

On Starknet, all three can be done in one transaction, in one click.

Finally, with Starknet’s Paymaster, currently in use by the DEX aggregator AVNU and coming soon at the protocol level, users can pay gas fees not only in ETH and STRK, but also in USDC and USDT. This flexibility makes trading simple and efficient, offering traders greater control over their assets.

Here’s how it works:

  1. Users choose their preferred token for gas fees, which AVNU then covers in ETH or STRK.
  2. If a user opts to pay with USDC and the gas fee is $0.01, AVNU collects $0.01 in USDC and buys back the equivalent amount of ETH it advanced to the user.

Starknet users currently can pay network fees in STRK and ETH (and, on AVNU, in USDC and USDT). In the future, other tokens will be available for fee payments as well. Eventually, thanks to Paymaster and Starknet’s ultra-low fees, protocols on Starknet could directly pay fees for users.

The road ahead for L2 scaling and DeFi

L2 scaling offers clear benefits for DeFi: faster, cheaper transactions, improved security, and better user experience. These advancements promise to make DeFi more accessible and efficient. But what does the future hold for the DeFi ecosystem with these improvements? Will we see a new era of financial freedom and innovation? It’s highly likely, if not inevitable.

Be sure to stay informed on L2 and DeFi developments. We invite you to dive deeper into the vibrant Starknet DeFi ecosystem to see how Starknet can revolutionize your DeFi experience.

Discover dApps on Starknet →