Hello World, this is Cipherchat! 🐈‍⬛
Tags: opensource, webdev, coding, javascript
Published: 2023-11-12 23:28:16

## Intro

Today I am excited to open source and launch a new bitcoin lightning network application to the world called **Cipherchat**! It is an encrypted messaging app that leverages the power of lightning nodes to communicate privately. I have been building this new project in my spare time over the past few months as a way to become a better developer and to learn more about how nodes operate under the hood. 

This blog post will give a bit of background on the origin of the project, highlight some key features, and explain how it works at a high level. If you would like to skip all of that and check out the app right away, you can just head over to [cipherchat.app](https://cipherchat.app) to get started!

## Background

Cipherchat builds on a number of technologies including the node module [lnc-web](https://github.com/lightninglabs/lnc-web). This package makes it possible for web developers to build applications that interact with a user's lightning node securely and remotely. For those interested you can look into **Lightning Node Connect** to learn more details. 

When I discovered this I knew I had to build something awesome using it. The question was, what to build? So I reached out to **Leo** the **Technical Content Lead** at **Lightning Labs** to ask him what kinds of new lightning apps he would like to see built. He gave me a few suggestions and the one that stood out to me was; create an easily accessible and private lightning messenger that can run on any device, from anywhere in the world.

So Cipherchat is exactly that. It is a web app which means the only requirement to use it is a browser. It can be installed on any device and will function with native features. A user simply needs to connect their node via a pairing phrase and they can start chatting privately in seconds.

## Keysend App Recap

The idea of using keysend messages to create chat experiences over lightning is not a new one. There are other existing and previous implementations of this feature. Some examples are [Sphinx](https://sphinx.chat/), [ThunderHub](https://thunderhub.io/), and [Whatsat](https://github.com/joostjager/whatsat). The first two have a product scope that is much larger than only sending and receiving messages, and the last one is a proof-of-concept that was created in the early days of lightning. 

While **Sphinx** covers decentralized social media and **ThunderHub** is an entire lightning node manager, I wanted to keep the focus for this new lightning messenger app very narrow. The goal was to create a great user experience for private chatting between nodes on the network. Similar to something like **Signal**, keeping in mind some of the constraints of the protocol itself.

When showing off a [keysend demo](https://youtu.be/mx5LI4vPnvo?t=1h17m33s) during the first **Shock the Web** hackathon presented by **Bolt.Fun**, **Bumi** from **Alby** said that:
> "You can even imagine if you allow loading the messages from the users wallet maybe in the future, that would be something like a web-based, lightning-based, decentralized chat."

And from the README file of **Whatsat**:
> "Whatsat is a client application for lnd that demonstrates how the Lightning Network can be used as an end-to-end encrypted, onion-routed, censorship-resistant, peer-to-peer chat messages protocol."

So in that light - I hope that the bitcoin community finds this new offering in the lightning app ecosystem a fun and useful tool that lives up to to some of the expectations set when keysend messages were first being discussed.

## Interoperability

One of the coolest parts of open protocols is interoperability. When selecting the custom record and verification scheme for message transfer, I used established keys in the [TLV Registry](https://github.com/satoshisstream/satoshis.stream/blob/main/TLV_registry.md#tlv-record-registry). This means that if other lightning apps use the same specification, conversations can be had between nodes regardless of which chat client they are using. 

Keysend messages are supported by many apps. However, the nuance is **if** and **how** those apps try to verify the information such as the **sender**, **intended recipient**, **timestamp** etc. A published table showing which records and how they are used in Cipherchat can be found [here](https://cipherchat.app/faq#is-cipherchat-inter-operable-with-other-lightning-messaging-apps).

## Privacy & Self-hosting

A note on privacy: Just like the lightning network itself, Cipherchat can be used privately. But it's important to understand that **anytime** you use the internet your IP address is exposed. So you should always take steps to protect that information and only reveal what you choose, to who you choose, when you choose to do it.

Users also have the option to self-host the entire tech stack. This is possible because everything is **free and open source** all the way down. For more information and to find answers to many questions there is a [FAQ](https://cipherchat.app/faq) available and be sure to check out the [Privacy](https://cipherchat.app/privacy) page.

## Thanks

I'd like to thank everyone in the **#dev-help** channel on the **LND Developer Community** Slack for answering questions I had while working on this project. Especially **alexbosworth** who is always in there helping people build. Also thanks to the contributors & maintainers of the **lnc-web** package, and to **Leo** for helping with beta testing.

## Wrap-up

Stay tuned for easy one-click installs to self-host the app on all the popular plug-and-play node app stores like **Umbrel**, **myNode** and **Start9**. Social accounts will be made for following updates and getting support if needed.

Now let's go and make keysend messages popular again! ⚡