Web3 Social: Create & Monetize with Smart Contracts

2023-12-14

Introduction

The rise of Web3 is transforming the landscape of social media. Departing from the centralized models of platforms like Facebook, Web3 social networks offer decentralized, user-centric experiences. This blog explores the innovative world of Web3 social networks, their unique benefits, key players in the space, and delves into monetization mechanisms using smart contracts, with a particular focus on the Lens platform.

What is Web3 Social?

In the realm of digital interactions, the emergence of Web3 social networks represents a transformative leap from their Web2 predecessors. But to appreciate this leap, let's consider a common frustration in the Web2 world: the YouTube Ad Revenue Rule Changes.

Imagine being a content creator who has spent years building a channel, only to find the rules of monetization suddenly change, leaving you with diminished earnings and increased uncertainties. This scenario underscores a key limitation of Web2 platforms - their centralized control and opaque policies can often leave creators and users at a disadvantage.

In stark contrast, Web3 social platforms are reshaping this dynamic. Built on blockchain technology, these networks are inherently decentralized, offering a level of transparency and user control unheard of in traditional social media.

Users and creators are not just passive participants but active stakeholders with a say in the platform's governance and policies. This shift from a centralized to a decentralized paradigm is more than just technological; it's a cultural revolution that empowers individuals and communities, ensuring that their contributions and engagements are fairly recognized and rewarded.

Benefits to Users & Creators

By addressing the fundamental limitations of Web2 experiences, Web3 social networks are not just an evolution of technology but a reimagining of how online communities can operate, grow, and flourish in a more equitable and user-centric environment.

For Users:

  1. Ownership of Data: In Web3 social networks, users have complete control over their data. This includes decisions on sharing and utilization, fostering a sense of empowerment and privacy.
  1. Enhanced Privacy: The decentralized nature of Web3 networks offers robust privacy protections. Users can have confidence in the secure storage of their data, knowing that their online identities are safeguarded and not accessible by centralized entities.
  1. Token-Based Rewards: Participation in Web3 social networks can be incentivized through token rewards. This not only offers tangible benefits for engagement but also instills a sense of ownership in the network's growth.
  1. Censorship Resistance: Decentralized platforms resist censorship more effectively, safeguarding freedom of speech and expression.
  1. Interoperability: Users benefit from seamless interactions across various platforms without losing their identity or data, thanks to the interoperable nature of Web3.

For Creators:

  1. Direct Monetization: Creators can monetize their content directly through tokens or NFTs without intermediaries, leading to improved earnings and control.
  1. Verifiable Content and Community Connection: Web3 enables creators to establish a direct and verifiable link with their audience. High-quality content can be authenticated by the community, enhancing trust and the potential for monetization.
  1. Creative Freedom: The absence of centralized control offers creators more freedom in content creation and presentation.
  1. Automated Royalties: Blockchain technology facilitates automated royalty systems, ensuring fair compensation for content use and distribution.

Pioneers of the Web3 Social Revolution

1. Lens Protocol: A Decentralized Social Graph Service

  • Lens Protocol, built on the Polygon blockchain and Momoka Layer2, offers a foundational infrastructure for decentralized social media applications. It allows users to create profiles as NFTs, ensuring ownership and control over their content. Its modular design enables developers to build various social media applications, emphasizing community governance and user empowerment.

2. Farcaster: Prioritizing User Agency in Social Networking

  • Farcaster is a decentralized social network that champions user control and interoperability. It operates as an open protocol, supporting transparency and collaboration. The network's design centers on user agency, allowing for control over data and interactions, and it actively involves its community in governance decisions.

3. Friend Tech: Integrating Blockchain with Social Networking

  • Friend Tech combines traditional social media features with blockchain technology, offering a decentralized platform for user interaction and content sharing. It introduces token-based incentives for user participation and emphasizes enhanced privacy and security through blockchain.

4. Ethereum Name Service (ENS): Facilitating Identity in Web3

  • ENS, while not a social network, is crucial in the Web3 space, providing a decentralized naming system for Ethereum addresses and resources. It plays a vital role in user identity across Web3 platforms, including social networks, and enhances the user experience through interoperability with various decentralized applications.

How Web3 Social Infrastructure Works

Lens V2 exemplifies Web3 social infrastructure. Its smart contract architecture and module interfaces provide insights into the workings of decentralized social networks. The Lens protocol offers comprehensive functionalities that reshape social interactions on the blockchain.

Lens Protocol Overview

Lens Protocol is a Web3 social graph built on the blockchain, designed to empower users and creators through decentralization. It's essentially a set of smart contracts that operate on the Ethereum blockchain, offering a framework for creating decentralized social media applications.

Key Components of Lens Protocol:

  1. Smart Contracts: At its core, Lens Protocol is built around a suite of smart contracts, which manage various aspects of the social graph. These contracts handle user profiles, posts, comments, and interactions like follows and likes.
  1. Decentralized Identity: Users on Lens create decentralized profiles, which act as their identity across various applications using the protocol. This identity is controlled by the user, not the platform.
  1. Content Ownership: All content created by users is owned by them. This is a shift from traditional social media, where platforms often hold control over user content.
  1. Interoperability: Applications built on Lens can interact with each other, enabling a shared social graph that's not confined to a single platform.

Technical Architecture of Lens Protocol

  1. Profile Creation and Management:
    • Profile NFTs: Users create their profiles as NFTs, which are unique and owned by the user. These NFTs are more than just collectibles; they represent the user's identity and social graph within the Lens ecosystem.
    • Profile Updates: Users can update their profiles (e.g., changing a profile picture or bio) directly through transactions on the Ethereum blockchain, facilitated by the Profile smart contract.
  1. Content Publishing:
    • Posts and Comments: When users publish posts or comments, these actions are executed through smart contracts. Each post or comment is essentially a transaction on the blockchain, ensuring immutability and ownership.
    • Content Linking: The content is linked to the user's profile NFT, establishing a clear ownership and attribution chain.
  1. Social Interactions:
    • Following: The Follow smart contract manages the mechanism of users following each other. This action updates the social graph, reflecting in the user's profile NFT.
    • Likes and Other Reactions: Similar to following, interactions like likes are handled by specific contracts. These interactions are publicly recorded on the blockchain, contributing to the content's visibility and engagement.
  1. Modularity and Extensibility:
    • Building on Lens: Developers can create additional smart contracts that interact with Lens' existing contracts. This modularity allows for the creation of new features and applications, such as content curation mechanisms or specialized social media platforms.

Security and Upgradability:

  • Lens Protocol's smart contracts are designed with security in mind. They undergo rigorous testing and audits to ensure their resilience against common vulnerabilities.
  • The contracts are also upgradable to adapt to new requirements and improvements over time, ensuring the protocol remains relevant and secure.

Content Monetization: Lens & Phat Contract Case Study

Monetization DApps in the Web3 Ecosystem

Web3 monetization DApps stand as innovative solutions that empower creators and users alike. These applications leverage blockchain technology to facilitate direct, transparent, and equitable monetization strategies. Unlike traditional platforms where monetization is often opaque and controlled by intermediaries, DApps in the Web3 space offer a decentralized approach, giving more control and rewards back to the users and creators.

How Monetization DApps Work:

  1. Direct Engagement and Rewards: Monetization DApps enable direct interaction between creators and their audience. For instance, creators can earn from their content directly through user engagements like likes, comments, or shares.
  1. Tokenization: These DApps often use tokens or cryptocurrencies as a medium of exchange. Users can earn tokens for engaging with content, which can then be exchanged, held as an investment, or used within the ecosystem.
  1. Smart Contract Integration: The core logic of monetization, including tracking engagements and distributing rewards, is managed by smart contracts. These are self-executing contracts with the terms of the agreement directly written into lines of code.

Monetization DApp Case Studies:

  1. MadFi Protocol: MadFi showcases a novel approach to content monetization. It introduces a system where creators earn tokens based on the engagement and appreciation their content receives. This mechanism ensures that the rewards are directly correlated with the value the community places on the content.
  1. Zurf and Phala Network Partnership: This case demonstrates a practical application of monetization DApps in social interactions. Through its partnership with Phala Network, Zurf leverages the power of Phat Contracts to monetize social interactions, offering a new model where both content creators and consumers benefit from the platform's growth and activity.

Demonstration:

Building on these concepts, our demonstration will simulate a basic DApp that uses Lens API and Phat Contracts to track user engagement and rewards on the Lens Protocol. This DApp will highlight how blockchain technology can be used to create transparent and fair monetization systems in the Web3 ecosystem.

Step 1: Interacting with Lens API

To interact with the Lens Protocol, you'll first need to fetch user engagement data like likes and comments. Here's a basic example of how you might retrieve this data using JavaScript:

function fetchApiStats(apiUrl: string, requestStr: string): any {
  // ...
  let query = JSON.stringify({
    query: `
      query Profile {
        profile(request: { forProfileId: "${requestStr}" }) {
          stats {
              followers
          }
        }
      }
    `,
  });
  let response = pink.batchHttpRequest[{
        url: apiUrl,
        method: "POST",
        headers,
        body,
        returnTextBody: true,
      },],10000)[0];
  // Value can be accessed via the path
  response.body.data.profile.stats.posts;
}

Step 2: Writing a Phat Contract

Next, you would write a Phat Contract in Solidity that processes this data. The contract here will check if the followers and timestamp returned will result in the marketer getting their payout based on the results from Lens API. Here's a simplified example:

// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.9;

import "@openzeppelin/contracts/access/Ownable.sol";
import "@phala/solidity/contracts/PhatRollupAnchor.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";

contract OracleConsumerContract is PhatRollupAnchor, Ownable {
    mapping(uint => address) requests;
    uint nextRequest = 1;
		uint256 initialFollowerCount = 70000;
		uint256 payDateTimestamp = 1701247182;
		uint256 marketerPayout = 1000;
		uint followersThreshold = 10000; 
		// Skip constructors code

    function requestPay() public {
        // assemble the request
        uint id = nextRequest;
        requests[id] = msg.sender;
        _pushMessage(abi.encode(id, reqData));
        nextRequest += 1;
    }

    function _onMessageReceived(bytes calldata action) internal override {
        (uint respType, uint id, uint256 followers, uint256 currentTimeStamp) = abi.decode(
            action,
            (uint, uint, uint256, uint256)
        );
				address payee = requests[id];
        delete requests[id];
				_withdrawMarketersPayout(followers, currentTimestamp);
    }

		function _withdrawMarketersPayout(address marketerAddress, uint256 followers, uint256 currentTimestamp) {
        // Security to be implemented
        payable(marketerAddress).transfer(marketerPayout);
        marketerPayout = 0;
    }
}

In this demonstration, we've gone through fetching data from the Lens API for a profile’s follower count, processing this data in a Phat Contract, and fulfilling the payout to a contracted marketer in the consumer contract based on the fetched data from Lens API. This simplified example gives an idea of how these components can work together, though a real-world application would require more robust and secure implementations.

Conclusion

The emergence of Web3 social networks, led by innovators like Lens Protocol, Farcaster, Friend Tech, and ENS, marks a significant shift towards a more equitable and user-centric digital world. These platforms are not just transforming the way we interact online; they're redefining the norms of ownership, privacy, and value creation in the digital space.

A key component in this transformation is the integration of technologies like Phat Contracts. These advanced smart contracts, offered by the Phala Network, are pivotal in enabling complex, data-intensive operations required for effective monetization in Web3 social networks. By facilitating intricate reward mechanisms and ensuring transparent, decentralized processing of user and creator interactions, Phat Contracts are essential in realizing the full potential of monetization in Web3.

The journey from Web2 to Web3 represents more than a technological evolution—it's a cultural shift towards a democratized internet. In this new era, everyone from developers to creators and users plays a crucial role, benefiting from enhanced control and rewards offered by these decentralized platforms.

Be Part of the Monetization Revolution in Web3 Ready to explore the limitless possibilities of Web3 social networking? Whether you are a developer keen on building innovative DApps, a content creator looking for fair monetization, or a user seeking a more empowering online experience, the Web3 world welcomes you. Here’s how you can start:

  • Discover the decentralized social graph services with Lens Protocol.
  • Experience user agency and network interoperability at Farcaster.
  • Explore Friend Tech for a unique blend of blockchain and social networking.
  • Understand how ENS enhances Web3 identity.
  • Delve into the functionalities of Phat Contracts on the Phala Network to see how they revolutionize content monetization.

Join this exciting revolution, contribute to the Web3 ecosystem, and be a part of shaping a more transparent, equitable, and rewarding future in social networking

About Phala

Phala Network is a decentralized cloud that offers secure and scalable computing for Web3.

With Phat Contracts, an innovative programming model enabling trustless off-chain computation, developers can create new Web3 use cases.

Get the latest Phala Content Straight To Your Inbox.