How to Migrate a Web3 Protocol from L1 to L2

Prefer to hear this blog aloud? Listen to the contents of this blog via The Graph Podcast.


One of the most common barriers to entry to the decentralized web is the cognitive shift in moving from a free-to-use web to one where usage carries a cost, i.e., gas. The difference is, however, in the legacy web (web2) – users are the product – with user information monetized and sold to advertisers. In web3, users own and operate the web, rejecting the status quo of being the product.

But how do we reduce gas costs, speed up blockchain transactions, and truly scale the decentralized web? One answer is by implementing layer-2 (L2) technology. To truly scale web3 and make it accessible to all, protocols including Livepeer, Synthetix, and The Graph migrated from deploying their protocols on layer-1 (L1) to L2, expanding access to users and developers while maintaining the ethos of decentralization. Let’s explore these examples, along with the motivation to scale with L2.

Why would a protocol move to L2?

Let’s start with a familiar example. Developers across web3 use The Graph for querying blockchain data – an essential part of the web3 ecosystem, enabling easy fetching and display of onchain information. While The Graph experienced explosive adoption on Ethereum’s mainnet (L1), network participants, particularly Indexers, voiced their feedback about the high gas fees that became common to L1.

So given the high gas fees and slower transaction times on L1, The Graph community rallied around the decision to migrate The Graph’s underlying protocol to Arbitrum.

The migration also presented the opportunity to make changes to the protocol. One such improvement was the removal of bonding curves from the curation mechanism, making curation significantly more straightforward on Arbitrum.

How The Graph Moved from Ethereum Mainnet to Arbitrum One

To scale effectively, The Graph community opted for a strategic and methodical transition from Ethereum mainnet to Arbitrum One, ensuring that the move would enhance performance without service disruption and mitigated any potential risks.

1. Choose an L2

To meet the demands of a rapidly growing network, The Graph needed more than a lift-and-shift approach. For some dapps, such as Uniswap, it is best to redeploy the protocol and have it entirely separate from other versions and encourage the community to adopt the latest version. However, this process can vary quite extensively depending on the nature of each protocol.

In The Graph’s case, a gradual transition to L2 was needed. This meant that The Graph had to maintain state on both deployments of the protocol, which became an important factor when choosing the L2. As the community weighed its options, one L2 stood above the rest: Arbitrum One, which was selected for its:

  • Interoperability: using a custom bridge to maintain state across both layers (similarly to Livepeer)
  • Maturity: Arbitrum is built using proven technology with a well-defined path toward decentralization
  • Activity: usage across many dapps, including DEXs to supply liquidity

Once The Graph community aligned on using Arbitrum One, it was time to take action.

2. Revise Smart Contracts

The transition to L2 required the protocol’s smart contracts to be rewritten to adapt the rewards mechanism to work on both layers simultaneously. These new contracts underwent rigorous audits to ensure they met the highest security standards. Core developer teams also created a comprehensive testing plan to mitigate risk before deploying to L2.

3. Safely Deploy on L2

After iterating on testnet, the redeployment began a devnet phase where core developer teams perfected the protocol on Arbitrum One as it operated without indexing rewards. Community members built crucial security features to ensure that the protocol could safely fail back to L1 in the scenario that something catastrophic happened. No such events took place, and The Graph’s devnet phase on Arbitrum One was successful, redeploying the protocol on block 42,449,166.

Migrating to Arbitrum in a staggered approach meant enabling indexing rewards on L2, which was also  successfully implemented, with 5% of indexing rewards being diverted to The Graph’s L2 deployment by The Graph Council via the governance process.

After this proof of concept, The Graph began the mass migration of users from L1 to L2.

4. Make it Easy to Transfer to L2

Core developer teams at The Graph released L2 Transfer Tools, a set of smart contracts and associated UI components that leveraged the custom bridge designed to facilitate seamless transfers to Arbitrum. These custom L2 Transfer Tools enabled all network participants to transfer their active involvement in The Graph including:

  • Delegation
  • Subgraphs
  • Curation
  • Indexer Self-Stake

L2 Transfer Tools were crucial to a seamless user experience. Core developer teams also developed special versions of these tools to support vesting contracts, ensuring that the entire ecosystem would be able to migrate.

The L2 Transfer Tools saved network participants a significant amount of time. For example, Delegators didn’t have to:

  1. Un-delegate their GRT and wait the undelegation period
  2. Manually bridge their GRT to L2 (bridging can often take 15-30 minutes)
  3. Locate the Indexer(s) they delegate to, and
  4. Re-delegate the GRT (paying a 0.5% delegation tax)

With the L2 Transfer Tools, Delegators only needed to initiate a single transaction. Their GRT would be bridged, and their delegation would remain with their chosen Indexer. This not only helped users have a smooth experience but significantly cut down on the time customer support teams needed to triage bridging issues.

5. Raise awareness about the transfer

A successful migration hinged on community awareness with a wide-reaching marketing campaign. Although indexing rewards on Arbitrum were used to incentivize active network participants to take advantage of appealing opportunities already available on Arbitrum, other forms of communication helped motivate all network participants.

Targeted blogs, social media posts, and Discord announcements on a continuous basis helped galvanize the ecosystem to move.

6. Deprecate the protocol on L1

The months following the migration saw tens of thousands of network participants transition to Arbitrum One. As the community embraced The Graph on Arbitrum, indexing rewards gradually increased, culminating in a full transition to 100% indexing rewards on Arbitrum on June 28th, 2024. This marked the beginning of the deprecation of The Graph’s deployment on Ethereum mainnet, as most network activities started winding down on L1, with only essential functions like the token bridge remaining operational.

Final Thoughts

Moving a protocol to an L2 isn’t just a technical upgrade but a milestone that unlocks a critical growth stage. By transitioning, web3 protocols like The Graph, Livepeer, and Synthetix not only scale their operations but also reinforce protocol improvements while doubling down on the commitment to decentralization and supporting users.

The benefits of this migration extend beyond just efficiency. With lower gas fees and faster transaction speeds, protocols are now better positioned to make web3 more accessible than ever before while maintaining decentralized values.

About The Graph

The Graph is the source of data and information for the decentralized internet. As the original decentralized data marketplace that introduced and standardized subgraphs, The Graph has become web3’s method of indexing and accessing blockchain data. Since its launch in 2018, tens of thousands of developers have built subgraphs for dapps across 70+ blockchains - including  Ethereum, Solana, Arbitrum, Optimism, Base, Polygon, Celo, Fantom, Gnosis, and Avalanche.

As demand for data in web3 continues to grow, The Graph enters a New Era with a more expansive vision including new data services and query languages, ensuring the decentralized protocol can serve any use case - now and into the future.

Discover more about how The Graph is shaping the future of decentralized physical infrastructure networks (DePIN) and stay connected with the community. Follow The Graph on X, LinkedIn, Instagram, Facebook, Reddit, Farcaster and Medium. Join the community on The Graph’s Telegram, join technical discussions on The Graph’s Discord.

The Graph Foundation oversees The Graph Network. The Graph Foundation is overseen by the Technical Council. Edge & Node, StreamingFast, Semiotic Labs, Messari, GraphOps, Pinax and Geo are eight of the many organizations within The Graph ecosystem.


Categories
Web3 KnowledgeRecommended
Published
September 5, 2024

Michael Macaulay

View all blog posts