How to Build a Decentralized Social Network: Exploring ActivityPub

The centralized nature of the internet itself with all the data aggregated under just several tech giants is rubbing many people the wrong way. The recent push toward using the Fediverse, which is a common name for the collection of social media platforms that use ActivityHub, seems like a natural reaction from some users and developers to the unending reign of Meta and Google.

Decentralization in social media spaces can work well, but the current implementation is still limited and riddled with performance issues. However, the arrival of Flipboard, Medium, Mozilla, Tumblr, and even Threads by Meta to the sector can change the pace of protocol updating and open a new era of social media that stands somewhere in the middle between Web 2.0 and 3.0. Large platforms like Mastodon that use ActivityPub as their main engine are quite popular with Mastodon.social struggling to keep up with the additional load caused two years ago by the acquisition of Twitter by Elon Musk.

Decentralized technologies for social media

The benefits of using a variety of distributed content generation and data storage are apparent to those concerned with privacy, anonymity, and censorship. Since over 62% of all US citizens are worried about the potential of centralized platforms to tamper with content and retroactively change it, the development of a tamper-proof alternative is an important priority for the tech community.

Here are some of the advantages provided by decentralization:

  • Privacy and security. ActivityPub, the biggest platform for such projects, is a C2S (client-to-server) protocol that distributes data and content across multiple instances forming the larger Fediverse. Users are in control of their personal and generated data. Since data is stored across a multitude of servers and can be easily verified, these architectures become resistant to all forms of censorship. Note that up to 81% of US citizens are concerned with how their information is used by centralized corporations.
  • No censorship. The Global Expression Report created by Article 19 claims that over 80% of the global population lives in regions with restricted freedom of expression. Centralized entities Meta can remove any content they want. For instance, Facebook deleted 27 million different posts and comments deemed as hate speech in 2021 alone! By distributing content through solutions like decentralized storage (IPFS) or other mechanisms, social media platforms can become truly resistant to censorship.
  • Better conditions for creators and users. Since data is added by individuals and groups to a decentralized network, it means that they are in control. Some protocols allow users to choose monetization options and do not negotiate with advertisers on their behalf. Tech giants like Google have huge corporate overheads and have to take a significant cut of the revenue generated by creators. For instance, YouTube takes 45%. 
  • More diversity in the sector. As of the time of writing, Facebook has a massive 62% of the global social media market with Instagram, also owned by Meta, firmly holding the second place with 11.8%, and YouTube rounding the TOP 3 with 9.4%. Projects that use ActivityPub don’t even break the TOP 10. This monopoly must be broken down for the sake of our collective good.
  • Communal governance. Decentralized autonomous organizations can be implemented using a variety of techniques. While the overwhelming majority of such communities exist in the world of DeFi (i.e. MakerDAO), it is possible to create something similar in the social media sector. However, here, it does not make that much sense and may introduce unnecessary complexity hindering the already suffering user experience.

What is a blockchain social network?

Some companies are trying to develop something unique by leveraging blockchain technology instead of experimenting with ActivityPub. In some senses, the added incentive to create content that increases engagement for cryptocurrency can be a good business model, but the network and its digital assets must be profitable. One of the most famous examples is Steemit which had to lay off 70% of its staff in 2018 following a sudden crash of the network’s $STEEM token.

Here are some of the interesting projects:

  • Sapien is an Ethereum-based social network that focuses on connecting DAOs to make them more efficient and interact to build a safer and more interconnected blockchain ecosystem. The idea is to create a passport that acts as a decentralized identity (DID) token that allows users to freely interact with the Sapien landscape. Currently, the project has 30,000 citizens and 30 DAOs operating together. It is a true decentralization-driven initiative without any central authority behind it.
  • Steemit is still there despite having some financial troubles 6 years ago. The platform is a destination for crypto enthusiasts who want to be active in a community of passionate individuals while also earning some money as a side gig. The primary currency here is STEEM, it can be traded or staked for STEEM POWER (SP) if you want to keep posting since activities are priced in SP. Note that Steemit is a privately held company, so there is at least some centralization and the possibility of the whole thing catastrophically collapsing one day.
  • Audius is a decentralized music-streaming service that focuses on delivering a Web 2.0 experience to crypto users while connecting them directly to their favorite creators. This approach seems to be working fine, but the current level of user activity is not as impressive as one would expect. The protocol is deployed on Solana and Ethereum simultaneously. The native token used to pay creators has a market cap of 7.8 times smaller compared to the ATH recorded in November 2021.

Why does blockchain-based social media struggle?

The problem with many of these projects is that they are inherently designed to extract money from the audience and give it to content creators. While this particular idea seems to be fair and interesting, the vast majority of people do not want to pay for entertainment that is offered for free on other, bigger platforms. At the same time, keeping native tokens protected from inflation can be extremely difficult.

Another important issue is the focus on connecting new social media platforms to the DeFi ecosystem directly through the issuance of native tokens that can be traded on centralized and decentralized exchanges. It is important to build a viable experience for users first and think about monetization instead of approaching the development process from the wrong end.

The last point is the very slow onboarding process. For example, a new user on Steemit has to keep in order 5 different keys that are used for 5 different activities. On top of that, all transactions are paid in a currency that is not pegged to the US dollar, but there is a token that is somewhat pegged to it with a 10% average volatility. It’s just too complicated for a newcomer.

Complicated dApp development

For these decentralized social media platforms to work and compete against established brands like Facebook or Instagram, we need to focus on user experience and the smoothness of navigation. Having a tamper-proof platform is great, but it is not enough to attract users.

The problem here is that developers must find a way to introduce high throughput, performance, and excellent UI while implementing components of blockchain technology with its sophisticated and slow validation mechanisms. You can do it, but the effort and time it takes to polish something made of bits and pieces of different technologies while keeping it decentralized just doesn’t make financial sense to many developers.

Decentralized App development outside DeFi

As mentioned previously, the easiest way to deploy a no-censorship distributed social media is by using ActivityPub. It is not a part of the blockchain ecosystem, but the C2S architecture and the interconnectedness of independently operated nodes and instances make it seem like a typical Dapp in the DeFi landscape. However, ActivityHub has a completely different architecture and does not use the same validation mechanism as some of the most popular blockchains.

Instead, the addition of new information to the decentralized network is called federated. The process is conducted within individual instances. This approach significantly limits the throughput capacity and makes accidental DDOS attacks possible (when too many activities are performed simultaneously, causing issues with efficient federation of content).

Another method of building decentralized social media is by using peer-to-peer connections. This particular approach is used very often as it requires installing individual clients that can be connected to a web of devices with each storing some data. Accessing content from other users can be difficult in many cases and the content is not stored in a way that makes it permanently accessible. Among successful peer-to-peer social networks, only Manyverse stands out. It is built on the SSB protocol and allows users to independently operate within the ecosystem by connecting directly to others.

Building a fully decentralized, distributed, and secure social media platforms is a difficult undertaking with many challenges that do not have easy solutions. Projects that do take off the ground and manage to gain traction are far and between with success stories happening rather rarely.

How to build a social network?

The easiest and most efficient way is through the use of Mastodon and similar protocols within the Fediverse ecosystem. You do need some technical know-how to get started. Let’s assume that you are familiar with Linux and understand the basics of running a server.

For the latest version of Mastodon, you will need:

  1. Linux VPS with Ubuntu 22.04. Alternatively, you can run it on Debian 11. The outcome will be the same.
  2. It is recommended to have at least 4 CPU cores, 8 GB of RAM, and 100 GB of disk space to start. Mastodon is scalable so you can expand later.
  3. To run an instance, you will need to get a domain name. The process of acquiring one is the same as in the case of any other website.

The process requires taking several steps:

  1. Setting up an SMTP server. Most hosting providers require users to Postfix and SASL modules.
  2. Servers must be secured with SHH, HTTP, and HTTPS protocols being the only allowed means of communication.
  3. It is important to install some of the most popular tools like Curl for data transferring, Wget for downloading files from the internet, etc. Usually, the list is provided by the hosting provider.
  4. Install the necessary packages for content creation and storage. These include, but not limited to, imagemagick for pictures, ffmpeg for audio and video streams, nodejs to run JavaScript, and redis-server to store key values in memory.
  5. Set up a PostgreSQL database where the essential information about objects, authors, and actions will be stored.
  6. Install and set up Mastodon. The Git command for getting it from the official repository is: “git clone https://github.com/mastodon/mastodon.git live && cd live” followed by “git checkout $(git tag -l | grep ‘^v[0-9.]*$’ | sort -V | tail -n 1”. The setup wizard will guide you through the rest of the process.
  7. Configure, test, and run the web server. You will need a functional SSL certificate. You can use the web interface by simply going to the domain address of your server and using admin credentials to log in.

Each step takes many more actions and requires, as mentioned previously, in-depth technical know-how. All hosting providers have their own requirements and recommended tools. It is important to choose a good provider before getting started!