How Mastodon Federation Works: ActivityPub Explained Simply
🔍 WiseChecker

How Mastodon Federation Works: ActivityPub Explained Simply

Mastodon is part of a decentralized social network called the Fediverse, where different servers communicate by speaking the same language: ActivityPub. You may have noticed that you can follow users on other Mastodon instances or even on platforms like PeerTube and Pixelfed without leaving your home server. This article explains the technical concept of federation and the ActivityPub protocol in plain terms. You will learn how data flows between servers, what makes the network resilient, and how to verify that your instance is federating correctly.

Key Takeaways: Understanding ActivityPub Federation in Mastodon

  • ActivityPub protocol: A W3C standard that defines how servers send and receive activities like posts and follows.
  • Inbox and Outbox: Every Mastodon account has a private inbox for receiving activities and a public outbox for broadcasting them.
  • Federated Timeline: Shows public posts from all servers your instance knows about, based on shared subscriptions.

What Is ActivityPub and How Does It Enable Federation

ActivityPub is a decentralized social networking protocol standardized by the World Wide Web Consortium. It defines a set of actions called activities such as Create, Follow, Like, and Announce. Each Mastodon server runs software that implements this protocol, allowing it to send and receive these activities with other servers. The protocol uses JSON-LD as its data format, which makes the messages both human-readable and machine-parseable.

Every Mastodon account has two key endpoints: an Outbox and an Inbox. The Outbox is a public list of all activities the account has performed, such as posting a status or boosting an entry. The Inbox is a private endpoint where the account receives activities from other servers. When you follow a user on a remote server, your server sends a Follow activity to that user’s Inbox. That remote server then sends a notification back to your server, and the connection is established. This two-way handshake is the foundation of federation.

Federation is not automatic for every server on the network. Your instance administrator can configure domain blocks, silence, or suspend entire servers if they violate the instance rules. This means that even though ActivityPub is an open protocol, your server decides which other servers it communicates with. The result is a network where each instance maintains its own moderation policies while still participating in the larger Fediverse.

How to Verify and Control Federation on Your Mastodon Instance

You do not need to configure federation manually as a regular user. However, understanding how to check which servers your instance is federating with helps you troubleshoot visibility issues. The following steps apply to Mastodon administrators and power users who have access to the server administration panel.

  1. Open the Administration Dashboard
    Log in to your Mastodon instance with an admin account. Click the hamburger menu in the top-right corner and select Preferences. From the left sidebar, choose Administration and then Domain Blocks.
  2. Review the Domain Blocks List
    The Domain Blocks page shows all servers that are blocked, silenced, or suspended. A green indicator next to a domain means it is allowed. If a server you want to reach appears here with a block status, federation is intentionally disabled for that server.
  3. Check the Federation Status of a Specific Server
    Scroll to the bottom of the Domain Blocks page and click View federation. This opens a search box where you can type a domain name. The result shows whether the server is reachable, the number of known accounts, and the last activity timestamp.
  4. Test Federation with a Remote Account
    Search for a public account on another server from your Mastodon search bar. If the account appears and you can view its profile, federation is working. If the search returns no results, either the remote server is blocked or your server has not yet discovered that account.
  5. Force a Federation Refresh
    On the Administration page, go to Sidekiq and look for the queue named pull. This queue handles incoming federation activities. If the queue is stuck or growing, restart the Sidekiq service from your server terminal using the command systemctl restart mastodon-sidekiq.

Common Federation Problems and Their Causes

Cannot See Posts from a Remote User

If you follow a user on another instance but their posts do not appear on your home timeline, the remote server may have silenced your server. Silencing hides posts from the federated timeline but still allows direct delivery. Check the remote server’s moderation policy by visiting their about page. If your server is listed under silenced domains, you will only see posts when you visit the user’s profile directly.

Federated Timeline Shows Duplicate or Outdated Posts

This happens when your server receives the same activity from multiple pathways. For example, if you follow a user directly and also follow a hashtag they used, the same post may appear twice. Mastodon deduplicates posts by their unique URI, but some older versions of the software may not handle this correctly. Update your Mastodon instance to the latest stable version to resolve most duplicate issues.

Server-to-Server Communication Fails Without Error

ActivityPub relies on HTTPS and valid SSL certificates. If your server’s SSL certificate is expired or misconfigured, other servers will reject incoming activities. Use an online SSL checker tool to verify your certificate. Also ensure that your server’s firewall allows incoming connections on port 443. Blocked ports prevent the inbox endpoints from receiving activities.

Item ActivityPub OStatus (Legacy)
Standardization body W3C Recommendation No formal standard
Data format JSON-LD XML (Atom)
Federation model Push and Pull via inbox/outbox Pull via RSS feeds
Supported by Mastodon Default since version 2.0 Removed in version 3.0
Real-time updates Yes, via Activity Streams No, polling-based

ActivityPub replaced OStatus as the primary federation protocol because it offers lower latency, better support for private activities, and a standardized data model. Mastodon instances running version 3.0 or later only support ActivityPub.

You now understand how ActivityPub enables Mastodon federation through inbox and outbox endpoints, and you can verify federation status from the administration panel. To further explore the Fediverse, try following an account on a non-Mastodon platform like Pixelfed or WriteFreely to see cross-protocol federation in action. For advanced control, consider configuring a custom domain block list or using the Preferences > Administration > Federation page to monitor server health.