Skip to content

Latest commit

 

History

History
110 lines (61 loc) · 10.1 KB

layer-2-guide.md

File metadata and controls

110 lines (61 loc) · 10.1 KB
description
Layer 2 is a different network running atop the Ethereum Mainnet (Layer 1).

Layer 2 Guide

ETHEREUM LAYER 2 SOLUTIONS

Ethereum network is a popular destination for most decentralized apps (dApps). The popularity has led to enormous activity of Ethereum, which results in high gas fees and slow transaction speed. Layer 2 networks are a solution for Ethereum scaling challenges.

Layer 2 is a different network running atop the Ethereum Mainnet (layer 1) and stays on the Mainnet as smart contract. Thus, layer 2 solutions help scale applications by handling transactions off the Ethereum Mainnet (layer 1) while taking advantage of the robust decentralized security model of Mainnet.

Rollups

Rollups perform transaction execution outside the Ethereum Mainnet (layer 1) and post the transaction data on layer 1. The “rollup” is so-called because the layer 2 solutions roll up transactions and fit them into a single block in layer 1. As transaction data is on layer 1, rollups are secured by layer 1. There are two types of rollups:

1) Optimistic rollups assume transactions are valid by default (hence the name optimistic) and only runs computation, via a fraud proof, in the event of a challenge. Optimistic rollups are scalable because they don't do any computation by default. If someone notices a fraudulent transaction, the rollup will execute a fraud-proof and run the transaction's computation, using the available state data.

Advantages Disadvantages
  • Low gas fees
  • Scalable
  • Smart contract compatible
  • Long wait times for on-chain transaction because of potential fraud challenges (may take up to a week)

Major implementations of optimistic rollups: Optimism, Arbitrum, Boba, Fuel Network.

2) Zero-knowledge rollups runs computation off-chain and submits a validity proof to the chain. Also known as ZK rollups or ZKRUs, these scaling solutions “roll up” many transactions off-chain and generate a cryptographic proof known as SNARK (validity proof) for the whole bundle. The validity proof is posted on layer 1, and the proof can be quickly verified, and invalid batches are rejected straightaway.

Advantages Disadvantages
  • Low gas fees
  • Scalable
  • Shorter wait time for fund withdrawals
  • Some solutions don't have EVM support (ZKSync 2.0 is expected in Q4 2021)

Major implementations of ZK-rollup: Loopring, Aztek 2.0, Starkware, zkTube.

ARBITRUM & OPTIMISM LAYER 2

Arbitrum and Optimism are both layer 2 solutions with a lot in common – both implement optimistic rollup, have smart contracts living in Ethereum Mainnet (layer 1), and use ETH as their currency.

Note: The challenge window for fraud and dispute is one week for both Optimism and Arbitrum. Your transactions in a bundle under suspicion can be held up for one week before they’re verified, and funds are released. However, the challenge process varies across Optimism and Arbitrum.

  • Arbitrum: When a challenge is submitted, Arbitrum uses an offchain dispute resolution process to isolate a single step within a transaction. The isolated step is then sent to EVM for final verification.
  • Optimism: When a challenge is submitted, the entire transaction in question is run through the Ethereum EVM.

{% hint style="info" %} Find Saddle's deployed code base here {% endhint %}

Arbitrum: Moving Assets In And Out (Deposit/Withdraw)

You can transfer assets from Layer 1 Ethereum to Layer 2 Arbitrum through the Arbitrum Bridge. Follow this guideline to deposit and withdraw crypto assets in Arbitrum.

Optimism: Moving Assets In And Out (Deposit/Withdraw)

Follow these guidelines to move crypto assets in Optimism.

BRIDGES

Like physical bridges which connect locations enabling movement of people and wealth, in the crypto ecosystem, a bridge is a connection between blockchain networks operating under different conditions. Bridges establish interoperability by enabling transfer of assets and information.

The communities built around individual blockchain networks need to collaborate and cooperate for the ecosystem to be truly decentralized and open. Bridges help the benefits to cross the boundaries and grow beyond the genesis ecosystem.

Therefore, bridges are not only about connecting Layer 1 Mainnet and Layer 2 solutions. For the ecosystem to mature and blossom, we require bridges across Layer 2 as well. Besides the bridges mentioned above, there are other bridges available to transfer assets across Layer 1/Layer 2. Let’s explore a few bridges now.

Hop Protocol

Hop is a scalable rollup-to-rollup general token bridge. Hop allows users to transfer tokens directly and easily between Layer 2s, sidechains, and Layer 1 Ethereum. With Hop, users can send tokens from one rollup to another almost immediately without having to wait for the rollup’s challenge period. Built with Saddle, Hop is a protocol built for quick, low cost, and trustless transfer of assets.

Check out the guide here to get started.

Synapse Protocol

Synapse is another bridge that provides users the option for cost-efficient, user friendly, and low-slippage stablecoin trade. Synapse unifies the thriving L1/L2 ecosystem, allowing users to seamlessly bridge assets across the most popular chains. Synapse allows users to frictionlessly transfer stablecoins to/from Arbitrum, Avalanche, BSC, Ethereum, Fantom, Polygon (as well as ETH to/from Arbitrum) - with more chains and assets in the works.

Check out the guide here to get started.

Celer Bridge

Celer network is a layer-2 scaling platform that brings fast, secure, and low-cost blockchain applications on Ethereum, Polkadot and other blockchains to mass adoption. Celer bridge (cBridge) can be used to instantly transfer token cross-chain and cross-layer between any two of these networks: Ethereum, Arbitrum, Polygon, and Binance Smart Chain. cBridge keeps the liquidity flow between these loosely coupled networks without long delays or a trust-based custodian.

Check out the guide here to get started.

Connext Network

Connext is a protocol for fast, fully noncustodial transfers and contract calls between EVM-compatible systems. As a cross-chain routing network, Connext enables seamless communication between the Ethereum mainnet, L2 systems, and shards. Connext routers act as the backbone of the network, providing liquidity for user swaps and earning fees in return.

Check out the guide here to get started.

WORKING WITH SADDLE L2 POOLS

Swapping and LP'ing are the same as on L1 (check out the deposit and withdraw guides), but ensure you have successfully switched the network.

Switching from L1 to L2 Network

  • Step 1: Head to https://saddle.exchange/#/pools.
  • Step 2: Switch the network from Ethereum to Arbitrum to LP or trade using Saddle’s L2 Stablecoin pools.

  • Step 3: Confirm the network switch

  • Step 4 : Once switched, working with L2 pools is the same as on L1 pools (check out the deposit and withdraw guides).

Incentives

Depositing assets into a pool on Saddle allows users to take part in the protocol as liquidity providers and earn reward incentives.

Read more about pool incentives in the tokenomics section.