When life gives you lemons, create a decentralized email system

Uros Radovanovic
Lemon Email
Published in
5 min readMay 2, 2017

This is part I of the series “Lemon Email — challenges and takeaways” Part II coming soon.

Edit: Since the project has been discontinued, following parts in this story are also canceled.

Battling unknown, deprecated and alfa versions to create Lemon Email
Lemon Email is in beta version at the moment, official release is coming soon

“What the hell is Ethereum?” I asked Malisha on October 31., 2016. not knowing which rabbit hole it would lead me trough.

At the time, I was an intern in one of plenty IT companies in Belgrade, Serbia, focused mainly on AngularJS. My contract was expiring on November the 1st, and someone named Malisha posted a job ad on local JS Meetup Slack, asking for front-end developer willing to work on blockchain-related project. I had previous blockchain experience, I worked at another startup developing POC for one international bank, so I said hi. Two messages after, the meeting was set and I agreed to come to one of the hottest companies in Belgrade, to have informal talk about the project and the ideas behind it.

He briefly explained what Ethereum is (even though it will be few months before I could really understand it) and laid out the plans for what the idea is to build. Email system faster and better than Gmail, with more intuitive UX, safer, more private. On the other side, there would be a additional service, POC if you will, of message-exchange platform (decentralized application) built on top of Ethereum. I said “ok”, we shook hands and I started working at Devana Labs the next day.

It turns out that building an email system that people actually use is very hard.

* not the actual representation of email underlying protocols

Not only the market is dominated by the big players like Gmail and Outlook (controlling 70% and 20% of market share, respectively), the remaining 10% is divided to niches which are hard to get into. That’s just email service providers — the web and desktop clients are also very advanced and proven.

There was also strong motivation for building email system on Ethereum.

First of all, it’s a great way to learn a new technology. Email encompasses plenty of things, so it’s great for POC — if you can build an email system using some new technology, you develop the knowledge needed to build pretty much anything else. Also, it’s hard like hell, at one point we talked about implementing SMTP server in NodeJS because it seemed that we would not find better option.

Another reason was that we had an opportunity to do it. Most of the tech companies in Serbia are outsourcing companies, and it’s not every day that you can try to take a bite of freaking Google, even if it’s most likely that you will fail. Also, we are all privacy and democracy geeks, so we wanted to give the power of privacy back into the user’s hands.

On one hand, there are a few open-source solutions that we could implement into our system. On the other, Roundcube (the best choice from our perspective for open-source webmail client) was ugly, slow and clunky.

I was to start probing and see if the messaging system on Ethereum is possible. In the first week I powered trough Geth setup, constantly breaking stuff and syncing the blockchain, going trough many tutorials in order to create simple Angular app which communicated with Smart Contract and displayed some sent message on frontend. The errors at this point were numerous.

Much of the tools we used were in alfa, beta and all other production-unready versions. My blockchain database was constantly crashing, and had random syncing problems. The tutorials were scarce, old and deprecated. Coming from something like AngularJS which had a ton of learning resources online, I felt lost, insecure and sometimes angry. But I tried to mitigate crashes using two computers and dev environments, in order to have backup if I screw up and have to re-sync the entire chain.

In spite of that, a “get messages from Ethereum and display them on the front-end” milestone was hit pretty fast, in couple of days. At that time, there were just Malisha, me, and newly formed dev-ops team.

During next period, we were constantly discussing architecture. One thing we always had on our minds is that we didn’t want our users to be the sys-admins at the same time. We saw first-hand how running the full node and syncing with the Ethereum blockchain could be hard, error-prone, and take long time. Users want to check email, not wait 15 minutes for blockchain to sync. So we took a detour from our initial idea of fully decentralized application, in favor of running our own nodes on Node.js server. We iterated little by little to come to some kind of conclusion in order to leverage the tradeoff between decentralization and proven technologies.

We don’t want our users to look this angry

In each iteration there was a new problem. How do we solve sending emails without SMTP and IMAP? How do we handle encryption? How do we tackle high prices for storing data on Ethereum? How can we send encrypted emails to external services like Gmail? We had couple of external consultants that helped us in deciding this, and soon we had another three part-time developers working with us, all of which had great ideas.

Our DevOps team also did a tremendous job. They’ve built a microservice oriented, scalable architecture in cloud, following the state-of-the-art technology guidelines and implementing strict security standards.

We decided that we’ll encrypt everything we can on the front-end, in order not to be able to access user data. We don’t store user data in our databases, we use IPFS. Everything we have is double-encrypted and stored on the decentralized services. We have classic, old-school email. It’s not great, but we are working on optimization, maybe we’ll write whole new webmail. For our decentralized email, we have minimal UI. Oh, and that initial idea for a Decentralized Application? We have that, too.

--

--

Uros Radovanovic
Lemon Email

Software developer, privacy geek and AI doomsayer. Occasional writer, dog person, and founder of https://crowd.sale