How Settlement Time and Composability Help DeFi Flourish on Sui

Sui offers short settlement times and broad composability, supporting the construction of better DeFi products.

How Settlement Time and Composability Help DeFi Flourish on Sui

Sui's decentralized finance (DeFi) success comes down to unique elements of the platform. Two of these core elements, settlement time and composability, not only grant DeFi protocols on Sui a competitive edge but also ensure unparalleled user experiences and development opportunities. 

Settlement timing, a metric based on Sui's transaction processing model, ensures DeFi users see near-immediate results for transactions. Composability, deeply ingrained in Sui's programming environment, extends its reach to both objects and smart contracts. Sui’s deep composability empowers DeFi builders to introduce innovative products, setting themselves apart from DeFi apps on other blockchains. 

With over 20 DeFi protocols launched within Sui Mainnet's first six months, these distinctive Sui-specific features have become a cornerstone for DeFi innovation.

From finality to settlement

DeFi often faces usability challenges due to communication overhead within the underlying network, leading to significant transaction confirmation delays. Waiting 10 minutes, or even 30 seconds, for transaction confirmation falls short for many DeFi use cases. Despite notable advancements in reducing transaction latency with proof-of-stake technology, most blockchains struggle to achieve the minimal latency required to compete effectively with Web2 applications.

When discussing transaction completion, it's important to distinguish between transaction finality and settlement. Time to finality (TTF) denotes the period for a transaction to become non-reversible and eventually recorded onchain. However, TTF does not assure successful transaction execution; the transaction might fail and be recorded as unsuccessful. Settlement time is a clearer metric to gauge a blockchain's transaction latency. One step beyond TTF, settlement time refers to the duration for transaction execution and its outcome to be recorded onchain. It marks the moment users retrieve the actual transaction result, representing the actual latency experienced when submitting a transaction.

Finality and settlement on Sui

On Sui, the settlement path of a transaction hinges on the object types involved. Sui's transaction processing model lets owned objects follow the fast path, while those involving shared objects require consensus validation. Despite the path taken, TTF remains consistent at approximately 400 milliseconds. Owned object transactions also achieve settlement at this point. However, shared object transactions require consensus validation, pushing settlement time to 2 to 3 seconds.

The settlement time of an owned object transaction is as fast it's time to finality, while shared object transactions experience slightly longer settlement times.

Highlighting the importance of defining 'finality,' especially in Layer 2 contexts, it's crucial to note the varied interpretations. In some instances, finality within Layer 2 frameworks refers to the initial transaction finalization with a sequencer before settling into an external network. However, on Sui, a Layer 1 blockchain, settlement stands as an absolute process, completely independent of any external network or additional infrastructure.

Blockchain settlement times vary widely across the industry, from fractions of a second to as long as thirty minutes. However, for most DeFi applications, a consistently fast settlement time is paramount. Surprisingly, certain blockchains, despite boasting low TTF, might still exhibit considerably longer settlement times. This duration directly impacts users and, if overly burdensome, can deter app usage.

On Sui, developers can creatively leverage owned object transactions, fostering the creation of projects with exceptionally low latency. Faster settlement times not only enhance the DeFi user experience but, when combined with robust composability, provide developers the flexibility to execute complex operations swiftly.

Composability

Composability underscores the capacity of software to seamlessly integrate with other systems, reducing reliance on inherent trust. Enabling developers to easily interact with various apps is crucial for inventing new mechanisms and products. Sui drives composability across two important levels of the developer stack: one for objects and data, and another for apps and contracts.

Data and object composability

Sui provides the flexibility for developers to define new object types tailored to encapsulate necessary data fields for their intended use. Once established, these object types gain network-wide recognition, ensuring seamless interaction with an object's data across various applications. This foundational focus on object-centricity within Sui paves a clear path for data and object composability.

Sui emphasizes explicit ownership in its objects, allowing for the easy establishment of hierarchical relationships by linking objects to others. Beyond this, enhanced capabilities arise from an object's ability to reference another object's data. However, direct object referencing through an object field necessitates including all referenced objects in the transaction, regardless of their relevance.

To address this challenge, Sui introduces a dynamic method that enables object incorporation without incurring gas fees for unnecessary objects in transactions. Through dynamic fields, applications or users selectively specify the required objects for reference in a transaction. This innovative development environment significantly optimizes gas usage, fostering greater gas efficiency and a better user experience for DeFi apps.

App and contract composability

While data and object composability is extremely important, enabling applications to interact with others in a composable manner is equally as vital. Despite the facilitation by object composability, app builders encounter additional requirements, notably the need for atomicity.

Atomicity signifies executing a series of transactions either entirely without interruption or not at all. This quality is especially valuable for processes involving multiple transactions across different apps. Ensuring that if any transaction within the sequence fails, the entire transaction path reverts is pivotal for maintaining consistency. Sui addresses this need through programmable transaction blocks (PTBs).

PTBs play a pivotal role in establishing atomic composability among applications within Sui. Transactions within a PTB execute sequentially but finalize only when the entire sequence concludes, ensuring atomic execution. Presently, a single PTB can accommodate up to 1,024 unique operations in a single execution. Contrarily, a traditional blockchain would execute 1,024 separate transactions consecutively, resulting in a cumbersome development experience and significant gas requirements.

PTBs serve multiple purposes beyond achieving atomic composability. For instance, minting and distributing numerous NFTs simultaneously can be efficiently executed through a PTB, significantly reducing gas usage. 

The integration of PTBs in DeFi apps provides a transformative advantage, reducing transaction costs and enabling comprehensive operations in a unified sequence. By consolidating multiple transactions into a single cohesive unit, PTBs allow for significant optimization of gas usage within Sui’s DeFi environment. This consolidation allows for increased efficiency while empowering developers with greater capabilities, marking a significant stride in DeFi evolution.

Expanding the DeFi universe

These qualities of finality, settlement, and composability underscore the intricate web of elements shaping the landscape of DeFi and Sui's transformative role within it. As the future of DeFi evolves, crucial protocol-layer elements such as network fee dynamics, scalable throughput, and account abstraction give developers the tools to bring greater innovation and efficiency to their protocols.

Although many DeFi activities fall along well-understood yield-earning mechanisms, developers can use Sui's intrinsic features to fine-tune the elements underlying the protocols. Leveraging composability to minimize fees and delivering settlement in record time can give new DeFi uses, with expectations created in traditional financial platforms, a satisfying experience encouraging onboarding and continued use. 

Sign up for Sui's monthly developer newsletter to keep informed about the newest Move and Sui developments.