
TDLib – Build Your Own Telegram Client - MikusR
https://telegram.org/blog/tdlib
======
kemonocode
Unless they release the server code, no, you can't build your own "Telegram"
yet. The original article's title was misleading, thankfully the HN submission
title was amended to correct it. Still useful of course for anyone creating
third-party clients, but an entirely different matter.

~~~
marknadal
Aye aye! Both Telegram and Signal scare me.

We're building an MIT/ZLIB/Apache2 Open Source End-to-End Encrypted
alternative that is a fully P2P decentralized app (dApp), see:
[https://hackernoon.com/so-you-want-to-build-a-p2p-twitter-
wi...](https://hackernoon.com/so-you-want-to-build-a-p2p-twitter-
with-e2e-encryption-f90505b2ff8) !

Currently it supports signed/verified messages, haven't added cyphered/private
messages yet to the API, but it is available in the SEA (Security, Encryption,
Authorization) utility library underneath - but that should be coming soon,
and of course love any contributions!

Also, the "server" has no special application logic on it, it is just another
peer in the network that can help with WebRTC signaling or being a websocket
relay. It cannot middleman the data, because every message is signed via the
"client" (technically there are no server/clients, everybody is just a peer)
using latest native Web Crypto API!

Here is a demo of an example social network app that is syncing character-by-
character with cryptographically verifiable sources across a test network of
real world devices:
[https://youtu.be/C3akdQJs55E](https://youtu.be/C3akdQJs55E)

Again, all truly Open Source (ie, MIT/ZLIB/Apache2)!

~~~
bqe
Why does Signal scare you? All of their code is open source[1] and has had
multiple public audits[2].

[1]: [https://github.com/signalapp](https://github.com/signalapp)

[2]:
[https://eprint.iacr.org/2016/1013.pdf](https://eprint.iacr.org/2016/1013.pdf)

~~~
codedokode
It requires you to provide a phone number (read disclose your identity) to use
it. And its homepage has the word "privacy" repeated several times. It looks
like a poor joke.

~~~
bqe
You can easily use a VoIP number to set up Signal if that's really an issue
for you.

The alternative (using Telegram's homegrown and dubious cryptography and lack
of actually encrypted group messages) is significantly worse. Here's a nice
summary of the issues:
[https://security.stackexchange.com/a/49802/43733](https://security.stackexchange.com/a/49802/43733)

~~~
ShabbosGoy
VoIP is easily traceable too. Pay with a credit card for the number? Use
Google Voice? Bam, they’ve got you.

------
igloofoo
There may be political motive to this.

Why is Telegram X issued by "Telegram Messenger LLP" while the original
Telegram is issued by "Telegram LLC"?

Telegram LLC, which issues the original Telegram app on the App Store has been
undergoing litigation with regards to its ownership. It is based out of Russia
and a company called UCP with Krelim ties who 'bought' VKontakte has been
suing Durov for full Telegram ownership pursuant to VKontakte 'purchase'.

Telegram Messenger LLP however is based in London and seemingly wholly owned
by Durov crew. In 2014, Telegram Messenger LLP launched Telegram HD, a
separate app from Telegram-LLC-issued-Telegram. Now it is launching Telegram X
, another separate app (which was until very recently Challegram, an open
source Telegram client, winner of Telegram contest, and purchased by Durov) .

Draw your own conclusions.

EDITED for clarity and details

[https://themoscowtimes.com/articles/the-telegram-lawsuits-
ex...](https://themoscowtimes.com/articles/the-telegram-lawsuits-explained-
pavel-durov-58989)

[http://www.ewdn.com/2014/07/29/pavel-durov-has-cloned-
telegr...](http://www.ewdn.com/2014/07/29/pavel-durov-has-cloned-telegram/)

[https://rusletter.com/articles/ucp_requires_to_recognize_tel...](https://rusletter.com/articles/ucp_requires_to_recognize_telegram_as_the_property_of_vkontakte)

[http://www.frandroid.com/android/applications/securite-
appli...](http://www.frandroid.com/android/applications/securite-
applications/484643_telegram-fait-lacquisition-de-challegram-et-le-renomme-en-
telegram-x)

~~~
drdaeman
> Challegram, an open source Telegram client

Is this true? I can't find the source anywhere. Not even a dated one, if they
had re-licensed it.

------
orbifold
I like how they do very good engineering (just straight C++, Swift, with
little to no external dependencies) with a very small team of apparently very
talented people. Most of their products are typically owned by one or two
people. It's also pretty smart of them to make all of the clients available as
open source and keep the server implementations private. This way they don't
have to license QT for example.

~~~
veeti
Behold, 12283 lines of very good engineering:

[https://github.com/DrKLO/Telegram/blob/e9e40cb13ea942b148b25...](https://github.com/DrKLO/Telegram/blob/e9e40cb13ea942b148b259c083fb3364a0cd90ea/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java)

~~~
tomsmeding
As far as I can see, that's lots of code for generating a UI. Interesting that
they do that instead of using the usual xml files for specifying the UI on
android; the result is that there's lots of code, a number of statements for
each single UI element, and all the listeners and such are declared inline.

The compiled code will be fine, probably. It won't be much different from that
would happen if they used the standard method of xml files and separate
classes for that stuff, and might even be slightly faster.

But it surely is less maintainable, and the code definitely doesn't look
generated to me. Maybe if you count copy-paste as code generation.

I hope they don't use Atom as an editor, because it surely won't be able to
cope with such a file. [/s; but might even be true. not tested.]

~~~
balladeer
Less maintainable? That's a nightmare. As an Android developer who has
struggled with couple of 4 digit lines long activity classes I literally
shuddered.

This is as if someone used a tool to translate UI code from some other
platform to Android (completely into Java) and forgot to refactor.

------
lozenge
Telegram has a poor security record, with homegrown encryption algorithms and
no end to end encryption by default.

~~~
fwdpropaganda
You're just repeating something that you read on HN. Entirely false.

~~~
mtgx
Are they allowing you to have accounts that don't depend on your phone number
yet? I think last I checked you could only login with your phone number, which
I consider extremely insecure, especially against a nation state agent (you'd
think the Telegram team would care more about that, considering where they
come from - and in fact, I believe there were some reports of Russian
government hacking people like this with the help of national carriers, too).

~~~
zimpenfish
> (you'd think the Telegram team would care more about that, considering where
> they come from)

That assumes the Telegram team aren't part of the nation state apparatus,
surely.

~~~
fwdpropaganda
Do you have any reason to assume they are? Of course, other than the fact that
the founder is _RUSSIAN_ _gasp_

~~~
zimpenfish
I don't assume they are. But equally I don't automatically assume they aren't,
either.

~~~
fwdpropaganda
You're just evading my point. Implicitely or explicitely you must have a
_working_ hypothesis. When you make decisions, you must assume one or the
other.

------
Shourai
The iOS version of Telegram and Telegram X are currently not available in the
Appstore.

It should be resolved soon:
[https://twitter.com/durov/status/958990254396059648](https://twitter.com/durov/status/958990254396059648)

~~~
cabaalis
There should be a notification "your app is about to be removed, please
contact us to solve the issue." (I'm assuming there wasn't because of other
horror stories I've read.) If my business's service was suddenly down for 2-3
days due to some externality I couldn't immediately correct, it would be a
death knell.

------
dingo_bat
Telegram is such an awesome software, I feel it's such a shame it's not more
popular.

------
rplnt
> P.S. Today, we're also introducing Telegram X for Android, a new official
> app.

What is wrong with the current app? Or was that not official? I find it better
than the Facebook Messenger (light or not) and it's definitely much better
than the Hangouts app from Google.

~~~
lloeki
They have had two apps (Telegram vs Telegram Desktop) on macOS too for a
while. IIRC one is Electron-ish-based and the other is native Cocoa. The first
one got features slightly faster but lacked Secret Chats IIRC.

~~~
rplnt
I was actually positively surprised to see the Telegram application is qt
based. Not sure which one is it of the two you mention, it's just called
"Telegram", and is same on both Windows and OSX.

Explains why it doesn't take a minute to start and doesn't need a gigabyte of
memory.

~~~
aneutron
Also, I was very surprised to see that it was really QT based in the sense
that there was no glue to an attached Chromium or something, just pure QT in
C++.

The effort that went into that thing is amazing. It's fast on my 5 years old
Pentium.

~~~
jamesb93
Which one should I be using? MacOS specific one feels polished whereas the
Telegram for Desktop one doesn't have this strange issue where media sometimes
never sends.

~~~
Aloha
I prefer the macOS native client.

------
chrisper
Title is misleading, I think. You can only build your own client.

