Creative Studio Name LinkedIn Article Cover Image

With a whopping number of 800M users worldwide, Telegram is the perfect channel to distribute web3 functionalities, so a Telegram Wallet to send/receive cryptocoins is a straighforward idea to implement. But the story of Telegram and blockchain is more than that, it’s a full and vibrant ecosystem.

Introduction

The emergence of TON (The Open Network), particularly its integration with the Telegram messaging app, has generated considerable buzz in the cryptocurrency and blockchain communities. This in-depth analysis aims to elucidate the nature of TON, its wallet services, and its standing in the blockchain ecosystem, particularly in comparison to other wallets like MetaMask.

The Evolution of TON

Initially known as the Telegram Open Network, TON was conceptualized to leverage the popularity of the Telegram app for introducing users to cryptocurrencies. Developed by the Durov brothers, Nikolai and Pavel, TON aimed to create a seamless connection between internet users, blockchain technology, and cryptocurrency.

The network faced regulatory challenges from the SEC regarding its native coin, GRAM, leading to a pause in development. The project refunded investors and distanced itself from Telegram, eventually relaunching as The Open Network (TON) with Toncoin as its native token and a shift to a Proof of Stake (PoS) consensus model.

Introduction to TON

TON is a decentralized Layer 1 smart contract network, designed to support both routine and specialized financial applications. It boasts the creation of over a million NFTs, reflecting its capacity for a wide range of tokenization. TON’s commitment to scalability and efficiency is evident in its design, tailored to accommodate billions of users while maintaining high performance.

TON and Telegram

The integration of TON with Telegram is a strategic move to bridge everyday internet users with blockchain technology. The whitepaper released by Nikolai Durov outlined the vision for this integration, focusing on the GRAM coin as a borderless medium for peer-to-peer transactions. Despite initial challenges, the project’s relaunch under the TON moniker retains its goal of widespread blockchain adoption through the popular messaging app.

How Does TON Work?

TON’s operational framework is built for flexibility, speed, and cost-effectiveness. Key features include:

  • Proof of Stake Consensus: TON uses a Byzantine Fault-Tolerant variant of the PoS algorithm, prioritizing energy efficiency and reduced resource demands compared to PoW.
  • Sharding: This technology divides the network into multiple shardchains, each capable of independent transaction processing, significantly enhancing scalability.
  • TON Virtual Machine (TVM): Similar to Ethereum’s EVM, the TVM handles the execution of smart contracts and manages the network’s state.

The masterchain coordinates the network, managing validator nodes and synchronizing components, while the workchains process requests from smart contracts and decentralized applications.

Toncoin and Governance

Toncoin serves multiple roles within the TON ecosystem, including transaction fee payments, validator rewards, and governance. The governance model, managed by the Orbs Network, allows community members to submit proposals, emphasizing transparency and inclusivity. This model enables collective decision-making, with recent notable decisions including the proposal to freeze a substantial amount of Toncoin.

Tokenomics

The circulating supply of Toncoin is over 3.4 billion, with a total supply nearing 5.1 billion as of September 2023. The supply is expected to increase as validators receive rewards. Toncoin is available on various exchanges, both centralized and decentralized.

The Telegram Wallet: A Fusion of Messaging and Crypto

Incorporated within the Telegram app, the Telegram wallet is a striking example of the convergence of messaging and financial technology. It allows users to execute transactions and engage with financial services directly in the app, vastly simplifying the crypto experience. This integration is especially beneficial for those new to cryptocurrencies, offering an intuitive and accessible entry point into the world of digital currencies.

Exploring the TON Space

The TON space encompasses an entire ecosystem built around the TON blockchain. It includes innovative services like TON DNS, TON Storage, and TON Payments, creating a robust and versatile environment for decentralized applications. This ecosystem transforms TON into a comprehensive infrastructure, similar to a decentralized internet, supporting a multitude of applications and services within its network.

Feature TON Ethereum 2.0 Solana
Block Time 5 sec. 12 sec. 1 sec.
Time-to-Finality Under 6 sec. 10–15 min. 6.4 sec.
Simple Transaction Performance High Potentially high High
Complex Transaction Performance High Low Very low
Sharding Support Max. 2^60 shards per workchain Max. to 2^6 shards None
Cross-shard communication Near-instant Slow time-to-finality None

In the blockchain ecosystem, TON (The Open Network), Ethereum 2.0, and Solana represent distinct approaches to scalability, transaction speed, and network efficiency. Here’s a comparative analysis based on the provided metrics:

Block Time

  • TON stands in the middle ground with a block time of 5 seconds, while Ethereum 2.0 has a longer block time of 12 seconds, and Solana leads with a rapid block time of just 1 second.

Time-to-Finality

  • TON showcases an impressive time-to-finality of under 6 seconds, which is the time taken for a transaction to be considered final and irreversible. Ethereum 2.0 lags significantly behind with a time-to-finality of 10 to 15 minutes. Solana offers a competitive time-to-finality of 6.4 seconds.

Transaction Performance

  • TON and Solana are on par, offering high performance for both simple and complex transactions. Ethereum 2.0, while potentially high for simple transactions, drops to low for complex transactions, indicating a possible decrease in efficiency when handling more sophisticated operations.

Sharding Support

  • TON provides extensive sharding capabilities, with support for up to 2^60 shards per workchain, which speaks to its highly scalable nature. Ethereum 2.0 supports sharding as well but to a lesser extent, with a maximum of 2^6 shards. Solana does not utilize sharding, relying on its single-layer architecture to maintain high throughput.

Cross-Shard Communication

  • The ability for different shards to communicate efficiently

is a clear advantage of TON, which boasts near-instant communication between shards. This is crucial for maintaining the network’s high throughput and operational efficiency. Ethereum 2.0, on the other hand, experiences slower times due to its more complex cross-shard communication processes. Solana, operating without sharding, does not require cross-shard communication mechanisms.

This comparison reveals TON as a robust contender in the blockchain space, striking a balance between speed, efficiency, and scalability. Ethereum 2.0, while slower, offers potentially high transaction performance and

The comparative analysis of TON, Ethereum 2.0, and Solana highlights each network’s strengths and weaknesses. TON showcases a moderate block time of 5 seconds with rapid finality at under 6 seconds, ensuring swift and irreversible transactions. Its capacity for high performance in both simple and complex transactions, alongside maximal sharding capabilities of up to 2^60 shards per workchain and near-instant cross-shard communication, indicates a strong emphasis on scalability and efficiency.

Wallet Custodianship: Empowering Users

TON’s approach to wallet custodianship leans towards self-custody, granting users complete control over their private keys and assets. This model of self-custodianship is pivotal in empowering users, ensuring that they have unfettered access and autonomy over their funds. The provision of recovery phrases for account security is a critical aspect of this model, emphasizing the user’s responsibility in managing their security details.

Private Key Storage: On the User’s Device

In TON’s security architecture, private keys are stored on the user’s device, a method that significantly bolsters security. This local storage of keys ensures that users have exclusive control over their assets. However, this also places the responsibility of secure storage and backup on the users, necessitating careful management of recovery phrases to avoid potential loss of access to their funds.

TON Blockchain Security Features

To conduct a security analysis of TON (The Open Network) it’s important to consider various aspects of blockchain technology and wallet security features.

  1. Sharding Mechanism: TON uses an “Infinite Sharding Paradigm,” significantly enhancing scalability and performance. This approach allows for parallel processing of transactions and smart contracts, reducing congestion and increasing efficiency.

  2. TON Virtual Machine (TVM): TVM, akin to Ethereum’s EVM, processes commands from contract applications and manages network state changes. This system contributes to the security and flexibility of the network.

  3. Dynamic Shardchains: TON can automatically split and merge shardchains based on network load, maintaining optimal performance and mitigating risks associated with high transaction volumes.

  4. Proof of Stake (PoS) Consensus: TON operates on a PoS model, adding an extra layer of security against malicious actors. This model is less resource-intensive compared to Proof of Work (PoW) and reduces the risk of centralized control.

  5. High Transaction Speed and Scalability: TON has demonstrated impressive transaction speeds, reportedly surpassing Visa’s speed and reaching approximately 100,000 transactions per second (TPS) during test runs. This speed is backed by a scalable architecture that can handle a high number of transactions without compromising security.

  6. Security Audits: The network’s architecture and performance have been authenticated by security partners like CertiK, confirming TON’s stability and security.

Web3 Services on TON

TON Storage

TON Storage is a significant leap in blockchain data storage, aligning with the decentralized and flexible nature of blockchain technology. Unlike traditional storage solutions, TON Storage utilizes torrent-based peer-to-peer file-sharing technology, enabling users worldwide to upload and access data at consistent speeds. Unique identifiers allow for the retrieval of stored data, ranging from basic files to multimedia content. This system not only enhances data accessibility but also allows for seamless integration with other network components, such as TON NFTs.

TON Domain Name Service (DNS)

The TON DNS transforms the complexity of alphanumeric wallet addresses into user-friendly, readable names. This feature significantly simplifies transactions by allowing users to send funds to easily recognizable names like “yourname.ton.” The service converts these names into smart contract addresses compatible with other TON components, including TON Sites. Furthermore, domain names on TON are implemented as NFTs, offering the same versatility and ownership properties, including the creation of subdomains.

TON Proxy and Sites

At its core, TON functions both as a data repository and a computational network. For developers, this dual functionality means TON can handle a variety of CRUD operations necessary for application interaction. TON Proxy establishes a bridge between developers’ applications and the TON blockchain, catering to a range of use cases from centralized exchanges to DeFi platforms. This proxy service is continually optimized for enhanced user privacy and network security. Additionally, TON Sites allow users to host web servers and launch websites directly on the TON network, ensuring automatic security and privacy through encryption and verification processes.

A Comparison: TON VS Vs Ethereum VM

The TON Virtual Machine (TON VM) and the Ethereum Virtual Machine (EVM) both serve as the backbone for executing smart contracts on their respective blockchain platforms. However, due to their differing design philosophies and technical implementations, certain features are unique to each, while others are shared. Below, I’ll outline features exclusive to each VM, common features, and then present a comparative table.

Features Exclusive to TON VM

  1. Dynamic Sharding: The TON VM operates within a blockchain designed for dynamic sharding, allowing the network to efficiently scale by dividing and processing transactions and smart contracts across multiple blockchain shards.

  2. Multi-Language Support: Designed with flexibility in mind, the TON VM supports a wider range of programming languages, making it more accessible to developers from different backgrounds.

  3. High-Speed Transaction Processing: Leveraging the Infinite Sharding Paradigm, the TON VM is optimized for high-speed transaction processing, aiming to handle millions of transactions per second.

  4. Hybrid Consensus Mechanism: The TON blockchain employs a hybrid consensus mechanism that is not directly a feature of the TON VM but significantly affects its operation and the execution of smart contracts.

Features Exclusive to EVM

  1. Turing Completeness with Gas Limit: The EVM is Turing-complete, meaning it can execute any computable function given enough resources (gas), with a gas limit per block to prevent abuse and infinite loops.

  2. Solidity and Vyper Support: The EVM primarily supports smart contracts written in Solidity or Vyper, languages specifically designed for Ethereum smart contract development.

  3. Established Developer Ecosystem: The EVM benefits from a more mature and extensive developer ecosystem, with a wide range of tools, libraries, and frameworks available for smart contract development.

  4. EVM-specific Opcode Set: The EVM uses a unique set of opcodes tailored for Ethereum’s smart contract execution, including specific instructions for token creation, cryptographic operations, and more.

Common Features

  1. Smart Contract Execution: Both VMs are designed to execute smart contracts in a decentralized and isolated environment.

  2. Gas Fees: Both use a gas system to meter computation and limit the resources a single smart contract can consume, protecting the network from spam and denial-of-service attacks.

  3. Isolated Execution Environment: Both VMs ensure that smart contracts are executed in an isolated environment, preventing them from directly accessing network resources or other contracts’ states without explicit permissions.

  4. Decentralized Applications (dApps) Support: They both provide the foundational layer for developing and deploying dApps, offering developers a platform to build decentralized services and applications.

Comparative Table

Feature TON VM EVM
Sharding Dynamic, integral to scalability Not natively supported
Programming Languages Supports multiple languages Primarily Solidity and Vyper
Transaction Processing Speed Optimized for high-speed processing Limited by block time and gas limit per block
Consensus Mechanism Influence Hybrid consensus impacts operation PoW (moving to PoS with Ethereum 2.0)
Developer Ecosystem Growing, less established Extensive, with numerous tools and libraries
Gas System Yes, for computation metering Yes, with gas limit for block and transaction fees
Isolation Yes, isolated smart contract execution Yes, provides a secure execution environment
Turing Completeness Depends on implementation details Yes, but with practical limitations (gas limit)
Main Use Cases High-speed transactions, scalable dApps General-purpose dApps, DeFi, NFTs, and more

This table highlights the distinct characteristics and commonalities between the TON VM and the EVM, reflecting their different approaches to achieving a decentralized execution environment for smart contracts and dApps.

Writing TON Smart contract

Writing and deploying a smart contract on the TON (Telegram Open Network) involves several steps, similar in nature to the process on other blockchain platforms but with nuances specific to TON’s technology stack. Below, I’ll outline a simple example of a smart contract written for the TON network, followed by a description of the general flow from code writing to deployment.

Example: A Simple TON Smart Contract

For demonstration purposes, let’s consider a very basic smart contract that stores and updates a message. TON smart contracts can be written in FunC, a programming language designed specifically for the TON blockchain. This example is simplified to illustrate the concept:

// SimpleMessageContract.fc

// Declare the contract
pragma ton-solidity >= 0.35.0;

// Import necessary components
import "ton-sdk/tvm.h";

// Define the contract
contract SimpleMessageContract {
    // Variable to store the message
    string public message;

    // Constructor to initialize the contract with a message
    constructor(string initialMessage) public {
        tvm.accept();
        message = initialMessage;
    }

    // Function to update the message
    function updateMessage(string newMessage) public {
        tvm.accept();
        message = newMessage;
    }
}

This contract has a variable message to store a text message, a constructor that sets the initial message upon deployment, and a function updateMessage to change the message stored in the contract.

Flow from Code Writing to Deployment

  1. Code Writing: Start by writing the smart contract code. In this case, we’ve written a simple contract in FunC (the example above uses a syntax reminiscent of Solidity for illustration, but the actual syntax may vary).

  2. Testing and Compilation: Before deployment, it’s crucial to test the smart contract to ensure it behaves as expected. This can be done using a TON-specific development environment or tools. After successful testing, the contract needs to be compiled into TVM bytecode (TON Virtual Machine bytecode), which is the format the TON blockchain can execute.

  3. Create a Wallet: To deploy a smart contract on the TON network, you need a wallet with a balance sufficient to cover the deployment and gas fees. You can create a wallet using TON’s client software or other tools provided by the community.

  4. Deploy the Contract: With the compiled bytecode and a funded wallet, you can deploy the smart contract to the TON blockchain. This is typically done through a command-line interface or a graphical interface provided by TON development tools, where you specify the bytecode file and the necessary deployment parameters.

  5. Interacting with the Contract: Once the contract is deployed, you can interact with it through transactions. In the case of our SimpleMessageContract, you could call the updateMessage function to change the message stored in the contract. These interactions also require transactions on the blockchain, which may incur gas fees.

  6. Monitoring and Management: After deployment, it’s important to monitor the contract’s performance and interactions. Tools and dashboards provided by the TON ecosystem can help you track transactions, changes, and events related to your smart contract.

This flow outlines the basic steps involved in taking a smart contract from code to deployment on the TON network. Each step can involve more detailed sub-steps and decisions, especially around testing, deployment, and management, depending on the complexity of the smart contract and the tools used.

A note on Metamask and TON

For the Ethereum developers who are familiar with tools and wallets for EVM, at the time of writing there is not the possibility to use Metamask for the TON network. MetaMask, which is primarily an Ethereum wallet and browser extension, does not natively support the TON (Telegram Open Network) blockchain. So for the time being the only viable solution is to use a native TON wallet like Tonkeeper. There are plans to develop a Metamask Snip which is a connector able to integrate the Metamask user experience outside the EVM realm.

Conclusion

TON, with its wallet services, emerges as a formidable entity in the blockchain landscape, distinguished by its scalability, user-friendly interface, and robust security features. While it shares some similarities with wallets like MetaMask, its unique features cater to a broad spectrum of users, from cryptocurrency novices to seasoned enthusiasts. As the blockchain ecosystem continues to evolve, TON’s role as an accessible, secure, and versatile platform is poised for growth, potentially revolutionizing the way users interact with blockchain technology and digital currencies.