Ask HN: ActivityPub or Mastodon?
I am thinking about joining the Fediverse.
I don't really understand the difference between ActivityPub and Mastodon yet.
If I write my own ActivityPub software (server code with web frontend), can I interact with Mastodon users just as if I also were a Mastodon user? Or would I have to implement some Mastodon specific protocols? Before you go to the trouble of writing your own software, consider using one that's already been written. There are many[0] out there already besides Mastodon. Thanks, will look through these. But all of the ones I have looked at so far seem pretty complex with hundreds of files. I don't know the fediverse protocol yet, but I would hope I can get away with just two files like this: receive.php The endpoints are surely called differently than receive.php and send.php. But this is how I would hope ActivityPub works in principle. Of course, this would be very bare. To read, I would have to read the raw log of ActivityPub messages and to post, I would have to manualy put together an ActivityPub message. But I would be in the Fediverse and could add more convenience functionality later. It's not so simple. In order to federate an object you must: - send requests with proper 'HTTP Signatures' (many AP nodes have strict enforcement here) - which requires you to have an actor with an attached signing pubkey - so you have to host the LD-JSON actor descriptor on another endpoint - actors MUST have an attached inbox & outbox, your receive endpoint will need to sit at your actor's inbox (on POST). both of these are OrderedCollections of Activities - and in order to be properly interoperable you will probably need to maintain follow relations & write an endpoint which can ACK/NAK follows, etc etc What do those "HTTP Signatures" do? If admin of serverA decides to add serverB to the servers_i_talk_to array, they also ask serverB to give them a public key and from then on serverA only accepts messages from serverB if they are signed with the corresponding private key? Is that so that serverB can change its IP without interrupting the communication with serverA? The fediverse is (generally) an open federation, not a closed one like you're describing. There is no manually-curated list of instances that you federate with. I would expect "Open Federation" does not mean you need to talk to every instance out there directly. But that it works like a web where messages are routed around. I could be wrong. But I would expect the "servers_i_talk_to" array is what the instances output at the "peers" endpoint: There's not really any routing, but you don't need to send posts to every instance, just every instance that has users following your instance's users. Is that the peers list? Other instance where at least one user follows one user from the given instance? Yep. HTTP signatures ensure that you can't send a message and spoof the user/instance that it's coming from. Think of it like DKIM for AP. They commonly include the specific actor who is interacting with the network (via the instance), so we can also achieve correct-side enforcement of blocks. With "actor" you mean "user"? Every user has their own private key? Sure an actor is basically a user, there's usually an "instance actor" though too that does some other things but I don't think having one is required. Every actor has a private key but it's kept on the server, it's basically an implementation detail. Strange that users have private keys. Is that kinda forward-looking, so that at some point those keys could be moved to the users themselves? So they can keep their identity, even if the owner of their instance becomes malicious? The private key is used in HTTP Signatures for authentication. The signature does not cover the body of the http request and is not stored or published. The http post contains an http headers that signs just a few other header fields. The signature is only valid for a short time. There is an example here:
<https://blog.joinmastodon.org/2018/06/how-to-implement-a-bas...> no lol Then why? If you want something lightweight, consider https://humungus.tedunangst.com/r/honk - despite the “whimsical” UI, it’s very easy to run. The download goes to tgz files. No GitHub or GitLab repo? No, although the author also maintains his own SCM host ( https://humungus.tedunangst.com/ ) where you can clone the repo. If you want a more lightweight server-side software that can access Fediverse, I found two good candidates (I am looking for other suggestions): - GoToSocial: https://docs.gotosocial.org/ - Pleroma: https://pleroma.social/ How about https://github.com/landrok/activitypub ? It's not two files, but it's PHP at least. Nice! 283 files Still crazy many, but I will look a into it in case https://microblog.pub turns out to be not what I am looking for. While everyone is talking about Mastodon because of Twitter, I want people to know that there is https://pixelfed.social which is alternative to Instagram. Theoretically you should be able to follow anyone from pixelfed on Mastodon and vice versa because both support ActivityPub. I haven't tried doing that myself. the homepage (Pixelfed) url is just a login screen with no explore page or even a landing page. not sure if that's a sign of a good product. Here you go https://pixelfed.social/discover. No idea why they would not put that on homepage. The trending images have only a handful of likes. Are likes not federated through the Fediverse? If someone on mastodon.social likes a post on pixelfed.social, will that increase the like count on pixelfed.social? The dev is working on a major update to the Pixelfed equivalent of joinmastodon.org. > the homepage (Pixelfed) url is just a login screen with no explore page or even a landing page. That's a pretty faithful clone of instagram then… It’s not a product. It’s a utility and a service I’ve been wondering why people are just now talking about mastodon. Musk per his own statements wants to increase free speech… why is that bad? Regardless, Gab and Truth.social both use mastodon. So it’ll improve their platforms the more people switch (and improve mastsdon). Technically the nodes can interconnect; though I believe that’s not happening today Gab has been throughly banned throughout most of the fediverse because of the constant spew of abuse. I don't believe that truth.social federates but I see it a lot in blocklists. Some people will automatically block people using the Gab fork of Mastodon as a last ditch attempt to curb hate and spam. This is kind of the nature of the beast. If the problem is that the remote instance allows things that you find intolerable, then you have to ban the remote instance from federating with you. Speech may be free, but actions have consequences. More than just thinking about what people say, compare with what they do. Musk "per his own actions" is seemingly taking the chainsaw to the existing company's organization, it's going to be a bumpy ride that way no matter what changes he wants to do. Often when I talk to people about their belief in “free speech” I soon discover that they really only mean speech that they like. I "like" plenty of speech I disagree with, if the speech is fact-based and informative and rational and interesting. I enjoy a good debate, I learn stuff, it's good. I don't "like" speech that lies, hates, tries to manipulate, tries to shock, or is just incoherent. So, do I have a belief in "free speech" ? BTW, the USA's First Amendment just prevents the govt from stopping religion or the press etc. It's doesn't mean anyone has to listen to anyone. It doesn't mean some platform such as Facebook or a newspaper is required to propagate your speech. > BTW, the USA's First Amendment just prevents the govt from stopping religion or the press etc. It's doesn't mean anyone has to listen to anyone. It doesn't mean some platform such as Facebook or a newspaper is required to propagate your speech. I always love this argument… you do know building owners in New York are required to allow protests outside? It’s not just the government Some (such as malls) even have a requirement to allow them inside. Company towns (think Disney, Hershey, etc) couldn’t shut down free speech either. The public square, regardless of ownership, is protected by the first amendment. Print is similarly protected by the first amendment, though you may have to own your own news org, no one can stop your distribution. Basically, you can’t impede others blocking roads), but you can stand and preach and distribute. This has been upheld MANY times by the Supreme Court. They will likely not do too much to social media quite yet, as there are 5-6 alternatives to distribution AND congress has passed specific laws governing internet speech. However, I’m sure as these court cases work up to SCOTUS we will eventually see it upheld again (might just take 2-3 more years). You can! I'm following @ username @pixelfed.social in my Mastodon client. Yeah, that works. AFAIK: ActivityPub is the protocol used by Mastodon and other platforms (like PeerTube) and so you'd be able to interact with other users using the protocol. If I'm wrong I believe someone will correct me pretty fast but that's my current understanding. The difference between ActivityPub and Mastodon was already explained by others. If the popular solutions are too complex, maybe you want to take a look at https://microblog.pub, a relatively small and simple AP implementation designed for single-user instances. Thanks. 153 files. An order of magnitude leaner than the ones I have seen so far. For anyone looking to mess around with making a single file ActivityPub server, this looks like a good intro to the spec: https://socialhub.activitypub.rocks/t/guide-for-new-activity... That page also links to https://blog.joinmastodon.org/2018/06/how-to-implement-a-bas..., which is a demo of hardcoding one part of the spec from scratch. Mastodon won't survive this, the Fediverse will. Much as Twitter when it was a Rails app buckled under the load already we see things like https://github.com/mastodon/mastodon/issues/19505 and users of other instances also complain. It's an old crusty complex codebase. So yes you can certainly interact with Mastodon users and you will need to. https://www.r-bloggers.com/2022/10/getting-acquainted-with-m... the largest Mastodon instance has less than a million users. Twitter has, what, 450 million? no. activitypub is the protocol which all apps in the fediverse use and can talk to each other.
you can create a pixelfed instance account and follow someone on mastodon.social and vice versa. same for interaction between them So... yes? yes I'm curious why you started your answer with "no"? ActivityPub : Mastodon :: SMTP : postfix Does this mean, I can use any AP implementation to federate with Mastodon servers? As long as it implements the same activities. They often do. Roughly yes, though you'll want one that supports the same activity types (Mastodon mostly uses "Note") or it won't make much sense :) How many types are there and how prevalent are they? I read some websites about "host your own server" and some were talking explicitly about Mastodon and some were like "let's do selfhostes microblogging with this AP server" And I asked myself, if I could use AP servers to follow people and let them follow me when they're on a public Mastodon instance. Yes, abet Mastodon has some non-standard extensions. But basically yes. Meanwhile………. Twitter is just a text field (basically). Yes, it'll federate with Mastodon, with no extra effort or code. Our usernames are nearly neighbours :-O Best not to waste your time on any of this microblogging rubbish. It only leads to misery. To each their own but I personally believe that’s sound advice. (And therefore I’m a little bit ashamed that I have hard time avoiding Mastodon and Twitter. Soooo much new stuff, all the time – not super high quality, though…) Well, avoiding twitter is easy. Sadly it's relatively often one comes across great things to follow, let's just take @pcwalton as a recent example. :) There are loads of smart and interesting people on Twitter. I don’t deny that. I have just grown tired of microblogging in general, and Twitter in particular. The overall signal:noise ratio is just too low, IMHO. I was trying to cut out "stuff I do on the internet habitually", i.e just scrolling. Twitter is the least missed item on the list. But I seem to slip back onto internet habits time and again.. What has once been won must be won again.
send.php <?php
if (!isset(servers_i_talk_to[$_SERVER['REMOTE_ADDR']]) die();
$data = $_POST['msg']
$file = 'log/' + time().'-'.mt_rand();
file_put_contents($file, $data);
Where receive.php is openly accessible and send.php is protected by a password. <?php
$data=$_POST['data'];
for ($servers_i_talk_to as $server) {
$url = "https://$server/receive.php";
$msg = ['msg'=>$data];
$opts = [
'http' => [
'header' => "Content-type: application/x-www-form-urlencoded\r\n",
'method' => 'POST',
'content' => http_build_query($msg)
]
];
$context = stream_context_create($opts);
file_get_contents($url, false, $context);
}
I might miss my target of 2 files. But I will surely not get the filecount go up to these extremes :) GoToSocial: 6849 files plus dependencies
Pleroma: 2289 files plus dependencies