In the ever-evolving landscape of blockchain and Web3, Lens Protocol stands as a beacon of innovation within the Polygon ecosystem. Setting up an indexer for Lens Protocol is an essential step for those eager to explore the vibrant world of Web3 and user-owned social graphs.

Within this comprehensive article, we provide an in-depth, user-friendly guide on configuring a SubQuery indexer for Lens Protocol. Our aim is to demystify the entire process, ensuring accessibility for users of all skill levels. This guide serves as your gateway to efficiently manage data within the Lens Protocol ecosystem, enabling users to navigate user-owned social graphs with confidence.

We delve into the intricacies of Lens Protocol's social graph structure and harness the capabilities of SubQuery SDK for easy access to critical data points. Whether you're a seasoned developer or just embarking on your Web3 journey, this guide equips you with the knowledge and confidence needed to seamlessly navigate the Lens Protocol ecosystem and its user-owned social graph.


The Lens sample project gathers data related to Profiles, Follows and Posts. Key resources:


When you start the project, you can ask questions. Because everything is connected – like 'Profile,' 'Follow,' 'Account,' and 'Post' – you can get answers to all your questions with just one question. This functionality is illustrated in the following example:

In essence, this query offers a comprehensive view of a specific follow action, allowing us to understand the various aspects and entities involved in the process. We retrieve a specific set of information to gain insights into a `follow` event. For the `follows` we then gather several key pieces of information. First, we obtain the 'id,' which serves as a unique identifier for the follow action. Moreover, the query delves into the actors involved in this interaction. It identifies the 'fromAccount,' which corresponds to the account responsible for initiating the follow action, and it includes the 'id' of this account. Additionally, we explore the 'toProfile,' which signifies the profile that was followed. 

In this query, we aim to obtain insights into the most recent indexed post, limited to the first one. The query provides details such as the 'id,' as well as the 'contentURI,' which points to the content associated with the post. The 'profile' section within the query reveals additional details about the author of the post.

To sum it up, SubQuery's SDK simplifies the process for developers to access social data from Lens Protocol, highlighting its capabilities. This illustrates how developers can seamlessly incorporate on-chain data for real-world social applications. Whether you're constructing tools to analyse the Lens graph or developing decentralised apps for Web3 social data, SubQuery's SDK is the ideal solution for the task.

About Lens

Lens Protocol represents a Web3 social graph operating on the Polygon Proof-of-Stake blockchain. Its primary objective is to grant creators the authority to possess the connections between themselves and their community, thereby establishing a completely adaptable, user-owned social graph. The protocol's architecture is intentionally designed with modularity as a core principle, enabling the seamless incorporation of new features and fixes while safeguarding the permanence of user-owned content and social connections.

​​Website | Docs | Brand Kit | GitHub | Twitter | Discord

About SubQuery

SubQuery is a leading blockchain data indexer that provides developers with fast, flexible, universal, and decentralised APIs for web3 projects. We empower developers from over 110+ ecosystems including Ethereum, Polygon, Polkadot, Cosmos, Algorand, NEAR, Avalanche, Stellar and ZKSync with rich indexed data to allow them to build intuitive and immersive decentralised applications. This blockchain developer toolkit enables developers to focus on their core use case and front-end without wasting time building a custom backend for data processing activities. In the near future, the SubQuery Network will replicate this scalable and reliable solution in a completely decentralised manner.

​​Linktree | Website | Discord | Telegram | Twitter | Matrix | LinkedIn | YouTube

Share this post