LensAPI Oracle: Supercharge Your Web3 Social App

Phala Network
Phala Network
Published in
6 min readJun 20, 2023


As of 2023, 4.9 billion people around the world are using social applications. This is about 60% of the world’s total population, where each person uses at least 6 social applications.
Let these numbers sink in for a moment and reflect on how much time people spend on their smartphones and social applications per day.

The Rise of Web3 Social Applications

SocialFi, also known as web3 social, merges the realms of social media and decentralized finance. Web3 social has become one of the most booming areas in the overall web3 space. According to Dune’s SocialFi Dashboard stats, there are already a staggering 4 million users in the web3 social space, with over 20 unique web3 social protocols in use.

The vision of web3 social is to empower users with data ownership, allowing them to regain control over their content and data. This is made viable by extracting this information from centralized platforms such as Twitter or TikTok and migrating it into public good blockchains.

Web3 social applications primarily utilize on-chain technology as their main protocol to ensure that social interactions can be recorded and, with the aid of smart contracts, securely stored on the blockchain indefinitely.

Lens Protocol — The Future of Web3 Social Applications

Lens Protocol is a modular web3 social graph on Polygon that empowers creators to own their community links and user-generated content while maintaining immutability. lt provides a solution to the issues of centralized and non-portable content on existing social media platforms by being a user-owned, open social graph that any application can use. This enables users to own and migrate their data to other platforms at their own discretion freeing them from being locked to a specific network.

Lens Protocol brings a new game rule to the table, revolutionizing the social infrastructure by changing the game from zero-sum to collaborative, allowing the entire ecosystem to benefit and meaningful social experiences to occur without relying on attention-grabbing feedback mechanisms, and giving developers maximum creativity and flexibility.

Why SocialFi Needs Web3 Oracles

Applications within SocialFi need to read data from APIs. At this stage, only centralized or hand-rolled solutions are available. We have identified a widespread demand for infrastructure tools, including verifiable computation and web3 oracles that are owned by developers.

In the rapidly expanding Lens ecosystem, three major needs have emerged:

  1. SocialFi applications have gained immense user adoption, creating a strong demand for decentralized off-chain services. These applications often rely on data sourced from conventional web2 APIs for program logic calculations. Examples within the Lens ecosystem include monetization applications like Wav3s, Guild, Dispatch, and Lens Garden.
  2. A significant amount of data is being stored in a trustless way, within smart contracts, fostering innovation and expanding the range of web3 social use cases.
  3. In addition to integrating web2 APIs, there is a need for seamless integration with web3 services. Therefore, developers need tools to make their smart contracts even smarter to overcome on-chain limitations.

All of the above-mentioned points represent core web3 principles, which provide users with control behind NFT-based profiles and private key ownership.

The rise of innovative ideas demonstrates the growing number of use cases that require a seamless flow of data information from web2 to web3. We dug deeper and formulated practical use cases that enhance both developer and user experiences within the Lens ecosystem.

  • A Lens Social Sync bot: connect Lens to web2 social platforms like Twitter and Facebook, allowing automated cross-posts.
  • Referral system: enable on-chain monetization for viral marketing based on the social graph. Off-chain computation is required because of the complex computation and the multi-data sources which are involved.

Web3 oracles are the ideal choice for powering such use cases, providing developers with new opportunities to build efficient and decentralized applications for SocialFi.

The LensAPI Oracle — Providing Powerful Developer Tooling

To cater to the growing needs of the Lens ecosystem, we present the LensAPI Oracle — a groundbreaking solution powered by Phala Network. This programmable web3 oracle enables developers to deploy custom, no-code oracles in just five minutes! Here’s what developers stand to gain:

  • Unrivaled accuracy: the data source is the Lens API and it’s verifiable with Phala’s infrastructure.
  • Rich features: customization of Lens data to the web3 oracle can be applied if needed, powered by the javascript engine.
  • Faster shipping: developers can enjoy a no-code experience for their set-up.
  • Low cost: the web3 oracle can be deployed to the underlying Phala Network for free, then the native Phala token needs to be staked to access the service.

The underlying technology that hosts this Lens protocol oracle is Phala Network’s Phat Contract. With this programming model developers can connect their dApp to the Lensverse in one click.

So, what does this mean for the web3 social space? The LensAPI Oracle, introduced by Phala Network, overcomes the limitations for dApp builders to get web2 and web3 data easily pushed into their smart contracts. This is solved via an automated process based on programmable web3 oracles. Verifiable computation as well as the benefit of omnichain smart contract communication run in the backend.

Getting Started with the LensAPI Oracle in Three Easy Steps

To get a Lens protocol oracle deployed on Polygon in 5 minutes, the development effort can be summarized in the following three steps:

  1. Data from an on-chain index API (e.g. Lens API) needs to be defined. Additional data fields that are needed can be simply picked. Users can also add custom expressions if necessary.

2. Developers deploy the Lens protocol oracle at a low cost. The LensAPI Oracle works with a stake-to-compute model, where Phala’s native $PHA tokens are needed for the stake to deploy the web3 oracle on the Phala Network, within a Phat Contract. Stay tuned for the free staking campaign for Lens and Polygon users coming very soon!

3. In the last step developers can connect their smart contracts on Polygon to request the oracle they just deployed in a few lines of code.

Crazy Cool right? How Does it All Work?

In short, Phala Network simplifies the developer process, making it easier than ever to deploy programmable web3 oracles and unlock the full potential of web3 social applications.

Phala Network’s off-chain programming model Phat Contract helps builders to convert any API data into decentralized Polygon oracles. Such oracles can be created by the Lens builders themselves with any additional customization included.

This means users can easily set up monetization and incentive-based posts and activities on Lens protocol through Phala Network’s backend services.

It reduces the barrier for dApp builders when converting data into smart contracts on Polygon or even Momoka, which is the latest solution on Lens to scale decentralized social for mass consumer adoption.

Tired of Tending to Your LensAPI Oracles? Let Us Plant One for You!

The Phala and Lens teams are committed to providing the best developer experience for all Lens dApp builders.

Don’t miss out on this exciting opportunity — visit https://bricks.phala.network/ today to deploy your first decentralized oracle and revolutionize the way you build and interact with web3 social applications.

If you already have a use case in mind and are looking for funding support or engineering-focused mentorship, you can check out the Phala Builders Program and apply for up to $50k in funding!

About Phala

Phala Network is a decentralized off-chain compute infrastructure like no other. Phat contract, an off-chain programming model running on Phala Network, enables developers to build Dapps with omnichain compatibility, internet connectivity, and verifiable computation. These benefits will make your smart contracts even smarter and can be simply integrated via no-code or low-code developer experiences.

🍽 — Subscribe | Website | Twitter | Github

🥤 — Discord | Forum | Telegram |Italiano |Français | Persian | Korean