The Architecture Behind The Open Network

Article image

In the recently announced TFxTelegram initiative, we described the vision of building the TON Ecosystem into a SuperApp, where you can interact with hundreds of projects on a single platform. There are multiple checkboxes to tick before this happens, and technical feasibility is one of the major ones.

It's no easy task to build a blockchain ecosystem that supports millions, if not hundreds of millions, of users and provides a seamless and affordable experience. We believe that to this day, no blockchain can provide infrastructure on this scale except The Open Network.

One of the core features of The Open Network is its ability for high scalability and throughput. TON achieves this by dynamic sharding the blockchain into multiple shards or shardchains, each of which can process transactions independently and in parallel. Sharding splits the blockchain state into smaller pieces so that each set of nodes only needs to store and validate a subset of the data.

Technically speaking, this should allow TON to scale up infinitely and handle millions of transactions per second from billions of users without sacrificing speed, security, or decentralization.

We understand that dozens of blockchains have made similar claims over the past years, but at TON Foundation, we believe every claim must be backed by concrete evidence.

To understand how TON can achieve such high transaction speed at a fraction of competitors' network fees, one must understand its architecture.

Architecture at a Glance

The TON Blockchain consists of one masterchain and up to 2^32 workchains. Each workchain is a separate chain with its rules. Each workchain can further split into 2^60 shardchains, or sub-shards, containing a fraction of the workchain's state. Currently, only one workchain is operating on TON - basechain.

Each workchain can split into one quintillion, one hundred fifty-two quadrillion, nine hundred twenty-one trillion, five hundred four billion, six hundred six million, eight hundred forty-six thousand, nine hundred seventy-six shardchains.

This means that TON is not just a single blockchain but a blockchain of blockchains. It allows for the operation of multiple workchains, each potentially having its own rules and token economics yet still interoperable.

You can visualize this as a hierarchical, sharded blockchain ecosystem where the masterchain sits at the top of the hierarchy, sharding into workchains, then sharding into shardchains.

Masterchain

The Masterchain is the primary chain that stores the network configuration and the final state of all workchains. You can understand this as the masterchain being the core directory, a single source of truth for all the shards in the ecosystem.

It carries fundamental protocol information, including current settings, a list of active validators and their stakes, active workchains, and associated shardchains. Most importantly, it maintains a record of the latest block hashes for all workchains and shardchains, enforcing consensus across the network.

Workchain

The Masterchain splits into individual chains called Workchains. Workchains are customized blockchains tailored to certain transactions or use cases, running parallel within the TON network.

For example, a blockchain game that requires thousands of transactions can run on its own workchain and transaction fees without competing for resources with other projects. They can have their own rules, consensus mechanisms, and tokenomics, but they all sync up with the Masterchain for validation and interoperability. The decentralization of work across multiple workchains allows for better scalability and higher transaction speeds.

Given TON's heterogeneous nature—which allows multiple, distinct blockchains to function within a unified ecosystem and interact— unique cross-chain solutions are possible. All workchains must agree on fundamental interoperability standards to support inter-workchain interactions.

Shardchain

Sharchains are sub-chains of workchains, identified by a 60-bit shard prefix, which indicates accounts (addresses) that belong to a specific shardchain. For example, a shard prefix of 01 means that the shardchain contains all accounts whose addresses start with 01. When a transaction needs to be processed, the network can quickly determine which shardchain should handle it by looking at the first 60 bits of the account address and matching it with the appropriate shard prefix.

Thanks to the 60-bit prefix, many shardchains can coexist within a single workchain, allowing for extensive scalability.

The length of 60 bits allows TON to have a wide range of shard prefixes, making it possible to split or merge shardchains dynamically to balance the workload. When a shardchain becomes too large or too small, it can be split or merged with another shardchain to ensure that each shardchain has an appropriate size.

Sharding

Dynamic sharding is TON's key feature that enables high scalability. As described above, the ability to shard into individual workchains and shardchains allows TON to "distribute" transactions, effectively removing the bottleneck of processing transactions on a single blockchain.

Every shardchain periodically communicates its state to the Masterchain, keeping an index of all shards and their state. Shardchains can also communicate with each other via Hypercube routing, ensuring that transactions can occur across the entire ecosystem.

Integrating sharded architecture with Masterchain, Workchains, and Shardchains creates a highly scalable, decentralized, and flexible blockchain ecosystem, allowing TON to support many use cases and extremely high transaction volumes.

Validators

Validators participate in the network by providing computing power and staked Toncoin to maintain its integrity, security, and continued operation - their servers are responsible for validating new blocks and confirming transactions on the blockchain.

Unlike traditional centralized networks, where a single entity has unlimited control, TON relies on a decentralized PoS mechanism to agree on the state of the blockchain. In this consensus, validators must "stake" or lock up a certain number of Toncoin. This staking serves as both an eligibility criterion for validators and a form of security for the network.

The role of a validator is not fixed but continually updates in a process that considers various factors, such as the size of their stake, the uptime and performance of their servers, and their behavior. The validator set is also periodically reshuffled to prevent collusion or malicious activity, ensuring the network remains resilient to various attacks.

Moreover, validators serve not just a single shard or workchain; their operations are integral to the entire ecosystem, from the Masterchain down to individual shardchains. They're involved in processing transactions, executing smart contracts, and even playing a part in TON's cross-chain interoperability features and governance.

By performing these roles, validators make TON a secure, scalable, and efficient blockchain network capable of supporting various applications and services. The staking and consensus mechanisms ensure that validators have skin in the game, keeping them interested in TON's long-term success and security.

Moving Forward

The architecture of The Open Network exemplifies foresight. Scalability and transaction speed issues plaguing many blockchain networks find solutions on TON. Its multi-faceted structure, from masterchain to shardchains, optimizes efficiency, scalability, and security.

TON is not only built to solve the problems of the present. TON Foundation is pushing The Open Network to its limits, challenging it with innovations that might only be meant for years into the future on other Layer-1 blockchains. Today, The Open Network is on the verge of setting a new benchmark in blockchain performance.

At this article's release, TON Foundation is preparing for a public performance test that might set a new world record. We invite the community and enthusiasts to join us in this thrilling journey as we strive to enhance and expand the TON ecosystem. With robust architecture as TON's backbone, the future of our ecosystem is bound to see unprecedented advancements and exciting partnerships for a long time to come.