3Box Threads: A Chat System for Decentralized Apps

The easiest way to add decentralized messaging to your dapp

3Box
3Box
Jun 12 · 6 min read

A Decentralized Chat System for Ethereum Dapps

If you’re building a distributed application — whether a DAO, DeFi platform, marketplace, game, social app, or whatever else you dream up — you likely need some decentralized way for users to message, communicate, or interact with each other. 3Box Threads are the easiest way to add decentralized chat functionality to your Ethereum dapp.

3Box Threads provides a drop-in messaging system that can power a variety of chat functionalities within your dapp, from comment and chat systems to full blown forum-style discussions.

Here are just a few of the features you can build with the new version of Threads: public chatrooms; reddit-like discussion forums; DAO proposal systems; content feeds; photo streams; curated lists; followers lists; commenting systems for websites, games, ERC721 collectibles, user-generated content, smart contract addresses; and much more!

New Threads Available Today

The 3Box team is excited to announce that today we have released 3Box.js 1.9 which contains a brand new version of the Threads Messaging API, now with support for access controllers, moderation, and members.

You can explore the API documentation for Threads here.

Get Started Building with Threads

Getting started with 3Box Threads is simple. Install 3Box.js 1.9 into your project and read the API docs to get going.

npm install 3box

Why use 3Box Threads? 💬

We handle all the complexity so you can focus on building your app.

Flexible Functionality, Simple Integration

3Box.js provides a drop-in messaging system that can power a variety of chat functionalities within your dapp, from comment and chat systems to full blown forum-style discussions. See the introduction to this article for a more complete list of use case ideas.

Increased Engagement

With 3Box Threads, you can enable rich social discourse directly inside of your own application, and no longer need to outsource this functionality to external, third-party platforms like Discord or Telegram. By allowing you to own the end-to-end user experience, Threads improve usability, engagement, and retention — while helping you build stronger community.

User Profiles, Not Hex Addresses

Since Threads are offered via 3Box.js, which also has a Profiles API, your app gets the added benefit of having user profiles associated with sent messages. Now you don’t need to worry about the poor user experience of users receiving messages from random hex addresses, and can feel confident that this chat experience will feel similar to the existing social platforms that your users are already familiar with.

Decentralized, High-Availability, Performant Infrastructure

3Box is built using IPFS, a popular decentralized storage network, OrbitDB, a database system for IPFS, DIDs, the emerging standard for decentralized identity put forth by the Decentralized Identity Foundation (DIF), and Ethereum Keys for user accounts and authentication.

Threads are stored on the 3Box storage network, so you don’t need to operate your own infrastructure including centralized servers or IPFS/OrbitDB pinning services, nor do you need to worry about what third-party providers, like Disqus, are doing with your users’ data and personal information — such as selling it to advertisers without users’ awareness.

To ensure data on 3Box is decentralized and available, users always maintain a local copy of their data in their browser which communicates with the rest of the network using the libp2p pubsub protocol offered by IPFS. We operate a network of pinning-nodes that listen for updates to users’ local nodes, pin this data, and replicate these updates across the network to ensure that data remains safe and available in the event that the user loses their local copy for some reason.

Furthermore, we have also built a robust caching layer for threads data stored on the 3Box network to ensures that applications’ network requests are always returned quickly. The 3Box infrastructure is performant enough to handle the demands of production-grade applications.

Cross-Application Data Interoperability

3Box is an open data storage network where multiple applications can read and write to the same Orbit databases. 3Box is not like centralized or siloed services where data is locked down. This means that users can interact with the same threads across multiple applications.

In the same way that the Ethereum network first made application and financial logic a shared public good accessible by many, 3Box dissolves the borders between user data silos, enabling a shared public data good that will unlock a whole wave of interoperable application ecosystems.

Consider the case where various thin prediction market interfaces want to offer access to the same underlying financial smart contracts and the same comment threads related to those markets. With 3Box this is now a possibility.

Match Your Application’s UI

3Box.js is a generalized JavaScript SDK for identity, authentication, and data storage, and contains a simple API for threads messaging functionality — meaning that you will need to implement your own UI on top of this base infrastructure. This makes it easy for the chat functionality provided by 3Box Threads to feel very native to the experience of your application, since it will use your components and therefore perfectly match your look and feel.


What’s New in this Release? ✨

Here’s a rundown of all the new features enabled by the 3Box.js 1.9 release.

Access Controllers and 3ID

Access controllers allow developers to have much more control over the permissions of threads users, including deciding which users are allowed to post in a thread, or remove posts from a thread. The previous versions of Threads did not have access controllers, so all threads were open threads — meaning anyone that discovered the thread was able to post in it.

3Box.js 1.9 includes OrbitDB 0.21 which allows for custom, third-party identity and access control modules. With these new capabilities, 3Box has built a much more polished messaging product — complete with moderation, members, and more.

To enable these new access controllers, we also overhauled the internal 3Box Identity System. In this release, we upgraded from our initial muport DID identity method to something much more robust and modular — 3ID.

Although OrbitDB 0.21 is a dramatic improvement over previous versions, it is a breaking release. This means that if you are using an older version of 3Box.js in your application, you will need to update to the latest version of 3Box.js to remain in sync with data stored in the new Threads.

Moderation

Moderated threads are threads that can be moderated by one or multiple users. Moderation gives users advanced permissions in a thread to remove other users’ posts and add new moderators. (Users are always able to remove their own posts.) This feature is a basic requirement of many production-grade messaging systems because it is a way to combat inappropriate or off-topic content, and has been requested by many projects in our community.

Members

Members threads are threads where the ability to post new messages (write-access) is limited to members of the thread. Messages are public and unencrypted though, so all users can still read messages saved in the thread.

Multi-member threads can be used to restrict the ability to post new messages to members of a specific community, while single-member threads can be used for lists produced by the user them self, such as content feeds, status updates, follower lists, shopping carts, or photo streams.


What’s Next? ⏭️

Everything we’ve already mentioned in this post can be used in production today, but we’re happy to provide guidance on what’s coming next.

You can look forward to private, encrypted threads which restrict read-access for private group chats and direct messages, ephemeral threads for impermanent messaging such as a TrollBox, upvoting, replies, and more.

If these sound interesting to you, get in touch on Discord.


Build Better Apps with 3Box 🚀

Want to integrate? Read our docs
Want to chat? Join our Discord
Want to follow? Follow us on Twitter
Want a job? View our positions

3Box

Suite of APIs for decentralized profiles, storage, and messaging. Learn more at 3box.io.

3Box

Written by

3Box

Distributed database infrastructure for Ethereum. We provide a simple, scalable Ethereum Profiles API.

3Box

3Box

Suite of APIs for decentralized profiles, storage, and messaging. Learn more at 3box.io.