Gun.JS as the Core of a Distributed, P2P, Shared-Timeline Social Medium

link to

Big tech needs to get out of our data. Ironic that I say that here, on Blogger, the place where "the product" first became "free" because the blog engine isn't the product, we bloggers are, but the statement is as true here as on Facebook, Twitter and, thanks to Meta's Threads, even on the fediverse. -1

Social media relies on databases to store your posts, replies and reactions. For us, this "persists" our conversations, so we can leave and come back. For big data, this gives them analytical data which allows them to target the ads that generate the most revenue at us or even, as the 2016 "Great Hack" by Cambridge Analytica proved, even influence our voting decisions. And don't think CA has gone away, their parent company is still in the game, Amazon are doing it, too, as are, well, all of big tech, especially Apple, who boast a big privacy game, but I don't beleive them for a bit.-2

So, I've discovered a javascript "library", "extension", call it what you like, gun.js. It's a distributed database, you store stuff with it, just like on a server, only there's no server, there's just you and connected peers. The aggregate of all of you and your peers' data is the database. Now, if somebody goes offline, those records aren't available unless, your instance has already downloaded it, or somebody else's you're connected to has it. It has encryption APIs (SEA), so it's not the "Great Data Theft of 2023," don't panic, it's actually how we kill big data. Call it P2P, call it Web3, call it what you will, but the future is serverless, and a distributed database is part of that serverless internet architecture!

Obviously app devs using this tool will need to be careful to expose the public stuff (timelines and profiles) and hide the private stuff (personal ID things, accesses, browsing history, passwords and hash keys, etc), but distributed databases ARE web3. Here's why.

Presently, to be on the web, you need a server account. That might be your social media account, it might be a web server you run for your gaming platoon, it might be your blogger account. It's called a server, because it serves up data to "clients" (your web browser, or social media app, etc) and that data comes from, you guessed it, a database. A basic web server for static pages still has a database, the file system, but most also have SQL database, or similar, for storing and retrieving content. Facebook works like this, so does twitter.

What Node.js, extended by Gun.js, does is make "the device" into a server. The only data on your device is your data (an oversimplification, bear with), the only data one everybody else's is theirs. You can only access their data if you've shared encryption keys, and vice versa. THERE IS NO SERVER IN THE MIDDLE, therefore, there is no man-in-the-middle "attack," like web2 social media. No Mark Zuckerberg, no Elon Musk, no "John Mastodon", just you and your friends, family, colleagues and other trusted connections. Facebook is one big man-in-the-middle attack, Apple is, Microsoft is, Google is and twitter is currently a malicious one! Amazon is a greedy one, too.

Peer-to-peer connections are how real life works. I meet you by chance, or through a friend, we chat, if trust feels possible, we agree to connect again. We're not permanently joined at the hip, like our social media accounts are, we drift into and out of each others' orbits as life allows. Peer-to-peer social media will work in a similar way - you're not online right now, so neither will your latests posts be until your app is open. Then your people, and only your people, get updated. There's no man-in-the-middle, just peers, friends, mums and dads, workmates, team members. Your device and the app alone connecting you to only those you are connected to, nobody at a faceless corporation. Gun.js is the database that can power that.

How does gun.js make this possible? Nothing is in the cloud, we are the cloud. You write a status update and "tweet" it, except there's no twitter, just your app that uses gun.

  • When you write the update and store it, the app encrypts it and only people you've shared your public key with can read that status.
  • Your profile page, even a full-blown web page, is stored on your device, fully encrypted. Your profile can only be seen by people who you've given your public key to. Your web page might be limited to those with your shared key, or you might allow the world to see that.
  • Posts and your profile live, encrypted, on your device, not on a server or in the cloud. Your status posts get shared out to the distributed database but, because it's encrypted, it can only be read by those with the key you gave them. They can't share your key, only you can.
  • An app that does this could allow you to have multiple profiles and keys, keeping work, family, friends and community groups within good boundaries. Boundaries the you set for your connections, not artificial ones, set by data harvesters. Each of us controlling who sees what we each publish, some connections overlapping, some not.

How we do it in real life, right? You don't give your boss or your life coach a key to your house, but you might to a partner. Of course, you ALWAYS have the right to demand a key be returned, or to CHANGE your locks. Gun.js is simple enough that even a coding numpty like me can work with it, primarily there's only 3 main things to learn, gun, sea (encryption) and axe (how the data is exchanged.)

Gun is the database for freedom fighters. As a leftist, I see that as being for those resisting oppression and standing for justice - intersectional feminists, anti-racism campaigners, trade unionists or those resisting fascistic authroity and oppression. I also see it as a fight for the freedom to not be constatly spied on by giant corporations who gave us social media to control us, not free us, because control equals money and power for a greedy few.

  1. Threads pulls in the activitypub feed from the fediverse, so now they're stealing data via a loophole, as well as by manufactured consent.
  2. Declaration: I use Apple hardware and software, it's a sickness, sorry, not sorry.


Popular posts from this blog

Because I'm That Kind of Crazy

I Am a Man of Many Projects

Look Over Here! A Distra... Um Distortion Pedal (rev3)