W3BStation
Markets
BTC $96,420 +2.34% ETH $3,280 +1.82% SOL $185.40 -0.92% BNB $642.50 +0.45% XRP $2.18 +3.12% DOGE $0.082 -1.50% ADA $1.05 +0.80% AVAX $42.10 +1.15%
BTC $96,420 +2.34% ETH $3,280 +1.82% SOL $185.40 -0.92% BNB $642.50 +0.45% XRP $2.18 +3.12% DOGE $0.082 -1.50% ADA $1.05 +0.80% AVAX $42.10 +1.15%
09/27/2024

From Mini-Games to DeFi: What's TON Actually Missing?

Over the past few months, we've witnessed explosive growth across the TON ecosystem, with projects like Notcoin, Dogs, Hamster Kombat, and Catizen launching on Binance. This reportedly brought millions of new KYC-verified users to major exchanges. Whether we acknowledge it or not, this is arguably the largest-scale blockchain adoption event in recent years. The question is: what comes next? Despite a substantial user base, TON's total value locked (TVL) remains relatively low, and we have yet to see a meaningful wave of DeFi protocols emerge.

From Mini-Games to DeFi: What's TON Actually Missing?

Over the past few months, we've witnessed explosive growth across the TON ecosystem, with projects like Notcoin, Dogs, Hamster Kombat, and Catizen launching on Binance. This reportedly brought millions of new KYC-verified users to major exchanges. Whether we acknowledge it or not, this is arguably the largest-scale blockchain adoption event in recent years. The question is: what comes next?

Despite a substantial user base, TON's total value locked (TVL) remains relatively low, and we have yet to see a meaningful wave of DeFi protocols emerge. This has fueled ongoing discussions and concerns about the low on-chain user value on TON and its still-maturing infrastructure.

In this article, however, we want to briefly explore a key concept underlying DeFi — "atomic swaps" — and the problem that LayerPixel (PixelSwap) is working to solve. On one hand, DeFi's early success can be traced back to Ethereum, which became the foundational platform for DeFi applications and smart contracts. On the other hand, the rise of asynchronous blockchains like TON has introduced new opportunities and challenges for DeFi applications, particularly around composability.

A Brief History of DeFi

The DeFi ecosystem flourished during "DeFi Summer," with Ethereum at the center of it all. Developers leveraged the Ethereum ecosystem, with smart contracts serving as foundational building blocks that could be snapped together like Lego pieces. This composability provided the network effects needed for the rapid spread of decentralized financial applications and services.

Ethereum's composability model allowed diverse DeFi protocols to interact in creative ways. Core financial primitives — atomic swaps, flash loans, rehypothecation, and lending platforms — demonstrated how different applications could be stacked on top of one another to produce complex, flexible financial products.

As DeFi matured, the limitations of Ethereum's synchronous model — primarily around scalability and high transaction fees — became increasingly apparent. This drove interest in exploring new blockchain architectures, such as asynchronous blockchains, which promised to address some of these inherent constraints.

Asynchronous Blockchains: A New Paradigm

Ethereum's traditional model is synchronous — it maintains a single monolithic state where every transaction is processed sequentially. Asynchronous blockchains like TON, by contrast, use an actor model approach. This shift introduces several fundamental structural differences:

Ethereum — Synchronous Blockchain (Single Monolithic State):

  • Atomic operations: Direct atomic transactions are possible because each transaction (even one that modifies the state of multiple smart contracts) can be treated as a single unit of work. The Ethereum Virtual Machine (EVM), for example, safely isolates all steps within a transaction, ensuring they either execute completely or not at all.
  • Sequential processing: Each transaction must wait for the previous one to complete, which inherently limits throughput and scalability.
  • Global state: All transactions operate on a single shared global state, which simplifies state management but amplifies contention.

TON — Asynchronous Blockchain (Actor Model):

  • Parallel processing: Transactions can be processed concurrently across multiple actors or smart contracts, improving overall scalability and throughput. On TON, smart contracts are self-contained units, or actors, that run independently and use one-way messages to update state between actors.
  • Distributed state: Different actors maintain their own separate states. They 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.

While asynchronous blockchains offer significant scalability advantages (at least in theory), the absence of atomic swaps has made DeFi development on TON considerably difficult — on top of the inherent challenge of working with the FunC/Tact language. Consider this: without atomic operations and sequential processing, providing liquidity for lending protocols becomes extremely hard, regardless of how ambitious the DeFi Lego ambitions may be.

With LayerPixel and PixelSwap (PixelSwap runs on LayerPixel's infrastructure and is part of the LayerPixel ecosystem), we introduce a novel approach to solving this problem — making atomic swaps possible and striving to deliver a safer, more robust solution for swapping and DeFi.

The Challenge of DeFi Composability on Asynchronous Blockchains

Maintaining composability on asynchronous blockchains presents complex challenges for DeFi applications, stemming primarily from distributed state and parallel execution:

Transaction Coordination:

  • Synchronization: Coordinating multiple actors to reach a consistent state at a specific point in time is complex. Unlike atomic operations simplified by synchronous global state, ensuring that multiple independent actors can operate in lockstep poses significant obstacles.
  • Consistency models: Asynchronous systems typically rely on weaker consistency models, such as eventual consistency. Ensuring that all involved actors converge on a shared state without divergence becomes a logistical challenge.

State Consistency:

  • Concurrency control: In a distributed environment, race conditions can arise when multiple transactions attempt to update overlapping states. This requires sophisticated mechanisms to ensure transactions are properly serialized without becoming a bottleneck for the system.
  • State reconciliation: Divergent states across actors need to be reconciled, and rollback mechanisms (in case part of a transaction fails) must be robust enough to gracefully reverse changes without introducing any inconsistencies.

Error Handling:

  • Atomicity: Ensuring that all parts of a transaction either succeed or fail completely is difficult in an environment where state is distributed and operations are not atomic by default.
  • Rollback mechanisms: Efficiently rolling back partial transaction state changes without leaving any inconsistencies behind requires advanced techniques.

Pixelswap: Bridging the Composability Gap

Pixelswap's innovative design addresses these challenges by introducing a distributed transaction framework built specifically for the TON blockchain. The architecture follows BASE principles (BASE: an alternative to ACID) and consists of two core components: a transaction manager and multiple transaction executors.

The Saga Transaction Manager

The Saga Transaction Manager orchestrates complex, multi-step transactions, overcoming the limitations of 2PC by adopting the Saga pattern — well-suited for long-running distributed transactions:

  • Lifecycle management: Manages the full transaction lifecycle by breaking it down into a series of smaller, independently executable steps, each with its own compensating action in case of failure.
  • Task assignment: Splits the primary transaction into discrete, isolated tasks and assigns them to the appropriate transaction executors.
  • Compensating actions: Ensures that every saga has a corresponding compensating transaction that can be triggered to undo partial changes, preserving consistency.

Transaction Executors

Transaction executors are responsible for carrying out the tasks assigned within the transaction lifecycle:

  • Parallel processing: Executors operate concurrently, maximizing throughput and balancing system load.
  • Modular design for extensibility: Each transaction executor is designed to be modular, enabling the deployment of diverse functionality. These functions can include various financial operations such as different swap curves, flash loans, lending protocols, and more. This modularity ensures these features can be seamlessly coordinated with the Saga Transaction Manager, upholding the core principle of DeFi composability.
  • Eventual consistency: Ensures that the local state of executors remains synchronized and reconciled with the overall distributed state of the transaction.

With these features, Pixelswap's transaction executors enable robust, scalable, and asynchronous transaction execution — making it feasible to build complex, composable DeFi applications on TON.

Conclusion

In summary, the future of DeFi demands embracing the paradigm shift from synchronous to asynchronous blockchains while still preserving and enhancing critical principles like composability. Pixelswap emerges on the TON blockchain as a breakthrough solution — elegantly combining robustness, scalability, and composability. By ensuring seamless interoperability and resilient transaction management, Pixelswap paves the way for a more dynamic, scalable, and innovative DeFi ecosystem.