Playing with P2P protocols and Firefox
Tags: firefox, decentralization, dat, ipfs
Published: 2019-03-26 11:29:58

---
title: Playing with P2P protocols and Firefox
published: true
tags: firefox, decentralization, dat, ipfs
canonical_url: https://andregarzia.com/2018/12/playing-with-p2p-protocols-and-firefox.html?utm_source=all&utm_medium=RSS
---

{% youtube Yg3O8n6hJqI %}

# Old browsers can learn new tricks

It is important that we evolve the browser towards the future we want. As mentioned in the video, I am heavily invested in the decentralization space and I want a user agent that unlocks agency in me, that allows me to browse the platforms I want while remaining in control of my digital life.

We can augment [our favorite independent browser](https://www.youtube.com/watch?v=LtOGa5M8AuU) by using [Web Extensions (in Firefox they are called Add-ons)](https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions) to add new features to the browser including supporting whole new protocols.

In this video I use the following Add-ons:

* [DAT P2P Protocol](https://addons.mozilla.org/en-US/firefox/addon/dat-p2p-protocol/)
	* Source: [https://github.com/sammacbeth/dat-fox/](https://github.com/sammacbeth/dat-fox/)
* [IPFS Companion](https://addons.mozilla.org/en-US/firefox/addon/ipfs-companion/)
	* Source: [https://github.com/ipfs-shipyard/ipfs-companion](https://github.com/ipfs-shipyard/ipfs-companion)
* [Patchfox](https://github.com/soapdog/patchfox), which isn't ready yet, so this link is for the sources on Github.

Each of them take over different protocol schemas such as `dat://` and `ipfs://` and `ssb:`. I [am the author of the patch that whitelisted those protocols](https://bugzilla.mozilla.org/show_bug.cgi?id=1428446) for usage in Web Extensions, so I've been wanting to be able to use such add-ons since the day I made that patch. I think we should invest more in building these types of add-ons and molding our browser experience to support the peer-to-peer web instead of shipping many different electron-based Dapps each siloed in itself.

# Towards a user agent that fosters decentralization

I briefly mention on the video the experimentation going on on [Libdweb](https://github.com/mozilla/libdweb). This is a WebExtension that adds new APIs for other Web Extensions (aka WebExtension Experiment) and even though it is not on track for implementation or shipping, it is a wonderful toolkit that allows us to investigate what sort of experiences we can build inside the browser if the add-on authors have access to low level APIs.

Libdweb adds support for the following things:

* TCP Sockets
* UDP Datagrams
* Filesystem access
* Streams of data
* Custom Protocols
* mDNS

So, using those APIs a developer can build a full IPFS or DAT node inside Firefox (this has already happened and it is awesome). Recently, as a toy, I've built [a little Web Server demo](https://github.com/mozilla/libdweb/tree/demo-httpd/demo/httpd) using those APIs. It is quite empowering to see your browser transforming into a server.

# Final thoughts and request for feedback

So, I hope you people enjoyed this little video. I am still working on Patchfox and hope to have it in some beta state soon. Lets build the decentralized web together, all of us, inside the same user agent.

Please tell me what you thought about these ideas and the video. Reach out to me on:

* Secure Scuttlebutt: `@gaQw6z30GpfsW9k8V5ED4pHrg8zmrqku24zTSAINhRg=.ed25519` 
* Mastodon: [@soapdog@toot.cafe](https://toot.cafe/@soapdog)
* Twitter: [@soapdog](https://twitter.com/soapdog) 

You can also subscribe to my [RSS feed](http://andregarzia.com/feeds/all.rss.xml) and be kept up to date with what I am up to and also subscribe to my [YouTube channel](https://www.youtube.com/channel/UCrZBEFp11PB7TkryjS2LWHw) to see more videos related to decentralization, programming languages and the web.