eallion

大大的小蜗牛

机会总是垂青于有准备的人!
mastodon
github
twitter
steam
telegram
keybase
email

Introduction to the Federal Universe and Mastodon

@e5n.cc@eallion

Preface: The Fediverse Has No Barriers#

A_view_into_the_Fediverse

Don't try to understand it, feel it. — "Inception"

Fediverse (Fediverse = federation + universe) may seem profound and mysterious to new users, but just like the famous quote from "Inception," don't try to understand it, just use it! There are no barriers to using the Fediverse; it's very easy to get started—choose an open instance, register an account, follow its rules, and start using it! If you don't like the rules of this instance? Just switch to another one. An instance is generally just a domain website.
There are no barriers to using the Fediverse! You only need an account from one instance to follow, comment, and like users and their posts on other instances. It doesn't matter if the domains of these accounts are different; as long as they follow the same federation protocol, they can communicate.
Is there a barrier to self-hosting an instance? As long as you can think of wanting to self-host an instance, then there are no barriers. There are many step-by-step tutorials online.
I self-hosted a Mastodon service in April 2017 and joined the Fediverse, and it has been over 7 years now. Later, for unknown reasons, I cleared this Mastodon (along with QQ Space, Weibo, Twitter, Facebook, etc.), and in 2023, I changed the domain and publicly launched the instance e5n.cc, so I have some insights into the Fediverse and would like to share my experiences briefly.

╰(°▽°)╯: e5n = eallion's k8s notation; cc = abbreviation for Charles Chin.

An Example 🌰#

1. Phone Universe#

If you have a "China Mobile" phone number, you can call or text your friend's "China Unicom" phone number on their iPhone, and you can also call or text an "AT&T" phone number on an American friend's Samsung phone. As long as you know someone's phone number, and as long as the other person's phone and the carrier support the same communication protocol, you can call or text them.
Such a mobile communication network can be called a "phone universe" or "mobile universe."

2. Email Universe#

Anyone who surfs the internet should have an email address. You can send emails from a QQ email to a Gmail email, to a NetEase 163 email, or to a Hotmail email. As long as the email accounts provided by the other party use the same email communication protocol, they can send and receive emails to each other.
Such an email communication network can be called an "email universe."

3. Summary (Adapted from Wikipedia)#

Fediverse consists of a series of free software, with a set of interconnected servers (self-hosted or third-party hosted), providing web publishing (such as social media, microblogging, blogs, or websites) or file hosting functions together. Although each server operates independently, and there are many instances with diverse content, the servers can communicate with each other. On different servers (instances), users can create different accounts. These accounts can communicate across instance boundaries because the software running on the servers supports one or more communication protocols that adhere to open standards. 1 Users can publish text or other media files through accounts in the Fediverse and can follow other users. 2 In some cases, users can publish or share data (such as audio, video, text files, etc.), making it open to all or part of the people and allowing them to collaboratively edit content (such as calendars and directories).

Fediverse_branches_1.2

Terminology#

Adapted from: "Introduction to the Fediverse" (Web Archive)

Fediverse (fediverse)#

The collection of all federated services (Federated Server) is called the Fediverse.

Federated Services#

Refers to independently deployed services that can communicate with each other. The key point here is that they can communicate; the functionality is irrelevant: social networks, microblogging, blogs, regular websites, and file storage can all be included. Communication is standardized by federation protocols.

Federation Protocol#

The protocol (Protocol) for communication between different instances (Instance) in the Fediverse.

Instance (Instance)#

A federated service is called an instance. Some people also refer to an instance as a Pod. Anyone can choose a federation protocol to write a brand new instance, but a more popular approach is to choose a Fediverse software to generate an instance.

Fediverse Software#

Software that facilitates others to quickly deploy new instances, which can be designed according to a certain federation protocol's API or can design a unique API.
The most famous software is: Mastodon.

Identity (Identity)#

An account registered on an instance is called an identity. In the following text, I will also use the term user, which is more familiar to everyone.

Protocol (Protocol)#

A set of agreed-upon standards. The same protocol means that communication is possible; even if two instances belong to different Fediverse software, as long as the protocols are the same, they can communicate. Therefore, the Fediverse is a very large concept.
The mainstream protocol currently is the ActivityPub protocol used by Mastodon.

API (Application Programming Interface)#

In a Fediverse, the API refers to the methods left by an instance for other programs to communicate with that instance. A completely self-written instance needs to design its own API, while an instance generated by Fediverse software generally uses the API designed by the Fediverse software directly.

Regarding the difference between protocols and APIs: a protocol is just a standard, while an API is a specific implementation of the protocol. An API can fully comply with the protocol, partially comply, or design APIs outside the protocol. To put it metaphorically: suppose all of humanity has a common moral standard; this moral standard is the protocol, while the laws of various countries are the APIs. Is there a better analogy?

Examples of Federation Protocols#

Adapted from: "Introduction to the Fediverse" (Web Archive)

Common federation protocols include:

Zot or Zot/6 Protocol#

Provides decentralized network connections for independent websites, communication, identity (user) management, and permission control. It is a protocol that has only emerged in the last two years, but it seems that the website is no longer accessible; the Wikipedia entry on Fediverse provided an Internet Archive link when mentioning it.

Diaspora Protocol#

According to Wikipedia, it is a non-profit, user-owned, distributed social network; GitHub page states it is a privacy-aware, distributed, open-source social network.
The only Fediverse software using this protocol should be diaspora*, which is what they use themselves. This Fediverse software has 12.5k stars and 2.9k forks on GitHub, started in 2010, and has been actively developed for ten years, with 88 releases, but the version number has risen conservatively, only reaching 0.7.14.0.
As a side note, I found a list of all open-source social network services on their GitHub page, which records many instances, their instance versions, the Fediverse software used, the protocols, the uptime (percentage of time the service has not been down), whether it supports IPv6, network latency, whether registration is open, user numbers, and many more details. I tried searching for my own instance, and it can be found. This list is updated in a timely manner and is truly a treasure trove!

OStatus Protocol#

According to Wikipedia, this is a protocol specifically for federated microblogging, with Mastodon being one of the earliest to use this protocol.
This protocol is an older one, created around 2010. In January 2012, the W3C community group wanted to maintain and further develop this protocol, but the good times didn't last long. In July 2014, a federated social network working group (W3C Federated Social Web Working Group) was formed, which directly created a new protocol, effectively sidelining the OStatus protocol.

ActivityPub Protocol#

This is the new protocol created by the federated social network working group, which overshadowed the OStatus protocol.
According to Wikipedia, an issue on GitHub #228: What are the differences between OStatus, pump.io, and ActivityPub and the final acknowledgments section of the ActivityPub protocol, this protocol is designed based on the API of pump.io. It fully absorbed the lessons learned from OStatus during its design phase and ultimately became a successful protocol.
I wonder if any experts can explain the specific differences and improvements between it and the OStatus protocol~ I haven't delved into it, but I know that ActivityPub is quite powerful.
Mastodon began using the ActivityPub protocol in September 2017; in January 2018, W3C recommended this protocol as a standard; in January 2019, Mastodon no longer supported the previous OStatus protocol.

Adapted from: https://o3o.ca/@jiangshanghan/105966250069371678

On the page https://fediverse.party/en/portal/servers/, you can find instances of interest categorized.
Since some instance operators do not wish for their instances to be public, here are some relatively official or large open instances:

Original PlatformAlternativeLarge Instances
TwitterMastodonhttps://joinmastodon.org/servers
WeiboMisskeyhttps://misskey-hub.net/en/servers/
InstagramPixelfedhttps://pixelfed.org/servers
FacebookFriendicahttps://dir.friendica.social/servers
YoutubePeertubehttps://joinpeertube.org/instances
WritingWriteehttps://writee.org/

To avoid a situation similar to Alipay mocking Windows Phone users—"Why choose a 1% life?"—I personally recommend choosing instances of Mastodon and its fork versions that support the mainstream ActivityPub protocol in the Fediverse.
The official instance operated by Mastodon is: https://mastodon.social/
Misskey is also very popular and suitable for users interested in anime.

PS: Recommended Reading

Self-Hosted Instances#

The main barrier to self-hosting a Mastodon instance lies in server configuration; a 1C1G configuration is indeed very difficult to run a Mastodon instance (it can still work with optimization), and even a 2C2G configuration needs some optimization. Currently, my personal instance e5n.cc runs on a 2C2G Tencent Cloud lightweight server, limiting PostgreSQL to 256M and Sidekiq tasks to 1 thread.

Another barrier is that the server should not be in a local area network environment to communicate with other instances.

Mastodon's media file (images, videos, emojis, etc.) storage logic is to cache media files from users of other instances into its own instance, and the official instance by default (without modifications) does not support most HTML tags, so <img> tags cannot be used, which requires relatively large hard disk space for caching. A more cost-effective approach is to cache media files in S3 object storage. Currently, my personal instance is connected to 7 relay nodes, generating 3-5G of content per day, depending on whether the users you follow and those on the relay are talkative and love to share images. In actual experience, the free 10G of Cloudflare R2 is not enough to cache media for 2 days.

I highly recommend this article 《How to Build a Mastodon Instance Using Docker (Part 1): Basic Setup》(Web Archive) as a reference for step-by-step deployment of your own Mastodon instance using Docker. You don't need much technical knowledge; as long as you have successfully deployed a Docker application, you can smoothly deploy Mastodon. If you don't want to use Docker, you can also install Mastodon from source code, which is even easier, as the official documentation is very detailed: https://docs.joinmastodon.org/admin/install/.

My self-hosting costs:

  • Domain: e5n.cc ¥39.00/year
  • Server: Tencent Cloud lightweight Silicon Valley 2C2G ¥144.00/year
  • S3 Storage: Cloudflare R2 under $1.00/month

Highly recommended: If you only have a low-spec server and still want to join the Fediverse, you can try GoToSocial, which is developed in Go and based on the ActivityPub protocol. I have personally experienced it for a few months; it is very lightweight, and resource usage is even lower than Memos: Ref Status. The downside is that it does not come with a built-in front-end application (not really a downside), and you need to use third-party applications to post.

gotosocial_docker_stat

Interesting Ecosystem#

Long-term updates

Mastodon Timeline Embed Website#

Source code: idotj/mastodon-embed-feed-timeline GitHub Mirror

Embed a Mastodon timeline on your website to showcase posts. Very easy to set up, no dependencies, no trackers, WCAG compliant, and fully responsive.

The Digu page currently integrated into my blog is embedded using this tool.

Mastofeed#

Source code: fenwick67/mastofeed

ActivityPub feed => iframe embed.
Embed Mastodon feeds for blogs, etc.
On the official website https://www.mastofeed.com/, simply fill in your federation account information to generate a segment of <iframe> HTML code.

masto.js#

Source code: neet/masto.js

A universal Mastodon API JavaScript client. The ELK client uses masto.js.

  • 🌎 Universality: Suitable for Node.js, browsers, and Deno
  • 📦 Lightweight: Less runtime code, only 7kB+ when compressed
  • 📚 TypeScript: Written in TypeScript, with type definitions provided
  • 🧪 Well-maintained: Actively maintained by a Fediverse enthusiast since 2018
Wildebeest - Fediverse Built on Cloudflare#

Source code: cloudflare/wildebeest

Wildebeest is an easy-to-deploy open-source server compatible with ActivityPub and Mastodon, fully built on Cloudflare's Supercloud. If you want to run your own Fediverse server, you can now do it entirely through Cloudflare.

Cloudflare's official blog introduces: 《Welcome to Wildebeest: The Fediverse on Cloudflare

Wildebeest is a server compatible with ActivityPub and Mastodon, aiming to allow anyone to run their Fediverse server and identity on their own domain without retaining infrastructure and with minimal setup and maintenance to get it running in minutes.

Wildebeest runs on Cloudflare's Supercloud, using Workers, Pages, Durable Objects, Queues, and the D1 database to store metadata and configuration information. It also employs Zero Trust Access for authentication and uses Images for media handling.

Mravatar#

Source code: HolgerHuo/Mravatar

A globally recognized avatar API for Mastodon, similar to Gravatar. Developed in Python, it can be self-hosted.

My avatar: https://mravatar.r669.live/avatar/@[email protected]

Mastodon-Driven Blog Comment System#

Original: Toot toot! Mastodon-powered Blog CommentsWeb Archive

The author introduces a fresh approach to using the Mastodon social network as website comments. Its biggest advantage is data openness, not being controlled by third parties, as Mastodon is an open, decentralized network service.

PS: 《Mastodon / GoToSocial as a Blog Comment System》- Kofe Bing Tang

Mastodon Token Generator#

Source code: takahashim/mastodon-access-token

Accessing the Mastodon API requires an Access_token, but since there is currently no direct user interface to obtain the Access_token on the Mastodon settings screen, we created a SPA (Single Page Application) site to obtain the Access_token externally. (However, if you are creating a mature application that will be used by third parties, you should implement this mechanism within the application itself, so consider it experimental).
I previously wrote an article 《NeoDB Obtaining Access Token》, which can also use this tool to generate.

Deploying a Federated Instance with Just 6 Files#

Source code: rothgar/static-mastodon

The author of this article states that he deployed a Mastodon instance with 6 files. I tried it, and it really works; you can follow him, but you can't communicate.
In reality, only 1 file is needed, but to make the instance look more complete, 6 files were used:

  • 2 files to create users
  • 2 files to pretend we are popular
  • 2 images for aesthetics
.
├── .well-known
  └── webfinger    <- user discovery (optional)
├── banner.png      <- banner image (optional)
├── followers       <- how many followers (optional)
├── following       <- how many following (optional)
├── image.jpg       <- profile image (optional)
└── justin          <- user information

A Few Small Things#

"The best time to plant a tree was ten years ago; the second best time is now." The Fediverse is thriving; when do you think is the best time to join the Fediverse?

Why Meta's Threads Wants to Integrate the Fediverse#

https://www.solidot.org/story?sid=77121

At the end of last year, Meta invited developers and representatives from the Fediverse to a dialogue meeting at its San Francisco office, with participants from the Threads team and the legal team. The scale of the Fediverse is still small; for example, the microblogging service Mastodon has only a few million active users, while Threads, despite being launched for only 8 months, is already a massive entity comparable to Godzilla compared to Mastodon. Although Meta announced at the launch of Threads that it would support the federation protocol ActivityPub, many people believed months later that Threads would never integrate ActivityPub to achieve interoperability with platforms like Mastodon. However, Meta is still pushing this plan and has announced a timeline for integration, which is currently in the first phase. Why would Meta, known for its walled garden approach, want to open up and interoperate? This question was on the minds of the attendees. The response from Meta developers was that they believe this is a general direction for social media development. After Elon Musk's acquisition of Twitter, social media celebrities have increasingly felt uncomfortable with the fact that they own their followers on the platform, and they want a capability to migrate freely. This viewpoint has some merit, but it is not very convincing. The representatives at the meeting believed: 1) Meta sees Twitter as an important and powerful part of the zeitgeist and is very interested in it; it is emulating Google's strategy in response to Apple's iPhone, promoting an open competitor from which they can benefit; 2) Meta is concerned that regulation of social media will strengthen, so they are building an absolutely open platform to eliminate controversies over censorship of conservative speech or antitrust issues; open means users can migrate freely and switch freely; 3) Differentiation, perhaps a sudden idea from a product manager; 4) Zuckerberg really dislikes Elon Musk and is doing everything he can to destroy Twitter/X.

NeoDB Major Updates from Last Year to Now#

https://neodb.social/announcement/

Personal tags have added annual statistics, filtering, and sorting; support for BoardGameGeek links, Letterboxd imports; ActivityPub has been enabled, allowing each user to have an @neodb.social identity connected to other Fediverse instances, whether registered via email or federated instances.

Further Reading#

Footnotes#

  1. Fed FAQ. Mastodon User Guide.(Original content archived on 2017-04-09).

  2. What on Earth is the fediverse and why does it matter?. New Atlas. [2021-10-10]. (Original content archived on 2021-02-25).

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.