In May, we announced that we were building a brand new high-performance network. In November, we unveiled significant upgrades from Lens V2 to V3: modular, flexible, and customizable social Lego blocks that offer limitless possibilities for developers and users to connect, distribute, and discover.

Currently, there are 647,000 profiles and 640,000 handles on Lens V2. 45,000 users interact with the protocol weekly, creating 31 million publications. To transition from Lens V2 on Polygon to Lens V3 on Lens Chain (built on the ZKSync stack and Avail), we decided to seamlessly migrate profiles, handles, and content without user intervention.

The Lens team developed a suite of solutions for migrating profiles, administrators, contacts, and content from Lens V2 on Polygon to Lens V3 and Lens Chain. This large-scale migration posed unique challenges, as the fundamental principle of the Lens Protocol is that users retain ownership of their digital identities, content, and social graphs. Preserving this core value while executing such a comprehensive transition requires innovative technical solutions.

Lens Protocol Migration Technical Journey

The migration of Lens Protocol presents significant technical challenges. Over the past few years, our user and application community has created a rich ecosystem consisting of identities, connections, and content. Preserving these digital legacies while transitioning to Lens Chain is crucial.

This is an unprecedented challenge — existing tools are insufficient to migrate data between blockchains at such scale. While other teams have attempted similar migrations, none have successfully executed a project of this magnitude.

To address this issue, we developed a migration solution using Rust. This powerful tool successfully transferred all existing data from Polygon to Lens Chain, preserving the integrity of user identities, social connections, and content history. Looking ahead, we designed this migration framework to be adaptable, potentially serving other projects seeking to transition to Lens Chain.

Building on this success, we plan to further refine our migration tools to create a standardized solution to support future projects from any EVM network joining the Lens Chain ecosystem.

The migration of Lens Protocol to Lens Chain requires technical coordination, particularly with Matter Labs (the team behind ZKsync and Elastic Network), to handle large-scale data transfers. The main challenge is managing 125GB of storage logs during chain generation, necessitating enhancements to Matter Labs' node capabilities.

Infrastructure Development

We established local Matter Labs nodes on high-capacity infrastructure to handle storage logs through verified contract calls. We will not directly insert data into the database but prioritize security by ensuring that all transactions go through audited contract code and node infrastructure.

Strategic Implementation

Our approach began with making contracts upgradable and creating dedicated migration contracts for each component. This lightweight approach focuses on core storage and combines verification checks to prevent duplicate migrations. To address the challenge of event loss at genesis, we collaborated with Matter Labs to develop an assembly contract that can recreate historical events after the mainnet chain is created. We enhanced the protocol's flexibility by implementing an 'extraData' key-value to efficiently look up legacy IDs during indexing.

Scale Optimization

The initial migration attempt using a single private key took 100 days to complete. To optimize this process, we:

Distributed processing across multiple private keys (one for every 10,000 accounts)

Implement Multi-Threaded Concurrent Processing

Achieve efficient transaction queuing using local random number computation

Use Multi-Call Function for Batch Operations

Manage call data sizes to prevent bootloader issues

Control Concurrent Management Through Semaphores

Data Synchronization

Our existing Polygon indexer provides a solid foundation for data extraction. The migration system connects to these databases, synchronizing data to the Lens local nodes while maintaining precise block number snapshots to prevent duplication.

Verification and Security

The migration process includes comprehensive verification steps:

Use Multi-Call Function for Concurrent Storage Log Verification

Check getter methods against migration targets

Control Node Concurrent Management Through Semaphores

Timeline and Progress

The entire migration process took five days, resulting in a database snapshot generated at block 67,391,819. Matter Labs conducted a week-long security review of the storage logs.

After the mainnet chain is created, the system will continue to synchronize data daily between Polygon and the new chain during the two-week governance voting period, ensuring data consistency until Lens V3 and Lens Chain go live.

This migration framework embodies the importance of non-dependent data parallel processing, laying the groundwork for future blockchain migration projects.

Lens Protocol V3 Migration: Data Transfer Overview

The transition from Lens V2 to V3 involves a comprehensive data migration across multiple protocol components. Below is a detailed breakdown of the migration scope and process:

Account System Migration

The transition of profiles to accounts marks a fundamental shift from NFT-based profiles to smart wallet architecture. We successfully migrated 650,000 profiles, and the ownership transfer process will occur when the original owner type goes live.

EOA owners receive direct ownership transfers

As long as all signers are EOA, profiles owned by Safe will receive a new Safe deployment with the same signer configuration.

Contract-owned profiles remain under temporary protocol custody and establish a declaration mechanism through the Lens API.

Manager and Metadata Transfer

We migrated 590,000 profile administrators to the new account administrator system, migrating if the account administrator is EOA, and assigning new 1-to-1 schedulers if the unsigned function is enabled. The migration also includes 400,000 profile metadata entries to preserve user identities and profile information.

Usernames

Migrated 650,000 usernames to the new usernames system, preserving user identities while implementing improved namespace management. All previously linked usernames are automatically associated with their respective accounts.

Applications

This transformation marks a significant shift in application architecture, from off-chain metadata to on-chain primitives. We successfully migrated 360 applications to this new framework, enhancing their autonomy and functionality.

Social Graph Migration

We preserved the platform's social graph by migrating 28,000,000 follow connections to the new global graph system, maintaining user relationships and network effects.

Content Migration

Content migration follows a structured approach:

Main Posts: 12,000,000 root posts migrated

Nested comments: Four levels of depth migration implemented

Level 1: 4 million comments

Level 2: 600,000 comments

Level 3: 100,000 comments

Level 4: 40,000 comments

Cited Posts: 310,000 root citations, 155,000 first-level comments

Due to relevance and volume considerations, mirrors have been excluded

Collect/Action

We decided not to migrate collections and operations, preserving their value proposition on the Polygon network. The new system allows users to re-enable these features as needed.

Participation Data

Other participation data (including reactions and report information) will be migrated and made available via public BigQuery.

Resilient Network Governance Process

The deployment of Lens Chain will involve significant state changes at genesis, requiring approval through the governance framework of ZKsync. This crucial step ensures transparency in the migration process and community validation.

Governance voting will last for two weeks, during which our migration infrastructure will remain active. This ongoing synchronization ensures that all user data (including profiles, connections, and content) stays in sync with existing protocols until Lens V3 is officially released.

This approach demonstrates our commitment to maintaining data integrity throughout the transition while adhering to appropriate governance procedures. By continuously updating the status during the voting period, we ensure that the final release will reflect the latest user activity, minimizing disruption to the Lens ecosystem.

The implementation of this governance process, combined with our proactive data synchronization, represents a methodical approach to launching Lens Chain while maintaining user community trust and engagement.

Transition to Lens V3: Seamless Migration Process

During the transition period, users will retain full access to their Lens accounts on Polygon until the official mainnet launch date. To ensure a smooth migration, we designed a maintenance window during which we will implement the final transition steps.

Maintenance Period Agreement

During this planned maintenance period, we will temporarily suspend API access and write operations to prevent any potential data loss. This precaution ensures that all user activity is correctly captured and transmitted. We are coordinating with application developers to implement appropriate maintenance notifications across the ecosystem.

Final Migration Steps

The maintenance period will facilitate two key processes:

Execution of final data synchronization

Transfer accounts to rightful owners

Post-Migration Access

After the maintenance period, users will have immediate access to their accounts on Lens Chain. All major applications in the ecosystem (including Orb, Hey, Tape, and Soclly) will be ready to support the enhancements of Lens V3 as well as some new applications.

User Experience

Throughout the transition, we consistently prioritized user convenience. The migration process requires no action or financial investment from users. The entire process is designed to be very seamless — users will experience an upgraded, more efficient Lens Protocol, gaining faster speeds and higher availability.

Application Migration: Coordinated Transition

The Lens team collaborated with well-known applications like Hey, Orb, Tape, and Soclly to establish the migration framework. This coordinated effort ensures that these platforms can operate fully on Lens Chain from day one, allowing users immediate access to the enhancements of V3.

Sunset Lens V2: Transition to Lens Chain

With the launch of Lens Chain and Lens V3, we are implementing a structured transition plan to ensure clarity and continuity for the community.

Transition Timeline

From the moment the mainnet launches, we will initiate the final phase of Lens V2 on Polygon and Momoka. This strategic decision includes the immediate cessation of late sponsorship programs and reducing Momoka rate limits to zero.

Reasons for Immediate Transition

Immediate transition is crucial for maintaining data consistency and user experience. Since Lens V3 represents a unique branch of the protocol, allowing continued activity on V2 could lead to data fragmentation and user confusion. Our top priority is ensuring that users engage with a well-maintained version of the protocol that offers enhanced capabilities and support.

Developer Support

We recognize that this transition necessitates coordination with our developer community. We encourage application developers who have not yet initiated the migration process to reach out to our technical team via our dedicated Telegram channel for comprehensive migration support and guidance.

Technical Best Practices for Large-Scale Blockchain Migration

Lens V2 on Polygon has successfully migrated to Lens V3 on Lens Chain, marking a milestone in the blockchain industry. Below are several best practices learned and implemented during this process.

Transaction Management

To achieve optimal performance in blockchain migration, implement bulk transactions via multi-call functions. This approach not only simplifies transaction processing but also enhances data retrieval efficiency. Rust's type safety features and concurrent processing capabilities make it an ideal language choice for such migrations, significantly reducing execution time and potential errors.

Infrastructure Optimization

By implementing sharded key management and local random number tracking, transaction throughput can be maximized. This can eliminate bottlenecks caused by node response delays. However, it is crucial to implement rate limiting through mechanisms like semaphores to prevent node overload and ensure system stability.

Operational Reliability

Successful migration requires robust infrastructure and careful progress tracking. Deploy the migration system on dedicated high-capacity servers, ensuring continuous uptime and sufficient storage space. Regularly update the database status to maintain checkpoints for seamless recovery in case of interruptions.

Data Management Strategy

Having structured and well-indexed source data can significantly simplify the migration process. Consider implementing a staging approach by writing migration data to intermediate tables to reduce the impact of complex queries on system performance. Process data in smaller, more frequent batches rather than in large chunks to improve overall throughput.

Smart Contract Security

Prevent state inconsistency by implementing migration contracts with sequence IDs for transaction verification. This can prevent duplicate state updates and provide a safety mechanism for handling interruptions or duplicate migrations. Utilize block number tracking to maintain precise migration boundaries and ensure data consistency.

Database Implementation

Utilize high-performance database systems like PostgreSQL with binary insert capabilities to achieve reliable data storage. This method offers greater reliability compared to disk-based storage solutions while maintaining data integrity throughout the migration process.

Technical Milestones

The migration of Lens Protocol from V2 to Lens Chain is one of the most significant technological transformations. This comprehensive data transfer covers over two years of user activity and community engagement, requiring careful planning and execution to maintain data integrity throughout the process.

Migration Scale

This migration successfully transmitted 125GB of smart contract storage logs, including:

650,000 user accounts and their associated digital identities

650,000 unique usernames maintain user identification across the platform

28 million fan connections preserve the social graph

360 applications ensure ecosystem continuity

16 million posts contain user-generated content

In addition to core protocol data, the migration also includes the transfer of 50 million user reactions, preserving engagement metrics and social interactions.

Looking Ahead

After the mainnet launches, Lens users will be able to easily open their favorite applications, interact with content, and manage their accounts on the new Lens Chain. Lens is proud to have successfully completed the migration from Lens V2 on Polygon to Lens V3 on Lens Chain and thanks the ZKsync team for their collaboration. The powerful tools developed for this migration will be open-source, allowing other development teams to leverage them. This migration process not only sets a new standard for seamless transitions (without requiring user action or cryptocurrency expenditure) but also raises the bar for on-chain innovation.

$AVAX

#LensProtocol

#比特币价格走势分析