What are we still missing on TON, from small games to DeFi?

CN
4 hours ago

TON's ecosystem is growing rapidly, but DeFi development is limited.

Article by: LayerPixel

Translated by: 白话区块链

In the past few months, we have witnessed the explosive growth of the TON ecosystem, including the launch of Notcoin, Dogs, Hamster Kombat, and Catizen on Binance. It is rumored that this has brought millions of new KYC users to major trading platforms. Whether we admit it or not, this is actually the largest-scale application of blockchain in recent years. But the question is, what's next?

Despite the large number of users, the total value locked (TVL) in TON is still relatively low, and we have not seen the emergence of many DeFi protocols. This has raised concerns and debates about the low user value on the TON chain and its incomplete infrastructure.

However, in this article, we want to briefly discuss an important concept behind DeFi - "atomic swaps" and the problems that LayerPixel (PixelSwap) is addressing. On the one hand, the initial success of DeFi can be traced back to Ethereum, which has become the cornerstone of DeFi applications and smart contracts. On the other hand, the rise of asynchronous blockchains, such as TON, has brought new opportunities and challenges to DeFi applications, especially in terms of composability.

1. A Brief History of DeFi

The DeFi ecosystem flourished during the "DeFi Summer" period, mainly concentrated on Ethereum. Developers utilized the Ethereum ecosystem, with smart contracts as the foundational building blocks that could be combined like LEGO bricks. This composability provided the necessary network effects for the rapid spread of decentralized financial applications and services.

Ethereum's composability paradigm allowed various DeFi protocols to interact with each other in innovative ways. Key financial primitives such as atomic swaps, flash loans, re-collateralization, and borrowing platforms demonstrated how different applications could be stacked together to create complex, multifunctional financial products.

As DeFi matured, the limitations of Ethereum's synchronous model - mainly regarding scalability and high transaction fees - became increasingly apparent. This sparked interest in exploring new blockchain architectures, such as asynchronous blockchains, which promise to address some of these inherent limitations.

2. Asynchronous Blockchains: A New Paradigm

The traditional model of Ethereum is synchronous, maintaining a monolithic state where each transaction is processed sequentially. On the other hand, asynchronous blockchains like TON adopt an actor model approach. This shift results in several fundamental differences in structure:

Ethereum - Synchronous Blockchain (Monolithic State):

  • Atomic operations: Direct atomic transactions are possible because each transaction (even if it modifies the state of multiple smart contracts) can be viewed as a single unit operation. For example, the Ethereum Virtual Machine (EVM) safely isolates all steps in a transaction, ensuring that either all are executed or none are executed.

  • Sequential processing: Each transaction must wait for the previous one to complete, naturally limiting throughput and scalability.

  • Global state: All transactions operate on a shared global state, simplifying state management but exacerbating contention.

TON - Asynchronous Blockchain (Actor Model):

  • Parallel processing: Transactions can be processed concurrently across multiple actors or smart contracts, enhancing overall scalability and throughput. For example, smart contracts on TON are independent units or actors that can update state between actors using one-way messages.

  • Distributed state: Different actors hold isolated states that can interact with other actors, but do not share a single global state.

  • Coordination complexity: Achieving atomic operations in this model is complex due to its distributed nature.

Although asynchronous blockchains have significant implications for scalability (in theory), the lack of atomic swaps makes it quite challenging for TON to develop in DeFi, regardless of the difficulty of using FunC/Tact languages. Without atomic operations and sequential processing, the liquidity of borrowing protocols becomes very difficult, no matter how challenging the DeFi LEGO is.

At LayerPixel and PixelSwap (PixelSwap is using LayerPixel's infrastructure and is part of LayerPixel), we propose a new approach to address this issue, making atomic swaps possible and striving to provide a more secure and better solution for exchanges and DeFi.

3. Challenges of Composability in DeFi on Asynchronous Blockchains

For DeFi applications, maintaining composability on asynchronous blockchains introduces complex challenges, mainly due to the characteristics of distributed state and parallelism:

Transaction Coordination:

  • Synchronization: Coordinating multiple actors to reach a consistent state at a specific point in time is complex. Unlike the simplified atomic operations in synchronous global states, ensuring that multiple independent actors can operate synchronously presents significant obstacles.

  • Consistency model: Asynchronous systems typically rely on weaker consistency models, such as eventual consistency. Ensuring that all relevant actors reach a common state without divergence becomes a logistical challenge.

State Consistency:

  • Concurrency control: In a distributed environment, if multiple transactions attempt to update overlapping states, race conditions may occur. This requires complex mechanisms to ensure that transactions are correctly serialized without becoming a bottleneck for the system.

  • State reconciliation: Reconciling different states between actors and having robust rollback mechanisms (if part of a transaction fails) must be powerful enough to gracefully undo changes without introducing inconsistencies.

Failure Handling:

  • Atomicity: Ensuring that all parts of a transaction either succeed or fail entirely in a state-distributed and operationally non-atomic environment is challenging.

  • Rollback mechanism: Efficiently rolling back partial transaction state changes without leaving residual inconsistencies requires advanced technology.

4. Pixelswap: Bridging the Composability Gap

The innovative design of Pixelswap addresses these challenges by introducing a distributed transaction framework designed specifically for the TON blockchain. The architecture follows the BASE principle (BASE: an alternative to ACID) and includes two main components: the transaction manager and multiple transaction executors.

Saga Transaction Manager

The Saga transaction manager orchestrates complex multi-step transactions, overcoming the limitations of 2PC by applying the Saga pattern, suitable for long-running distributed transactions.

  • Lifecycle management: Manages the entire transaction lifecycle, breaking it down into a series of smaller, independently executable steps, each with its own compensating operation in case of failure.

  • Task allocation: Decomposes the main transaction into discrete, isolated tasks and delegates them to the appropriate transaction executors.

  • Compensating operations: Ensures that each saga has corresponding compensating transactions that can be triggered to undo partial changes and maintain consistency.

Transaction Executors

Transaction executors are responsible for executing the assigned tasks throughout the transaction lifecycle:

  • Parallel processing: Executors operate simultaneously, maximizing throughput and balancing system load.

  • Modular design for feature expansion: Each transaction executor is designed to be modular, allowing for the implementation of various functionalities. These functionalities can include different exchange curves, flash loans, borrowing protocols, and various financial operations. This modular approach ensures that these functionalities can seamlessly coordinate with the Saga transaction manager, maintaining the core principle of DeFi composability.

  • Eventual consistency: Ensures that the local state of the executor remains synchronized and harmonized with the overall distributed state of the transaction.

With these features, the transaction executors of Pixelswap ensure robust, scalable, and asynchronous transaction execution, making it possible to create complex and composable DeFi applications on TON.

5. Conclusion

In conclusion, the future of DeFi requires adaptation to the paradigm shift from synchronous to asynchronous blockchains while maintaining and enhancing key principles such as composability. Pixelswap's emergence on the TON blockchain elegantly combines robustness, scalability, and composability, making it a pioneering solution. By ensuring seamless interaction and robust transaction management, Pixelswap paves the way for a more dynamic, scalable, and innovative DeFi ecosystem.

免责声明:本文章仅代表作者个人观点,不代表本平台的立场和观点。本文章仅供信息分享,不构成对任何人的任何投资建议。用户与作者之间的任何争议,与本平台无关。如网页中刊载的文章或图片涉及侵权,请提供相关的权利证明和身份证明发送邮件到support@aicoin.com,本平台相关工作人员将会进行核查。

Share To
Download

X

Telegram

Facebook

Reddit

CopyLink