Blast off! A tour of Spritely Institute's tech

-- Wed 17 August 2022

Goblins mascot riding the Spritely Institute flask, blasting off! Greetings! Now that we’ve announced the FFDW grant, things are getting serious over here at Spritely Networked Communities Institute (a 501(c)(3) nonprofit.) Which means it’s time to talk about our technology!

Our ambition – enable the creation of peer-to-peer, gatekeeper-free community-run networks and social spaces for everyone.

Mockup of Spritely-based communication platform

Building such a dream on top of existing systems is too difficult, lacking necessary decentralized programming safety and ergonomics features. We need a revolution in the way people write distributed, highly collaborative networked programs.

That sounds like a lot to chew on, but we’ve already got quite a bit in-progress! And so, it’s time for a tour:

Goblins: distributed, cooperative, transactional programming

At the heart of Spritely is Goblins, its distributed object programming environment. Goblins provides an intuitive security model, automatic local transactions for locally synchronous operations, and an easy to use and efficient asynchronous programming model based on encapsulated objects which can live anywhere on the network. Goblins’ networking model abstracts away these details so the programmer can focus on object programming rather than protocol architecture.

Goblins has been in development for a few years. There is both a Guile version of Goblins and a Racket version of Goblins. The Racket version is more feature-complete, but the Guile version will catch up soon. Both of these are written in Scheme; we have published a Scheme Primer for those who are interested in learning the language. We are planning to port Goblins to some other programming language environments in the near-term future.

In the meanwhile, seeing is believing. What does Goblins give you?

Transactions and time travel

Goblins’ object programming design draws from many inspirations, including many taken from functional programming, but with great efforts to make programming in it fun and easy without having to expose overly complicated machinery towards the user. Goblins is transactional: when an error occurs, it simply isn’t committed to the permanent state of the program. This is important for making peer-to-peer programs easy and comfortable to program in and to make them robust against misbehavior. This is important: should something go wrong (and in peer-to-peer, mutually distributed networks, plenty of things can go wrong), we want to be able to identify and cooperatively inform interested parties of errors. But we also want to avoid our precious code from becoming corrupt. Goblins achieves this by synthesizing ideas from object capability security, the classic actor model, and various functional programming languages (most importantly Scheme).

The Vat model diagram from the Heart of Spritely whitepaper

This isn’t just an academic exercise in programming language theory, it’s a multi-machine/multi-user application platform for the future, and we have some reference applications that show off various features.

Testing Terminal Phase image

The above is a space shooter style video game than runs in a developer’s terminal named Terminal Phase which was written on the Racket version of Goblins.

Fun is a worthwhile goal of course, but Spritely’s tech is not primarily for the purpose of making video games. Terminal Phase was really written to make sure that Goblins’ style of programming is both fun and sufficiently performant.

This game also demonstrates Goblins’ transactions feature in a curious way. An error can be recovered-from and relevant parties are notified and any in-progress code changes can simply be rolled back as if they never happened.

But what are the implications of arbitrary transactional recovery? Time travel!

Testing Terminal Phase image

This image shows Terminal Phase with the ability to undo mistakes and restore previous state visibly exposed. But here’s the wild thing: the gameplay code of Terminal Phase was fully written and released before any consideration was given to showing off time travel as a demo. The time travel interface was added on within just a couple of short hours after the game was already written and without modifying any core gameplay code. The only thing that needed to be added was some scaffolding to keep a certain amount of state and display it to the user.

This game prototype is entirely local, but where Goblins gets really exciting is applications running over a distributed network…

Goblins’ distributed programming features

goblin-chat demo

This animation is from a prototype fully networked decentralized chat system running on the Racket version of Goblins; this is a proof of concept, recorded to show off a demo of our networked distributed programming features.

Please note that there are some interesting things happening here:

  • The two participants are speaking over a peer to peer network (Tor Onion Services, in this case, though Goblins is designed to be flexible as to the particular network substrate chosen)
  • No participant in the chat can fake messages coming from any other participant in the chat (on an object identity level; avoiding naming conflicts through a petname system came in later iterations of the system)
  • Communication is end-to-end encrypted
  • And, the entire chat system backend, for both rooms and for users, is a mere 154 lines of code!

But here is the even more amazing part: the core chat protocol does not mention the network even once. It does not need to… in fact, the entire chat program was written using Goblins’ asynchronous programming style locally, within the same process. When the chat code was connected to Goblins’ networking code, the chat system just works.

CapTP wiring diagram from Heart of Spritely whitepaper

This is because Goblins includes network protocol abstractions which make it so that programming against remote objects is just as easy as programming against local ones. For the most part, the code to deal with both is the same. Goblins builds upon a powerful family of protocols named CapTP, and working on specification and eventual standardization of this protocol work is a major aim of Spritely Institute.

Let’s build a better internet, together

Goblins mascot holding up flask triumphantly There is much more which could be said about the work we already have, but even more importantly, there is more work to do. We look forward to sharing more news about current and developing Spritely technology.

In the meanwhile, if you find the above exciting and you’d like to be a part of making better networked systems for everyone, note that we will soon post our first job openings! You could join our awesome team!

That’s it for now. See you at the next tech update!