OpenChat: A Truly Decentralized Alternative to WhatsApp

Matt Grogan
The Internet Computer Review
6 min readJun 3, 2021

OpenChat functions like WhatsApp, except that it runs entirely on the Internet Computer, the world’s first internet-scale blockchain.

By Matt Grogan and Hamish Peebles

Earlier this year, WhatsApp announced an updated privacy policy that requires users to accept that their account details, phone number, metadata, financial transactions, log reports, location, device identifiers, and IP addresses will be shared with Facebook. Users were told to accept the new policy or risk losing access to their account. Amid the ensuing controversy, the ultimatum changed: if users don’t comply, the messaging app will now gradually degrade in service until it stops operating entirely.

This is why we are building OpenChat, a decentralized messaging service that functions much like existing messaging apps such as WhatsApp and Signal, with a key difference being that OpenChat runs end-to-end on a blockchain, the Internet Computer.

You can try it out the alpha version in development here: https://oc.app

Your chat messages are processed and maintained on-chain by advanced smart contracts, which in Internet Computer language are sometimes called “canisters,” because they are a bundle of WebAssembly bytecode and persistent memory pages, and run in parallel using the software actor model, which allows dapps to scale.

The architecture of OpenChat will allow it to scale to millions of users while remaining free to use for the average user. Never before has it been remotely possible to build such a scalable system on a public blockchain that is inexpensive enough to offer to users for free. Moreover, while the cost to store 1 GB of data on Ethereum is $60.86 million at the time of writing (after recently peaking at $869 million), costs shall remain stable at around $5 per GB per year on the Internet Computer owing to the extraordinary efficiencies its scalable architecture and “Chain Key” cryptography have unleashed.

OpenChat will become an open internet service once tokenization is enabled on the Internet Computer, which means the dapp will be fully decentralized and governed entirely by the community — no company will be tracking and selling your data. OpenChat will be owned and managed by the holders of its governance tokens, which will be widely distributed to users across the world to enable decentralized decision-making and incentivize participation on the platform. As an open internet service, all changes must be made via public governance proposals. Any OpenChat token holders who want to take part in the governance of the platform can vote on these proposals, and only the proposals that gain enough support will be adopted and implemented.

OpenChat is available in limited release for members of the public to try for themselves. We are in a testing phase, and currently have a limit of 10,000 users.

The code will also soon be public and open to anyone who wants to contribute. The advent of open internet services will make it possible to reward contributors of new features and bug fixes with bounties of OpenChat tokens, creating a thriving open product.

End users, meanwhile, will simply be able to enjoy a secure, intuitive, and open chat app!

Technical Overview of OpenChat

OpenChat runs on canister smart contracts installed on the Internet Computer blockchain. A variety of canister smart contracts will run the central services, such as the user registry and WebRTC connection handling.

All messages are processed and stored by smart contracts, but the Internet Computer still takes 2 seconds to finalize state-altering transactions. Therefore, we try to front-run the smart contracts using WebRTC, which can make them available faster, and keeps the “instant” in chat (note that 2 seconds is very fast indeed for a blockchain however). The smart contracts broker and establish the peer-to-peer WebRTC connections between the web browsers hosting the chats.

Note, that smart contracts on the Internet Computer can securely serve interactive web content into end-users’ browsers, and that content can then securely interact with the smart contracts. Thus, Open Chat uses blockchain end-to-end to provide its functionality, and does not depend upon cloud services, or any other centralized and insecure legacy technology.

In order to scale using a simple architecture, a new canister smart contract instance is created for each user, which stores a copy of their chat history and configuration information. The inherent security of the Internet Computer means that users can only gain access to their own canister data (or, in the case of a group chat, the group participants).

Soon, once the code is open sourced, it will be possible to identify and verify the precise version of the software running on each canister, linking back to a particular revision in source control. Additionally, as an open internet service, OpenChat will have a governance system that functions similarly to the NNS, so changes can only be made as the result of proposals voted on and accepted by the global community of OpenChat token holders. Given the Internet Computer’s secure nature, the visibility of the software being run at any point, and the fact that the OpenChat community itself will be responsible for approving each change, once SEV-ES is enabled on the Internet Computer nodes, users can be extremely confident that, apart from the recipients of their messages, their data will not be accessible now or in the future to anyone but themselves.

For additional security, OpenChat will in due course offer end-to-end encryption over the already secure Internet Computer network. With this option enabled the chat data will only be accessible by the chat participants on their own devices, and will otherwise be encrypted within the memory of the associated canisters. This is comparable to how WhatsApp secures user data, but it means that the only way to search your chat history is on-device.

As mentioned, chat histories will be stored in the relevant smart contracts created for their owners. Currently though, a single canister smart contract can only utilize a maximum of 4GB of persistent memory (although we believe this will increase in the future), which will limit the amount of chat history and media some users wish to maintain (ditto for group chats). In order to get around this, we will offer users the ability to maintain images and videos within a version of the BigMap smart contract database we will create on the blockchain, which can store unbounded volumes of data. This will likely use content addressing, such that widely shared media will only be stored once, which is more efficient and cost effective, although arguably at the cost of introducing some privacy concerns — which we will be aiming to address however.

Features

Here are some of the standard features that OpenChat currently offers, which users would expect of a typical messaging app:

  • The ability to send messages to other users, with ticks indicating when the message has been received by the OpenChat services and read by the recipient(s).
  • The ability to send media messages (e.g., photos, videos, etc.).
  • Instant messaging for online users.
  • The ability to see if your contacts are currently typing a message.
  • Group chat function.
  • Soon, the integration of notifications, so that you can see if you have messages waiting even if you don’t have Open Chat open in your browser…

Here are some OpenChat features that would not be found in a typical messaging app:

  • Integration with Internet Identity blockchain authentication technology, which enables users to sign-in anonymously using any of their devices without a username or password in a secure but friction-free manner (essentially, the WebAuthn protocol allows the web browser to integrate with TPM chips, for example via the fingerprint sensor on a MacBook, or Face ID system on a phone, or HSM devices, such as a YubiKey).
  • The ability to search across your entire chat history without compromising security once SEV is enabled on the nodes machines that host the Internet Computer blockchain network.
  • The ability to send cycles, which are used to power computation on the Internet Computer, to other developers — and other advanced tokenization features, yet to be announced.

Next Steps

In the near future, as OpenChat transitions to becoming an open internet service, early adopters and contributors will be rewarded with OpenChat tokens, which can be used to participate in the governance of the service (we will adopt the Service Nervous System model, which is derived from the Network Nervous System of the Internet Computer).

We believe that users should participate in services that they make valuable through governance, and ultimately, should also become part of the team and earn rewards through participating in tasks such as moderation in public chat groups that act as forums.

Follow @OpenChat on Twitter to keep up with the latest developments on OpenChat and to be notified when the OpenChat code becomes public!

We welcome your contributions, and look forward to seeing how you will help OpenChat and the wider Internet Computer ecosystem grow and evolve.

--

--