The Open Network (TON)

From CryptoWiki

TON is a sharded smart contract blockchain network.

Basics

  • Started in:
  • Based in: Russia
  • TON launched in 2018
  • Fka Telegram Open Network, since then usually just called TON.
  • Telegram was planned to launch their own blockchain in 3-2019 but got closed down (12-5-2020) as an official Telegram project. However, the TON blockchain itself kept running and is still used by Telegram (1-12-2022).

History and Forks

"The Chinese community group for the Telegram Open Network today announced that it is launching its own version of the blockchain. The Chinese project to launch TON is one among several trying to keep Telegram’s magic alive. There’s Free TON and NewTON, both of which want to get the Telegram Open Network online, using open source-code published by Telegram."

"Telegram recently delayed their open network, TON, and their cryptocurrency, GRAM, once again. There is one related project that has not experienced these setbacks, however. TON OS, an operating system for the TON blockchain, will soon get an open source release.

The project’s core infrastructure developers, TON Labs, are planning to open source the main components of the TON OS on GitHub tomorrow. Mitja Goroshevsky, CTO at TON Labs, confirmed the news to Cointelegraph on May 6."

TON Labs to issue a token known as TON Cash within a month

As reported by industry publication, ForkLog, the release includes TON Node in the Rust programming language, command line interface, TON Multi signature Wallet smart contract, as well as tools for launching TON validators. The report notes that within a month, TON Labs also plans to issue its decentralized browser, Surf, its staking pool, DePool, and the token known as TON Cash.

In conjunction with the TON OS open source release, TON Labs is joining the Free Software Foundation (FSF), a major free software movement. As such, all the components of the TON OS are being launched as a free software. According to the developers, the idea of a permissionless blockchain in a closed source is absurd. TON Labs reportedly felt that joining the FSF will help them maintain free use of the application as well as the TON blockchain."

Audits & Exploits

  • Bug bounty program can be found here (21-7-2022). Up to $100k.
  • Had a SlowMist audit, which it passed:

"The SlowMist security team use a manual and SlowMist team's analysis tool to audit the project, during the audit work we found 2 low risk, 2 suggestion vulnerabilities."

  • "CertiK has become (28-12-2022) an official partner of The Open Network and will be auditing smart contracts and services based on TON. CertiK has already audited (https://t.me/toncoin/640) many critical components of The Open Network, including vesting schedule smart contracts, the TON Bridge app, the TON Baselayer, and others."

Bugs/Exploits

Governance

DAO

Treasury

Token

Launch

Token Allocation

"New Toncoins are generated during validation. These also go to validators. Overall annual coin inflation is about 0.6%."

"The blockchain runs on proof-of-stake technology, making it fast and cheap, but the initial token distribution was enabled by mining, which was decentralized and had the same conditions for all who participated.

A case in point is all the donations from TON miners that led to the creation of the TON Foundation and the TON Reserve"

"When testnet2 later renamed as Mainnet was launched, 5bn coins were generated with a small fraction (1.45% of the total supply) distributed between testers and developers."

Utility

"$TON is used for transaction processing fees as well as cross-chain transaction fees. dApps that build on TON can also receive the token in exchange for services their app provides. $TON is also the governance token of the network, and is used to vote for decisions that affect the future of the network."

Other Details

Coin Distribution

  • The TON Foundation has 2 wallets with in total around ~570M tokens, at the moment there are around 5B tokens, so this would be ~11.3% of the supply. This was given by miners. These wallets also seem quite active, with 9 tx in the last 4 days. There is also a list of early miners. The highest address has a bit above 2% of the supply. Keep in mind that TON has 0.6% inflation per year, so this will dilute.

TON Technology

Transaction Details

How it works

"An ad hoc Byzantine Fault Tolerant Catchain protocol was developed to ensure that stakeholders achieve consensus as long as the number of cheaters among them is 1/3 or less."

  • From their docs (14-12-2022):

"A sequence of transactions Tx1 -> Tx2 -> Tx3 -> .... may be called a chain. And in the considered case it is called AccountChain to emphasize that it is the chain of a single account of transactions. We can get a few AccountChains and store them together, such a set of AccountChains is called a ShardChain. In the same way, we can cut ShardChain into ShardBlocks, which are an aggregation of individual AccountBlocks. An aggregation of all shards which contains all accounts behaving by one set of rules is called a Blockchain. In TON there can be many sets of rules and thus many blockchains which operate simultaneously and can interact with each other by sending messages crosschain in the same way that accounts of one chain can interact with each other.

If you want to customize rules of the group of Shardchains, you could create a Workchain. A good example is to make a workchain that works on the base of EVM to run Solidity smart contracts on it. Theoretically, everyone in community can create own workchain. In fact, it's pretty complicated task to build it, after that to pay (expensive) price of creating it and receive 2/3 of votes from validators to approve creation of your Workchain. TON allows creating up to 2^30 workchains, each subdivided to up to 2^60 shards. Nowadays, there are only 2 workchains in TON: MasterChain and BaseChain."

"Its purpose is to provide a platform for decentralized applications (dApps) and smart contracts. It is based on a multi-blockchain architecture and consists of a master chain, several working blockchains, and sharding protocols.

Some of TON’s Components:

  1. The TON P2P (peer-to-peer) Network which is for accessing the TON Blockchain, sending transactions candidates, and giving blockchain updates to a client
  2. Distributed storage, or TON Storage, which archives copies of blocks and snapshots.
  3. TON Proxy, which users can anonymously access and use the network through.
  4. A distributed hash table.
  5. A platform for services that feature UI that is browser/app-like for easy use through a smartphone.
  6. TON DNS, which, like DNS for the Internet, assigns human-readable names to smart contracts, accounts, services, network nodes, and smart contracts.
  7. A platform for micropayments called TON Payments

So about that “1million tps”. That sounds crazy, right? Well, this is made possible due to TON’s unique architecture. The TON blockchain is made up of a “collection of two blockchains”. That is, a master blockchain (or masterchain) and several working blockchains (or workchains). The master blockchains are responsible for being a repository of the protocol’s general information, information about validators, workchains and their shards, and the hashes of the work- and sharchains’ most recent blocks. The workchains, on the other hand, contain information on events like smart contract transactions and value-transfer. In terms of consensus, the blockchain uses a proof of stake mechanism.

What is interesting about the workchains is that they themselves can be split up into shard blockchains (or shardchains). Each shardchain is tasked with handling transactions for a subset of accounts. The network has an impressive block time of 5 seconds, and can split workchains into 260 shards, allowing for much less network stress and congestion."

  • On its sharding mechanism. From the TON blog (16-8-2022):

"The number of shards is not fixed - TON supports adding more and more shards as needed with an upper bound of 2^60 ( per workchain). This number is practically limitless, enough for every person in the world to be allotted 100 million shards, and still have spare.

The number of shards is elastic - TON supports automatic splitting of shardchains in two when the load is high, and then merging them back together when the load is low. This is the only way to deal with dynamic scaling requirements that are impossible to predict in advance. As load on a specific shardchain increases, it will be split in two. Since smart contracts instances are atomic, they're never broken in half. This means that some smart contract instances that once lived on the same shardchain may one day find themselves residing on different ones!

If [a] token is held by 1,000,000 different users, there will be exactly 1,000,001 contract instances deployed. This is where the magic of auto-sharding happens. By default, all contract instances will be found on a single shardchain. But, if these users start issuing a large number of transactions and this single shardchain is under high load, TON will automatically split it into smaller shardchains. Theoretically, the system can keep splitting and splitting until every contract instance is found on a dedicated shard. That's the secret that enables TON to scale to billions of users."

  • From the TON blog (28-4-2022):

"Calls between smart contracts are asynchronous and not atomic:

If you imagine Ethereum as a monolith on a single server, TON is more similar to a cluster of microservices. Think that every smart contract may be running on a different machine. If two smart contracts want to call each other, just like two microservices communicating, they can send a message over the network. This message takes some time to travel, so communication is suddenly asynchronous! This means that when your smart contract calls a method of a different smart contract, the call will be processed after the transaction terminates, on some different future block.

This is much more difficult to reason about. What happens if conditions change from when the message was sent and until it was received? For example, the calling contract balance had one value, but by the time the second contract processes the call, the balance has changed. Maintaining consistency is more difficult and bugs can creep up. What about atomicity? What happens if you chain three calls and only the last one fails? If you need to roll back all the changes, you will have to do so manually. Smart contracts on TON can only communicate by sending asynchronous messages. If you need to query data from another contract and you require the answer immediately, you're out of luck.

Smart contract code is not immutable and can easily be modified:

“Smart contracts are free to modify their own code just like writing to any other state variable. If a contract writes to the code variable, it is mutable, and if it doesn't, it is immutable.

Wallets are contracts and one public key can have multiple wallets deployed:

On TON, wallets are not implied, they are independent smart contracts that must be deployed like any other smart contract. When a new user wants to start using TON blockchain, their first step would be to deploy a wallet on-chain. The address of this wallet is derived from the wallet contract code and various init parameters like the user's public key.

This means that a user can have more than one wallet deployed, each with its own address. The wallets can differ on their code (different official code versions are published by the foundation from time to time) or on their init parameters (one of these parameters is normally a sequence number). This also means that a user that knows their private key must still make a conscious effort to remember their wallet address (or the init parameters used in its construction).

Sending a transaction to some dapp on TON involves signing a message using the user's private key. Unlike Ethereum, this transaction is not sent to the dapp smart contract, but to the user's wallet contract, which will in turn forward the message to the dapp smart contract.

This design approach opens up a new dimension of flexibility on TON. New wallet contracts can be invented by the community over time, for example consider a wallet without a nonce (transaction sequence number) that allows multiple transactions to be sent in parallel from different clients without prior synchronization. In addition, special wallets like multi-sig wallets (that also on Ethereum require a special smart contract to be deployed), behave just like their regular counterparts."

Fees

  • From the TON blog (28-4-2022):

"The fee model on TON is quite different [compared to Ethereum]. Instead of emulating a bank account [a 1 time fee per tx], TON is inspired from web apps like * instant messengers*. Who is paying the cost to send a message on Facebook Messenger? It's definitely not the person initiating the transfer. The app developer is actually covering the costs, and it's up to Facebook Inc to recover these costs somehow and fund itself.

Accordingly, in TON, the dapp itself needs to pay for its own resource costs. Every smart contract holds a TON token balance and uses this balance to pay rent. If the smart contract runs out of money, it will eventually be deleted (don't worry, everything is recoverable). Notice that paying for chain storage doesn't happen once, the rent payment is continuous. If you only hold data for a short period of time, you will pay significantly less. These fee economics are more in line with the costs of miners and thus easier to scale.

Very similar to Facebook Inc, the contract developer in TON has a lot of freedom to choose how to fund its operation. The developer can fund the contract with TON tokens out of pocket and subsidize its users; or it can charge gas from users for different actions and keep this gas in its balance for future rent payments."

Upgrades

Staking

"Validators stake Toncoin for a fixed specific term, and the stake is refunded with interest after the completion of a validation round. Should a validator attempt to cheat or be unavailable during a validation round, its stake is partially or fully forfeited as a penalty. The TON Nominator service allows Toncoin holders to lend their asset to owners of validator nodes (validators). Toncoin earned by the validator is distributed to those that lent their assets to the validator."

Validator Stats

" Currently, the average validator stake is 600k Toncoin. ~270 Toncoin / per day. Average income daily generated by validator node with average stake as of May 2022."

According to TONwhales the minimum for staking is at least 350,000 TON.

Mining

"In June 2020, all of the available Toncoin tokens (98.55% of the total supply) became available for mining. The tokens were placed in special Giver smart contracts, allowing anyone to participate in the mining — up until 28 june 2022. Users mined around 200,000 TON daily. Today, two years later, the last Toncoin was mined, signaling the successful closure of TON’s initial distribution.

Although all PoW Giver smart contracts have been completely emptied and TON mining is no longer available in a classical sense, the TonWhales team has developed a fascinating solution for miners who want to continue mining Toncoin: a pool for perpetual Toncoin mining called Infinity TON Mining Pool."

Which indeed seems to happen: "InfinityTON pool is the only pool where you can continue to mine TON."

Liquidity Mining

Scaling

"The system can potentially accommodate up to 232 workchains, each of which can be subdivided into up to 260 shardchains with near-instant cross-shard and cross-chain communication, resulting in millions of transactions per second."

Interoperability

Other Details

Oracle Method

Projects

"Pavel Durov—the messaging platform’s founder and CEO—announced that the company would begin building “non-custodial wallets” and “decentralized exchanges” that would let millions of users safely trade their crypto. The executive argued that the project should be more than feasible: the development of Fragment, Telegram’s decentralized auction platform, “took only 5 weeks and 5 people, including myself,” according to Durov. The marketplace, which launched last month, has already raked in $50 million worth of Toncoin by selling tokenized usernames on the blockchain." ==Roadmap==*Can be found here (Q3 2022). Has TON Storage and Bitcoin & EVM crosschain on its roadmap.

Usage

Projects that use or built on it

  • Can be found here (15-12-2022).
  • Ston.fi; AMM, with around ~600k TVL (14-12-2022). Has 7 coins to swap.

Pros and Cons

Pros

Cons

Competition

  1. "Your smart contract needs to pay rent and charge its users
  2. Calls between smart contracts are asynchronous and not atomic
  3. Smart contract code is not immutable and can easily be modified
  4. Wallets are contracts and one public key can have mutliple wallets deployed"

Team, Funding, Partners

Team

"Two developers known as Anatoliy Makosov and EmelyanenkoK initiated Newton open-source community aimed at further development and support of TON on the open source principles. Newton team, in turn, got renamed as TON Foundation. By now over 40 independent non-incorporated developers from various geographies work on the project as TON Foundation not-for-proft community funded by donations."

  • TON Labs; The project’s ex core infrastructure developers
  • Has TONcoin Fund, which invests in TON related projects (27-7-2022).

Funding

  • Has (12-2022) a TONcoin Fund of $250M in partnership with Orbs, MEXC Global, Huobi Incubator, KuCoin Ventures, Cypher Capital, Kilo and the TON Alpha-Vista Incubation, which is a $90M ecosystem builder for The Open Network (TON), backed by VistaLabs and Alphanonce.
  • Part of (9-3-2020) the portfolio of Arrington XRP Capital.
  • Raised $90M for a new ecosystem fund continuing its recent attempts to get the Telegram-founded blockchain project back into gear (7-7-2022).

Partners