Lens is a decentralized social graph protocol created by the AAVE team. The purpose of the protocol is to empower creators to own the links in the social graph that connects them with their community. Lens allows accounts to create and follow profiles, publish and collect posts, and much more, focusing on the economics of social interactions.
The protocol is EVM compatible and is still in development (see Github). A version of it has been deployed to the Polygon Mumbai testnet.
Nomenclature:
Most interactions happen through the Lens Hub — a contract that implements profiles and publication interactions. Each profile and publication is an NFT created through this contract. Below is a list of interactions supported by the protocol:
The Lens Hub keeps track of interactions through a mix of storage on the Lens Hub contract and callbacks that mint NFTs or provide custom logic through modules.
Accounts can create profiles with a profile handle name, a profile image, a Follow NFT URI, and a Follow module. After creating a profile, a Lens Hub NFT is minted to the account that controls the profile.
The protocol uses its own profile name handling and restricts profile creation to an allowed list of accounts. The reason for this restriction is that the low fee environment of Polygon could lead to an excessive amount of profile name squatting. The protocol governance maintains the list of allowed profile creators. See the Security and Ownership section for more details on governance.
The Follow NFT URI is a content URI that is stored in the Lens Hub contract.
Currently, the profile image is just a URL. An improvement could be to allow profiles to have image modules. Image modules could delegate profile logic to NFT contracts.
Following a profile consists of two main mechanisms: Follow NFTs and Follow modules.
Follow NFT
Follow NFTs are minted to follower accounts after following a profile. This means that following a profile comes with all the financial functionality and interoperability of NFTs. Some benefits could be airdrops, token gated content, or simply belonging to a cohort of accounts that hold a specific piece of digital art.
Each profile gets its own Follow NFT contract. If a profile does not have any followers, the first follow transaction deploys the Follow NFT contract. Since the follower is initializing the Follow NFT contract deployment, the protocol decides the name and symbol parameters for the Follow NFT. The name is set to the profile handle name with the suffix -Follower
appended, and the symbol is the first 4 bytes of the handle name with the suffix -Fl
appended.
The Follow NFT content function (tokenURI
) calls back into the Lens Hub contract and returns the Follow NFT URI profiles specified when creating the profile.
An improvement would be to allow accounts to set up their own Follow NFT contract when setting up their profile. With this approach, the profile decides their name and symbol, and the first follower does not have to pay for the gas of deploying the Follow NFT.
Follow Module
Follow modules are contracts that specify the rules for new followers. The rules determine whether your account can follow a specific profile. There are a few different types of following modules:
Currently, the FeeFollowModule
implementation takes a percentage of the fee and sends it to a treasury.
Taking a modular approach to the following feature can be explored widely. A few ideas for new following modules are:
Creating profiles and publishing is a restricted feature, but all accounts can follow profiles as long as they satisfy the Follow module conditions.
Publishing refers to creating posts and their interactions (collecting, comments, and mirrors). Only profiles can create posts, comments, and mirrors. However, similarly to following, collecting posts is open to all accounts.
Posts are created and stored on the Lens Hub by providing a content reference as well as a Reference and Collect module:
Collecting and commenting are subject to Reference and Collect module rules, while Mirroring is only subject to the Reference module rules.
Collecting
Collecting a post, mints an NFT with a reference to the original post. The Collect NFT stores the profile and post IDs used later to retrieve the post content.
Commenting
Commenting on posts mints an NFT with a reference to the original post and an additional content reference that holds the comment's content.
Mirroring
A Mirror refers to a “repost” of content. When you Mirror a post, the original post’s profile and publication ID are stored as a new post. No content references are stored since the Mirror can point to the original post for content.
A good design choice has been to allow publishing with signatures using a meta transaction approach. Transactions using signatures are supported for posting, commenting, mirroring, burning, and following.
This means that the end-user can interact with the protocol without spending any gas as long as someone else is willing to submit the transaction for you. This pattern is used in EIP-2612, which describes a standard for granting ERC20 token approvals with signatures. A similar design has been used by Mirror by using Ethereum wallet signatures to publish content to Arweave.
Dispatchers
Profiles can specify a “dispatcher.” A dispatcher is an account that can act on behalf of a profile as a form of delegation or sharing profile access. Dispatchers can update profile information, post, comment, and mirror. Only the profile owner can update dispatchers.
Profiles can only specify a single dispatcher. However, a dispatcher could be a contract that allows multiple accounts to submit transactions, effectively allowing multiple accounts to control a single profile.
Governance
The Lens Protocol has a governance module currently in control of a multisig that has special privileges.
Admin
The governance role can update an “emergency admin” role. The emergency admin can update the state of the protocol. The states are:
The Lens protocol lays a foundational infrastructure to create connections between creators and their communities through on-chain interactions. The use of ERC-721 tokens gives users open access to their social graphs without any intermediaries. The Lens protocol is the beginning of social media moving away from old extractive models and letting creators own their social graphs.
Protocol Review is excited to continue publishing accessible reviews for decentralized protocols. We believe in using our deep technical knowledge to distill protocols and increase their mainstream understanding. To stay up to date with the latest reviews or if you’re interested in writing for the publication follow us on Twitter and join Discord.
Thanks to everyone that helped get this review completed. Julian for the illustration. Julie, Graeme, Denis, Lauren, and Davidbrai for reading and editing the drafts.