What to Expect From the Telegram Open Network: A Developer’s Perspective

How TON could disrupt the blockchain landscape.
How TON could disrupt the blockchain landscape.

Recently, new materials surfaced about the lite client for the Telegram Open Network (TON) blockchain, powered by encrypted instant messaging service Telegram. Based on the content of these documents, it is possible to make a lot of assumptions about its future, especially in regard to comparing TON with competitors — such as the Cosmos network, Polkadot and Ethereum 2.0 — as well as the overall impact of the blockchain ecosystem.

Polkadot, Cosmos and TON will definitely compete for users and developers. Moreover, in 2019, every blockchain really needs to have a lot of use cases built on it in order to attract users and potential investors, as the era of the initial coin offering (ICO) and new blockchains may now be over. Requirements for blockchain projects are currently high and about to be even higher after the release of TON. It is important to explain to users which problems are solved by this project. It is possible to compare projects by the amount of potential users. TON is probably the leader because of existing Telegram user base (300M+).

TON lite client CLI

Neither Ethereum nor any other cryptocurrency or blockchain company currently has 300 million users — but Telegram does. One of the largest problems of current blockchain development is handling the scalability for such an amount of users, which is why Polkadot, Ethereum 2.0 and others exist in the first place. These blockchains attempt to address larger volume and faster speed. Currently, Ethereum and Bitcoin can process about 15 and 7 transactions per second (TPS) respectively — much less than Visa’s almost 45,000 TPS. Thus, TON needs to process more than Visa to facilitate its millions of users.

Scalability issues

The main challenge for modern blockchains is being able to scale enough to process such a large amount of transactions that it’s suitable for mass adoption, which would mean it could bear millions or even billions of potential users.

TON claims to be fast in terms of processing transactions between users. However, not a single blockchain project is capable of achieving the goal of processing millions of transactions per second.

Transaction Speed of Various Blockchains

There are different approaches to scaling a blockchain system while having the same security and decentralization as Bitcoin — or at least close to it.

The first way is to use centralized hubs controlled by smart contracts. A user can deposit funds into the smart contract and will retain the same funds on this hub. However, if something unforeseen happens, users can get their funds back from a smart contract without any interaction with the hub. An example of this is Plasma, which was proposed on Aug. 11, 2017 by Ethereum co-founder Vitalik Buterin and Joseph Poon, the creator of Lighting Network, in order to scale Ethereum. During the development, a number of issues appeared that made Plasma quite complicated to implement. The main difficulty was the exit from Plasma. To exit, the user needed to wait seven days. During this period, anybody could provide proof that the user cheated. A smart contract needs to verify that the user has the right to exit. The main challenge is to make the least possible calculations and to have the smallest possible proof size on the Ethereum side, because you need to pay for any calculation or for any data on Ethereum. During Plasma discussions 1 2 3 4 5 6 7 8 9 10 and implementations 1 2 3 4 5 6 7, an issue with the history of exit proofs caused Plasma to become unstable after a couple of months. Because of that problem, there is no fully production-ready Plasma with smart contracts on it right now.

Plasma architecture

The second way to scale blockchain is to use a proof-of-stake (PoS) consensus algorithm instead of proof-of-work (PoW). The main difference between these approaches is that PoS allows for the validation of blocks by one’s stake — the amount of coins that the validator owns. PoS is more efficient than PoW according to its creators’ (Sunny King and Scott Nadal) research. An example of proof-of-stake blockchains right now are Stellar, EOS (which uses a delegated proof-of-stake of DPoS), Binance Chain, Cosmos and Polkadot.

Proof-of-Work & Proof-of-Stake

The third approach to solving scalability problem is sharding.

What is sharding?

Sharding is a way to split the entire state of the network into a bunch of partitions (called shards) that contain their own independent piece of state and transaction history.

The main principle is to execute transactions parallelly and to separate all the data into different small blockchains that can interact with each other.

To think of it in a metaphor, imagine Ethereum was split into thousands of pieces. Each piece can function on its own and can have its own features known to each respective piece. If the pieces want to talk to one another, they will have to use some sort of protocol. Sharding creates a way for each shard to maintain individual transaction receipts that are cryptographically secure. They can be brought back together to be a larger piece at any time.

Sharding, together with PoS, is one of the best ways to scale current systems. However, there are a couple of security issues with it that are still unresolved.

TON is a PoS blockchain that actively uses sharding to scale. It has a masterchain and workchains that are also connected, with both having their own shardchains. Thus, the TON description document conclusion reads:

“To achieve the necessary scalability, we proposed the TON Blockchain, a ‘tightly-coupled’ multi-blockchain system [...] with bottom-up approach to sharding (cf. 2.8.12 and 2.1.2).”

TON will be scalable because it will combine several approaches, such as sharding and PoS consensus. With sharding, the data is stored in different places so less information is being sent through the network — making it faster. The benefit of PoS is that you don’t need to do a lot of calculations to validate the block. By using both of these, they create much faster transaction validations than proof-of-work.

TON vs. Ethereum 2.0, Polkadot and Cosmos

Polkadot is a blockchain that allows for the connection to other blockchains, which was built by Gavin Wood, a co-founder of Etherium. Cosmos is similar to Polkadot — however, the Cosmos team developed a PoS consensus algorithm that is the leader in speed and security.

TON’s main advantage over its competitors is its user base of 300 million. But there are other parameters that can be compared.

Summary of some notable blockchain projects

Summary of some notable blockchain projects

Developers community:
 Without a developers community, there could be no future for any blockchain systems. Right now, there are still not a lot of use cases of blockchain in the general population. It is obvious that without developers, there would not be any apps based on a given blockchain, so there would not be any users either.

Polkadot and Ethereum are the leaders here. Ethereum has been growing its community for six years. There are many companies and enthusiasts from the best technological universities that have built and continue to build apps on the Ethereum blockchain. The main reason for this is that the Ethereum and Polkadot approach is to develop everything open-source and allow anybody to participate in it by proposing ideas through EIP (Ethereum Improvement Protocols) and getting research grants.

The main problem with TON here is that it is not public: There is no way to participate in the development process. The TON team is well known as a team of talented and smart people, but are very closed off from the public. There is no large, open developer community for TON and, therefore, there might not be many apps and protocols built on TON — at least, not until it operates more publicly. For mass adoption for any blockchain, there needs to be many developers building mass use cases — so, this is an issue for TON’s growth, at least for now.

Smart contract language:
 Right now, there is only one language on TON, which allows for smart contracts. However, TON is still under active development, and everything could be significantly different in future. We will analyze only the current situation now.

TON’s smart contract language, called Fift, is quite unusual. It was inspired by the programming language Forth that first appeared about 50 years ago. This language could be unfriendly to new developers. Most JavaScript or Python developers will maybe never understand how to code with it. However, it is somewhat similar to the language Lisp in terms of syntax.

This means that the TON team decided to have dev quality over quantity. Only well-experienced developers can work with Fift, which also means that there will be fewer mistakes in the production of smart contracts. However, that also means there will be fewer developers. It could be a good approach to use Fift, but it is still risky for TON.
TON's Fift language syntax

It is pretty much the opposite approach to Ethereum’s strategy with the Solidity language, which was designed to be similar with JavaScript to allow a lot of new developers and JavaScript developers to start working with Solidity quickly.

Both Polkadot and Ethereum 2.0 allow for developing decentralized applications (DApps) using classical languages like C#, Java, C++, JS, Go, Rust and others. The main idea is to use the WebAssembly virtual machine, which suits perfectly for blockchain systems. WebAssembly was originally designed for web applications. Thus, developers can use one language while completing different tasks with it. Cosmos also allows developers to use classical languages.

TON could potentially have a lot of problems with Fift. Polkadot, Cosmos and Ethereum use classical languages and there is no simple solution for TON now about how to compete with this. However, TON Labs is working on optimization the Fift for other coding languages, such as C++, that are more widely used. However, it is possible that other languages will have the possibility to be converted to Fift. Ton Labs is working to do that in future. With support for languages like C++ and C#, Ton will solve all the issues connected with the difficulties of understanding Fift and will have the same level of adoption of developers as Polkadot — or maybe even better. The Telegram team always has had a good API and documentation for its API, such as Telegram Bots.

Architecture: 
Polkadot has one mainchain called the relay chain, with many sidechains connected to it called parachains. Parachains do not have their own consensus, so all the blocks are verified on the relay chain by a group of about 1,000 validators. It is more scalable than most current solutions because blocks in the parachains are executed parallelly.

Polkadot architecture visualization. All chains have shared validators

Cosmos also has one mainchain called Cosmos Hub. Other sidechains are connected to the hub and called zones. Every zone has its own validators, so blocks are executed independently. The problem here is that, with such a small amount of validators (100), zones can be hacked. In Polkadot, all chains have common validators to solve this issue. Cosmos’ approach is to have only useful zones, so there will be enough validators to stay safe. You could have your own blockchain for specific reasons, in this case.

Cosmos abstract architecture. Each zone has its own validators and blocks

TON’s architecture, as detailed in section 2.1 of the TON Description Document, is completely different. Its defining characteristic is that it has a masterchain and a large number of workchains — independent blockchains that can interact with each other and be governed by the masterchain. Every workchain consists of shardchains — small chains responsible for specific data in a blockchain stored in blocks.

Each workchain is subdivided into up to 260 sharded blockchains, having the same rules and block format as the workchain itself but responsible only for a subset of accounts, depending on several (the most significant) bits of the account address.

TON masterchain and workchains abstract visualization

Each shardchain block is a group of cells — the specific type of data in TON. A shardchain block itself can also be described by an algebraic formula and is stored as a “bag of cells,” according to the TON Description Document (section 2.5.6).

Each TON workchain consists of shardchains

The most interesting architectural approach is TON’s sharding. However, there are a lot of issues concerning the implementation and security of that solution right now. Sharding in this case can be insecure and has some exposure to hacking.

Use cases of blockchain and what’s possible now

There are a certain number of use cases that can be implemented on TON and other new generation blockchains.

Telegram bots + blockchain:
 Telegram already has bots. It is one of the best ways to build an app with a human interface directly in messenger. It is much easier to use when you don’t need to install any new app, but can just tap your favorite bot in search. With TON’s API for bots, it could be possible to build simple, user-friendly DApps for users that will be available to them in seconds. There are already some bots on Telegram now that allow you to use bitcoin and ether, and even exchange, buy or sell them. 
With TON payments, Telegram can build its own marketplace of apps directly within the messenger, which could end up being the Apple App Store killer. With the first phone banking beginning in 1983 by the Bank of Scotland, then the first online banking by Stanford Credit Union, followed by banking apps in 2007 and banking bots in 2015, now we see bots becoming commonplace. By 2020, it is estimated that 85% of banking customer service will be done bots. Businesses should find the messenger “home” of their users — Discord for gamers, Telegram for crypto enthusiasts, WeChat for China and Slack for enterprise business — to align with where their target user currently resides.

Micropayments in messenger: Micropayments in messengers are one of the most promising blockchain applications in everyday life.

For example, WeChat payments: one of the main reasons WeChat is unsuccessful in Europe and in the United States is that WeChat is too centralized and affiliated with the Chinese government. The West prefers more slightly agnostic platforms, on which people are free to select services and payments from a variety of options.

DEX:
 A decentralized cryptocurrency exchange (DEX) is another possible use case of the TON blockchain that can also work for Telegram bots. With the potential of TON to process millions of transactions, it is possible to build an exchange to trade.

Bridges between other chains: A bridge is a connection between the blockchains, which is the main goal of Cosmos, Polkadot and TON. Bridges allow sending transactions to another blockchain with one point of failure, as bridges work with validators that could be attacked. When we use a bridge, we need a group of trusted validators who listen to events from one blockchain and will transfer them to another. The main problem is that validators can be attacked or malfunction on their own. To prevent such cases, validators need to stake assets on both chains. They will be punished by losing the staked amount for any malfunction or misconduct. However, that also means that amount of crypto that can be transferred through a bridge must be less than the amount staked by the validators. This is important because bridges could make exchanging more decentralized than just using current exchanges.

Influence on the blockchain landscape

The TON team’s strategy differs quite a bit from the main strategy of current leaders like Polkadot, Ethereum and Cosmos. The current way TON is being developed is much more complicated for developers than the aforementioned blockchains. However, if the TON team finds out how to attract developers, this could completely change the way developers work with all blockchains. TON could illustrate that it’s possible to release a product without any public discussions and still attract a robust community. TON could attract professional, well-experienced C++ developers instead of JavaScript developers, which can definitely change the quality of DApps. This could impact customers who hire developers in a positive way by eliminating lower-quality developers in outsourcing organizations.

TON could become a powerhouse blockchain — as upon its release, 300 million people will instantly possess gram wallets, which will make it the world’s most adopted cryptocurrency. In seconds it’s very probable that TON will move to the forefront as being the most-used blockchain within the whole ecosystem, with the best developers in the world building on it.

The team behind TON declares that it will maintain its own infrastructure, and the company will have a voting capacity twice as powerful as the rest of the community. The question is why it would advocate for such a centralized system. It claims to make a distributed blockchain system, but in fact, it is not distributed, but centralized. Other than the fact that it has a public ledger, it is no different from other processing systems. It has created some services on the blockchain, but so far it is unclear how it will work and what it needs (DHT, proxies, DNS).

If we consider the network, blockchain, services and payment — then this results in a completely centralized system that will be serviced by the organization (TON). Technically, it has a very detailed and well-implemented white paper. The understandable purpose of the services, the clear connection between them, and that there are no technological issues all make for a potentially great platform that can withstand a large load.

With all due respect to world-class technology, it could cause one to ponder: Why be agnostic and private if you're in fact really just centralized? Perhaps it’s a message for both centralized and decentralized systems to maintain the integrity that was so meticulously built.

Related reading: Exclusive: New Report Reveals Details of Telegram’s TON Blockchain

The article is co-authored by Nick Kozlov and Dmitry Gorilovsky.

Nick Kozlov is software developer, nominated as Microsoft MVP in blockchain, winner of 10+ international hackathons, CTO of Button Wallet.

Dmitry Gorilovsky is a product creator and innovator with a proven track of record in hardware/software development, 10+ years of experience in IoT product and business development, six+ years in blockchain industry, the creator of YotaPhone, the founder and CEO of Woodenshark — the company behind multiple IoT and hardware products — and the founder and CEO of Moeco — a global connectivity platform.