Rapture in Everything

Privacy, data ownership, federation, and the Matrix chat network

zblesk

Matrix is a federated chat network. If you already know what it means, feel free to skip ahead a bit. Otherwise, here's the (very terse)[1] gist of it:

The gist of it

There are a number of issues with chat apps. Let's disregard those of accessibility or usability - there are plenty of tools with great user experiences, so everyone can find something just right. Let's just focus on two common issues: privacy and ownership.

Privacy - and I also include security in this, since you can hardly have privacy if your communication lines aren't secure[2] - determines who can see your messages. It's always the best to use tools that implement end-to-end encryption (E2EE). If they do, that means that only the sender and recipient(s) can access the contents of your messages, not even the ones running the service can do that.

That's the difference between, say, Facebook Messenger or Discord, where your messages are stored on their servers, where they can (and do[3]) access, read and analyze them in any way they like. In comparison, apps like Wire or a few others that implement E2EE can never read what you wrote. Even if they really, really wanted. That also means they can't sell your data or lose them when they get hacked.

Ownership is a different thing entirely. Some of the most important questions here are: who owns your data? Who runs your service? That is: who can decide to shut you down? If all your pictures and chats are on Facebook and you get banned for whatever reason, you might never see them again. If your communities only live on Discord and they ban you, you're out of luck. (Those are not hypotheticals. Things like that happen often enough, and it's not always the banned user's fault.)

On the other hand, if you or your community run your own chat (or an alternative to Facebook, Twitter or whatever), it's in your hands. Of course, it is more work for you, but you can't get ousted from your own, and you have complete control and ownership of your data.

So what if everyone ran their own communities? That has its own set of problems. After all, one of the benefits of huge social networks is how easy it is to move or link between communities, discover new ones, or generally interact with absolutely anyone. Is that not lost, if everyone just has their own place? After all, many of us remember a few years ago, in when communities gathered in things like forums: they are great, but they are not connected. If you wanted to participate in three communities, you had to create three accounts on three web sites, go to each one in turn, create a new identity, and do all of that manually.

Federation

This is where the concept of federation comes in. The basic idea is: what if everyone could have their own community, but the communities could talk to each other?

Let's illustrate on a concrete example. The most popular federated service is Mastodon, which one might notice looks a lot like Twitter.

You can join the "official" Mastodon server. Or you can join one of the may others: there ones made for people in a specific city, for instance. Or a specific topic, like beer. Or cartoon drawings.

And since the servers are interconnected, you are not restricted to the single community you happen to have an account on. Let's say you register on Mstdn.social. This will be your primary, your home web. If you then later find a post you like on an unrelated server, say Donphan, and want to give some posts a like, there's no need to make a new account. You just press Like, and the action is performed via Mstdn, where you're currently logged in. If you want to message someone on another server, say hackers.town, you can just do that and it will work.

You can follow people, give likes, message people on different websites, all from your original Mstdn place. If you do, your stuff - including posts of the people you follow on other websites - will show up in your feed, on your home website.

The federation mechanism will take care of the rest: copy the posts, pictures and data between servers, etc. But none of those servers is "central". If any one shuts down, the rest of the network works as if nothing has happened.

The "language" the servers speak amongst themselves is called a "protocol"[4] and is itself open. That means other systems entirely can also join in the same federated network. Systems like Friendica - an alternative to Facebook, PeerTube - a video streaming site similar to YouTube, or PixelFed - a photo sharing platform, all speak the same protocol and therefore can interoperate. You can use Mastodon to follow someone on PeerTube. It's like if YouTube updates showed up as regular posts in your Facebook feed, and when you pressed Like, it also manifested as a Like on the YouTube video.

The various communities and services joined in federations are often called the fediverse.

When communities run their own services like this, it gets harder to shut them down, since there is no central controlling authority. And they retain ownership of their data.

Enter the Matrix

So, to sum up: a federated service is one where anyone can host their own instance of a service and join it to a network of similar services that interact and share data among themselves. This way one can both retain control of their service and data, but still join the wider social network. (Phew, that explanation was waaaay longer than planned.)

Matrix, then, is a protocol for a federated chat system. It aims to make chatting with someone, even calling them, as simple and straightforward as sending e-mails.

Right now, I am running my own instance (in matrix also called a "homeserver"), named zble.sk. My nickname on it is, you guessed it, zblesk. That means that anyone who enters my complete address, @zblesk:zble.sk (pronounced "at zblesk on zble.sk") into a Matrix-compatible chat app can start talking to me right away.

At first glance the format of the username is a bit weird, what with it having an @ at the beginning, and a : where an @ usually is. That is because a username is not the only thing you might want to address. For instance, if you wanted to join a chatroom called Synapse on the server matrix.org, you just need to enter #synapse:matrix.org.[5]

So how does it work? Each user joins a conversation via a homeserver. Matrix shares ownership of the conversation equally with every one of them, and every message sent is copied to every homeserver participating in the conversation. (Or. as the Matrix docs put it, "it is really a decentralised conversation store rather than a messaging protocol.")

In this picture from Matrix's official webpage there are three homeservers with one user each, all connected to every other homeserver. (The site has a nice interactive visualization of how the communication itself works.)

Matrix federation

And they boast having a number of Bridges - connections to external services. That means one can potentially write messages from Matrix and communicate with people on Facebook's Messenger, or Whatsapp, or IRC - all from one single app.

I have used Matrix a few times before without really thinking about it (thanks to the Riot.im client, recently renamed to the most un-googlable name, Element). Since it also boasts end-to-end encryption, I decided on a whim to try hosting my own instance and try it out some more. Seeing how long this post is already, I'll leave the actual setup to the next one.

Update: here is the next one: Setting up a Matrix chat server


  1. update after finishing this post: not very terse ↩︎

  2. he said, handwaving all the related subtleties away ↩︎

  3. Feel free to google the related scandals. Just for Messenger alone there are more than one can be bothered to link to. ↩︎

  4. The one Mastodon uses is called ActivityPub. ↩︎

  5. Another option is joining a community, which is a collection of rooms and users, not unlike Discord's Server feature. Their address takes the form of +community:server. ↩︎