All posts by Anders Rune Jensen

Butts in the Browser Fosdem talk

Over the weekend I gave a talk on running secure scuttlebutt directly in the browser. The talk gives an overview of ssb in general, how it is different from federated services. It touches on some of the work we have been doing for a European NGI pointer grant including jitdb. The browser app uses local storage, indexed db and Chrome FS. WASM for crypto and web sockets for communication with other nodes. Slides are available here and video available here.

GITEA and cors

I was looking to use git as a storage backend for a project I was working on, as one can run git in the browser now using isomorphic git. The app needed to run from my machine directly for easier development, which meant that the remote git backend has to support CORS. Luckily the gitea project allows one to quite easily host your own git reposities with an interface very similar to github.

The following 3 extra options was need in the app.ini file for CORS to ne working:


ENABLED = true

How to setup a PUB for SSB browser

SSB-browser as mentioned in my last blog post runs a SSB client in the browser. In order to communicate with other peer it needs a pub to relay messages through. Furthermore the pub acts as a super node allowing the browser peer to do partial replication without necessarily needing to store the full feeds of peers.

We don’t really gain very much compared to the classical client-server setup if we rely too much on especially a single pub. The browser client can of course run fully off-line, but still when it needs to communicate messages with other peers it needs some intermediary.

In this post I will show how to setup a pub that can be used together with ssb browser. I will also show how this can be used to build a totally seperate network from the main scuttlebutt network for local groups and communities.

First of all one needs to install the basic ssb-server. On my pub I use ssb-minimal-pub-server. The good thing is that this already comes with everything we need for peer invites. So we just need to install the before mentioned ssb-partial-replication module into ~/.ssb/node_modules/. Easiest is just to git clone and npm install it from the directory. It is also recommended to install ssb-tunnel but this is not required.

Lastly we need to configure ssb-server to use the modules and to enable web sockets so the browser will be able to connect.

"connections": {
"incoming": {
"net": [{ "port": 8008, "host": "::", "scope": "public", "transform": "shs", "external": [""] }],
"ws": [{ "port": 8989, "host": "::", "scope": "public", "transform": "shs", "external": [""], "key": "/etc/letsencrypt/live/", "cert": "/etc/letsencrypt/live/" }]
"outgoing": {
"net": [{ "transform": "shs" }],
"tunnel": [{ "transform": "shs" }]
"logging": {
"level": "info"
"plugins": {
"ssb-device-address": true,
"ssb-identities": true,
"ssb-peer-invites": true,
"ssb-tunnel": true,
"ssb-partial-replication": true

As one can see this uses letsencrypt, but that is not strictly needed.

Lastly we need to start up the server. I run it using the following bash script that will make sure the pub keeps running even if it should crash.

while true; do
sbot server --port 8008 >> log.txt 2>&1
sleep 30

This is everything you need to run your own scuttlebutt pub that supports browser clients.

Separate network

If one wants to run a totally different network than the main scuttlebutt network one needs to use a different caps key. This means that messages from this network will never appear on the main network. This can generated using using node:


And can be added to the config file on the pub using:

"caps": {
"shs": "72I4EC/gZUuNffHEwooHob4hhtXHAj0HE5xKM3njRSg="

SSB-browser-core needs a little tweak to use the same caps. Change browser.js to:

require('./core').init(dir, { 
  caps: { 
   shs: '72I4EC/gZUuNffHEwooHob4hhtXHAj0HE5xKM3njRSg=' 

It might also be a good idea to change hops to 2 in the client. In order to bootstrap the network, generate an invite or follow the first user from the command line of the pub in order for messages to start propagating.

sbot publish --type contact --contact '@feedId=.ed25519' --following

That is all you need to run your seperate network 🙂

Secure scuttlebutt in a browser

For roughly the last year I have been working on bringing secure scuttlebutt to the browser. The result of this is ssb-browser-core.

Secure scuttlebutt allows one to write an unforgeable append-only log of messages and to exchange these messages between nodes in a p2p network without a central authority. With this, one can build event sourcing systems.

The first secure scuttlebutt implementation (there are also Go and rust implementations now) is a normal node application and thus requires a lot of things that are not readily available in a browser such as a filesystem and crypto. Filesystem api is provides by random-access-web that for chrome uses the file system api which is quite fast. Crypto is provided by libsodium.js which uses wasm and is roughly 90% the speed of running it natively. The last part is network, he we rely on web sockets which gives us a long running connection to a server somewhere. With epidemic broadcast trees to exchange messages, one can get the latest messages for several hundred feeds (probably also thousands) in a reliable and low latency manor.

With this, one is able to run secure scuttlebutt in any environment where the browser works. This includes Chrome, Firefox, Safari and on android and iOS. By running as a progressive web app it is possible to side step the normal walled garden of the dominant mobile operating systems. Jacob also managed to get it running as a web extension.

The main application for showing what can be built on top of these primitives is a social network called scuttlebutt. In order to test the functionality of the core, I wrote a demo application with most of the basic functionality for having conversations. Other applications that has been built on top of the protocol includes gatherings, chess, git, books.

I did a walkthrough of how it works for a few people in the SSB community. You can watch the video below.

This weekend I’ll be at the University in Basel to discuss SSB and related p2p technologies.

Book review: Better work together

A few weeks ago I finished a really good technical book called Better work together. The book is written by people from enspiral about working together in non-hierarchical structures and the lessons learned from doing this within enspiral. I was lucky to meet a few of the authors at the network convergence retreat I attended last year.

The book is written as a bunch of essays and reflections by a range of authors, instead of a single author, very much inline with the books theme. This includes great stories, such as the ones from Susan and Kate, but also deep thoughts about growing distributed leadership by Alanna and musings on consensus by Richard. Also thoughts on how to value the commons and the things you can’t (and probably shouldn’t measure).

It was interesting to hear the ways in which enspiral has envolved over time. It is both a collection of great individuals, but also a collection of coops or livelyhood pods and companies. Enspiral as I see it, is a shared brand for these, and this is where I find a tension as that puts a lot of pressure to align, almost top-down a bit like a political party. Instead of doing it bottom up, where the individual companies are the main focus. Maybe it is just the way the story is presented, but that is both impression from talking to people and from reading the book.

That being said, it is probably the best book about running a non-hierarchical organization I have read since The Seven-Day Weekend by Ricardo Semler. Highly recommended.

Techfestival talk

I went to TechFestival in September and did a talk at the Algorithmic Sovereignty summit. The talk touches on how Scuttlebutt can be used to regain some sovereignty over how data is shared and bring transparancy to the algorithms that runs on the data. The whole summit was a wonderful experience with lots of interesting people and discussions. When talking about these issues most people talk about the negative aspects of current systems such as Facebook, but rarely about solutions so I was really happy to give a more solarpunk positive story. The problems are really hard as it intersects human nature and technology but are increasingly important in todays society.

Scuttlebutt development grant

Since January I have been working on a grant to add a benchmarking ci framework to scuttlebot to better understand the behaviour and make it easier to find regressions as the implementation matures and changes. Furthermore I have been spending time understanding and finding things that can be improved performance wise.

The grant is almost at an end so I’ll use this blog to summarize what has been achived.

  • Built a CI framework and visualization tool for the bench-ssb repo. I used the nci framework for this and have been quite happy with the result.
  • Found and fixed a memory leak that made level-post really slow over time.
  • Made several improvements to flume to improve performance. Some interesting links related to this: charwise  and json performance related to buffers in node.

I have kept a dev diary for the duration of the grant. It has been a very interesting to really get to understand a relatively large and real world distributed system.

This is why scuttlebutt is awesome

I wrote a small plugin for ssb that allows it to read through posts to discover dat links and seed them automatically.  The cool thing is that you can tell it to only seed for people you follow.  Besides the normal use case of a user only sharing friends links, this also makes it really easy to set up a pub that automatically seeds content shared by its member. This combined with something like beaker browser makes it easy to create content and share it in a totally distributed fashion.

The best part is that it is only 100 lines of JavaScript.

Chromebook for development

I got myself an early Christmas present: an Acer Chromebook 14. I wanted a dedicated linux development machine and always wanted to try out Chrome OS to see what it was like. So far the overall experience has been good. The laptop is excellent for the price, the screen is good, keyboard is fine and best of all, the battery life is really good.

I installed debian stable (jessie) in a chroot on the machine using crouton. There i can run node, scuttlebot and tor and use emacs graphically using xiwi  for editing. The best part about crouton is that you can do a full chroot backup and store that somewhere safe. You can even have multiple chroots running at the same time for testing. Crouton seems a little rough, like I ran into this wierd node bug. But overall I like the seperation. I might end up installing debian directly at some point, but for now this suits me fine.